ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Patches/Patches.c
(Generate patch)

Comparing Daodan/src/Patches/Patches.c (file contents):
Revision 1000 by alloc, Sun May 4 18:17:11 2014 UTC vs.
Revision 1017 by alloc, Mon Mar 23 23:29:19 2015 UTC

# Line 5 | Line 5
5   #include "Cheater.h"
6   #include "../Daodan_Config.h"
7   #include "GL.h"
8 + #include "Input.h"
9   #include "../Daodan_Patch.h"
10   #include "Utility.h"
11   #include "Win32.h"
# Line 131 | Line 132 | int16_t ONICALL DD_COrTextArea_Resize(vo
132          return Oni_COrTextArea_Resize(inTextArea, inBounds, inNumTextEntries);
133   }
134  
135 +
136 +
137   #define IMcShade_Red (0xFFFF0000)
138   #define IMcShade_Green (0xFF00FF00)
139   #define IMcShade_Blue (0xFF0000FF)
# Line 277 | Line 280 | void DD_Patch_ShowNames()
280   }
281  
282  
283 <
283 > void DD_Patch_CharacterAwareness()
284 > {
285 >        const unsigned char patch[] =
286 >        {
287 >                0x52,                           //  0: push   edx
288 >                0xBA, 0xA0, 0x16, 0x00, 0x00,   //  1: mov    edx,0x16a0
289 >                0x89, 0xF8,                     //  6: mov    eax,edi
290 >                0xF7, 0xE2,                     //  8: mul    edx
291 >                0x89, 0xC2,                     //  a: mov    edx,eax
292 >                0xE8, 0x00, 0x00, 0x00, 0x00,   //  c: call   ONrGameState_LivingCharacterList_Get (-> OniExe + 0x000fca90)
293 >                0x8B, 0x00,                     // 11: mov    eax,[eax]
294 >                0x01, 0xD0,                     // 13: add    eax,edx
295 >                0x89, 0xC6,                     // 15: mov    esi,eax
296 >                0x5A,                           // 17: pop    edx
297 >                0x8B, 0x46, 0x04,               // 18: (ORIG) mov        eax, dword [ds:esi+0x4]
298 >                0xF6, 0xC4, 0x80                // 1b: (ORIG) test       ah, 0x80
299 >        };
300 >        void* newCode = DDrPatch_ExecutableASM((char*)(OniExe + 0x0009A609), (char*)(OniExe + 0x0009A60F), patch, sizeof(patch));
301 >        if ((int)newCode > 0) {
302 >                DDrPatch_MakeCall((char*)(newCode+0xC), (char*)(OniExe + 0x000FCA90));
303 >                DDrPatch_NOOP((char*)(OniExe + 0x0009A60E), 1);
304 >        }
305 > }
306  
307  
308  
# Line 321 | Line 346 | bool DD_Patch_Init()
346          if (DDrConfig_GetOptOfType("modding.d_regen", C_BOOL)->value.intBoolVal)
347                  DD_Patch_Regeneration();
348  
349 +        if (DDrConfig_GetOptOfType("gameplay.characterawareness", C_BOOL)->value.intBoolVal)
350 +                DD_Patch_CharacterAwareness();
351 +
352          // Cheats always enabled
353          if (DDrConfig_GetOptOfType("gameplay.cheatsenabled", C_BOOL)->value.intBoolVal)
354          {
# Line 346 | Line 374 | bool DD_Patch_Init()
374  
375                  // At end of ONrUnlockLevel to init values on level loading
376                  DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
377 +                
378 +                if (DDrConfig_GetOptOfType("gameplay.bindablecheats", C_BOOL)->value.intBoolVal)
379 +                {
380 +                        InitBindableCheats();
381 +                }
382          }
383          
384          if (DDrConfig_GetOptOfType("language.chinese", C_BOOL)->value.intBoolVal)
# Line 413 | Line 446 | bool DD_Patch_Init()
446                  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 ();
453 +        }
454 +        
455          // Hackish fix for Konoko not kicking guns
456          // Don't use this, it breaks stairs.
457          if (DDrConfig_GetOptOfType("gameplay.kickguns", C_BOOL)->value.intBoolVal)

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)