diff options
Diffstat (limited to 'src/NDS.h')
-rw-r--r-- | src/NDS.h | 41 |
1 files changed, 40 insertions, 1 deletions
@@ -22,9 +22,21 @@ #include "Savestate.h" #include "types.h" +// when touching the main loop/timing code, pls test a lot of shit +// with this enabled, to make sure it doesn't desync +//#define DEBUG_CHECK_DESYNC + namespace NDS { +#ifdef DEBUG_CHECK_DESYNC +extern u64 dbg_CyclesSys; +extern u64 dbg_CyclesARM9; +extern u64 dbg_CyclesTimer9; +extern u64 dbg_CyclesARM7; +extern u64 dbg_CyclesTimer7; +#endif + enum { Event_LCD = 0, @@ -87,6 +99,16 @@ typedef struct } Timer; +typedef struct +{ + u8* Mem; + u32 Mask; + +} MemRegion; + +extern u8 ARM9MemTimings[0x40000][4]; +extern u8 ARM7MemTimings[0x20000][4]; + // hax extern u32 IME[2]; extern u32 IE[2]; @@ -113,6 +135,9 @@ void Stop(); bool DoSavestate(Savestate* file); +void SetARM9RegionTimings(u32 addrstart, u32 addrend, int buswidth, int nonseq, int seq); +void SetARM7RegionTimings(u32 addrstart, u32 addrend, int buswidth, int nonseq, int seq); + bool LoadROM(const char* path, const char* sram, bool direct); void LoadBIOS(); void SetupDirectBoot(); @@ -127,6 +152,10 @@ void ReleaseScreen(); void SetKeyMask(u32 mask); +void SetLidClosed(bool closed); + +void MicInputFrame(s16* data, int samples); + void ScheduleEvent(u32 id, bool periodic, s32 delay, void (*func)(u32), u32 param); void CancelEvent(u32 id); @@ -141,14 +170,20 @@ void ClearIRQ(u32 cpu, u32 irq); bool HaltInterrupted(u32 cpu); void StopCPU(u32 cpu, u32 mask); void ResumeCPU(u32 cpu, u32 mask); +void GXFIFOStall(); +void GXFIFOUnstall(); u32 GetPC(u32 cpu); +u64 GetSysClockCycles(int num); +void NocashPrint(u32 cpu, u32 addr); bool DMAsInMode(u32 cpu, u32 mode); +bool DMAsRunning(u32 cpu); void CheckDMAs(u32 cpu, u32 mode); void StopDMAs(u32 cpu, u32 mode); -void RunTimingCriticalDevices(u32 cpu, s32 cycles); +void RunTightTimers(u32 cpu, s32 cycles); +void RunLooseTimers(u32 cpu, s32 cycles); u8 ARM9Read8(u32 addr); u16 ARM9Read16(u32 addr); @@ -157,6 +192,8 @@ void ARM9Write8(u32 addr, u8 val); void ARM9Write16(u32 addr, u16 val); void ARM9Write32(u32 addr, u32 val); +bool ARM9GetMemRegion(u32 addr, bool write, MemRegion* region); + u8 ARM7Read8(u32 addr); u16 ARM7Read16(u32 addr); u32 ARM7Read32(u32 addr); @@ -164,6 +201,8 @@ void ARM7Write8(u32 addr, u8 val); void ARM7Write16(u32 addr, u16 val); void ARM7Write32(u32 addr, u32 val); +bool ARM7GetMemRegion(u32 addr, bool write, MemRegion* region); + u8 ARM9IORead8(u32 addr); u16 ARM9IORead16(u32 addr); u32 ARM9IORead32(u32 addr); |