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
16 changes: 10 additions & 6 deletions src/Bannerlord.LauncherEx/Patches/LauncherUIPatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Bannerlord.LauncherEx.Helpers;
using Bannerlord.LauncherEx.Helpers;

using HarmonyLib;
using HarmonyLib.BUTR.Extensions;
Expand All @@ -23,16 +23,20 @@ public static bool Enable(Harmony harmony)
postfix: AccessTools2.DeclaredMethod(typeof(LauncherUIPatch), nameof(InitializePostfix)));
if (!res1) return false;

var res2 = harmony.TryPatch(
AccessTools2.DeclaredMethod(typeof(LauncherUI), "Update"),
postfix: AccessTools2.DeclaredMethod(typeof(LauncherUIPatch), nameof(UpdatePostfix)));
if (!res2) return false;

// Patch the cleanup point before installing BUTRInputManager.
// If LauncherUI.AdditionalArgs was removed or renamed in this game version,
// installing BUTRInputManager without a cleanup path would leave it active
// when the game starts, causing a native crash (e.g. at GauntletVideoPlaybackScreen).
var res3 = harmony.TryPatch(
AccessTools2.DeclaredPropertyGetter(typeof(LauncherUI), "AdditionalArgs"),
postfix: AccessTools2.DeclaredMethod(typeof(LauncherUIPatch), nameof(AdditionalArgsPostfix)));
if (!res3) return false;

var res2 = harmony.TryPatch(
AccessTools2.DeclaredMethod(typeof(LauncherUI), "Update"),
postfix: AccessTools2.DeclaredMethod(typeof(LauncherUIPatch), nameof(UpdatePostfix)));
if (!res2) return false;

return true;
}

Expand Down