Add initial macOS build support #715
Closed
yeetbot90 wants to merge 35 commits from
main into main
pull from: main
merge into: MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!715
Loading…
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
macOS builder app
Adds an Apple Silicon macOS builder package that uses the existing Hookshot Builder interface. The generated
HookshotBuilder.applaunches the same Tk-based builder used by the Linux package, with macOS-specific config and Finder-folder handling. A command-line launcher is included as well.The builder runs its x86-64 game toolchain under Rosetta 2 and uses WebGPU's Metal backend. CI packages Python, SDL2, static FFmpeg and wgpu-native with the source. It does not receive a game dump or build a game; users supply their own
.nupfile.The first package attempt took about 15 minutes and failed after dependency compilation because the wgpu-native license URL used hyphens instead of the upstream filenames' periods. This update fixes those URLs, runs dependency builds natively on Apple Silicon (only the x86 Python runtime uses Rosetta), skips the separate dav1d build in favor of FFmpeg's AV1 decoder, and caches built dependencies. The macOS builder job compiles the app, checks the packaged launcher, and uploads `HookshotBuilder-macos-arm64"
Validation
Fix conflicts please,
Honestly, macos would be hard to implement considering the fact that macos has integrated graphics, not a gpu, meaning that the fps you would probably experience in game would be less then ideal.
What are you averaging in game on macOS?
i am currently testing it so ii changed it to a drafft
Looks cool, yet I'm curious why this is even needed in the first place. I believe there are projects like Macnative that have this done already.
As I thought it would be cool to just have a version of hookshot for mac as I believe it's great.
And I also have another Mac computer and I want to just try to port something to mac for once
I have an M4 so would be happy to test this too
https://github.com/NotRexed/Hookshot/actions/runs/42512541321/artifacts/13630345902 this should have the zip of the app
tell me if somethings wrong as i haven't had the chance to test it yet as my laptop died and i am editing it from a pc
Could you check if it support sdl3 ? there's a new stub for swapping between 2 and 3. And could you check for cross-compilation from linux (most generic builder in CI's), its mostly a recommendation to be able to do 3 builds from the same type of machine
Could you check to combine work on this ?
#459
I'll try
https://github.com/NotRexed/Hookshot/actions/runs/42517523284/artifacts/13632390784 The newest one if someone wants to try It should work and has the other ones in it too
Tested the latest build (run 42517523284) on an M4 Pro, macOS 27.0.1, with Xcode installed. It didn't work as downloaded. I hit two bugs:
1. Reading the
.nupfails with'string.h' file not found--check --nup ...fails while buildingzbic.dylib:nx2/zbic.py_build()calls Xcode's clang by its full path (.../XcodeDefault.xctoolchain/usr/bin/clang). It only passesnative_target/native_link, not the macOS sysroot. Called directly like that, clang can't find the SDK headers.check_macos_toolchain()already passestoolchain.macos_sysroot_flags(), so the startup check passes and the failure only shows up later. A fix would be to addmacos_sysroot_flags()to the zbic compile (and any other host compiles). Another option is to exportSDKROOT="$(xcrun --show-sdk-path)"inHookshotBuilder.commandand in the app's AppleScript launcher. I did theSDKROOTversion locally and--checkthen passed: "This is the version Hookshot supports (build e0f3ccfa)."2.
HookshotBuilder.apphas an invalid code signatureIt looks like the app is ad-hoc signed before
tools/is copied intoContents/Resources. If someone downloads it in a browser, Gatekeeper will probably block it. Signing as the last packaging step should fix it (codesign --force --deep -s - HookshotBuilder.app).With both fixed locally, the app opens to the builder window. I'll report back after a full build.
Update: after a few local fixes the build finishes, but the game crashes on startup.
Fixed locally (please add to the PR):
nx2/build.py: the macOS link is missing the C++ standard library. Add-lc++to macOSHOST_LIBS.host/posix/win32_posix.c:InitializeCriticalSection,SleepConditionVariableSRWandSleepConditionVariableCSexist only in the Linux (#else) branch. Add them to the__APPLE__branch too. They only use pthreads, so the same code works.nx2/build.py:libwgpu_native.dylibis only copied into the game folder in the Windows branch. On macOS the game can't find it at launch.Still broken:
makecontextinCreateFiberEx(called fromnn::os::InitializeFiber), writing just past the top of the fiber stack. macOS deprecatesgetcontext/makecontext, and they don't work reliably on Apple Silicon, so fibers probably need a different implementation on Mac.host/posix/display_sdl.cforces SDL's video driver towayland,x11, so the game runs headless on macOS. Skip that hint on__APPLE__.~/.local/share/hookshot\save\...(Linux path with backslashes).Tested on an M4 Pro, macOS 27.0.1.
Last update from me. I'm on Windows and only tested this on my Mac as a favour, so I'm handing it back to you. With the fixes below the game boots to the title screen on an M4 Pro at about 30 fps.
More fixes needed (on top of my last comment):
CreateFiberEx(host/posix/win32_posix.c): macOS'smakecontextzeroes the whole stack, so it hits the guard page that was justmprotected. On__APPLE__, add the guard aftermakecontext, sizedgetpagesize()(16 KB on Apple Silicon).host/posix/display_sdl.c): skip theSDL_VIDEODRIVER=wayland,x11hint on__APPLE__so SDL uses cocoa.scripts/macos/deps.shdropped dav1d, but FFmpeg's built-inav1decoder is hardware-only. Build dav1d likescripts/linux/deps.shdoes and configure FFmpeg with--enable-libdav1d --enable-decoder=vp8,vp9,libdav1d.build.pyalready linkslibdav1d.awhen it's in the prefix. I tested this with dav1d 1.5.4 + FFmpeg 9.0.2 and the movies decode.Still broken (not fixed):
RX_NO_CULLdidn't obviously fix it. It would be worth comparing with Windows/Linux to see whether it only happens on Metal.~/.local/share/hookshot\save\....I didn't get past the title screen.
Closing to keep the queue clear — please rebase on current main and reopen; thanks!
Ok Thanks for all the help I'll try to fix it just as you also said