Skip to the content.

How the port works

The pieces

  1. The game: summers-aaron/halo-3 is a decompilation of Halo 3 for the Xbox 360, rebuilt as C++ with a PC port layer: a Xenos (Xbox 360 GPU) emulation layer on top of Vulkan or Direct3D 12, its own D3D9-style device, audio and input. Its shaders are the game’s original Xbox 360 microcode, translated ahead of time into a shader pack.
  2. ARM64 Linux: tools/patch_arm64.py changes the upstream tree so it builds and runs as an AArch64 Linux program against glibc 2.31, the oldest C library among the H700 firmware. It covers:
    • PowerPC memory barriers (lwsync, eieio) as ARM dmb ish;
    • the Microsoft x64 calling convention, used by the port layer, on ARM;
    • a low-4 GB allocator for the game’s 32-bit pointers that works on the handheld’s 4.9 kernel;
    • NEON in place of the port layer’s SSE code;
    • the handheld detail switches (render tier, detail scale, motion blur, particles);
    • fixes for crashes found along the way.
  3. OpenGL ES 3.2: the H700’s Mali driver (Arm’s r20p0 blob) has no Vulkan entry points, so src/gles_backend.cpp is a third backend behind the upstream renderer’s backend interface (gpu_backend.h), beside Vulkan and Direct3D
    1. The Xenos layer above it is unchanged: EDRAM emulation, resolves, the texture cache, constant blocks, vertex fetch.
  4. Shaders: tools/patch_gles_shaders.py adds a GLSL ES emitter to the upstream shader translator. Every Xbox 360 shader becomes a GLSL ES 3.20 module in a pack. On the handheld the backend links them into programs and keeps the Mali’s program binaries in a cache, so each program is compiled once. A program list records what a level needs, and a warm-up compiles it before play.

What makes it fast enough (so far)

Tools

The game data, the translated shader pack and the program cache are not in this repository.