mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
detect whether we are running the game
This commit is contained in:
@ -231,6 +231,8 @@ void ARMv5::JumpTo(u32 addr, bool restorecpsr)
|
|||||||
PrefetchAbort();
|
PrefetchAbort();
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
NDS::MonitorARM9Jump(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMv4::JumpTo(u32 addr, bool restorecpsr)
|
void ARMv4::JumpTo(u32 addr, bool restorecpsr)
|
||||||
|
32
src/NDS.cpp
32
src/NDS.cpp
@ -101,6 +101,7 @@ u8 ARM7WRAM[0x10000];
|
|||||||
|
|
||||||
u16 ExMemCnt[2];
|
u16 ExMemCnt[2];
|
||||||
|
|
||||||
|
// TODO: these belong in NDSCart!
|
||||||
u8 ROMSeed0[2*8];
|
u8 ROMSeed0[2*8];
|
||||||
u8 ROMSeed1[2*8];
|
u8 ROMSeed1[2*8];
|
||||||
|
|
||||||
@ -145,6 +146,8 @@ u16 RCnt;
|
|||||||
|
|
||||||
bool Running;
|
bool Running;
|
||||||
|
|
||||||
|
bool RunningGame;
|
||||||
|
|
||||||
|
|
||||||
void DivDone(u32 param);
|
void DivDone(u32 param);
|
||||||
void SqrtDone(u32 param);
|
void SqrtDone(u32 param);
|
||||||
@ -393,6 +396,7 @@ void Reset()
|
|||||||
FILE* f;
|
FILE* f;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
RunningGame = false;
|
||||||
LastSysClockCycles = 0;
|
LastSysClockCycles = 0;
|
||||||
|
|
||||||
f = Platform::OpenLocalFile("bios9.bin", "rb");
|
f = Platform::OpenLocalFile("bios9.bin", "rb");
|
||||||
@ -676,21 +680,16 @@ bool DoSavestate(Savestate* file)
|
|||||||
file->Var16(&KeyCnt);
|
file->Var16(&KeyCnt);
|
||||||
file->Var16(&RCnt);
|
file->Var16(&RCnt);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
DMAs[i]->DoSavestate(file);
|
|
||||||
|
|
||||||
file->Var8(&WRAMCnt);
|
file->Var8(&WRAMCnt);
|
||||||
|
|
||||||
|
file->Var32((u32*)&RunningGame);
|
||||||
|
|
||||||
if (!file->Saving)
|
if (!file->Saving)
|
||||||
{
|
{
|
||||||
// 'dept of redundancy dept'
|
// 'dept of redundancy dept'
|
||||||
// but we do need to update the mappings
|
// but we do need to update the mappings
|
||||||
MapSharedWRAM(WRAMCnt);
|
MapSharedWRAM(WRAMCnt);
|
||||||
}
|
|
||||||
|
|
||||||
if (!file->Saving)
|
|
||||||
{
|
|
||||||
InitTimings();
|
InitTimings();
|
||||||
SetGBASlotTimings();
|
SetGBASlotTimings();
|
||||||
|
|
||||||
@ -699,6 +698,9 @@ bool DoSavestate(Savestate* file)
|
|||||||
SetWifiWaitCnt(tmp); // force timing table update
|
SetWifiWaitCnt(tmp); // force timing table update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
DMAs[i]->DoSavestate(file);
|
||||||
|
|
||||||
ARM9->DoSavestate(file);
|
ARM9->DoSavestate(file);
|
||||||
ARM7->DoSavestate(file);
|
ARM7->DoSavestate(file);
|
||||||
|
|
||||||
@ -1276,6 +1278,22 @@ void NocashPrint(u32 ncpu, u32 addr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MonitorARM9Jump(u32 addr)
|
||||||
|
{
|
||||||
|
// checkme: can the entrypoint addr be THUMB?
|
||||||
|
|
||||||
|
if ((!RunningGame) && NDSCart::CartROM)
|
||||||
|
{
|
||||||
|
if (addr == *(u32*)&NDSCart::CartROM[0x24])
|
||||||
|
{
|
||||||
|
printf("Game is now booting\n");
|
||||||
|
RunningGame = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HandleTimerOverflow(u32 tid)
|
void HandleTimerOverflow(u32 tid)
|
||||||
{
|
{
|
||||||
Timer* timer = &Timers[tid];
|
Timer* timer = &Timers[tid];
|
||||||
|
@ -174,6 +174,8 @@ u32 GetPC(u32 cpu);
|
|||||||
u64 GetSysClockCycles(int num);
|
u64 GetSysClockCycles(int num);
|
||||||
void NocashPrint(u32 cpu, u32 addr);
|
void NocashPrint(u32 cpu, u32 addr);
|
||||||
|
|
||||||
|
void MonitorARM9Jump(u32 addr);
|
||||||
|
|
||||||
bool DMAsInMode(u32 cpu, u32 mode);
|
bool DMAsInMode(u32 cpu, u32 mode);
|
||||||
bool DMAsRunning(u32 cpu);
|
bool DMAsRunning(u32 cpu);
|
||||||
void CheckDMAs(u32 cpu, u32 mode);
|
void CheckDMAs(u32 cpu, u32 mode);
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define SAVESTATE_MAJOR 4
|
#define SAVESTATE_MAJOR 5
|
||||||
#define SAVESTATE_MINOR 1
|
#define SAVESTATE_MINOR 0
|
||||||
|
|
||||||
class Savestate
|
class Savestate
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user