add missing shit to savestates. bump the version up.

This commit is contained in:
StapleButter 2018-12-11 21:50:28 +01:00
parent 40f3f91368
commit 3101bd595f
5 changed files with 43 additions and 21 deletions

View File

@ -126,7 +126,18 @@ void ARM::DoSavestate(Savestate* file)
file->Var32(&ExceptionBase);
if (!file->Saving)
SetupCodeMem(R[15]); // should fix it
{
if (!Num)
{
SetupCodeMem(R[15]); // should fix it
((ARMv5*)this)->RegionCodeCycles = ((ARMv5*)this)->MemTimings[R[15] >> 12][0];
}
else
{
CodeRegion = R[15] >> 24;
CodeCycles = R[15] >> 15; // cheato
}
}
}
void ARMv5::DoSavestate(Savestate* file)

View File

@ -66,14 +66,24 @@ void ARMv5::CP15DoSavestate(Savestate* file)
file->Var32(&DTCMSetting);
file->Var32(&ITCMSetting);
file->VarArray(ITCM, 0x8000);
file->VarArray(DTCM, 0x4000);
file->Var32(&PU_CodeCacheable);
file->Var32(&PU_DataCacheable);
file->Var32(&PU_DataCacheWrite);
file->Var32(&PU_CodeRW);
file->Var32(&PU_DataRW);
file->VarArray(PU_Region, 8*sizeof(u32));
if (!file->Saving)
{
UpdateDTCMSetting();
UpdateITCMSetting();
UpdatePURegions();
}
file->VarArray(ITCM, 0x8000);
file->VarArray(DTCM, 0x4000);
}
@ -225,6 +235,8 @@ void ARMv5::UpdatePURegions()
//UpdateRegionTimings(start<<12, end<<12);
}
// TODO: this is way unoptimized
// should be okay unless the game keeps changing shit, tho
UpdateRegionTimings(0x00000000, 0xFFFFFFFF);
}

View File

@ -608,6 +608,8 @@ bool DoSavestate(Savestate* file)
file->VarArray(ROMSeed0, 2*8);
file->VarArray(ROMSeed1, 2*8);
file->Var16(&WifiWaitCnt);
file->VarArray(IME, 2*sizeof(u32));
file->VarArray(IE, 2*sizeof(u32));
file->VarArray(IF, 2*sizeof(u32));
@ -644,7 +646,6 @@ bool DoSavestate(Savestate* file)
file->VarArray(DMA9Fill, 4*sizeof(u32));
//file->VarArray(SchedList, sizeof(SchedList));
if (!DoSavestate_Scheduler(file)) return false;
file->Var32(&SchedListMask);
file->Var32((u32*)&CurIterationCycles);
@ -667,6 +668,18 @@ bool DoSavestate(Savestate* file)
MapSharedWRAM(WRAMCnt);
}
if (!file->Saving)
{
GPU::DisplaySwap(PowerControl9>>15);
InitTimings();
SetGBASlotTimings();
u16 tmp = WifiWaitCnt;
WifiWaitCnt = 0xFFFF;
SetWifiWaitCnt(tmp); // force timing table update
}
ARM9->DoSavestate(file);
ARM7->DoSavestate(file);
@ -677,11 +690,6 @@ bool DoSavestate(Savestate* file)
RTC::DoSavestate(file);
Wifi::DoSavestate(file);
if (!file->Saving)
{
GPU::DisplaySwap(PowerControl9>>15);
}
return true;
}

View File

@ -43,15 +43,6 @@ enum
Event_SPU,
Event_Wifi,
/*Event_TimerIRQ_0,
Event_TimerIRQ_1,
Event_TimerIRQ_2,
Event_TimerIRQ_3,
Event_TimerIRQ_4,
Event_TimerIRQ_5,
Event_TimerIRQ_6,
Event_TimerIRQ_7,*/
Event_DisplayFIFO,
Event_ROMTransfer,
Event_ROMSPITransfer,

View File

@ -22,8 +22,8 @@
#include <stdio.h>
#include "types.h"
#define SAVESTATE_MAJOR 2
#define SAVESTATE_MINOR 1
#define SAVESTATE_MAJOR 3
#define SAVESTATE_MINOR 0
class Savestate
{