--- Daodan/src/Patches/Cheater.c 2014/04/09 00:10:18 995 +++ 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 { @@ -252,7 +254,7 @@ uint8_t ONICALL DDrCheater(uint32_t chea } case cheat_elderrune: { - if (DDrConfig_GetOptOfType("patches.d_regen", C_BOOL)->value.intBoolVal) + if (DDrConfig_GetOptOfType("modding.d_regen", C_BOOL)->value.intBoolVal) { int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax; if(*Regeneration) @@ -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); + } +} +