Skip to content

UnifiedSavePath: make it load and work on Linux#7

Open
RazanKai wants to merge 1 commit into
luojiesi:masterfrom
RazanKai:linux-compat
Open

UnifiedSavePath: make it load and work on Linux#7
RazanKai wants to merge 1 commit into
luojiesi:masterfrom
RazanKai:linux-compat

Conversation

@RazanKai

@RazanKai RazanKai commented Jun 8, 2026

Copy link
Copy Markdown

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:

  • 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//profile1 (no "modded/" segment).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant