Files
xboxrecomp/docs/runtime/README.md
sp00nz ef5ad3a734 Initial release: Xbox static recompilation toolkit
Complete toolchain for statically recompiling original Xbox (2001-2005) games
into native Windows executables. Includes:

- XBE parser, x86 disassembler, function identifier, and x86-to-C lifter
- 6-step pipeline documentation (parse, disassemble, identify, lift, runtime, debug)
- 8 technical deep dives (register model, memory layout, ICALLs, D3D, kernel, SEH, etc.)
- 3 Xbox format references (XBE, kernel exports, disc images)
- Runtime templates (recomp_types.h, xbox_memory.h, kernel_stubs.h)
- Candidate game analysis for future recompilation targets

Proven on Burnout 3: Takedown — 22,097 functions lifted from machine code to C.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 02:27:26 -08:00

55 lines
2.2 KiB
Markdown

# Runtime Implementation Guide
The recompiled C code needs a host environment to run. This directory documents the four major runtime subsystems you need to build for each game.
## The Four Pillars
### 1. Memory Layout (`xbox_memory.c`)
Reproduce the Xbox's 64 MB address space at the correct virtual addresses. This is the most critical piece — get it wrong and nothing else works.
See: [../technical/memory-layout.md](../technical/memory-layout.md)
Template: [../../templates/runtime/xbox_memory.h](../../templates/runtime/xbox_memory.h)
### 2. Kernel Shim (`xbox_kernel.c`)
Replace the 147 Xbox kernel imports with Win32 equivalents. Most can be stubbed (return STATUS_SUCCESS). The critical ones are memory allocation and file I/O.
See: [../technical/kernel-replacement.md](../technical/kernel-replacement.md)
Template: [../../templates/runtime/kernel_stubs.h](../../templates/runtime/kernel_stubs.h)
### 3. Graphics Translation (`d3d8_to_d3d11.c`)
The Xbox uses a modified Direct3D 8. You need a translation layer to D3D11 (or D3D12, Vulkan, etc.). This is the largest runtime component.
See: [../technical/d3d-translation.md](../technical/d3d-translation.md)
### 4. Input System (`xbox_input.c`)
Map Xbox controller input to Windows XInput. This is usually the simplest piece — Xbox controllers on Windows are nearly 1:1.
## Build System
We recommend CMake with MSVC. Structure your project as static libraries:
```
src/
├── kernel/ → xbox_kernel.lib
├── d3d/ → d3d_translation.lib
├── audio/ → audio_stubs.lib
├── input/ → input_layer.lib
└── game/ → your_game.exe (links all the above + recompiled code)
```
## Game-Specific Components
Beyond the four pillars, each game needs:
- **Manual function overrides** — hand-written replacements for functions that don't work when mechanically translated (physics, rendering orchestrators, hardware-specific code)
- **Asset loaders** — each game/engine has its own file formats for textures, models, levels, audio, etc.
- **Game-specific workarounds** — vtable guards for corrupted pointers, state machine patches, etc.
These go in the game-specific repo, not in the generic xboxrecomp toolkit.