Skip to content

Native 64-bit macOS build (rebase of #42) and a macOS release zip - #95

Open
smidley wants to merge 3 commits into
murkantor:mainfrom
smidley:macos-native-rebased
Open

smidley wants to merge 3 commits into
murkantor:mainfrom
smidley:macos-native-rebased

Conversation

@smidley

@smidley smidley commented Oct 28, 2026 •

Copy link
Copy Markdown

Goal

Run Project Midas natively on macOS (Apple Silicon and Intel) and ship a macOS zip next to the Windows and Linux ones. Closes #31.

This carries #42 forward. #42's branch is still on 1.0.1 and conflicts with current main, so I rebased its single commit onto 1.0.2b with sh4 kept as the commit author, fixed one 64-bit bug in code that landed in 1.0.2b, and added packaging. Credit for the 64-bit port goes to sh4 (#42). If sh4 would rather update #42, the two extra commits here apply on top of it once it's rebased onto 1.0.2b, and this PR can be closed.

Description

Three commits:

  1. Add native 64-bit macOS support (sh4, from Add native 64-bit macOS support #42). Rebased onto 1.0.2b. Three conflicts, all resolved by keeping both sides:
  2. Keep the sight's display-list pointer 64-bit (src/game/gunfire.c). 1.0.2b's HUD Scale brackets in gunDrawSight store the display-list pointer back with (s32). On the 64-bit build that truncates it, and right-click aiming crashed with SIGSEGV. sp54 is already intptr_t, so both lines now cast to intptr_t, like the wide-aim block above them. No change on the 32-bit builds.
  3. Package a universal macOS release zip.
    • scripts/port/package_macos.sh builds releases/<name>/ProjectMidas-<name>-macos.zip with the linux zip's layout. SDL2 is bundled next to the executable, both are relinked to @executable_path and ad-hoc signed, and the README covers the quarantine flag.
    • The script refuses a build linked to Homebrew's sdl2. That package is sdl2-compat, which loads SDL3 at runtime, so it can't be shipped on its own.
    • New package-macos CI job: builds SDL2 2.30.11 from the pinned source (same SDL2_SRC_SHA1 as the Linux job), builds one universal arm64 + x86_64 binary for macOS 11+, packages it, and uploads the zip. Run on a tag, the zip gets the tag's name, e.g. ProjectMidas-v1.0.3-macos.zip.
    • docs/macos.md: short "Release zip" section.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

How Has This Been Tested?

All on an M4 Pro, macOS 27.2, with a locally supplied US cart (SHA-1 matches).

  • Native build and fixtures: clean Release build of the rebased branch; all 7 GE_PORT_TESTS fixtures pass.
  • Pointer-width audit of the 1.0.2b changes: recompiled every translation unit with -Wpointer-to-int-cast -Wint-to-pointer-cast -Wvoid-pointer-to-int-cast -Wint-conversion -Wshorten-64-to-32 and kept the warnings on lines 1.0.2b added. The only hit was the (s32) agdl cast fixed in commit 2. I also searched those lines for (u32)(uintptr_t) double casts and raw (u8 *)p + 0x... struct offsets and found none.
  • Aim crash, before and after: reproduced without a mouse using GE_SKIPINTRO=1 GE_STAGE=dam GE_NOINPUT=1 GE_INPUTPLAY=<file>, where the file holds R (P <tick> 10 0 0 for ticks 600-6000). Before the fix: SIGSEGV in portDisplayCrosshairImage from gunDrawSight on the first aiming frame. After: about 30 s in aim mode at 60 fps, no crash.
  • Release zip: unzipped into an empty folder and ran it there. It loaded the bundled libSDL2-2.0.0.dylib (checked with lsof), found the cart in Data/ by itself, and ran Dam at 60 fps. Both binaries are universal and ad-hoc signed (codesign --verify --strict passes), with no rpaths into the build machine.
  • In-game play on the rebased build: played it with the fix in; right-click aiming works.

Not tested:

  • Intel runtime: the x86_64 slice compiles and links, but this Mac has no Rosetta. The CI matrix still builds and tests on macos-15-intel.
  • Windows and Linux 32-bit builds: not built locally. Commit 2's change is intptr_t instead of s32, which is the same width there. CI will confirm.
  • Sanitizer fixtures: not run locally. The build-macos CI job runs them.
  • Multiplayer: not tested (also untested in Add native 64-bit macOS support #42).

Checklist

  • My code has been thoroughly tested and is free of bugs
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • The commits I've made a clean, small and easy to understand (Add native 64-bit macOS support #42's port is one large commit, as it was in Add native 64-bit macOS support #42)
  • My changes generate no compiler warnings (the macOS __DATA,__common alignment linker warning from Add native 64-bit macOS support #42 remains)
  • My Code is AI-Generated or AI-assisted: Add native 64-bit macOS support #42 was written with Codex (GPT-6). The rebase, fix, packaging and testing here were done with Claude (Opus 5.5).
  • My PR contains no AI-generated images, textures, models, sound or music
  • I am an AI (this description was drafted by Claude at my request; I have reviewed it)
  • I have reviewed my PR to make sure the above is truthful and accurate. I understand my PR can be rejected if it doesn't meet this project's standards.

Separate from this PR: RecompLauncher's Project Midas entry expects ProjectMidas-*-windows.7z and ProjectMidas-*-linux.7z, but 1.0.2b ships .zip. Once a macOS zip is in a release, the entry also needs "macos": "ProjectMidas-*-macos.zip".

🤖 Generated with Claude Code

iamsh4 and others added 3 commits October 28, 2026 08:00
Convert serialized ROM records to native layouts at load boundaries and remove 32-bit address and runtime-layout assumptions. Add Cocoa/SDL build and fullscreen support, ROM-free regression fixtures, macOS CI, build documentation, and converter attribution.
1.0.2b's HUD Scale brackets around the aim sight stored the display-list
pointer back with (s32), which truncates it on the native 64-bit build: the
next crosshair draw wrote through a garbage pointer and right-click aiming
crashed (SIGSEGV in portDisplayCrosshairImage). sp54 is intptr_t, so cast to
that like the wide-aim block above. No change on the 32-bit builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/port/package_macos.sh assembles ProjectMidas-<name>-macos.zip in the
same layout as the linux zip, with SDL2 bundled beside the exe (rewritten to
@executable_path and ad-hoc re-signed). It refuses Homebrew's sdl2, which is
sdl2-compat and loads SDL3 at runtime.

The package-macos CI job builds SDL2 2.30.11 from the pinned source and one
universal arm64 + x86_64 binary for macOS 11+, then uploads the zip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

MacOS Support

2 participants