Snapshot the CPU state as well.

This commit is contained in:
Unknown W. Brackets 2012-12-27 20:33:10 -08:00
parent b81899876f
commit e3e6f81dfa
3 changed files with 38 additions and 0 deletions

View File

@ -99,6 +99,33 @@ void MIPSState::Reset()
rng.Init(0x1337);
}
void MIPSState::DoState(PointerWrap &p)
{
// Reset the jit if we're loading.
if (p.mode == p.MODE_READ)
Reset();
p.DoArray(r, sizeof(r) / sizeof(r[0]));
p.DoArray(f, sizeof(f) / sizeof(f[0]));
p.DoArray(v, sizeof(v) / sizeof(v[0]));
p.DoArray(vfpuCtrl, sizeof(vfpuCtrl) / sizeof(vfpuCtrl[0]));
p.DoArray(vfpuWriteMask, sizeof(vfpuWriteMask) / sizeof(vfpuWriteMask[0]));
p.Do(pc);
p.Do(nextPC);
p.Do(hi);
p.Do(lo);
p.Do(fpcond);
p.Do(fcr0);
p.Do(fcr31);
rng.DoState(p);
p.Do(inDelaySlot);
p.Do(llBit);
p.Do(cpuType);
p.Do(exceptions);
p.Do(debugCount);
p.DoMarker("MIPSState");
}
void MIPSState::SetWriteMask(const bool wm[4])
{
for (int i = 0; i < 4; i++)

View File

@ -18,6 +18,7 @@
#pragma once
#include "../../Globals.h"
#include "../../Common/ChunkFile.h"
#include "../CPU.h"
enum
@ -92,6 +93,12 @@ public:
return (m_z << 16) + m_w;
}
void DoState(PointerWrap &p) {
p.Do(m_w);
p.Do(m_z);
p.DoMarker("GMRng");
}
private:
u32 m_w;
u32 m_z;
@ -104,6 +111,7 @@ public:
~MIPSState();
void Reset();
void DoState(PointerWrap &p);
u32 r[32];
float f[32];

View File

@ -24,6 +24,7 @@
#include "HLE/sceKernel.h"
#include "HW/MemoryStick.h"
#include "MemMap.h"
#include "MIPS/MIPS.h"
namespace SaveState
{
@ -70,7 +71,9 @@ namespace SaveState
Memory::DoState(p);
MemoryStick_DoState(p);
currentMIPS->DoState(p);
__KernelDoState(p);
// TODO: filesystem, HLE?
}
void Enqueue(SaveState::Operation op)