mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 15:19:53 -06:00
add stupid cast
also lay base for DSi savestates
This commit is contained in:
@ -168,6 +168,13 @@ void Reset()
|
|||||||
GPU::DispStat[1] |= (1<<6);
|
GPU::DispStat[1] |= (1<<6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
file->Section("DSIG");
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
void DecryptModcryptArea(u32 offset, u32 size, u8* iv)
|
void DecryptModcryptArea(u32 offset, u32 size, u8* iv)
|
||||||
{
|
{
|
||||||
AES_ctx ctx;
|
AES_ctx ctx;
|
||||||
|
@ -57,6 +57,8 @@ bool Init();
|
|||||||
void DeInit();
|
void DeInit();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file);
|
||||||
|
|
||||||
void SetupDirectBoot();
|
void SetupDirectBoot();
|
||||||
void SoftReset();
|
void SoftReset();
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ void Reset();
|
|||||||
// however, no DSi savestate stuff seems to be actually implemented?!
|
// however, no DSi savestate stuff seems to be actually implemented?!
|
||||||
void DoSavestate(Savestate* file);
|
void DoSavestate(Savestate* file);
|
||||||
|
|
||||||
|
void DSPCatchUpU32(u32 _);
|
||||||
|
|
||||||
// SCFG_RST bit0
|
// SCFG_RST bit0
|
||||||
bool IsRstReleased();
|
bool IsRstReleased();
|
||||||
void SetRstLine(bool release);
|
void SetRstLine(bool release);
|
||||||
|
46
src/NDS.cpp
46
src/NDS.cpp
@ -41,6 +41,9 @@
|
|||||||
|
|
||||||
#include "DSi.h"
|
#include "DSi.h"
|
||||||
#include "DSi_SPI_TSC.h"
|
#include "DSi_SPI_TSC.h"
|
||||||
|
#include "DSi_NWifi.h"
|
||||||
|
#include "DSi_Camera.h"
|
||||||
|
#include "DSi_DSP.h"
|
||||||
|
|
||||||
|
|
||||||
namespace NDS
|
namespace NDS
|
||||||
@ -199,7 +202,6 @@ bool Init()
|
|||||||
DMAs[6] = new DMA(1, 2);
|
DMAs[6] = new DMA(1, 2);
|
||||||
DMAs[7] = new DMA(1, 3);
|
DMAs[7] = new DMA(1, 3);
|
||||||
|
|
||||||
//if (!NDSCart_SRAMManager::Init()) return false;
|
|
||||||
if (!NDSCart::Init()) return false;
|
if (!NDSCart::Init()) return false;
|
||||||
if (!GBACart::Init()) return false;
|
if (!GBACart::Init()) return false;
|
||||||
if (!GPU::Init()) return false;
|
if (!GPU::Init()) return false;
|
||||||
@ -227,7 +229,6 @@ void DeInit()
|
|||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
delete DMAs[i];
|
delete DMAs[i];
|
||||||
|
|
||||||
//NDSCart_SRAMManager::DeInit();
|
|
||||||
NDSCart::DeInit();
|
NDSCart::DeInit();
|
||||||
GBACart::DeInit();
|
GBACart::DeInit();
|
||||||
GPU::DeInit();
|
GPU::DeInit();
|
||||||
@ -718,7 +719,14 @@ bool DoSavestate_Scheduler(Savestate* file)
|
|||||||
DivDone,
|
DivDone,
|
||||||
SqrtDone,
|
SqrtDone,
|
||||||
|
|
||||||
NULL
|
DSi_SDHost::FinishRX,
|
||||||
|
DSi_SDHost::FinishTX,
|
||||||
|
DSi_NWifi::MSTimer,
|
||||||
|
DSi_Camera::IRQ,
|
||||||
|
DSi_Camera::Transfer,
|
||||||
|
DSi_DSP::DSPCatchUpU32,
|
||||||
|
|
||||||
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
int len = Event_MAX;
|
int len = Event_MAX;
|
||||||
@ -728,7 +736,7 @@ bool DoSavestate_Scheduler(Savestate* file)
|
|||||||
{
|
{
|
||||||
SchedEvent* evt = &SchedList[i];
|
SchedEvent* evt = &SchedList[i];
|
||||||
|
|
||||||
u32 funcid = -1;
|
u32 funcid = 0xFFFFFFFF;
|
||||||
if (evt->Func)
|
if (evt->Func)
|
||||||
{
|
{
|
||||||
for (int j = 0; eventfuncs[j]; j++)
|
for (int j = 0; eventfuncs[j]; j++)
|
||||||
@ -775,7 +783,7 @@ bool DoSavestate_Scheduler(Savestate* file)
|
|||||||
evt->Func = eventfuncs[funcid];
|
evt->Func = eventfuncs[funcid];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
evt->Func = NULL;
|
evt->Func = nullptr;
|
||||||
|
|
||||||
file->Var64(&evt->Timestamp);
|
file->Var64(&evt->Timestamp);
|
||||||
file->Var32(&evt->Param);
|
file->Var32(&evt->Param);
|
||||||
@ -789,13 +797,24 @@ bool DoSavestate(Savestate* file)
|
|||||||
{
|
{
|
||||||
file->Section("NDSG");
|
file->Section("NDSG");
|
||||||
|
|
||||||
// TODO:
|
if (file->Saving)
|
||||||
// * do something for bool's (sizeof=1)
|
{
|
||||||
// * do something for 'loading DSi-mode savestate in DS mode' and vice-versa
|
u32 console = ConsoleType;
|
||||||
// * add IE2/IF2 there
|
file->Var32(&console);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
u32 console;
|
||||||
|
file->Var32(&console);
|
||||||
|
if (console != ConsoleType)
|
||||||
|
{
|
||||||
|
file->Error = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
file->VarArray(MainRAM, 0x400000);
|
file->VarArray(MainRAM, MainRAMMaxSize);
|
||||||
file->VarArray(SharedWRAM, 0x8000);
|
file->VarArray(SharedWRAM, SharedWRAMSize);
|
||||||
file->VarArray(ARM7WRAM, ARM7WRAMSize);
|
file->VarArray(ARM7WRAM, ARM7WRAMSize);
|
||||||
|
|
||||||
file->VarArray(ExMemCnt, 2*sizeof(u16));
|
file->VarArray(ExMemCnt, 2*sizeof(u16));
|
||||||
@ -807,6 +826,8 @@ bool DoSavestate(Savestate* file)
|
|||||||
file->VarArray(IME, 2*sizeof(u32));
|
file->VarArray(IME, 2*sizeof(u32));
|
||||||
file->VarArray(IE, 2*sizeof(u32));
|
file->VarArray(IE, 2*sizeof(u32));
|
||||||
file->VarArray(IF, 2*sizeof(u32));
|
file->VarArray(IF, 2*sizeof(u32));
|
||||||
|
file->Var32(&IE2);
|
||||||
|
file->Var32(&IF2);
|
||||||
|
|
||||||
file->Var8(&PostFlag9);
|
file->Var8(&PostFlag9);
|
||||||
file->Var8(&PostFlag7);
|
file->Var8(&PostFlag7);
|
||||||
@ -893,6 +914,9 @@ bool DoSavestate(Savestate* file)
|
|||||||
RTC::DoSavestate(file);
|
RTC::DoSavestate(file);
|
||||||
Wifi::DoSavestate(file);
|
Wifi::DoSavestate(file);
|
||||||
|
|
||||||
|
if (ConsoleType == 1)
|
||||||
|
DSi::DoSavestate(file);
|
||||||
|
|
||||||
if (!file->Saving)
|
if (!file->Saving)
|
||||||
{
|
{
|
||||||
GPU::SetPowerCnt(PowerControl9);
|
GPU::SetPowerCnt(PowerControl9);
|
||||||
|
@ -50,8 +50,6 @@ enum
|
|||||||
Event_DSi_NWifi,
|
Event_DSi_NWifi,
|
||||||
Event_DSi_CamIRQ,
|
Event_DSi_CamIRQ,
|
||||||
Event_DSi_CamTransfer,
|
Event_DSi_CamTransfer,
|
||||||
|
|
||||||
Event_DSi_RAMSizeChange,
|
|
||||||
Event_DSi_DSP,
|
Event_DSi_DSP,
|
||||||
|
|
||||||
Event_MAX
|
Event_MAX
|
||||||
|
@ -275,7 +275,7 @@ QString VerifySetup()
|
|||||||
std::string GetSavestateName(int slot)
|
std::string GetSavestateName(int slot)
|
||||||
{
|
{
|
||||||
std::string ext = ".ml";
|
std::string ext = ".ml";
|
||||||
ext += ('0'+slot);
|
ext += (char)('0'+slot);
|
||||||
return GetAssetPath(false, Config::SavestatePath, ext);
|
return GetAssetPath(false, Config::SavestatePath, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user