fix: prevent BUTRInputManager orphan crash on game v1.4.4+ - #140
Open
w1r3dh4ck3r wants to merge 1 commit into
Open
fix: prevent BUTRInputManager orphan crash on game v1.4.4+#140w1r3dh4ck3r wants to merge 1 commit into
w1r3dh4ck3r wants to merge 1 commit into
Conversation
When BLSE runs on game versions newer than any compiled LauncherEx binary (e.g. v1.4.4 falls back to the v1.4.0 binary), the LauncherUI.AdditionalArgs property may no longer exist. The old patch order was: Initialize → Update → AdditionalArgs. If AdditionalArgs failed, Enable() returned false — but the Update postfix was already applied, leaving BUTRInputManager installed with no cleanup path. On the next frame the game loaded, this orphaned input manager caused a native crash at GauntletVideoPlaybackScreen::HandleResume. Fix: patch AdditionalArgs (cleanup) before Update (install). If the cleanup target is missing, we bail before ever installing BUTRInputManager, so the game starts with its original input manager intact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When BLSE v1.6.5 runs on game v1.4.4 (build 114449), it falls back to the
v1.4.0LauncherEx binary (the highest compiled version below 1.4.4, selected byModuleInitializer.ResolveLauncherExAssemblies).In that binary,
LauncherUIPatch.Enable()applies patches in this order:LauncherUI.Initialize→ succeeds (res1 = true)LauncherUI.Update→ succeeds (res2 = true) — installsBUTRInputManagerLauncherUI.AdditionalArgs→ fails (res3 = false) —AdditionalArgswas removed or renamed in v1.4.4Enable()returnsfalseafter step 3, butManager.Enable()ignores the return value. The result:BUTRInputManageris installed by theUpdatepostfix, but theAdditionalArgspostfix (which restores the original input manager) never fires.When the user clicks Play and the game starts in the same process, the native engine initializes its input subsystem and immediately crashes inside
GauntletVideoPlaybackScreen::HandleResumebecauseBUTRInputManageris still the activeInput.InputManager.Observed crash point from
rgl_log_*.txt:Confirmed via
watchdog_log_*.txt: game version is v1.4.4 build 114449, GPU AMD Radeon RX 9070 XT. Vanilla (no BLSE) and BLSE with only base modules both work correctly.Fix
Reorder the patch calls in
LauncherUIPatch.Enable()so thatAdditionalArgs(the cleanup) is patched beforeUpdate(the install). IfAdditionalArgsis not found in the current game version,Enable()returnsfalsebeforeBUTRInputManageris ever installed. The game then starts with its original input manager intact.The
Initializepostfix (launcher UI setup) is still applied regardless — it does not interact with the input manager.Behaviour change
AdditionalArgs(e.g. v1.4.0, v1.3.x)AdditionalArgs(e.g. v1.4.4)Long-term note
The correct long-term fix is to add a
GameAPIVersionentry for v1.4.2+ inBannerlord.BLSE.Shared.csprojonceBannerlord.ReferenceAssemblies.Corev1.4.4 is published, so a properly targeted LauncherEx binary exists for v1.4.4. This PR is the defensive fallback that prevents the crash in the meantime.