diff options
author | StapleButter <thetotalworm@gmail.com> | 2018-12-11 21:50:28 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2018-12-11 21:50:28 +0100 |
commit | 3101bd595ffd3352ae21f60ec567323b38f1ac1c (patch) | |
tree | 81dd8671fd696d4326f1c122409b26feb47897df | |
parent | 40f3f91368be1994155f61c8e186109698520a79 (diff) |
add missing shit to savestates. bump the version up.
-rw-r--r-- | src/ARM.cpp | 13 | ||||
-rw-r--r-- | src/CP15.cpp | 18 | ||||
-rw-r--r-- | src/NDS.cpp | 20 | ||||
-rw-r--r-- | src/NDS.h | 9 | ||||
-rw-r--r-- | src/Savestate.h | 4 |
5 files changed, 43 insertions, 21 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp index 7e2e887..f537fb4 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -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) diff --git a/src/CP15.cpp b/src/CP15.cpp index 2187fae..fb0da0d 100644 --- a/src/CP15.cpp +++ b/src/CP15.cpp @@ -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); } diff --git a/src/NDS.cpp b/src/NDS.cpp index 8b5912c..48b2ec4 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -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; } @@ -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, diff --git a/src/Savestate.h b/src/Savestate.h index 6ca3b51..be96d78 100644 --- a/src/Savestate.h +++ b/src/Savestate.h @@ -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 { |