UnifiedSavePath: make it load and work on Linux#7
Open
RazanKai wants to merge 1 commit into
Open
Conversation
The mod crashed on Linux during Initialize() at Harmony.PatchAll(): DllNotFoundException: Unable to load shared library '/tmp/mm-exhelper.so.*' ... undefined symbol: _Unwind_RaiseException Harmony's runtime detours go through MonoMod's native helper, which needs the stack-unwinding routines from libgcc_s. The Godot/.NET host doesn't load libgcc_s with global symbol visibility, so the helper can't resolve the symbol and PatchAll() throws — the save-path patches never apply and the game keeps using the separate modded/ profile directory (issue luojiesi#1). Fix: before patching, dlopen("libgcc_s.so.1", RTLD_NOW | RTLD_GLOBAL) via libdl.so.2 on Linux only (no-op on Windows/macOS). This makes the unwind symbol globally available to the helper. Self-contained, so it works regardless of mod load order and needs no Steam launch-option workaround. Also: - csproj: detect the host OS and reference the correct game data dir (data_sts2_linuxbsd_x86_64 on Linux, macos on macOS) instead of the hardcoded Windows path with backslashes; STS2GameDir still overridable. - manifest: has_pck = false (pure code mod, ships no Godot resources), which removes a spurious "no PCK found" error on load. Verified on STS2 v0.107.0 / Linux: mod initializes with no exception and the profile path becomes user://steam/<id>/profile1 (no "modded/" segment). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The mod crashed on Linux during Initialize() at Harmony.PatchAll():
DllNotFoundException: Unable to load shared library '/tmp/mm-exhelper.so.*'
... undefined symbol: _Unwind_RaiseException
Harmony's runtime detours go through MonoMod's native helper, which needs the stack-unwinding routines from libgcc_s. The Godot/.NET host doesn't load libgcc_s with global symbol visibility, so the helper can't resolve the symbol and PatchAll() throws — the save-path patches never apply and the game keeps using the separate modded/ profile directory (issue #1).
Fix: before patching, dlopen("libgcc_s.so.1", RTLD_NOW | RTLD_GLOBAL) via libdl.so.2 on Linux only (no-op on Windows/macOS). This makes the unwind symbol globally available to the helper. Self-contained, so it works regardless of mod load order and needs no Steam launch-option workaround.
Also:
Verified on STS2 v0.107.0 / Linux: mod initializes with no exception and the profile path becomes user://steam//profile1 (no "modded/" segment).