diff --git a/src/DMA.cpp b/src/DMA.cpp index 8c25e262..694e90ac 100644 --- a/src/DMA.cpp +++ b/src/DMA.cpp @@ -118,6 +118,11 @@ void DMA::Reset() InProgress = false; } +void DMA::Savestate(Savestate* file) +{ + // +} + void DMA::WriteCnt(u32 val) { u32 oldcnt = Cnt; diff --git a/src/DMA.h b/src/DMA.h index e34126a2..0bc5ed18 100644 --- a/src/DMA.h +++ b/src/DMA.h @@ -29,6 +29,8 @@ public: void Reset(); + void Savestate(Savestate* file); + void WriteCnt(u32 val); void Start(); diff --git a/src/FIFO.h b/src/FIFO.h index 215abd83..fbb1bbfa 100644 --- a/src/FIFO.h +++ b/src/FIFO.h @@ -47,6 +47,16 @@ public: } + void Savestate(Savestate* file) + { + file->Var32(&NumOccupied); + file->Var32(&ReadPos); + file->Var32(&WritePos); + + file->VarArray(Entries, sizeof(T)*NumEntries); + } + + void Write(T val) { if (IsFull()) return; diff --git a/src/NDS.cpp b/src/NDS.cpp index 909e8c25..ee6dd105 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -358,12 +358,58 @@ void Stop() void Savestate(Savestate* file) { - // NDS shito + file->Section("NDSG"); + + file->VarArray(ARM9BIOS, 0x1000); + file->VarArray(ARM7BIOS, 0x4000); + + file->VarArray(MainRAM, 0x400000); + file->VarArray(SharedWRAM, 0x8000); + file->VarArray(ARM7WRAM, 0x10000); + + file->VarArray(ExMemCnt, 2*sizeof(u16)); + file->VarArray(ROMSeed0, 2*8); + file->VarArray(ROMSeed1, 2*8); + + file->VarArray(IME, 2*sizeof(u32)); + file->VarArray(IE, 2*sizeof(u32)); + file->VarArray(IF, 2*sizeof(u32)); + + file->Var8(&PostFlag9); + file->Var8(&PostFlag7); + file->Var16(&PowerControl9); + file->Var16(&PowerControl7); + + file->Var16(&ARM7BIOSProt); + + file->Var16(&IPCSync9); + file->Var16(&IPCSync7); + file->Var16(&IPCFIFOCnt9); + file->Var16(&IPCFIFOCnt7); + IPCFIFO9->Savestate(file); + IPCFIFO7->Savestate(file); + + file->Var16(&DivCnt); + file->Var16(&SqrtCnt); + + // MapSharedWRAM + // powcnt shito + ARM9->Savestate(file); ARM7->Savestate(file); CP15::Savestate(file); + file->Var32(&CPUStop); + + file->VarArray(Timers, 8*sizeof(Timer)); + file->VarArray(TimerCheckMask, 2*sizeof(u8)); + + // DMA + file->VarArray(DMA9Fill, 4*sizeof(u32)); + + // sched etc + // NDSCart // GPU // SPU