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 1017 by alloc, Mon Mar 23 23:29:19 2015 UTC vs.
Revision 1163 by rossy, Sun Oct 24 02:50:48 2021 UTC

# Line 183 | Line 183 | int16_t ONICALL DD_ONrMechanics_Register
183          return Oni_ONrMechanics_Register(inObjectType, inObjectTypeIndex, inGroupName, inSizeInMemory, inObjectMethods, inFlags, inMechanicsMethods);
184   }
185  
186 _ONrGameState_HandleUtilityInput Oni_ONrGameState_HandleUtilityInput = (_ONrGameState_HandleUtilityInput)0;
187 void ONICALL DD_ONrGameState_HandleUtilityInput(const void* inInput)
188 {
189        Oni_ONrGameState_HandleUtilityInput(inInput);
190        
191        if (ONrDebugKey_WentDown(7)) {
192                OBJgTriggerVolume_Visible = !OBJgTriggerVolume_Visible;
193        }
194 }
195
196
186   // Enables d_regen script command. Instead of one global flag to only regenerate player each char has a flag to enable local regeneration
187   void DD_Patch_Regeneration()
188   {
# Line 384 | Line 373 | bool DD_Patch_Init()
373          if (DDrConfig_GetOptOfType("language.chinese", C_BOOL)->value.intBoolVal)
374                  DD_Patch_Chinese();
375  
387        // Limit cursor to Oni's window
388        if (DDrConfig_GetOptOfType("windows.clipcursor", C_BOOL)->value.intBoolVal)
389        {
390                // LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook.
391                DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set);
392
393                // LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook.
394                DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set);
395        
396                // LIrTerminate: replace LIrPlatform_Terminate call with our hook.
397                DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate);
398        }
399
376          // Disables weapon cooldown exploit
377          if (DDrConfig_GetOptOfType("gameplay.cooldowntimer", C_BOOL)->value.intBoolVal)
378          {
# Line 409 | Line 385 | bool DD_Patch_Init()
385          {
386                  DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)DD_GLrEnumerateDisplayModes);
387          }
388 <        
389 <        // Forced DirectInput (for Windows NT)
390 <        if (DDrConfig_GetOptOfType("windows.directinput", C_BOOL)->value.intBoolVal)
388 >
389 >        if (DDrConfig_GetOptOfType("windows.daodaninput", C_BOOL)->value.intBoolVal)
390 >        {
391 >                DDrInput_PatchDaodanInput();
392 >        }
393 >        else
394          {
395 <                // LIrPlatform_Initialize: replace conditional jump by unconditional
396 <                DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
395 >                // The following patches aren't compatible with, or are superseded by
396 >                // Daodan input
397 >
398 >                // Limit cursor to Oni's window
399 >                if (DDrConfig_GetOptOfType("windows.clipcursor", C_BOOL)->value.intBoolVal)
400 >                {
401 >                        // LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook.
402 >                        DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set);
403 >
404 >                        // LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook.
405 >                        DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set);
406 >
407 >                        // LIrTerminate: replace LIrPlatform_Terminate call with our hook.
408 >                        DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate);
409 >                }
410 >
411 >                // Forced DirectInput (for Windows NT)
412 >                if (DDrConfig_GetOptOfType("windows.directinput", C_BOOL)->value.intBoolVal)
413 >                {
414 >                        // LIrPlatform_Initialize: replace conditional jump by unconditional
415 >                        DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
416 >                }
417          }
418  
419          // Disable Oni's command line parser so it doesn't interfere with ours
# Line 448 | Line 447 | bool DD_Patch_Init()
447          
448          // Allow custom actions to be bound through Daodan
449          if (DDrConfig_GetOptOfType("gameplay.customactions", C_BOOL)->value.intBoolVal)
450 <        {
451 <                Input_PatchCode ();
453 <        }
454 <        
450 >                DDrInput_PatchCustomActions();
451 >
452          // Hackish fix for Konoko not kicking guns
453          // Don't use this, it breaks stairs.
454          if (DDrConfig_GetOptOfType("gameplay.kickguns", C_BOOL)->value.intBoolVal)
# Line 570 | Line 567 | bool DD_Patch_Init()
567          // Allow bsl-var show_triggervolumes or ctrl+shift+x (devmode) to work
568          if (DDrConfig_GetOptOfType("devmode.showtriggervolumes", C_BOOL)->value.intBoolVal)
569          {
570 +                DDrInput_PatchUtilityInput();
571                  Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register);
574                Oni_ONrGameState_HandleUtilityInput = DDrPatch_MakeDetour((void*)ONrGameState_HandleUtilityInput, (void*)DD_ONrGameState_HandleUtilityInput);
572          }
573 <        
573 >
574          // Experiment with allowing enemies to be thrown over railings
575          if (DDrConfig_GetOptOfType("gameplay.throwtest", C_BOOL)->value.intBoolVal)
576          {
# Line 591 | Line 588 | bool DD_Patch_Init()
588                  DDrPatch_NOOP((char*) OniExe + 0x0002651c, 6);
589                  DDrPatch_MakeCall((char*) OniExe + 0x0002651c, (void*) GetClientRect);
590  
591 +                // Note: Daodan input makes the following GetCursorPos and SetCursorPos
592 +                // patches unnecessary
593 +
594                  // LIrPlatform_PollInputForAction: fix GetCursorPos call to return client coordinates.
595                  DDrPatch_NOOP((char*) OniExe + 0x000032cc, 6);
596                  DDrPatch_MakeCall((char*) OniExe + 0x000032cc, (void*) DD_GetCursorPos);

Diff Legend

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