From 6f2a83cad984519482f936d8c86002081ff813bc Mon Sep 17 00:00:00 2001 From: SuuperW Date: Mon, 30 Sep 2019 11:19:52 -0500 Subject: [PATCH] FrameAdvance and SetInput --- desmume/src/frontend/windows/DesHawkAPI.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/desmume/src/frontend/windows/DesHawkAPI.cpp b/desmume/src/frontend/windows/DesHawkAPI.cpp index e790e2e3d..3007eaa06 100644 --- a/desmume/src/frontend/windows/DesHawkAPI.cpp +++ b/desmume/src/frontend/windows/DesHawkAPI.cpp @@ -70,3 +70,23 @@ DLL bool LoadROM(u8* file, int fileSize) { return (NDS_LoadROM(file, fileSize) > 0); } + +DLL void SetInput(u16 buttons, u8 touchX, u8 touchY) +{ + NDS_setPad(buttons & 0x0002, buttons & 0x0001, buttons & 0x0008, buttons & 0x0004, + buttons & 0x0800, buttons & 0x0400, buttons & 0x0020, buttons & 0x0010, + buttons & 0x0080, buttons & 0x0040, buttons & 0x0100, buttons & 0x0200, + buttons & 0x1000, buttons & 0x2000); + if (buttons & 0x4000) + NDS_setTouchPos(touchX, touchY); + else + NDS_releaseTouch(); +} +DLL void FrameAdvance() +{ + NDS_beginProcessingInput(); + NDS_endProcessingInput(); + + NDS_exec(); + SPU_Emulate_user(); +}