aboutsummaryrefslogtreecommitdiff
path: root/src/NDS.h
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2023-11-02 21:04:09 +0100
committerArisotura <thetotalworm@gmail.com>2023-11-02 21:04:09 +0100
commit70c6750561b0c130b430e2ec3d076708b3767674 (patch)
treef2cc1b0aad735f9be60e5f837ceca120980ca682 /src/NDS.h
parent5ccd3916ff719ea4ed49030077794fadda048cb9 (diff)
better, less hacky, more OOP-friendly scheduler design
Diffstat (limited to 'src/NDS.h')
-rw-r--r--src/NDS.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/NDS.h b/src/NDS.h
index de038b2..89ebb1c 100644
--- a/src/NDS.h
+++ b/src/NDS.h
@@ -20,6 +20,7 @@
#define NDS_H
#include <string>
+#include <functional>
#include "Platform.h"
#include "Savestate.h"
@@ -57,12 +58,8 @@ enum
Event_MAX
};
-struct SchedEvent
-{
- void (*Func)(u32 param);
- u64 Timestamp;
- u32 Param;
-};
+typedef std::function<void(u32)> EventFunc;
+#define MemberEventFunc(cls,func) std::bind(&cls::func,this,std::placeholders::_1)
enum
{
@@ -297,8 +294,9 @@ void SetLidClosed(bool closed);
void CamInputFrame(int cam, u32* data, int width, int height, bool rgb);
void MicInputFrame(s16* data, int samples);
-void ScheduleEvent(u32 id, bool periodic, s32 delay, void (*func)(u32), u32 param);
-void ScheduleEvent(u32 id, u64 timestamp, void (*func)(u32), u32 param);
+void RegisterEventFunc(u32 id, u32 funcid, EventFunc func);
+void UnregisterEventFunc(u32 id, u32 funcid);
+void ScheduleEvent(u32 id, bool periodic, s32 delay, u32 funcid, u32 param);
void CancelEvent(u32 id);
void debug(u32 p);