Perform savestate actions more intelligently.

This commit is contained in:
The Dax 2013-11-28 15:34:11 -05:00
parent 1b8df0d826
commit ba31e18060
3 changed files with 16 additions and 3 deletions

View file

@ -61,6 +61,8 @@ u8 *m_pUncachedVRAM;
// These replace RAM_NORMAL_SIZE and RAM_NORMAL_MASK, respectively.
u32 g_MemorySize;
u32 g_MemoryMask;
// Used to store the PSP model on game startup.
u32 g_PSPModel;
// We don't declare the IO region in here since its handled by other means.
static MemoryView views[] =
@ -99,18 +101,27 @@ void Init()
void DoState(PointerWrap &p)
{
auto s = p.Section("Memory", 1);
auto s = p.Section("Memory", 0, 2);
if (!s)
return;
if (s < 2) {
g_MemorySize = RAM_NORMAL_SIZE;
g_PSPModel = PSP_MODEL_FAT;
}
else {
g_MemorySize = g_PSPModel == PSP_MODEL_FAT ? RAM_NORMAL_SIZE : RAM_DOUBLE_SIZE;
p.Do(g_PSPModel);
p.DoMarker("PSPModel");
}
p.DoArray(m_pRAM, g_MemorySize);
p.DoMarker("RAM");
p.DoArray(m_pVRAM, VRAM_SIZE);
p.DoMarker("VRAM");
p.DoArray(m_pScratchPad, SCRATCHPAD_SIZE);
p.DoMarker("ScratchPad");
p.Do(g_Config.iPSPModel);
p.DoMarker("PSPModel");
}
void Shutdown()

View file

@ -75,6 +75,7 @@ extern u8 *m_pUncachedVRAM;
// These replace RAM_NORMAL_SIZE and RAM_NORMAL_MASK, respectively.
extern u32 g_MemorySize;
extern u32 g_MemoryMask;
extern u32 g_PSPModel;
enum
{

View file

@ -160,6 +160,7 @@ void CPU_Init() {
g_RemasterMode = false;
g_DoubleTextureCoordinates = false;
Memory::g_PSPModel = g_Config.iPSPModel;
std::string filename = coreParameter.fileToStart;
IdentifiedFileType type = Identify_File(filename);