Conversation
Read native game arguments through the macOS C runtime and resolve the actual executable through dyld. Preserve existing option parsing while supporting UTF-8 paths and loader base directories outside the Unity app bundle. Update the bundled x64 plthook archive with the universal Mach-O chained-fixup correction, including pinned source provenance, rebuild instructions, and license. The original dependency repository is archived, so the source fix is available for review in the fork. Add a native-host regression using production sources. Validate both Mac architectures for the helpers, normal macOS Debug/Release solution builds, Windows/Linux managed compilation, and headless Unity/mod startup. Co-Authored-By: Codex <codex@openai.com>
johanntan
marked this pull request as ready for review
September 10, 2026 01:20
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.
A universal macOS Unity game can start without working hooks, ignore
--melonloader.basedir, or resolve its game data path outside the actual app bundle. This fixes three independent startup problems encountered with A Dance of Fire and Ice 3.3.1 (Unity 6000.3.10f1), using the supported x64 loader under Rosetta._NSGetArgc/_NSGetArgvon macOS.Environment.GetCommandLineArgs()in the NativeAOT bootstrap does not expose the native game's arguments. Existing option parsing and syntax are unchanged._NSGetExecutablePath, decode UTF-8, and find the enclosing Unity app bundle.Process.MainModulecan identify a different module in an embedded runtime. Keep the public macOSGameExecutablePathconvention of returning the app bundle.libplthook.awith a rebuild that accounts for universal Mach-O slice offsets when reading chained fixups. The exact source revision, build command, deployment target, and license are recorded beside the archive. The archive contains a single rebuilt object.Dependency status:
kubo/plthookis archived; GitHub rejected an upstream PR as read-only. The tested source fix is available for review at johanntan/plthook#1. This MelonLoader PR is a draft for review of that dependency and coordination with #1174. The native path fix overlaps that PR's app discovery changes, but this PR does not add arm64 loader targets, interposition changes, or another launch wrapper.Validation
bash tests/MacHost/run.sh: a C executable loads a NativeAOT shared library linking the production parser and environment class. It checks separate/equals basedir syntax, empty values, embedded equals, UTF-8 values and app paths, flags, and a loader directory outside the app. Both x64 and native arm64 helper runs pass; the latter does not claim full arm64 loader support.net35,net472, andnet6targets also compile with Windows and Linux platform guards; their runtimes were not exercised here.Launch and validation limits
The existing
melonloader-launch.shworks when invoked through an x64 shell on this Apple Silicon Mac. The equivalent Steam launch-option form is:/usr/bin/arch -x86_64 /bin/bash "/absolute/game/path/melonloader-launch.sh" %command%The wrapper invocation was tested directly with the game's app-bundle argument; launching through Steam's UI was not tested. Without explicit architecture selection, dyld rejects the x64 bootstrap in the arm64 game. No changes to that wrapper are included.
These are startup checks, not a full gameplay or clean-exit certification. The game remained running until the test timeout; SIGTERM cleanup ended in SIGABRT in the with-mod and no-mod loader runs. Interactive gameplay and normal in-game shutdown still need validation.