diff --git a/CommonAPI/Systems/KeyBindSystem/Patches/Chainloader_Patch.cs b/CommonAPI/Systems/KeyBindSystem/Patches/Chainloader_Patch.cs index 4eafc02..bc19b0c 100644 --- a/CommonAPI/Systems/KeyBindSystem/Patches/Chainloader_Patch.cs +++ b/CommonAPI/Systems/KeyBindSystem/Patches/Chainloader_Patch.cs @@ -68,16 +68,12 @@ public static void SaveKeyBindsOnApplyOptions() stream.Dispose(); } - // Search for loading 256 and replace it with new size + // Skip GameOption.InitKeys() to avoid reset of GameOption.overrideKeys. [HarmonyPatch(typeof(GameOption), nameof(GameOption.InitKeys))] - [HarmonyTranspiler] - public static IEnumerable PatchInitKeys(IEnumerable instructions, ILGenerator generator) + [HarmonyPrefix] + public static bool PatchInitKeys() { - CodeMatcher matcher = new CodeMatcher(instructions, generator) - .MatchForward(false, - new CodeMatch(OpCodes.Ldc_I4, 256)); - matcher.Set(OpCodes.Ldc_I4, OverrideKeysNewSize); - return matcher.InstructionEnumeration(); + return false; } // Search for: