From 309bfbedfc1296922beeb26eb652c8a508c8e207 Mon Sep 17 00:00:00 2001 From: BearddOddity Date: Wed, 21 Oct 2026 04:59:55 -0500 Subject: [PATCH] docs: list every RECOMP_* switch in one page, and link it from the index docs/INDEX.md stays the one index. Every page gets one navigation line under its title that points back to it, and runtime/ gets a reference page for the environment variables. docs/runtime/environment-variables.md lists every RECOMP_* switch the runtime and tools read: its default, its effect and the source file that reads it, grouped as bring-up, kernel, pushbuffer executor, video, audio and input. Fifty-one of them were not in the docs at all. docs/INDEX.md links it from "Start Here". No page is renamed, moved or rewritten, and no other index is added. Checked: every RECOMP_* name read by getenv, env_on, apu_env_on, env_int or xa2_env_int in src/, tools/, templates/ and include/ is on the page, and every name on the page is in the source. All relative links in docs/ resolve (0 broken, as at v0.16.0). The 34 existing pages change by insertion only: 68 lines added, none removed. docs/INDEX.md gains one line. Co-Authored-By: Claude Sonnet 5.5 --- docs/DECOMP.md | 2 + docs/GETTING_STARTED.md | 2 + docs/INDEX.md | 1 + docs/formats/disc-image.md | 2 + docs/formats/kernel-exports.md | 2 + docs/formats/xbe.md | 2 + docs/pipeline/01-xbe-parsing.md | 2 + docs/pipeline/02-disassembly.md | 2 + docs/pipeline/03-function-id.md | 2 + docs/pipeline/04-lifting.md | 2 + docs/pipeline/05-runtime.md | 2 + docs/pipeline/06-debugging.md | 2 + docs/runtime/README.md | 2 + docs/runtime/environment-variables.md | 163 +++++++++++++++++++ docs/technical/burnout3-reunification.md | 2 + docs/technical/candidate-games.md | 2 + docs/technical/conformance-testing.md | 2 + docs/technical/d3d-translation.md | 2 + docs/technical/d3d8ltcg-device-context.md | 2 + docs/technical/function-coalescence.md | 2 + docs/technical/gap-analysis.md | 2 + docs/technical/indirect-calls.md | 2 + docs/technical/kernel-replacement.md | 2 + docs/technical/lessons-learned.md | 2 + docs/technical/memory-layout.md | 2 + docs/technical/ms-fusion-adoption-plan.md | 2 + docs/technical/ms-fusion-codegen-teardown.md | 2 + docs/technical/ms-fusion-corpus.md | 2 + docs/technical/ms-fusion-recompiler.md | 2 + docs/technical/nv2a-shaders.md | 2 + docs/technical/pushbuffer-executor.md | 2 + docs/technical/register-model.md | 2 + docs/technical/rtti-recovery.md | 2 + docs/technical/seh-handling.md | 2 + docs/technical/svod-extraction.md | 2 + docs/technical/xemu-debugging.md | 2 + 36 files changed, 232 insertions(+) create mode 100644 docs/runtime/environment-variables.md diff --git a/docs/DECOMP.md b/docs/DECOMP.md index 8bd76419..4464068f 100644 --- a/docs/DECOMP.md +++ b/docs/DECOMP.md @@ -1,5 +1,7 @@ # Using xboxrecomp for Decompilation +> Part of the [Documentation Index](INDEX.md) + This is a different job from the rest of the toolkit. [GETTING_STARTED.md](GETTING_STARTED.md) is about turning an Xbox binary into a native `.exe` that runs. This is about splitting one into per-function assembly you can decompile by hand, matching the diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index a2b4e470..3a486862 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -1,5 +1,7 @@ # Getting Started with Xbox Static Recompilation +> Part of the [Documentation Index](INDEX.md) + This guide walks you through recompiling your first Xbox game, from extracting the XBE to getting the game running on Windows. ## What You Need diff --git a/docs/INDEX.md b/docs/INDEX.md index f63e9442..aa75413a 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -11,6 +11,7 @@ stuck in. - [Getting Started](GETTING_STARTED.md) — End-to-end walkthrough from XBE to a running title - [Decompilation Guide](DECOMP.md) — Using the toolkit as a function splitter instead: one byte-exact `.s` per function, with signatures and the call graph - [Runtime Implementation Guide](runtime/README.md) — The four pillars every title needs: memory layout, kernel, graphics, input +- [Environment Variables](runtime/environment-variables.md) — Every `RECOMP_*` switch: default, effect, and the source file that reads it - [Contributing](../CONTRIBUTING.md) — Setup, where to focus, code style, how to submit ## Pipeline Guides diff --git a/docs/formats/disc-image.md b/docs/formats/disc-image.md index 22c16107..25326ca1 100644 --- a/docs/formats/disc-image.md +++ b/docs/formats/disc-image.md @@ -1,5 +1,7 @@ # Xbox Disc Images +> Part of the [Documentation Index](../INDEX.md) + This document covers the Xbox disc image formats and how to extract game files for use with the recompilation toolkit. ## XISO Format diff --git a/docs/formats/kernel-exports.md b/docs/formats/kernel-exports.md index 12e8a2bb..abdd7fcd 100644 --- a/docs/formats/kernel-exports.md +++ b/docs/formats/kernel-exports.md @@ -1,5 +1,7 @@ # Xbox Kernel Exports +> Part of the [Documentation Index](../INDEX.md) + The Xbox kernel (`xboxkrnl.exe`) exports up to 366 functions and data objects. Games import a subset of these via the kernel thunk table in the XBE header. This document covers the most commonly imported exports (~147 that a typical game uses), organized by category. Each entry shows: **ordinal**, function prototype, description, and suggested Win32 replacement. diff --git a/docs/formats/xbe.md b/docs/formats/xbe.md index 112361b5..f5c8a017 100644 --- a/docs/formats/xbe.md +++ b/docs/formats/xbe.md @@ -1,5 +1,7 @@ # XBE File Format Reference +> Part of the [Documentation Index](../INDEX.md) + The XBE (Xbox Executable) format is the native executable format for the original Microsoft Xbox console. It is analogous to Windows PE (Portable Executable) but with Xbox-specific extensions for kernel thunks, digital signatures, and section management. Reference: https://xboxdevwiki.net/Xbe diff --git a/docs/pipeline/01-xbe-parsing.md b/docs/pipeline/01-xbe-parsing.md index 2d81d3c7..79f368f0 100644 --- a/docs/pipeline/01-xbe-parsing.md +++ b/docs/pipeline/01-xbe-parsing.md @@ -1,5 +1,7 @@ # Step 1: Extracting and Parsing XBE Files +> Part of the [Documentation Index](../INDEX.md) + ## What is an XBE File? An XBE (Xbox Executable) is the native executable format for the original Microsoft Xbox (2001). It is analogous to PE (Portable Executable) on Windows or ELF on Linux. Every game shipped as a disc image containing one or more XBE files, with `default.xbe` being the primary game executable. diff --git a/docs/pipeline/02-disassembly.md b/docs/pipeline/02-disassembly.md index 03263b73..ed1526ed 100644 --- a/docs/pipeline/02-disassembly.md +++ b/docs/pipeline/02-disassembly.md @@ -1,5 +1,7 @@ # Step 2: Disassembly and Function Detection +> Part of the [Documentation Index](../INDEX.md) + ## Why a Custom Disassembler? Tools like IDA Pro and Ghidra are excellent for interactive reverse engineering, but they are not designed for pipeline automation. The static recompiler needs structured, machine-readable output -- JSON files containing every function boundary, every cross-reference, and every string location. This output feeds directly into the lifter (Step 4) which translates x86 instructions to C code. diff --git a/docs/pipeline/03-function-id.md b/docs/pipeline/03-function-id.md index 1b7887d9..183d7b89 100644 --- a/docs/pipeline/03-function-id.md +++ b/docs/pipeline/03-function-id.md @@ -1,5 +1,7 @@ # Step 3: Function Identification +> Part of the [Documentation Index](../INDEX.md) + ## Why Identify Functions? A typical Xbox game produces tens of thousands of recompiled functions. Burnout 3 has 22,095 functions in its .text section -- a mix of game code, C runtime (CRT), RenderWare engine, and XDK library code all baked together with no clear boundaries. diff --git a/docs/pipeline/04-lifting.md b/docs/pipeline/04-lifting.md index 2ee17beb..3159723f 100644 --- a/docs/pipeline/04-lifting.md +++ b/docs/pipeline/04-lifting.md @@ -1,5 +1,7 @@ # Step 4: x86 to C Lifting +> Part of the [Documentation Index](../INDEX.md) + ## Overview This is the core of the static recompiler. The lifter takes each x86 instruction from the disassembly output and translates it to equivalent C code. The result is a massive C codebase that, when compiled with a native compiler (MSVC or GCC), produces a Windows executable that behaves identically to the original Xbox code. diff --git a/docs/pipeline/05-runtime.md b/docs/pipeline/05-runtime.md index 74d6830d..cd7a9df7 100644 --- a/docs/pipeline/05-runtime.md +++ b/docs/pipeline/05-runtime.md @@ -1,5 +1,7 @@ # Step 5: Building the Runtime +> Part of the [Documentation Index](../INDEX.md) + ## Overview The lifted C code from Step 4 is just one piece of the puzzle. It expects to run in an environment that mimics the original Xbox: memory at specific addresses, kernel functions available for calling, a D3D8 graphics device, and input from Xbox controllers. The runtime provides all of this. diff --git a/docs/pipeline/06-debugging.md b/docs/pipeline/06-debugging.md index 3dba2d48..7ff0317f 100644 --- a/docs/pipeline/06-debugging.md +++ b/docs/pipeline/06-debugging.md @@ -1,5 +1,7 @@ # Step 6: Iterative Debugging +> Part of the [Documentation Index](../INDEX.md) + ## The Reality The game will crash. Constantly. The first boot attempt will fail within milliseconds. You will fix one crash, and the next instruction will crash differently. This is normal and expected. diff --git a/docs/runtime/README.md b/docs/runtime/README.md index 636c9697..64335524 100644 --- a/docs/runtime/README.md +++ b/docs/runtime/README.md @@ -1,5 +1,7 @@ # Runtime Implementation Guide +> Part of the [Documentation Index](../INDEX.md) + 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 diff --git a/docs/runtime/environment-variables.md b/docs/runtime/environment-variables.md new file mode 100644 index 00000000..b6891895 --- /dev/null +++ b/docs/runtime/environment-variables.md @@ -0,0 +1,163 @@ +# Environment Variables + +> Every `RECOMP_*` switch the runtime and tools read, what it does, and what it defaults to. +> +> **Read this when:** a title needs a bring-up switch, a log is asking you to set one, or you want to know what a variable you found in a script does. +> +> Part of the [Documentation Index](../INDEX.md) + +Almost everything here is **off by default**. A switch that changes behaviour is a per-title opt-in: set it for the title that needs it and leave it unset for the rest, so one title's fix never moves another's output. Debug switches only print or dump; they never change what the title does. + +How to read the tables: + +- **Default** is what happens with the variable unset. "off" means the variable has to be present (or non-zero, where the entry says so). "on" means it is active until you set `0`. +- **Where** is the source file that reads it, so the code is one search away. +- Values are text. A flag is "set" when the variable exists, unless the entry says `1` or non-zero is required. + +## Bring-up and diagnostics + +Start here when a title does not run. See [Step 6: Iterative Debugging](../pipeline/06-debugging.md) for the workflow these belong to. + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_WATCHDOG_SECS=N` | off | Dumps registers, PUT/GET and the guest stack when the title stops making progress for N seconds. | `xbox_memory_layout.c` | +| `RECOMP_WATCH=` | off | Names the guest code that writes a value at an address (a callback slot, a "ready" flag). Wrap the address in `[` `]` to watch the word it points to. | `xbox_memory_layout.c` | +| `RECOMP_WATCH_LEN` | off | Length in bytes of the watched range. | `xbox_memory_layout.c` | +| `RECOMP_WATCH_DEPTH` | 14 | Frames printed per watch hit; identical consecutive return addresses are folded. | `xbox_memory_layout.c` | +| `RECOMP_WATCH_RAW` | off | Also prints the raw stack frame, to see which object the writer was working on. | `xbox_memory_layout.c` | +| `RECOMP_KERNEL_WATCH=` | off | Reports a guest address whenever a kernel bridge call changes it. | `kernel_bridge.c` | +| `RECOMP_KERNEL_WATCH_ALL` | off | With the above: prints every sample, so a value that was already wrong at the first call shows. | `kernel_bridge.c` | +| `RECOMP_KERNEL_LOG_BUDGET=N` | 200 | Number of kernel-call log lines kept before the log goes quiet. | `kernel_bridge.c` | +| `RECOMP_IRQL_TRACE` | off | Prints the first IRQL transitions; a lower from a level the raise did not set is a calling-convention bug. | `kernel_hal.c` | +| `RECOMP_UNIMPL_TRAP=1` | off | Stops at the first untranslated instruction that is actually reached, instead of logging it. | `templates/new-game/src/recomp_manual.c` | +| `RECOMP_STUB_LOG=1` | off | Prints each unresolved stub the first time it runs, with return address and `esp`. Read by the generated stubs file. | `tools/recomp/translator.py` | +| `RECOMP_TRACE_BUDGET=N` | 400000 | Lines of the call trace kept; a larger file is better than a hole. | `recomp_trace.c` | +| `RECOMP_TRACE_PROFILE=N` | 20000000 | Prints the call profile every N calls (and at exit). | `recomp_trace.c` | +| `RECOMP_TRACE_ARGS=N` | off | Adds N stack arguments to each trace line. | `recomp_trace.c` | +| `RECOMP_TRACE_DEREF` | off | Follows pointer arguments one level in the trace. | `recomp_trace.c` | +| `RECOMP_CS_TRACE_CRT[=all]` | off | Traces critical-section activity (CRT sections only, or all). | `kernel_rtl.c` | +| `RECOMP_CS_WATCH=` | off | Traces one critical section by address. | `kernel_rtl.c` | +| `RECOMP_POKE=va[:val][,...]` | off | Holds guest globals at a value. A bring-up probe, not a fix. | `xbox_memory_layout.c` | +| `RECOMP_PEEK=[,...]` | off | Prints guest words at each report, both as a number and as a pointer. | `nv2a_pb_exec.c` | +| `RECOMP_PEEK_CHAIN` | off | Follows a pointer chain level by level and says where a null breaks it. | `nv2a_pb_exec.c` | +| `RECOMP_TRAP_NULL` | off | Protects the null page so a null dereference faults. | `xbox_memory_layout.c` | +| `RECOMP_FORCE_RETURN` | off | Turns on the early return of functions generated with `--force-return`; without it they behave normally. | `xbox_memory_layout.c` | +| `RECOMP_MISSING_FILES` | list | `0` turns the missing-file report off, `all` lists every miss, otherwise the default report. | `kernel_missing.c` | +| `RECOMP_MISSING_FILES_LIST=` | off | Writes the missing-file list to that path on exit. | `kernel_missing.c` | +| `RECOMP_CMDLINE=` | off | Command line handed to the title, as a launcher would (`+map intro`). | `kernel_bridge.c` | + +## Memory and kernel + +Opt-ins that change how the kernel layer behaves. Each fixes a class of titles; none is a default. See [Xbox Kernel Replacement](../technical/kernel-replacement.md) and [Memory Layout Reproduction](../technical/memory-layout.md). + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_SAVE_DIR=` | off | Root for the title's `UDATA`, `TDATA` and cache folders; created if missing. Absolute. Saves left in the game folder are then not used. | `kernel_path.c` | +| `RECOMP_HEAP_RECLAIM` | off | Gives freed guest heap back. | `xbox_memory_layout.c` | +| `RECOMP_EXT_VMA` | off | Extended virtual-memory areas above the mirrors. | `guest_vmem.c`, `xbox_memory_layout.c` | +| `RECOMP_CONTIG_AVOID_IMAGE=1` | off | Keeps contiguous allocations out of the image range. | `xbox_memory_layout.c` | +| `RECOMP_WIN_PLACEHOLDER` | off | Reserves the guest window with placeholders on Windows hosts where fixed bases are taken. | `xbox_memory_layout.c` | +| `RECOMP_TITLE_KEVENTS=1` | off | Host events for events a title builds inline instead of through `KeInitializeEvent`. | `kernel_bridge.c` | +| `RECOMP_GUEST_LOCK=1` | off | Only one guest thread runs guest code at a time. | `kernel_guest_cpu.c` | +| `RECOMP_GUEST_QUANTUM=ms` | 4 | With the lock: milliseconds before the lock is handed over (0 = at every call). | `kernel_guest_cpu.c` | +| `RECOMP_GUEST_CPU_TRACE[=ms]` | off | With the lock: periodic trace of who holds it. | `kernel_guest_cpu.c` | +| `RECOMP_GUEST_CPUS` | all | `all`, or a core number: pin the title's threads to one core. | `kernel_thread.c` | +| `RECOMP_CS_MODE=single` | per-section | Backs every critical section with one host lock. | `kernel_rtl.c` | +| `RECOMP_WORKERS` | off | Runs requests of the title's worker threads inline. A bisecting tool for concurrency bugs. | `kernel_bridge.c` | +| `RECOMP_ASYNC_IO` | off | Reports a read on an asynchronous handle as still in flight. The data is read synchronously either way. | `kernel_bridge.c` | +| `RECOMP_DISPATCH_GATE=1` | off | The one-CPU gate: guest code runs only at safe points while interrupts are delivered. | `kernel_hal.c` | +| `RECOMP_IRQ_SAFE_POINTS` | on with the gate | `0` disables safe-point delivery under the gate. | `kernel_hal.c` | +| `RECOMP_IRQ_SAFE_FORCE` | off | Forces delivery at a safe point. | `kernel_hal.c` | +| `RECOMP_IRQ_SAFE_MS=N` | 250 | Milliseconds the gate waits for a safe point. | `kernel_hal.c` | +| `RECOMP_DPC_ON_RAISE` | on with the gate | `0` stops DPCs running when IRQL is raised. | `kernel_hal.c` | +| `RECOMP_CPUID_NO_SIMD` | off | Hides SIMD from `cpuid`. | `kernel_hal.c` | +| `RECOMP_AC97_READY=1` | off | Reports the AC'97 codec ready and routes the APU aperture to the emulated APU. | `xbox_memory_layout.c`, `templates/new-game/src/main.c` | +| `RECOMP_DSP_ACK=va[,...]` | off | Guest addresses to acknowledge as the DSP's doorbell. | `xbox_memory_layout.c` | + +## Graphics: pushbuffer executor + +The executor is itself opt-in: set `RECOMP_PB_EXEC=1` to execute the pushbuffer. See [Pushbuffer Executor](../technical/pushbuffer-executor.md). + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_PB_EXEC` | off | Executes the title's pushbuffer. | `nv2a_pb_scan.c`, `xbox_memory_layout.c` | +| `RECOMP_PB_SCAN` | off | Read-only survey of the pushbuffer; ranks what is not implemented. | `nv2a_pb_scan.c`, `xbox_memory_layout.c` | +| `RECOMP_PB_WALK=dma` | off | Walks the pushbuffer as the DMA engine does, which delivers D3D's software-method interrupt. | `nv2a_pb_scan.c` | +| `RECOMP_NV2A_TRACE` | off | Shows whether `DMA_PUT` moves at all. | `xbox_memory_layout.c` | +| `RECOMP_PB_REPORT_MS=N` | 10000 | Milliseconds between `[GPU]` reports (minimum 100). | `xbox_memory_layout.c` | +| `RECOMP_PB_EXEC_VERBOSE` | off | Per-batch trace. | `nv2a_pb_exec.c` | +| `RECOMP_PB_UNHANDLED_ALL` | top 10 | Lists every method the executor does not model, not only the top ten. | `nv2a_pb_exec.c` | +| `RECOMP_VBLANK[=paced]` | no vblanks | Raises vblanks: a ~50 Hz tick, or `paced` for the 60 Hz schedule. | `kernel_bridge.c` | +| `RECOMP_FLIP_PACING[=edge]` | off | Holds each flip to the vblank count. | `nv2a_pb_exec.c` | +| `RECOMP_FFP_FLIP_NORMALS` | off | Lights the side of a fixed-function mesh that faces the viewer. Not hardware behaviour. | `nv2a_pb_exec.c` | +| `RECOMP_CLIP_NEAR_Z` | on | `0` turns off the near-plane clip. | `nv2a_pb_exec.c` | +| `RECOMP_SWIZZLED_RT` | on | `0` stops rendering into swizzled render targets. | `nv2a_pb_exec.c` | +| `RECOMP_NO_COMBINERS` | off | Skips the register combiners. | `nv2a_pb_exec.c` | +| `RECOMP_NO_VSH` | off | Skips vertex programs. | `nv2a_pb_exec.c` | +| `RECOMP_RASTER_THREADS=N` | auto | Worker threads for the software rasteriser. | `nv2a_pb_exec.c` | +| `RECOMP_RASTER_TEST` | off | Bring-up aid: draws a magenta triangle after every clear, to prove the rasteriser and presenter work. | `nv2a_pb_exec.c` | +| `RECOMP_FFP_TRACE` | off | Matrix and first vertices of the first fixed-function batches. | `nv2a_pb_exec.c` | +| `RECOMP_VSH_TRACE=N` | 0 | Prints N vertex-program batches. | `nv2a_pb_exec.c` | +| `RECOMP_VSH_DUMP` | off | Vertex-program constant traffic. | `nv2a_vsh_interp.c` | +| `RECOMP_FRAME_TRACE` | off | Traces one frame in detail. | `nv2a_pb_exec.c` | +| `RECOMP_FRAME_TRACE_METHODS` | off | With the above: every method of the traced frame, less the bulk uploads. | `nv2a_pb_exec.c` | +| `RECOMP_TEX_STATE` | off | Texture state per report. | `nv2a_pb_exec.c` | +| `RECOMP_TEX_DUMP=` | off | Writes each distinct texture as a BMP, first use only. | `nv2a_pb_exec.c` | +| `RECOMP_TEX_DUMP_EVERY=N` | 0 | Dumps every Nth texture bind instead. | `nv2a_pb_exec.c` | +| `RECOMP_FB_DUMP=` | off | Writes the draw surface as a BMP at each report. | `nv2a_pb_exec.c`, `fb_present.c` | +| `RECOMP_FB_DUMP_FLIPS` | off | `1` dumps every flip; any other value names a file whose existence turns dumping on. | `nv2a_pb_exec.c` | +| `RECOMP_FIND_NAN` | off | Scans for NaN matrices at every report. | `nv2a_pb_exec.c` | +| `RECOMP_FIND_QUAD` | off | Scans once for quad vertices. | `nv2a_pb_exec.c` | + +## Video output + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_FB_WINDOW` | off | Opens a window showing the frame buffer. | `fb_present.c`, `fb_present_sdl.c` | +| `RECOMP_FB_VA=` | follows the draw surface | Pins the window to one guest address. | `fb_present.c` | +| `RECOMP_FB_WINDOW_DUMP_EVERY=N` | 0 | With `RECOMP_FB_DUMP`: dumps what the window shows every N frames. | `fb_present.c` | +| `RECOMP_WINDOW_SCALE=1..8` | 2 | Client-area scale. | `fb_present.c`, `fb_present_sdl.c` | +| `RECOMP_FULLSCREEN` | off | Starts fullscreen. | `fb_present.c` | +| `RECOMP_HEADLESS` | off | No window and a dummy audio driver. | `fb_present_sdl.c`, `apu_sdl2.c` | +| `RECOMP_CLOSE_KEEPS_RUNNING=1` | off | Closing the window only closes it instead of exiting the process. | `fb_present.c` | +| `RECOMP_D3D_PRESENT` | off | Presents through a D3D11 swap chain. | `gpu_present.c` | +| `RECOMP_PRESENT_VSYNC` | on | `0` turns vsync off. | `gpu_present.c`, `fb_present_sdl.c` | +| `RECOMP_PRESENT_FILTER` | default | Sampler filter for the D3D11 present. | `gpu_present.c` | +| `RECOMP_FMV_HOST` | off | Plays a movie through the host player when the title asks to. A substitute for the title's own output. | `kernel_bridge.c` | +| `RECOMP_FMV_DUMP=` | off | Writes two frames of a movie as BMP evidence. | `video_pump.c` | + +## Audio + +See the [APU](../../src/apu/README.md) and [DirectSound](../../src/audio/README.md) module references. + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_APU_TRACE` | off | Voice statistics and host playback accounting. | `apu_core.c`, `apu_vp.c`, `apu_mmio_hook.c` | +| `RECOMP_AUDIO_HOST` | off | Host playback accounting without the rest of the trace. | `apu_core.c` | +| `RECOMP_APU_RING` | off | Ring monitor: finds a streaming writer that falls behind the play cursor. | `apu_vp.c` | +| `RECOMP_APU_SOLO=` | off | Mutes every other voice, to find where a sound comes from. | `apu_core.c` | +| `RECOMP_APU_VOICE_DUMP=` | off | Dumps voices as raw PCM to `RECOMP_APU_VOICE_DUMP_FILE`. | `apu_vp.c` | +| `RECOMP_AUDIO_WAV=` | off | Records exactly what the device is given. | `apu_core.c` | +| `RECOMP_AUDIO_WAV_SECS=N` | unlimited | Caps the recording. | `apu_core.c` | +| `RECOMP_APU_HRTF` | on | `0` turns HRTF for 3D voices off. | `apu_vp.c` | +| `RECOMP_APU_MIXDOWN_ALL` | on | `0` limits the mixdown. | `apu_dsp.c` | +| `RECOMP_APU_DSP_ACK` | auto | DSP doorbell acknowledgement: `auto` derives it, `0`/`off` disables, or a list of addresses. | `apu_dsp.c` | +| `RECOMP_AUDIO_BUF_COUNT`, `RECOMP_AUDIO_BUF_SAMPLES` | built-in | Device buffer count and size. | `apu_sdl2.c`, `apu_xaudio2.c` | + +## Input + +See [xbox_input](../../src/input/README.md). + +| Variable | Default | What it does | Where | +|---|---|---|---| +| `RECOMP_KEYBOARD` | off | Keyboard acts as a controller. | `keyboard.c`, `usb_gamepad.c` | +| `RECOMP_MKB` | off | Keyboard-and-mouse layer; tuned by `RECOMP_MKB_SENS`, `_DZ`, `_ACC`, `_FULL`, `_INVERT_Y`, `_SWAP_STICKS` or an `RECOMP_MKB_INI` file. | `mkb_input.c` | +| `RECOMP_KEY_TRACE` | off | Prints the first 40 key-downs. | `keyboard_sdl.c`, `fb_present.c` | +| `RECOMP_INPUT_DIAG` | off | Reports whether the input chain is wired. | `usb_gamepad.c` | +| `RECOMP_RUMBLE` | on | `0` turns rumble off. | `ohci.c` | +| `RECOMP_USB` | off | Enables the USB controller model. | `ohci.c` | +| `RECOMP_USB_PADS=1..4` | 1 | Number of pads plugged. | `ohci.c` | +| `RECOMP_USB_PORT=0..3` | 2 with four ports | Root port the pad appears on. | `ohci.c` | +| `RECOMP_USB_HC`, `RECOMP_USB_NDP` | model default | Host-controller selection and port count. | `ohci.c` | +| `RECOMP_USB_TRACE`, `RECOMP_USB_STATS` | off | Controller trace; completions every 5 s. | `ohci.c` | +| `RECOMP_PAD_LIVE=`, `RECOMP_PAD_SCRIPT`, `RECOMP_PAD_PRESS` | off | Test input: a file read live, a script, or a periodic press. | `usb_gamepad.c` | diff --git a/docs/technical/burnout3-reunification.md b/docs/technical/burnout3-reunification.md index 90b33219..3127f518 100644 --- a/docs/technical/burnout3-reunification.md +++ b/docs/technical/burnout3-reunification.md @@ -1,5 +1,7 @@ # Reuniting Burnout 3 with xboxrecomp +> Part of the [Documentation Index](../INDEX.md) + Burnout 3 was the first static recompilation of an original Xbox title with no prior recompiler to lean on. The core of xboxrecomp was written while getting it to boot, then extracted into a reusable toolkit and hardened against Halo, diff --git a/docs/technical/candidate-games.md b/docs/technical/candidate-games.md index 5eeac9d1..79692bf5 100644 --- a/docs/technical/candidate-games.md +++ b/docs/technical/candidate-games.md @@ -1,5 +1,7 @@ # Candidate Games for Xbox Static Recompilation +> Part of the [Documentation Index](../INDEX.md) + This document provides guidance on selecting Xbox games as targets for the static recompilation toolkit. Games are tiered by estimated difficulty based on their technical characteristics. ## Selection Criteria diff --git a/docs/technical/conformance-testing.md b/docs/technical/conformance-testing.md index fdf8eff5..68e8cf5c 100644 --- a/docs/technical/conformance-testing.md +++ b/docs/technical/conformance-testing.md @@ -1,5 +1,7 @@ # Conformance Testing +> Part of the [Documentation Index](../INDEX.md) + The unit tests in `tools/recomp/test_lifter_*.py` compare the lifter's **output text** against an expected string. That catches a rewrite that changes the emitted form, and it catches nothing else. It cannot tell you whether the C it diff --git a/docs/technical/d3d-translation.md b/docs/technical/d3d-translation.md index af72806f..5a322ccc 100644 --- a/docs/technical/d3d-translation.md +++ b/docs/technical/d3d-translation.md @@ -1,5 +1,7 @@ # D3D8 to D3D11 Translation +> Part of the [Documentation Index](../INDEX.md) + How to bridge the Xbox's modified Direct3D 8 API to modern DirectX 11 for rendering recompiled game code. ## Overview diff --git a/docs/technical/d3d8ltcg-device-context.md b/docs/technical/d3d8ltcg-device-context.md index 39abb4c2..e4505a58 100644 --- a/docs/technical/d3d8ltcg-device-context.md +++ b/docs/technical/d3d8ltcg-device-context.md @@ -1,5 +1,7 @@ # Xbox D3D8LTCG Device Context Reference +> Part of the [Documentation Index](../INDEX.md) + ## Overview Xbox games using Criterion's RenderWare engine (and potentially other Xbox D3D8 games) use a statically-linked D3D8LTCG library that maintains a ~16KB device context structure. This document maps the critical fields needed to get recompiled D3D8LTCG gen code running. diff --git a/docs/technical/function-coalescence.md b/docs/technical/function-coalescence.md index 5a00b9c8..a9f22f92 100644 --- a/docs/technical/function-coalescence.md +++ b/docs/technical/function-coalescence.md @@ -1,5 +1,7 @@ # Recovering a function split into false entries +> Part of the [Documentation Index](../INDEX.md) + The detector can split one function at an interior branch target. Translating the pieces separately can lose a comparison before a conditional branch or turn a local loop into recursive host calls. When independent analysis has diff --git a/docs/technical/gap-analysis.md b/docs/technical/gap-analysis.md index 5ecab391..189b8739 100644 --- a/docs/technical/gap-analysis.md +++ b/docs/technical/gap-analysis.md @@ -1,5 +1,7 @@ # xboxrecomp Gap Analysis vs xemu +> Part of the [Documentation Index](../INDEX.md) + Comprehensive comparison of what xemu implements vs what xboxrecomp provides. Prioritized by impact on Blood Wake and Wreckless (both launch-era titles). diff --git a/docs/technical/indirect-calls.md b/docs/technical/indirect-calls.md index e86dddd1..ad3fe36d 100644 --- a/docs/technical/indirect-calls.md +++ b/docs/technical/indirect-calls.md @@ -1,5 +1,7 @@ # Indirect Call Dispatch +> Part of the [Documentation Index](../INDEX.md) + The hardest problem in static recompilation: resolving function pointers and vtable calls at runtime. ## What Are Indirect Calls? diff --git a/docs/technical/kernel-replacement.md b/docs/technical/kernel-replacement.md index c52ae9f9..ef187d55 100644 --- a/docs/technical/kernel-replacement.md +++ b/docs/technical/kernel-replacement.md @@ -1,5 +1,7 @@ # Xbox Kernel Replacement +> Part of the [Documentation Index](../INDEX.md) + Mapping 147 Xbox kernel imports to Windows equivalents for recompiled game code. ## How Xbox Kernel Imports Work diff --git a/docs/technical/lessons-learned.md b/docs/technical/lessons-learned.md index 197ab944..93b14918 100644 --- a/docs/technical/lessons-learned.md +++ b/docs/technical/lessons-learned.md @@ -1,5 +1,7 @@ # Lessons Learned +> Part of the [Documentation Index](../INDEX.md) + Battle-tested advice from building the first Xbox static recompilation, based on 29 sessions of development on Burnout 3: Takedown. ## Things That Worked Well diff --git a/docs/technical/memory-layout.md b/docs/technical/memory-layout.md index 5ad4906b..6c871ba9 100644 --- a/docs/technical/memory-layout.md +++ b/docs/technical/memory-layout.md @@ -1,5 +1,7 @@ # Memory Layout Reproduction +> Part of the [Documentation Index](../INDEX.md) + How to map Xbox memory at its original virtual addresses on Windows so that recompiled code with hardcoded addresses works unmodified. ## The Problem diff --git a/docs/technical/ms-fusion-adoption-plan.md b/docs/technical/ms-fusion-adoption-plan.md index ae3cf097..be3a695c 100644 --- a/docs/technical/ms-fusion-adoption-plan.md +++ b/docs/technical/ms-fusion-adoption-plan.md @@ -1,5 +1,7 @@ # Adopting the Crimson Skies Findings — Plan and Status +> Part of the [Documentation Index](../INDEX.md) + Working plan for folding everything learned from Microsoft's own recompiler into xboxrecomp. Source analysis: [ms-fusion-recompiler.md](ms-fusion-recompiler.md) and [ms-fusion-codegen-teardown.md](ms-fusion-codegen-teardown.md). diff --git a/docs/technical/ms-fusion-codegen-teardown.md b/docs/technical/ms-fusion-codegen-teardown.md index 25e3cf87..dbdd11ca 100644 --- a/docs/technical/ms-fusion-codegen-teardown.md +++ b/docs/technical/ms-fusion-codegen-teardown.md @@ -1,5 +1,7 @@ # Ficl/Fission Codegen Teardown — and What It Means For Us +> Part of the [Documentation Index](../INDEX.md) + Companion to [ms-fusion-recompiler.md](ms-fusion-recompiler.md), which covers the shipped package layout, the build pipeline, and the HLE boundary. This document is the **codegen teardown**: what the two translators actually emit, established with IDA Professional 9.1 diff --git a/docs/technical/ms-fusion-corpus.md b/docs/technical/ms-fusion-corpus.md index ebd6065d..ba9de070 100644 --- a/docs/technical/ms-fusion-corpus.md +++ b/docs/technical/ms-fusion-corpus.md @@ -1,5 +1,7 @@ # Ficl/Fission Across Four Titles — a Corpus +> Part of the [Documentation Index](../INDEX.md) + White-room analysis of **all four** Microsoft Xbox backward-compatibility packages released to date, extending the single-title teardown in [ms-fusion-recompiler.md](ms-fusion-recompiler.md) into a corpus. The point of a corpus is to separate *what the recompiler does* (constant across diff --git a/docs/technical/ms-fusion-recompiler.md b/docs/technical/ms-fusion-recompiler.md index 36d05a83..19e89109 100644 --- a/docs/technical/ms-fusion-recompiler.md +++ b/docs/technical/ms-fusion-recompiler.md @@ -1,5 +1,7 @@ # Microsoft's Own Xbox Static Recompiler (Ficl / Fission) +> Part of the [Documentation Index](../INDEX.md) + White-room analysis of a shipped Microsoft Xbox backward-compatibility package, done to compare Microsoft's production static recompiler against this project's design. diff --git a/docs/technical/nv2a-shaders.md b/docs/technical/nv2a-shaders.md index dec6fef8..8f610f66 100644 --- a/docs/technical/nv2a-shaders.md +++ b/docs/technical/nv2a-shaders.md @@ -1,5 +1,7 @@ # NV2A Shader Translation +> Part of the [Documentation Index](../INDEX.md) + Xbox games do not ship HLSL. They configure the NV2A's fixed-function combiner pipeline, or upload raw vertex-shader microcode. Both have to become something D3D11 or OpenGL will accept, and both are translated at runtime and cached. diff --git a/docs/technical/pushbuffer-executor.md b/docs/technical/pushbuffer-executor.md index dfd15aa4..fabe22e9 100644 --- a/docs/technical/pushbuffer-executor.md +++ b/docs/technical/pushbuffer-executor.md @@ -1,5 +1,7 @@ # Pushbuffer Executor +> Part of the [Documentation Index](../INDEX.md) + A title that statically links the XDK's Direct3D never calls the toolkit's D3D8 layer. It writes NV2A methods into a pushbuffer and kicks the GPU, and the only way to see its frames is to execute that pushbuffer. `RECOMP_PB_SCAN` diff --git a/docs/technical/register-model.md b/docs/technical/register-model.md index 52c8dad8..fc51ee32 100644 --- a/docs/technical/register-model.md +++ b/docs/technical/register-model.md @@ -1,5 +1,7 @@ # The Register Model +> Part of the [Documentation Index](../INDEX.md) + How global registers enable correct static recompilation of x86 Xbox code to C. ## The Problem diff --git a/docs/technical/rtti-recovery.md b/docs/technical/rtti-recovery.md index 654f6520..a0a21806 100644 --- a/docs/technical/rtti-recovery.md +++ b/docs/technical/rtti-recovery.md @@ -1,5 +1,7 @@ # MSVC RTTI Recovery +> Part of the [Documentation Index](../INDEX.md) + `py -3 -m tools.rtti ` — recovers C++ class names, vtables, virtual method addresses and the inheritance graph from a title's MSVC RTTI, and emits the method addresses as `tools.disasm --seed-functions` input. diff --git a/docs/technical/seh-handling.md b/docs/technical/seh-handling.md index 0ba8225d..6f1babaf 100644 --- a/docs/technical/seh-handling.md +++ b/docs/technical/seh-handling.md @@ -1,5 +1,7 @@ # SEH and Exception Handling +> Part of the [Documentation Index](../INDEX.md) + Structured Exception Handling in statically recompiled Xbox code, and our own use of Vectored Exception Handlers. ## Background: SEH on Xbox diff --git a/docs/technical/svod-extraction.md b/docs/technical/svod-extraction.md index 55d07cf9..7afb0309 100644 --- a/docs/technical/svod-extraction.md +++ b/docs/technical/svod-extraction.md @@ -1,5 +1,7 @@ # Getting the Guest XBE Out of a BC Package (SVOD) +> Part of the [Documentation Index](../INDEX.md) + [ms-fusion-corpus.md](ms-fusion-corpus.md) §5 notes that Microsoft's byte-dense address map is a coverage oracle for our own function detection, and `tools/fusion/coverage_oracle.py` implements the grading. It takes two arguments: diff --git a/docs/technical/xemu-debugging.md b/docs/technical/xemu-debugging.md index 6882ba0d..b8cdfd2e 100644 --- a/docs/technical/xemu-debugging.md +++ b/docs/technical/xemu-debugging.md @@ -1,5 +1,7 @@ # xemu GDB Debugging for Xbox Recompilation +> Part of the [Documentation Index](../INDEX.md) + Using xemu's built-in GDB stub as a reference debugger to discover runtime game state for static recompilation projects.