Changeset 1017 for Daodan/src/Patches


Ignore:
Timestamp:
Mar 24, 2015, 12:29:19 AM (10 years ago)
Author:
alloc
Message:

Daodan 4.0: Added Input module, cheats bindable to keys

Location:
Daodan/src/Patches
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Patches/Cheater.c

    r1000 r1017  
    1010#include "../Daodan_Config.h"
    1111#include "Cheater.h"
     12#include "Input.h"
     13#include "Utility.h"
    1214
    1315union MSVC_EVIL_FLOAT_HACK
     
    293295                ++*((unsigned int*)((char*)Ebp + 0xf6));
    294296}
    295  
     297
     298
     299static void BindableCheatCallback (CustomActionCallbackArgument cheatnum) {
     300        uint8_t res = DDrCheater (cheatnum);
     301        if (res)
     302                COrMessage_Print(DDr_CheatTable[cheatnum].message_on, 0, 240);
     303        else
     304                COrMessage_Print(DDr_CheatTable[cheatnum].message_off, 0, 240);
     305}
     306
     307void InitBindableCheats() {
     308        oniCheatCode* cur;
     309        for (cur = DDr_CheatTable; cur->name != 0; cur++) {
     310//              char* val = malloc(20);
     311//              sprintf(val, "cheat_%s", cur->name);
     312                Input_RegisterCustomAction (cur->name, EVENT_KEYPRESS, 0, BindableCheatCallback, cur->func);
     313        }
     314}
     315
  • Daodan/src/Patches/Cheater.h

    r994 r1017  
    4949void __stdcall FallingFrames(void* Ebp);
    5050void ONICALL DDrCheater_LevelLoad();
     51void InitBindableCheats();
    5152
    5253#endif
  • Daodan/src/Patches/Patches.c

    r1008 r1017  
    66#include "../Daodan_Config.h"
    77#include "GL.h"
     8#include "Input.h"
    89#include "../Daodan_Patch.h"
    910#include "Utility.h"
     
    131132        return Oni_COrTextArea_Resize(inTextArea, inBounds, inNumTextEntries);
    132133}
     134
     135
    133136
    134137#define IMcShade_Red (0xFFFF0000)
     
    372375                // At end of ONrUnlockLevel to init values on level loading
    373376                DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
     377               
     378                if (DDrConfig_GetOptOfType("gameplay.bindablecheats", C_BOOL)->value.intBoolVal)
     379                {
     380                        InitBindableCheats();
     381                }
    374382        }
    375383       
     
    437445        {
    438446                Oni_COrTextArea_Resize = DDrPatch_MakeDetour((void*)COrTextArea_Resize, (void*)DD_COrTextArea_Resize);
     447        }
     448       
     449        // Allow custom actions to be bound through Daodan
     450        if (DDrConfig_GetOptOfType("gameplay.customactions", C_BOOL)->value.intBoolVal)
     451        {
     452                Input_PatchCode ();
    439453        }
    440454       
Note: See TracChangeset for help on using the changeset viewer.