aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/NDS.cpp16
-rw-r--r--src/RTC.cpp24
-rw-r--r--src/RTC.h2
3 files changed, 39 insertions, 3 deletions
diff --git a/src/NDS.cpp b/src/NDS.cpp
index d2551dc..525c925 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -501,9 +501,14 @@ bool DoSavestate(Savestate* file)
for (int i = 0; i < 8; i++)
DMAs[i]->DoSavestate(file);
- // MapSharedWRAM
- // powcnt shito
+ file->Var8(&WRAMCnt);
+ if (!file->Saving)
+ {
+ // 'dept of redundancy dept'
+ // but we do need to update the mappings
+ MapSharedWRAM(WRAMCnt);
+ }
ARM9->DoSavestate(file);
ARM7->DoSavestate(file);
@@ -513,9 +518,14 @@ bool DoSavestate(Savestate* file)
GPU::DoSavestate(file);
SPU::DoSavestate(file);
SPI::DoSavestate(file);
- // RTC
+ RTC::DoSavestate(file);
// wifi
+ if (!file->Saving)
+ {
+ GPU::DisplaySwap(PowerControl9>>15);
+ }
+
return true;
}
diff --git a/src/RTC.cpp b/src/RTC.cpp
index fd60eaf..cd35643 100644
--- a/src/RTC.cpp
+++ b/src/RTC.cpp
@@ -73,6 +73,30 @@ void Reset()
FreeReg = 0;
}
+void DoSavestate(Savestate* file)
+{
+ file->Section("RTC.");
+
+ file->Var16(&IO);
+
+ file->Var8(&Input);
+ file->Var32(&InputBit);
+ file->Var32(&InputPos);
+
+ file->VarArray(Output, sizeof(Output));
+ file->Var32(&OutputBit);
+ file->Var32(&OutputPos);
+
+ file->Var8(&CurCmd);
+
+ file->Var8(&StatusReg1);
+ file->Var8(&StatusReg2);
+ file->VarArray(Alarm1, sizeof(Alarm1));
+ file->VarArray(Alarm2, sizeof(Alarm2));
+ file->Var8(&ClockAdjust);
+ file->Var8(&FreeReg);
+}
+
u8 BCD(u8 val)
{
diff --git a/src/RTC.h b/src/RTC.h
index 516eb5d..ebfcda8 100644
--- a/src/RTC.h
+++ b/src/RTC.h
@@ -20,6 +20,7 @@
#define RTC_H
#include "types.h"
+#include "Savestate.h"
namespace RTC
{
@@ -27,6 +28,7 @@ namespace RTC
bool Init();
void DeInit();
void Reset();
+void DoSavestate(Savestate* file);
u16 Read();
void Write(u16 val, bool byte);