* somewhat proper event scheduler

* support for timers
* fixes, additions, shit
This commit is contained in:
StapleButter
2016-12-05 17:08:24 +01:00
parent a14c01208a
commit 343797f47d
12 changed files with 488 additions and 75 deletions

28
NDS.h
View File

@ -7,6 +7,18 @@
namespace NDS
{
#define SCHED_BUF_LEN 64
typedef struct _SchedEvent
{
u32 Delay;
void (*Func)(u32);
u32 Param;
struct _SchedEvent* PrevEvent;
struct _SchedEvent* NextEvent;
} SchedEvent;
enum
{
IRQ_VBlank = 0,
@ -36,6 +48,15 @@ enum
IRQ_Wifi
};
typedef struct
{
u16 Reload;
u16 Control;
u16 Counter;
SchedEvent* Event;
} Timer;
extern u32 ARM9ITCMSize;
extern u32 ARM9DTCMBase, ARM9DTCMSize;
@ -44,6 +65,13 @@ void Reset();
void RunFrame();
SchedEvent* ScheduleEvent(s32 Delay, void (*Func)(u32), u32 Param);
void CancelEvent(SchedEvent* event);
void RunEvents(s32 cycles);
// DO NOT CALL FROM ARM7!!
void CompensateARM7();
void Halt();
void MapSharedWRAM();