BUTR / BUTR/Bannerlord.ButterLib

Realm of Thrones 7.1 — crashes before main menu on Linux/Proton (Bannerlord 1.3.15)

Open
#458 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
28
Forks
9
Avg merge
1m
Merged PRs (30d)
1

Description

## Environment
- Game: Mount & Blade II: Bannerlord v1.3.15, build 110062 (Steam)
- OS: Nobara/Fedora Linux, NVIDIA RTX 4070 Ti (driver 595.71.05)
- Proton: proton-cachyos-11.0 (also tested Experimental 11, 9.0, GE — same/earlier crashes)
- Mods (manual install): Harmony 2.4.2, ButterLib 2.10.4, UIExtenderEx 2.13.2,
MCM (MBOptionScreen) 5.12.1, ROT 7.1 (ROT-Core/Content/Map/Dragon). No BLSE
(its .NET Framework launcher can't load net6 0Harmony 2.4.2 under Wine-Mono).
- Load order correct: Harmony, ButterLib, UIExtenderEx, MCM, Native, SandBoxCore,
Sandbox, StoryMode, ROT-Core, ROT-Content, ROT-Map, ROT-Dragon.

## Summary
On Linux/Proton the modded game never reaches the main menu. Under Proton the game
runs its managed layer on Mono, which diverges from CoreCLR (Windows) and produces
crashes ROT's code doesn't hit on Windows. All dependencies are present and correct.

## Crash A — Mono path (default `Bannerlord.exe`)
Fatal at ROT's `Harmony.PatchAll()` in `OnSubModuleLoad`:

HarmonyLib.HarmonyException: Patching exception in method System.Boolean
TaleWorlds.CampaignSystem.CampaignBehaviors.EncounterGameMenuBehavior::
game_menu_encounter_capture_the_enemy_on_condition(MenuCallbackArgs)
---> System.TypeInitializationException: The type initializer for
'EncounterGameMenuBehavior' threw an exception.
---> System.NullReferenceException
at TaleWorlds.Core.GameTexts.FindText (System.String id, System.String variation)
at TaleWorlds.CampaignSystem.CampaignBehaviors.EncounterGameMenuBehavior..cctor ()
at HarmonyLib.Harmony.PatchAll ()
at ROT.SubModule.OnSubModuleLoad ()
at TaleWorlds.MountAndBlade.Module.InitializeSubModuleBases ()

Cause: on Mono, Harmony patching forces the target type's static constructor to run
immediately; `EncounterGameMenuBehavior..cctor` calls `GameTexts.FindText` before the
game-text manager is initialized → NRE. CoreCLR (Windows) runs the cctor lazily, so it
doesn't reproduce there. (Timing-dependent: with some Proton builds it slips past this
and renders the menu background, then dies as below.)

## Crash B — forced CoreCLR path (`Bannerlord.Native.exe`, use_coreclr=1)
Passes Crash A, reaches the menu background render, then:

System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.IndexOutOfRangeException: Index was
outside the bounds of the array.
at System.Diagnostics.TraceInternal.get_AppName ()
CoreCLR Version: 6.0.3624.51421 / .NET 6.0.36

`Environment.GetCommandLineArgs()` is empty because the native host starts CoreCLR via
`coreclr_create_delegate` (no managed entry/args), so `get_AppName` throws. Any Trace/
Debug/Assert call at menu init then crashes.

## Crash C — ROT-Content ships a STALE shader cache (concrete ROT packaging bug)
`Modules/ROT-Content/Shaders/D3D11/compressed_shader_cache.sack` is dated 2024-05-03,
while `ROT-Map`'s is 2026-02-28 and is accepted. The 1.3.15 engine logs
"Shader cache version of the external module (ROT-Content) is invalid" then crashes
natively parsing it:

Exception 0xC0000005 (READ) at address 0xFFFFFFFFFFFFFFFF
IP inside TaleWorlds.Native.dll + 0x7437e0 (rglShader_manager, shader-cache parser)

(-1 "not found" sentinel dereferenced.) Workaround: delete/replace
`Modules/ROT-Content/Shaders/D3D11`. Please ship a ROT-Content shader cache matching the
1.3.15 engine (as ROT-Map already does).

## Crash reporter is broken under Wine (hides the real cause)
The in-game/BUTR crash reporter fails with:
- "Cannot parse dxdiag output. Index was outside the bounds of the array."
- `IndexOutOfRangeException` in `TraceInternal.get_AppName()`
These mask the true menu-init exception; Wine truncates the managed stack via
`OutputDebugStringA` and WER is a stub, so the real exception is unrecoverable. A
Wine-safe crash reporter (guard dxdiag parsing and `GetCommandLineArgs()[0]`) would make
Linux issues diagnosable.

## Ask
Is there a known way to run ROT 7.1 on Bannerlord 1.3.15 under Proton/Linux? The two
runtime-path crashes (Mono cctor timing; CoreCLR native-host empty command line) seem to
require ROT patch-timing and/or BUTR/TaleWorlds fixes. Happy to provide full logs and
minidumps.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the default Bannerlord.exe and use_coreclr=1 paths under Proton, using the reported stack traces. Inspect ROT.SubModule.OnSubModuleLoad and Modules/ROT-Content/Shaders/D3D11/compressed_shader_cache.sack, then compare the failures with the accepted ROT-Map cache. Done means identifying a reproducible actionable cause and documenting a verified outcome for Bannerlord 1.3.15.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, linux
Domain
game-dev, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.