macOS / POSIX build support (supersedes #10) - #13
Merged
Merged
Conversation
Re-applies the macOS portability work from PR #10 onto current master (the PR branched ~39 commits back and could not be cleanly rebased): - recompiler/main_nes.c: abstract _mkdir/direct.h behind a make_dir() macro with a POSIX sys/stat.h mkdir() fallback - runner/coroutine.c: POSIX ucontext_t coroutine backend, replacing the non-Windows #error stub (matches the current coroutine.h API surface) - runner/nes_runtime.h: fix stale 2-arg mapper_init declaration to match the 4-arg definition in mapper.h / mapper.c - runner/nestopia_cmake.cmake: clang narrowing flags for oracle builds launcher.c and override_chr.c already gained POSIX branches on master, so they are unchanged here. Co-authored-by: Nat Budin <nbudin@actbluetech.com>
Building Super Mario Bros. on macOS (AppleClang) surfaced three latent issues that MSVC silently tolerated: - code_generator.c: emit forward declarations into the generated _dispatch.c (call_by_address) translation unit. Previously only _full.c got them, so dispatch.c relied on implicit function declarations — a hard error under clang/gcc C99+. RULE 1 fix: corrected in the generator, not the artifact. - nes_runtime.h: declare runtime_get_ppu_t / runtime_scroll_from_t_valid / runtime_get_latch_state / runtime_set_latch_state (defined in runtime.c, called from ppu_renderer.c without a prior declaration). - debug_server.h: remove a stale duplicate declaration of debug_server_get_frame_record (uint32_t) that conflicted with the uint64_t definition. With these, the recompiler and the SMB runner build clean and the game boots natively on arm64 macOS.
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.
Native macOS (Apple Silicon + Intel) build support for the recompiler and game runners. Both Super Mario Bros. and The Legend of Zelda build and run natively on arm64 macOS; Zelda plays cleanly end-to-end.
Credit
This is a rebase of @nbudin's work in #10 onto current
master. That PR branched ~39 commits back and could not be cleanly rebased in place (it lives on a fork), so its changes were re-applied here with authorship preserved (Co-authored-byon the port commit). Thanks, @nbudin! Once this merges, #10 can be closed as superseded.What's here
From #10 (rebased):
ucontextcoroutine backend, replacing the non-Windows#errorstub (matches the currentcoroutine.hAPI)make_dirmacro over_mkdir/mkdir)mapper_initdeclaration fixed to matchmapper.h/mapper.cAdditional fixes surfaced by building on Apple Clang (MSVC silently tolerated these):
code_generator.cnow emits forward declarations into the generated_dispatch.c— previously it relied on implicit function declarations, a hard error under clang/gcc C99+. Fixed in the generator, not the artifact (RULE 1).runtime_*functions innes_runtime.hthat were defined inruntime.cbut called without a prior declaration.debug_server_get_frame_record.Docs:
Notes
launcher.c/override_chr.calready had POSIX branches onmaster, so they're untouched.nesrecomp.pinand regenerating.🤖 Generated with Claude Code