Files
goldeneye-pc-port/port
Dan Turner d4cc71af0a macos: native Apple Silicon (arm64) support — address model, boot chain, 21/21 levels
Adds native arm64 macOS support on top of #88's Intel macOS layer.

The one structural change arm64 needs is an address model. The port realises
the N64's 32-bit address space *as host addresses* — DRAM at 0x70000000, cart
at 0x10000000, plus ~1700 linker-absolute symbols — which is only sound while
host addresses fit in 32 bits. Native arm64 cannot map below 4 GiB
(__PAGEZERO; a shrunken pagezero is SIGKILLed at exec; PIE is mandatory;
MAP_32BIT fails). So the whole space is relocated to a fixed host base,
PORT_ADDR_BASE (16 TiB), with portN64ToHost / portHostToN64 / PORT_N64PTR as
the conversion chokepoints. PORT_ADDR_BASE is 0 on every other platform, so
all of this is an identity there.

That relocation then surfaces a class of latent 64-bit bugs that are invisible
at base 0 — any place the decomp round-trips a pointer through a 32-bit
integer. The src/ changes here are that class: pointer-width/layout only, no
behaviour change, N64 branch textually unchanged, each documented in
docs/dev/findings.md (D298/M2).

Also: Mach-O absolute-symbol generation at the same base, #pragma weak ->
symbol equates, __x86_64__ -> PLATFORM_64BIT, Darwin crash handler/ucontext,
shm_open DRAM, the AppKit main-thread guard, and the sidecar generation that
was the real boot blocker.

Verified: 21/21 solo levels boot, render and run crash-free.
2026-10-04 10:50:01 +01:00
..
2026-09-01 19:28:59 -04:00

GoldenEye 007 — PC port layer

This directory contains the PC port layer: the code that lets the (unmodified) GoldenEye game sources run on a modern host instead of N64 hardware.

It mirrors the layout of the Perfect Dark PC port, which ports the same Rare engine family. See docs/internals.md (repo root) for the full research write-up and phased plan.

Layout

port/
├── fast3d/            # Software RSP: interprets GBI display lists -> OpenGL
│   ├── gfx_pc.cpp     #   RSP interpreter (matrices, lights, tris, fog)
│   ├── gfx_opengl.cpp #   OpenGL rendering backend (shaders, textures, zbuf)
│   ├── gfx_sdl2.cpp   #   SDL2 window-manager backend
│   ├── gfx_cc.cpp     #   color-combiner -> GLSL shader compiler
│   └── ...
├── include/           # port-facing headers
│   ├── audio.h  config.h  fs.h  input.h  mixer.h
│   ├── platform.h  romdata.h  system.h  video.h  utils.h
│   └── versioninfo.h.in
└── src/
    ├── main.c         # PC entry point (replaces boot.s / init())
    ├── libultra.c     # shims for the libultra OS API
    ├── video.c        # SDL2 window + GL context + frame pacing
    ├── audio.c        # SDL audio device, buffer queueing
    ├── mixer.c        # audio mixing
    ├── input.c        # SDL2 keyboard/mouse/gamepad -> N64 controller structs
    ├── fs.c           # filesystem abstraction over the ROM + data dir
    ├── romdata.c      # loads the .z64 ROM from disk, sets up segments
    ├── config.c       # INI config (ge007.ini)
    ├── system.c       # platform primitives (time, logging, paths)
    ├── crash.c        # crash handler / stack traces
    ├── gesched.c      # replacement RCP scheduler that drives the software RSP
    └── utils.c

How it works (short version)

  • The R4300 game code (src/game, src) is compiled unmodified.
  • The RSP is emulated in software (fast3d/): it interprets the Gfx display list the game builds and emits OpenGL calls, bypassing the RDP.
  • The RCP scheduler (gesched.c) replaces src/sched.c's hardware task submission: instead of writing RSP registers it calls gfx_run().
  • libultra OS functions are shimmed in libultra.c (single-threaded, host clock, VI/PI/SI/AI mapped onto the video/audio/fs/input layers).
  • Saves (Memory Pak / EEPROM) are backed by files in the data dir.

GE-specific RSP work

The PD fast3d already handles G_TRI4 (GE's 4-triangle command). The new work for GE is:

  • G_SETTEX — GE's custom texture-bank command (include/gbi_extension.h, gsSPUseTexture). Must be added to the RSP interpreter + GL backend.
  • Verify GE's custom color-combiner modes (G_CC_*FADE*) and render mode (G_RM_CUSTOM_AA_ZB_XLU_SURF) produce correct GLSL / GL state.

Use rsp/graphics/gmain.s (the real GE RSP ucode) as the ground truth for the exact command encodings.

Status

Scaffolding only. The files in src/ and fast3d/ are stubs that define the interfaces and mark the work to be done. The actual implementation is brought in phase by phase (see docs/internals.md §8), largely by adapting the PD port's port/ layer.