Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions CommonAPI/Systems/KeyBindSystem/Patches/Chainloader_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CodeInstruction> PatchInitKeys(IEnumerable<CodeInstruction> 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:
Expand Down