Changeset 1017 for Daodan/src


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
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Daodan.h

    r992 r1017  
    88#include "Oni/Oni.h"
    99
     10#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
     11
    1012extern HMODULE DDrDLLModule;
    1113extern HMODULE DDrONiModule;
  • Daodan/src/Daodan_Config.c

    r1008 r1017  
    33#include <time.h>
    44
     5#include "Daodan.h"
    56#include "Daodan_Config.h"
    67#include "Daodan_Patch.h"
     
    1112
    1213#include "Inifile_Reader.h"
    13 
    14 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
    1514
    1615static const char* iniName = "daodan.ini";
     
    4847        } },
    4948        { "gameplay", "Gameplay", {
     49                { "bindablecheats",
     50                        "Allows cheats to be bound to keys. Requires 'customactions' and 'cheattable' to be true.",
     51                        C_BOOL,
     52                        {.intBoolVal = true},
     53                        {.intBoolVal = true} },
    5054                { "characterawareness",
    5155                        "Makes AI remember the player.",
     
    6569                { "cooldowntimer",
    6670                        "Disables weapon cooldown exploit.",
     71                        C_BOOL,
     72                        {.intBoolVal = true},
     73                        {.intBoolVal = true} },
     74                { "customactions",
     75                        "Allows more actions to be bound through Daodan.",
    6776                        C_BOOL,
    6877                        {.intBoolVal = true},
  • Daodan/src/Oni/Oni.h

    r992 r1017  
    3434} UUtRect;
    3535
     36typedef struct {
     37        uint32_t input;
     38        float analog;
     39} LItDeviceInput;
     40
    3641#include "Symbols_Var.h"
    3742#include "Symbols_Func.h"
  • Daodan/src/Oni/Symbols_Func.h

    r995 r1017  
    101101
    102102// Print message to console ?
    103 DefFunc(int, COrMessage_Print, ONICALL, (char* Message, char* Key, void* noidea), 0x004304B0);
     103DefFunc(int, COrMessage_Print, ONICALL, (const char* Message, const char* Key, uint32_t fadeTime), 0x004304B0);
    104104DefFunc(UUtBool, COrCommand_Execute, ONICALL, (char* command), 0x004317D0);
    105105
     
    171171DefFunc(void, LIrPlatform_Terminate, ONICALL, (void), 0x00403620);
    172172
     173// Key_config callback for each mapping found
     174DefFunc(uint16_t, LIrBinding_Add, ONICALL, (uint32_t key, const char* name), 0x00403c60);
     175
     176// Called when processing key input
     177DefFunc(void, LIrActionBuffer_Add, ONICALL, (void* unknown, LItDeviceInput* input), 0x00403b30);
     178
     179
    173180#undef DefFunc
    174181
  • 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       
  • Daodan/src/_Version.h

    r1008 r1017  
    55#define STRINGIZE(s) STRINGIZE2(s)
    66
    7 #define DAODAN_VERSION_MAJOR 3
    8 #define DAODAN_VERSION_MINOR 9
     7#define DAODAN_VERSION_MAJOR 4
     8#define DAODAN_VERSION_MINOR 0
    99#define DAODAN_VERSION_STRING STRINGIZE(DAODAN_VERSION_MAJOR) "." STRINGIZE(DAODAN_VERSION_MINOR)
    1010
Note: See TracChangeset for help on using the changeset viewer.