Skip to content

About

General-purpose Xbox Series X|S (GDK) compatibility layer with a native Metal backend for Apple Silicon macOS

Resources

Contributing

Stars

226 stars

Watchers

4 watching

Forks

Repository files navigation

MacBox GDK

Clean-room Xbox Series X|S (GDK) compatibility layer for Apple Silicon Macs and Windows. Combines a PE32+ loader, console runtime libraries (xgameruntime, d3d12_xs, dstorage, GameInput, XMem, XAudio2/XMA), an RDNA2-to-DXIL shader recompiler, and a native Apple Metal backend (MACBOX_GPU=metal).

User-supplied, unencrypted executables only. This repository contains no game files, keys, screenshots, title-specific patches, or DRM bypasses.

Quick Start (macOS Apple Silicon)

Requires an Apple Silicon Mac on macOS 15+ with Rosetta 2 (softwareupdate --install-rosetta), Xcode Command Line Tools, Homebrew, and Apple's Game Porting Toolkit (provides D3DMetal.framework and libmetalirconverter.dylib).

1. Build the runtime and toolchain

GPTK_DMG=/path/to/Game_Porting_Toolkit.dmg ./setup.sh

Installs Rust (x86_64-pc-windows-gnullvm), builds patched x86_64 CrossOver Wine, extracts D3DMetal.framework / libmetalirconverter.dylib (auto-detected from ~/Downloads if GPTK_DMG is omitted), compiles the native Metal bridge (target/metal), and builds gdk-run.exe.

2. Run a title

Always launch through tools/macos/run.sh rather than invoking gdk-run.exe directly. run.sh sets the full verified Apple Silicon configuration (MACBOX_GPU=metal, WINEMSYNC=1, Series S profile, MetalFX temporal upscaling, wave64-to-SIMD32 compute compatibility switches, write-watch tracking, and tuned DirectStorage workers) and converts POSIX paths to Wine Z:\ paths. Running gdk-run.exe manually without those switches often causes visual artifacts, missing UI overlays, or poor frame pacing.

tools/macos/run.sh run --execute /path/to/your/title/executable.exe

Keep title packages, caches, and save data outside this repository (the runtime rejects paths inside the source tree). The first launch compiles shaders and populates the on-disk DXIL and Metal binary archive caches, so frame times settle once the cache is warm.

Useful overrides (prefix the command above):

# Store caches and saves in custom directories
MACBOX_CACHE_DIR=/path/to/cache \
MACBOX_DATA_DIR=/path/to/saves \
MACBOX_METAL_CACHE=/path/to/metal-cache \
  tools/macos/run.sh run --execute /path/to/your/title/executable.exe

# Common tuning / debug switches
MACBOX_METAL_FPS_OVERLAY=0               # hide the FPS overlay
MACBOX_WINDOW_MAX=1280x720               # cap window size
MACBOX_FIDELITYFX_METALFX=spatial        # temporal (default), spatial, or bilinear
MACBOX_LOG=info MACBOX_METAL_STATS=1     # print per-frame GPU/CPU/memory stats

Add --console series-x after the executable path to report Series X instead of the default Series S profile (Series S is recommended for lower memory and GPU load). See docs/macos.md for the full list of switches and keyboard/controller mappings.

Testing

cargo test --workspace        # host unit tests
cargo xtask policy            # clean-room asset and compliance checks
tools/macos/test-metal.sh     # 83 synthetic Metal GPU tests under Wine

Changelog

2026-12-02

  • 67beea2 — Isolated MetalFX temporal/spatial encoding in dedicated retained command buffers with synchronous initialization, input usage checks, and transient MTLCompilerService XPC retries (66/66 Metal tests).
  • f816a81 — Defaulted MACBOX_FAULT_TRACKING off below macOS 27 in tools/macos/run.sh and fixed docs/macos.md env documentation.
  • 6ec2754 — Refreshed tools/macos/patches/wineserver-view-tree.patch against CrossOver 26.3.0 so ./setup.sh applies cleanly.
  • 9aae538 — Aligned tools/macos/run.sh defaults (WINEMSYNC=1, MACBOX_DSTORAGE_WORKERS=6, MACBOX_SCREEN_PASS_WAIT=15, MACBOX_PRESENT_COMPOSITE=1).
  • 60c3ac4 — Cut streaming write-watch, texture upload, descriptor-heap sync, and segment-resolution CPU overhead (MACBOX_HOT_OPEN=4 Metal default, frame-windowed take_many streaks, PAGE_SCRATCH direct-reservation hashing, WRAPS-backed descriptor sync, REMOVED_RING/GROW_RING validation, MACBOX_METAL_STATS=1 CPU breakdown; 65/65 Metal tests).
  • 6a23247 — Defaulted MACBOX_UAV_SIZE_LEVEL0 and MACBOX_CODE_TABLE_LOADS on native Metal.

2026-12-01

  • 7a267fd — Cut moving memory footprint, lock contention, and compile stalls (console-RAM-bounded texture eviction, lock-light wrapping, coalesced physical spans, WrapCacheGuard, live compute/graphics pipeline wait budgets; 64/64 Metal tests).
  • f1bae74 — Added native MetalFX temporal upscaling (MTLFXTemporalScaler), RGB9E5 packing, linear aspect-preserving presentation, and exact client-ratio window sizing.
  • bf16169 — Enabled pipeline-ordered concurrent Metal compute (MACBOX_METAL_SERIAL_COMPUTE=pipeline) and MACBOX_METAL_FAST_IR=1 (60/60 Metal tests).
  • 25076a8 — Sized Metal texture eviction to host working set and reduced write-watch contention.
  • 42d0a52 — Translated AMD clzero clear loops on non-CLZERO / Rosetta hosts.
  • 3dbfac8 — Enabled generic shader clarity and compute defaults in tools/macos/run.sh.
  • 4a83a22 / ca7d552 — Added GitHub Actions CI (policy, host tests, Windows non-GPU tests, Clippy correctness).
  • 414e2db — Bundled BCPack format constant tables by default.
  • 1c39214 — Streamlined the native Metal macOS launcher, setup script, and docs (59/59 Metal tests).
  • f59bbea — Initial clean-room MacBox GDK repository with native Metal backend (58/58 Metal tests).

Roadmap

  • Cut remaining CPU time spent scanning and mirroring large shader-visible descriptor heaps during heavy multi-zone streaming.
  • Cap long-session Metal texture/heap/staging allocations so extended runs stay flat on unified memory.
  • Expand exact wave64-to-SIMD32 cross-half LDS/UAV ordering (MACBOX_HALVES_ORDER, MACBOX_HALVES_LDS_ORDER, MACBOX_HALVES_ACROSS) with minimal barrier cost.
  • Reduce per-frame gpu_ms through tighter encoder batching, IR lowering cleanup, and redundant barrier elimination.
  • Grow synthetic test coverage in tests/fixtures/hle-probe and tools/macos/test-metal.sh.

Docs & Contributing

Bug reports and PRs are welcome on GitHub. Include your Apple Silicon model, commit hash, exact command, and relevant MACBOX_LOG=info / MACBOX_METAL_STATS=1 output — keep everything clean-room (no proprietary binaries, assets, screenshots, or hashes).

License

Declared GPL-3.0-or-later; see LICENSE and docs/provenance.md.

About

General-purpose Xbox Series X|S (GDK) compatibility layer with a native Metal backend for Apple Silicon macOS

Resources

Contributing

Stars

226 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages