--- Daodan/src/Patches/Cheater.c 2014/05/04 18:17:11 1000 +++ Daodan/src/Patches/Cheater.c 2021/10/24 02:50:48 1163 @@ -9,6 +9,8 @@ #include "../Daodan.h" #include "../Daodan_Config.h" #include "Cheater.h" +#include "Input.h" +#include "Utility.h" union MSVC_EVIL_FLOAT_HACK { @@ -292,4 +294,21 @@ void __stdcall FallingFrames(void* Ebp) if (inc_fallingframes) ++*((unsigned int*)((char*)Ebp + 0xf6)); } - + + +static void BindableCheatCallback (intptr_t cheatnum) { + uint8_t res = DDrCheater (cheatnum); + if (res) + COrMessage_Print(DDr_CheatTable[cheatnum].message_on, 0, 240); + else + COrMessage_Print(DDr_CheatTable[cheatnum].message_off, 0, 240); +} + +void InitBindableCheats() { + oniCheatCode* cur; + for (cur = DDr_CheatTable; cur->name != 0; cur++) { + DDrInput_RegisterCustomAction(cur->name, DDcEventType_KeyPress, + BindableCheatCallback, cur->func); + } +} +