Signed-off-by: Bartosz Szczepański <bartosz.szczepanski@hotmail.com>
BetterXen
An Xbox Series (Scarlett) compatibility layer for Apple Silicon Macs, built on CrossOver, Rosetta 2 and D3DMetal 3.0.
Important
Experimental. The goal is one project-authorized target build, fully playable on Apple Silicon Macs with 16 GB of memory. Today that build boots, reaches its frame loop and its first menus, and translates its own shaders at run time, but it shows almost no picture yet. CrossOver, Rosetta 2 and D3DMetal are installed separately and are never bundled or redistributed.
Where it stands
As of 2026-11-30, on main. The live status is on the pinned issue labelled ladder.
The current stage is Picture: the target build should show its first non-black screen, correctly.
| State | |
|---|---|
| Boot | The target build starts, creates its Xbox-layout D3D12 device, loads through DirectStorage, and presents frames. |
| Menus reached | With scripted input it goes through its first-run setup screens. A hang watchdog in the build still ends most runs after a few minutes (#722). |
| Shaders | The build ships console (RDNA 2) code only. BetterXen's own translator turns a vertex/pixel pair into HLSL when a pipeline is first drawn; the result is compiled and cached on disk. Every vertex/pixel pipeline the build draws with in its first two minutes translates and runs. Opt-in: BX_CONSOLE_SHADERS=1. |
| Picture | Only the menu's background bars appear, in a few frames. The rest is open work: #744 (why only the bars), #745 (texture contents), #746 (compute shaders). |
| Translator coverage | 1,538 of 4,331 vertex and pixel shaders in one member's dump of the build translate offline (35.5%). That means "produces HLSL that compiles", not "verified against the console". |
| Sound, saves, gameplay, performance | Not started as stages. Audio and save shims answer the build's calls so that it runs; nothing is audible. |
Without BX_CONSOLE_SHADERS=1 the window stays black: pipelines with console shaders are refused and their draws are skipped.
Stages
From the Boot stage on, progress is measured by how far the target build gets in repeated, recorded runs, not by subsystems. Each stage has one exit gate: ten runs out of ten on a 16 GB Mac.
flowchart LR
F["Foundation\nM0–M2, synthetic"]:::done
B["Boot"]:::done
P["Picture\n(current)"]:::active
M["Menus"]:::planned
W["World"]:::planned
Fi["Fidelity"]:::planned
Pl["Playable"]:::planned
F --> B --> P --> M --> W --> Fi --> Pl
classDef done fill:#dafbe1,stroke:#1a7f37,color:#0f5323,stroke-width:2px
classDef active fill:#ddf4ff,stroke:#0969da,color:#0a3069,stroke-width:2px
classDef planned fill:#f6f8fa,stroke:#8c959f,color:#57606a
| Stage | The target build… | Status |
|---|---|---|
| Foundation | (synthetic tests only) repository, frozen ABI, cross-built shims, a synthetic first frame, the shader format decision | Done |
| Boot | starts, reaches its frame loop and stays there | Left on 2026-11-30 by the repository owner's decision; its ten-run gate was not run |
| Picture | shows its first non-black screen, correctly | Current |
| Menus | plays its opening sequence and menus with sound and input | Planned |
| World | loads into gameplay and keeps running | Planned |
| Fidelity | draws its 3D scenes as the console does | Planned |
| Playable | is playable start to finish on every supported Mac | Planned |
docs/roadmap.md is the single authoritative roadmap, with each gate's exact wording. docs/process/working-method.md explains how runs are made and recorded.
How it works
Rosetta 2 executes the build's x86-64 code. CrossOver/Wine provides Win32. D3DMetal 3.0 translates Direct3D 12 to Metal. BetterXen supplies what is missing between an Xbox title and that stack:
- Xbox Game OS shims (
shims/): x86-64 Windows DLLs, cross-compiled on macOS, that implement the Xbox runtime the title imports: memory, DirectStorage, the Xbox flavour of Direct3D 12, the GDK runtime, input and audio. - A shader translator (
shader-transpiler/): console shaders are AMD RDNA 2 machine code. The translator turns them into HLSL, one rule per instruction, and the Direct3D shim compiles and caches the result. - A native launcher (
launcher/):bx-clichecks the host, runs a program in an isolated CrossOver environment, and turns the shims' logs into a run report.
flowchart TD
Guest["Xbox Series title (x86-64 PE32+)"]
subgraph Shims["BetterXen shims (x86-64 DLLs, built on macOS)"]
VEH["bx_runtime_veh.dll\ninstruction traps, logging, fault diagnostics"]
XMem["xmem.dll\nvirtual and physical page mapping"]
DS["XCRDAPI.dll\nDirectStorage queues, zlib, BCPack"]
D3DX["d3d12_xs.dll\nXbox-layout D3D12 over the host's D3D12"]
XGR["xgameruntime.dll, GameInput.dll, audio DLLs"]
Bridge["bx_shader_bridge.dll (Rust)\nshader classifier and translator"]
end
subgraph GDK["From the member's own GDK, staged at run time, never shipped"]
XG["xg_xs.dll (texture layouts)\nBCPack.dll"]
DXC["dxcompiler.dll (HLSL to DXIL)"]
end
subgraph External["External foundation (installed by the user)"]
Wine["CrossOver 26.3+ / Wine"]
Rosetta["Rosetta 2"]
D3DM["D3DMetal 3.0"]
end
CLI["bx-cli (native ARM64)\nsetup, preflight, run, report"]
Guest --> Shims
D3DX -->|"console shaders, at first draw"| Bridge
Bridge -->|"HLSL"| DXC
DXC -->|"DXIL, cached on disk"| D3DX
D3DX --> D3DM
D3DX --> XG
XMem --> Wine
DS --> Wine
XGR --> Wine
VEH --> Rosetta
Wine --> Rosetta
CLI -.->|"launches, isolates, stages, reports"| External
Design decisions are recorded as ADRs in docs/adr/: the CrossOver-based direction (0005), the shader format gate (0008), Xbox-layout Direct3D objects (0009), and using the GDK's own texture libraries and compiler at run time (0010).
Repository layout
Work is split into tracks with their own directories, around one frozen abi/ contract, so several contributors and coding agents can work at once (docs/architecture/parallel-tracks.md).
| Directory | Track | Stack | Contents |
|---|---|---|---|
abi/ |
ABI gate | C headers, .def |
Cross-DLL headers and the canonical export table of every shim DLL (17 DLLs, 118 exports) |
launcher/ |
A | Rust (arm64) |
bx-cli, bx-probe (PE32+ import classifier), bx-telemetry (JSONL trace aggregator) |
shims/runtime_veh/, shims/win32_bridge/ |
A | C++20 (x86-64 PE) | bx_runtime_veh.dll (traps for instructions Rosetta 2 lacks, structured logging, fault diagnostics) and API-set forwarders (ADR 0007) |
shims/xmem/, shims/xcrdapi/ |
B | C++20 (x86-64 PE) | xmem.dll (Xbox memory APIs, physical page mapping) and XCRDAPI.dll (DirectStorage) |
shims/d3d12_xs/, shims/xg_xs/, shims/ffx_bvh_hooks/ |
C | C++20 (x86-64 PE) | The Xbox-layout Direct3D 12 layer, PresentX, console pipelines translated at first draw, title-memory resources, and the texture-layout shim |
shader-transpiler/ |
D | Rust | gfx10-translate (RDNA 2 decoder and translator to HLSL), dxbc-accc (container classifier; built for Windows as bx_shader_bridge.dll), d3dmetal-harness |
shims/xgameruntime/, shims/gameinput/, shims/audio/ |
E | C++20 (x86-64 PE) | Offline GDK runtime, GameInput.dll, and AcpHal.dll / xapu.dll / chad.dll |
tests/conformance/, docs/ |
F | C++20 (x86-64 PE), Markdown | 54 synthetic test programs, auto-discovered from test_*/CMakeLists.txt, and the documentation |
Quick start
Building and running the synthetic tests
This needs no game and no GDK:
- an Apple Silicon Mac with Rosetta 2 and CrossOver 26.3+ (licensed separately);
- Rust 1.85 or later, Python 3.11 or later;
brew install mingw-w64 cmake.
git clone https://github.com/MacosPorters/betterxen.git
cd betterxen
# 1. The native ARM64 Rust workspace (launcher and shader translator)
cargo fmt --all -- --check
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo test --locked --workspace
cargo build --locked -p bx-cli
# 2. Host readiness: Apple Silicon, Rosetta 2, CrossOver, D3DMetal, mingw-w64
target/debug/bx-cli doctor
# 3. Cross-compile the 16 C++ shim DLLs, build the Rust bx_shader_bridge.dll and the
# conformance programs; verifies every export of all 17 DLLs against abi/defs/*.def
scripts/build-shims.sh
# 4. Two synthetic tests inside CrossOver and Rosetta 2
target/debug/bx-cli run --prefix /tmp/bx-test --shims build-shims/bin --log /tmp/bx-test.jsonl --exe build-shims/bin/test_veh_clwb.exe
target/debug/bx-cli run --prefix /tmp/bx-test --shims build-shims/bin --log /tmp/bx-test.jsonl --exe build-shims/bin/test_shim_exports.exe
target/debug/bx-cli trace /tmp/bx-test.jsonl
# 5. Markdown links and repository hygiene
python3 scripts/audit/docs_hygiene.py
The graphics tests need a CrossOver bottle with D3DMetal (--bottle <name> --backend d3dmetal); in a plain prefix they skip.
Working on the project
Contributing needs three more things, and they are a hard requirement: the project-authorized target build, the GDK under the project's authorization, and the Ghidra results of the target build. They are distributed among members only. Nothing from them (files, names, hashes, paths, bytes) is ever committed or posted.
target/debug/bx-cli setup --find # finds the build, the GDK and the Ghidra results on this machine
target/debug/bx-cli preflight # must print: Ready to work.
Then point a coding agent at the repository and say "work", or follow the same steps by hand. CONTRIBUTING.md explains what you need and how work is organised; AGENTS.md (also CLAUDE.md) holds the full rules, including how one item is picked, claimed with a draft pull request, tested and proven.
bx-cli commands
| Command | Purpose |
|---|---|
bx-cli doctor |
Inspects the host: chip, memory, Rosetta 2, CrossOver, D3DMetal, mingw-w64 |
bx-cli setup [--find] |
Remembers where the target build, the GDK and the Ghidra results are on this machine, outside the repository |
bx-cli preflight |
Checks everything work needs; fails if anything is missing |
bx-cli run --exe <path> ... |
Runs a program under CrossOver with a cleared environment, the shim overrides and a JSONL log. For the target build it stages the GDK's libraries beside the shims |
bx-cli report <log.jsonl>... |
One run report per log, then a summary with blocker signatures |
bx-cli trace <log.jsonl> |
Summarises a log: unimplemented calls, trapped instructions, shader-gate decisions |
bx-cli probe <pe32+> |
Classifies a program's imports by track |
bx-cli shader <blob> |
Classifies a shader container (DXIL, legacy, or console code) |
bx-cli shader translate <vs> <ps> --out <dir> [--root <layout>] |
Translates a console vertex/pixel pair to HLSL |
bx-cli shader coverage <dir> |
Counts how many shaders in a folder translate and ranks what blocks the rest |
What is verified, and what is not
Verified by tests in this repository (synthetic programs of the project's own, on Apple Silicon with CrossOver 26.3 and Rosetta 2):
- All 17 shim DLLs build, and their export tables match
abi/defs/*.defexactly (118 exports, no extras, no MinGW runtime dependency). - 54 conformance programs cover the shims' contracts: memory mapping, DirectStorage, the Xbox-layout Direct3D objects,
PresentX, rectangle lists, console formats, the shader gate, and console pipelines translated at first draw. - The translator's output matches a reference translator on its golden pairs, and its instruction decoder matches LLVM's on its test vectors.
A conformance test shows that a shim matches the contract the project recorded. It does not show that the recorded contract is what a console does.
Observed on the target build, on members' machines (recorded in pull requests and issues, not reproducible without the build): the states in "Where it stands" above.
Not claimed:
- Nothing is verified on Xbox hardware. The project has none.
- No commercial game is supported or playable.
- Translated shaders are not checked against console output yet; most have never been drawn.
- Performance has not been measured.
Evidence classes are defined in docs/claims.toml.
Provenance and legal boundaries
Caution
BetterXen opposes piracy. The repository contains no game files, firmware, keys, DRM circumvention, GDK files or compiler outputs, and none may be added to it or to its history.
- Contracts that have no public documentation are established from the authorized GDK, from the project-authorized target build (call sites and run-time diagnostics), and from compilers run on the project's own shaders. Each implemented contract gets a synthetic conformance test.
- The GDK's own libraries (
xg_xs.dll,BCPack.dll,dxcompiler.dll) are loaded at run time from each member's GDK. They are not reimplemented, committed or shipped (ADR 0010). - See docs/legal.md, docs/licenses.md and THIRD_PARTY_NOTICES.md.
History
The earlier native-first implementation (an x86-64 interpreter and ARM64 translator, a native Metal backend and a Swift app) was retired from main by ADR 0006. It is preserved at the Git tag native-first-final.
License
BetterXen is licensed under the GNU General Public License v3 or later.
BetterXen is an independent open-source project and is not affiliated with Microsoft, Xbox, Apple, CodeWeavers, AMD or any game publisher.