-
Notifications
You must be signed in to change notification settings - Fork 69
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 MacOS Apple Silicon (arm64) #61
Comments
I don't think any of us have anything with apple silicon in it so this won't be worked on. Someone would have to make a PR that adds this support. |
I would happily donate time on an Apple Silicon Mac Mini at one of the cloud providers for you guys to work on this. However, I've already made some headway: I managed to fix the build scripts and the GitHub Actions (the latter, untested at the moment) for Apple Silicon / universal binary support. See allquixotic@6734aca The library builds and links just fine, and produces a universal binary, but when it's run in arm64, the code in plthook_osx.c which assumes x86-64 architecture crashes with a segmentation fault. Log at the bottom. The original developer of plthook_osx.c has added support for Apple Silicon; you can find it here: https://github.com/kubo/plthook/blob/master/plthook_osx.c I see your version of the header has If not, would it be possible to replace plthook_osx.c with the latest upstream, then patch in Just spitballing to try to determine how to get this working. Crash on arm64:
|
I tried this, and it seems to work (?) but there might be something wrong with the HarmonyX patcher that BepInEx uses. Not sure if this is caused by the plthook implementation or if this is something that breaks on arm64 and needs to also be adjusted for arm64. Code is HERE: master...allquixotic:UnityDoorstop:master Anyway, from these logs, it appears that Doorstop "does its job" and invokes the main method of the entry point DLL of BepInEx. The latter may not be coded to properly support this new arm64 world :) Here is my Doorstop verbose output:
Here is my BepInEx preloader where Harmony crashes (using the latest BepInEx bleeding edge DLLs or the latest stable):
|
A fairly high profile game, Valheim, just released a native Mac build. It is going to be featured at WWDC 2024, so it is likely to receive a lot of attention.
The Mac build of Valheim is still based on Unity and Mono, just like the Windows version, and they provide a "Universal Binary" of the game, which ships dual-architecture executables and libraries that are compiled for both Intel x64 and Apple Silicon arm64.
We have a way of running mods using BepInEx currently by forcing the game to run in Intel x64 mode, which kicks in Apple's Rosetta binary translator. Unfortunately, because Mono emits "new" native code all the time using its JIT compiler, Rosetta frequently causes the game to stutter or reduce FPS on some hardware. The Apple Silicon (arm64) native version of the game runs much faster because this binary translation layer is not needed.
Is it just a matter of recompiling UnityDoorstop to get it working for arm64, or would it require significant new code (e.g. in arm64 assembly) to get it to work?
The text was updated successfully, but these errors were encountered: