start implementing actual shito

(also looks like the test bench in libui_sdl/main.cpp snuck in with the copyright update. shit)
This commit is contained in:
StapleButter 2018-09-15 02:47:34 +02:00
parent fea7955675
commit 0bfd019dc0
6 changed files with 63 additions and 0 deletions

View File

@ -161,6 +161,27 @@ void ARM::Reset()
JumpTo(ExceptionBase);
}
void ARM::Savestate(Savestate* file)
{
file->Section(Num ? "ARM7" : "ARM9");
file->Var32(&(u32)Cycles);
file->Var32(&(u32)CyclesToRun);
file->Var32(&Halted);
file->VarArray(R, 16*sizeof(u32));
file->Var32(&CPSR);
file->VarArray(R_FIQ, 8*sizeof(u32));
file->VarArray(R_SVC, 3*sizeof(u32));
file->VarArray(R_ABT, 3*sizeof(u32));
file->VarArray(R_IRQ, 3*sizeof(u32));
file->VarArray(R_UND, 3*sizeof(u32));
file->Var32(&CurInstr);
file->VarArray(NextInstr, 2*sizeof(u32));
file->Var32(&ExceptionBase);
}
void ARM::JumpTo(u32 addr, bool restorecpsr)
{
if (restorecpsr)

View File

@ -38,6 +38,8 @@ public:
void Reset();
void Savestate(Savestate* file);
void JumpTo(u32 addr, bool restorecpsr = false);
void RestoreCPSR();

View File

@ -57,6 +57,25 @@ void Reset()
DTCMSize = 0;
}
void Savestate(Savestate* file)
{
file->Section("CP15");
file->Var32(&Control);
file->Var32(&DTCMSetting);
file->Var32(&ITCMSetting);
if (!file->Saving)
{
UpdateDTCMSetting();
UpdateITCMSetting();
}
file->VarArray(ITCM, 0x8000);
file->VarArray(DTCM, 0x4000);
}
void UpdateDTCMSetting()
{

View File

@ -24,6 +24,8 @@ namespace CP15
void Reset();
void Savestate(Savestate* file);
void UpdateDTCMSetting();
void UpdateITCMSetting();

View File

@ -356,6 +356,22 @@ void Stop()
SPU::Stop();
}
void Savestate(Savestate* file)
{
// NDS shito
ARM9->Savestate(file);
ARM7->Savestate(file);
CP15::Savestate(file);
// NDSCart
// GPU
// SPU
// SPI
// RTC
// wifi
}
bool LoadROM(const char* path, bool direct)
{
if (NDSCart::LoadROM(path, direct))

View File

@ -19,6 +19,7 @@
#ifndef NDS_H
#define NDS_H
#include "Savestate.h"
#include "types.h"
namespace NDS
@ -108,6 +109,8 @@ void DeInit();
void Reset();
void Stop();
void Savestate(Savestate* file);
bool LoadROM(const char* path, bool direct);
void LoadBIOS();
void SetupDirectBoot();