Skip to content

Commit

Permalink
Fix a bug where resetting hotkeys in-game would delete Keyboard.ini f…
Browse files Browse the repository at this point in the history
…rom subfolders
  • Loading branch information
ZivDero committed Feb 26, 2025
1 parent 40f1609 commit 47612e5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/extensions/options/optionsext_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@
#include "fatal.h"
#include "debughandler.h"
#include "asserthandler.h"
#include "hooker.h"
#include "hooker_macros.h"
#include "rawfile.h"


/**
* Patches Hotkey_Dialog_Proc to use RawFileClass when deleting Keyboard.INI to ensure only
* the file in the game's root directory is deleted.
*
* @author: ZivDero
*/
void _Delete_Keyboard_INI()
{
RawFileClass keyboard_ini("Keyboard.ini");
keyboard_ini.Delete();
}

DECLARE_PATCH(_Hotkey_Dialog_Proc_Keyboard_INI_RawFileClass_Patch)
{
_Delete_Keyboard_INI();
JMP(0x0058AA21);
}


/**
Expand All @@ -42,4 +64,6 @@ void OptionsClassExtension_Hooks()
* Initialises the extended class.
*/
OptionsClassExtension_Init();

Patch_Jump(0x0058AA18, &_Hotkey_Dialog_Proc_Keyboard_INI_RawFileClass_Patch);
}

0 comments on commit 47612e5

Please sign in to comment.