Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support platform macosx/arm64 #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

allquixotic
Copy link

Current version of UnityDoorstop supports only x86 CPU architecture on MacOS. This patch adds support for arm64, which was enabled by integrating the latest version of plthook upstream into plthook_osx.c and re-adding the UnityDoorstop-specific public function,

void *plthook_handle_by_name(const char *name)

... which appears to work just fine after pulling in the changes from plthook upstream.

The build system has been updated to produce a MacOS Universal Binary, by first compiling the x86_64 and arm64 versions of the library, then smashing them together into a single file. You can distribute the Universal Binary as the only MacOS distributable for both Intel and Apple Silicon architectures, and it will automatically "do the right thing" when the user tries to use it, irrespective of their CPU architecture.

NOTE: due to MonoMod#90, game mod loaders that leverage UnityDoorstop as their entry point but use HarmonyX as their managed code patching library will still fail to work on Apple Silicon. This is an issue unrelated to UnityDoorstop, which by all accounts, appears to correctly load and hand over control to the mod loader.

Tested with BepInEx; confirmed that BepInEx's managed code starts running successfully, and it only crashes because of the MonoMod#90 issue mentioned above, which again isn't UnityDoorstop's fault.

Resolving this issue is a prerequisite to one day getting mod loaders to work with Apple Silicon on MacOS.

Resolves bug #61.

Copy link
Collaborator

@ManlyMarco ManlyMarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a glance it looks fine but it would be nicer to read without the unnecessary formatting changes, not a big deal though.
The additional logging for config should be a separate PR though.

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.

2 participants