Repository navigation
macOS Unity 6 fixes: restore runtime hooks and native packaging - #5
Open
Zheng-Yu7463 wants to merge 3 commits into
Open
Zheng-Yu7463 wants to merge 3 commits into
Zheng-Yu7463 wants to merge 3 commits into
Conversation
The macOS build copied only the osx-x64 native libraries from the unityscenerepacker package, while CI merged them with the osx-arm64 ones into universal binaries afterwards. Local builds therefore shipped x86-64-only libraries: the game launches natively on Apple Silicon, but UnitySceneRepacker fails to load in an arm64 process and Benchwarp teleports time out. Move the merge into the Assembly-CSharp build itself and let CI install its lipo binary before the build, so every macOS build produces the same universal libraries. The x86-64 slice is unchanged for Rosetta launches. Verified on an M4 with Hollow Knight 1.5.12620: the arm64 game process loads UnitySceneRepacker and completes a Benchwarp teleport to Town, and the x86-64 slices of the rebuilt libraries match the previously installed ones byte for byte.
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.
Follow-up to hk-modding#164, based on @SFGrenade's
hk-beta-branch-unity-6-updateat468f579. This adapts the Unity 6 branch so EnemyHPBar and Benchwarp run on macOS with Hollow Knight 1.5.12620 (Unity 6000.0.61f1), in both native arm64 and Rosetta game processes.Fixes
MonoMod.Patcher/MonoModder.cs):AggressiveInliningwas applied instead of cleared, so patched methods stayed inlined and runtime hooks never observed calls. Both game assemblies now build withPreventInlineas intended.TeamCherry.Localization.Language: a[Modding.ForwardedHooks]marker letsHookGeneratorretargetOn/ILendpoints to the real methods while keeping legacy signatures, including the oldLanguageCodeenum in parameters and returns. Invalid forwarded facades are rejected at generation time.PrepareForMenuTransition()to set the privatewaitForManualLevelStartbeforeLoadSceneAsync("Quit_To_Menu"), fixing aGameManager.SetupHeroRefscrash. The field has to stay private: making it public changes Unity serialization layout and crashes at runtime.OutputFinal, packages both native dylibs per RID, always regenerates HookGen output, fixes Pre/PostPatcher build order, and merges the x86-64 and arm64 natives into universal libraries as part of the build itself. The GitHub Actions macOS job installslipobefore building instead of merging afterwards, so local builds and CI produce the same universal libraries. Previously a local Apple Silicon build silently shipped x86-64-only natives, which madeUnitySceneRepackerfail in a native arm64 process and Benchwarp teleports time out.Validation
Tests/HookGenregression tests (no game files needed): PASS.Tutorial_01Crawler creates an EnemyHPBar and its HP is tracked from 8 to 7; Benchwarp teleports to Town's RestBench marker with the hero active and gameplay resumed.UnitySceneRepackerloads (Repacked 1 preload scenes from 1146 to 45 objects) and the modded title screen lists all three mods.Limitations
The changes can be split into smaller PRs if that is preferred for review.