--- Daodan/src/Patches/Cheater.c 2014/05/04 18:17:11 1000 +++ Daodan/src/Patches/Cheater.c 2015/03/23 23:29:19 1017 @@ -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,22 @@ void __stdcall FallingFrames(void* Ebp) if (inc_fallingframes) ++*((unsigned int*)((char*)Ebp + 0xf6)); } - + + +static void BindableCheatCallback (CustomActionCallbackArgument 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++) { +// char* val = malloc(20); +// sprintf(val, "cheat_%s", cur->name); + Input_RegisterCustomAction (cur->name, EVENT_KEYPRESS, 0, BindableCheatCallback, cur->func); + } +} +