Files
Sylpheed/docs/reference/xbox360-architecture.md
sim 6dcdea1cf1 docs(reference): adopt the last reference files from the project root
Three untracked files in the project root had no home in either repository:

- the Xbox 360 technical reference report (a research compilation) becomes
  docs/reference/xbox360-re-technical-reference.md, unchanged;
- XBOX360_ARCHITECTURE.md becomes docs/reference/xbox360-architecture.md,
  trimmed to its platform facts. Its format "status" sections (PAK unknown,
  mesh unknown, audio TODO) and the `just sniff` workflow predate every
  decoder in this repo and were wrong;
- generate_export_docs.py becomes tools/generate_export_docs.py, the path the
  committed xbox360-exports.* already name as their generator. It lived
  inside a Canary checkout, so it now takes --canary and --out and fails
  loudly on a tree that is not Canary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 22:19:54 +02:00

116 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- Adopted 2026-09-16 from docs/XBOX360_ARCHITECTURE.md in the project root —
early notes from before any of Sylpheed's formats were decoded. Only the
platform facts are kept; the per-format "status" sections and the old
`just sniff` workflow were out of date and are dropped. Not measured by this
project. -->
# Xbox 360 Architecture — RE Quick Reference
A condensed reference for reverse engineering Xbox 360 games. The longer
[technical reference report](xbox360-re-technical-reference.md) has the
binary-level detail. Project Sylpheed's own formats are decoded, and each has a
page under [`docs/re/`](../re/INDEX.md).
---
## CPU: IBM Xenon
| Property | Value |
|----------|-------|
| Architecture | PowerPC 2.02 (64-bit ISA, 32-bit addressing in games) |
| Cores | 3 symmetric cores × 2 SMT threads = **6 logical processors** |
| Clock | 3.2 GHz |
| Execution | In-order, dual-issue superscalar (no speculation) |
| L1 I/D cache | 32 KB each, per core |
| L2 cache | 1 MB unified, shared across all 3 cores |
| Vector registers | **VMX-128** — 128 × 128-bit VRs per thread (vs. standard AltiVec's 32) |
| Endianness | **Big-endian** |
**Key for RE:** All multi-byte integer and float values in game binaries are big-endian.
The VMX-128 extension adds dot-product instructions (`vmsum3fp128`/`vmsum4fp128`)
and D3D pack/unpack instructions absent from standard PowerPC. Their semantics are in
the [PowerPC instruction manual](../../tools/ppc-manual/README.md).
---
## GPU: Xenos (ATI R400/R500 derived)
| Property | Value |
|----------|-------|
| Clock | 500 MHz |
| Shader processors | 48 unified (3 SIMD × 16, each with 5-wide VLIW ALU) |
| Peak throughput | ~240 GFLOPS |
| On-chip memory | **10 MB eDRAM** (framebuffer, depth, MSAA — no separate VRAM) |
| System RAM | 512 MB GDDR3 shared with CPU |
| Northbridge | GPU also acts as northbridge / memory controller |
### Command Packets (PM4)
The GPU is driven by a **PM4 command ring buffer** written by the CPU. Key packet types:
| Type | Description |
|------|-------------|
| `DRAW_INDX` | Indexed draw call |
| `SET_CONSTANT` | Write shader constant registers |
| `SET_TEXTURE_CONTROL` | Texture fetch constant (address, format, tiling mode) |
| `LOAD_ALU_CONSTANT` | Load vertex shader constants |
Xenia Canary's `src/xenia/gpu/` implements a full PM4 parser — invaluable for
understanding draw calls and state management.
### Texture Tiling
Xbox 360 textures are stored **tiled** in memory, not linear; the Xenos hardware
de-tiles on fetch. Texture data read from game files must be de-tiled before it is
displayed. Tile size depends on the texture format (DXT1 = 4×4 blocks, etc.).
---
## Executable Format: XEX2
`default.xex` is the main game executable in Microsoft's **Xbox EXE (XEX2)** format.
| Offset | Field | Notes |
|--------|-------|-------|
| 0x00 | Magic | `58455832` = `XEX2` |
| 0x04 | Module flags | Security, format flags |
| 0x08 | Header data offset | Points to optional header list |
| 0x10 | Security info offset | RSA signature, image hash |
The executable contains encrypted, compressed PowerPC code. The full layout is in
[`xex2-format.md`](xex2-format.md). This project loads and disassembles it with
`crates/sylpheed-xex` and `crates/sylpheed-xexdb`.
---
## Platform File Formats
### XPR2 — Texture Container
| Offset | Field | Value |
|--------|-------|-------|
| 0x00 | Magic | `58505232` = `XPR2` |
| 0x04 | Total size | u32 BE |
| 0x08 | Header size | u32 BE — data starts at this offset |
| 0x0C | Object count | u32 BE |
Each texture object contains a D3DFORMAT, width/height/depth/mip levels, and tiled
pixel data.
### XWB / XSB — XACT Audio Banks
Wave banks (`.xwb`) and sound banks (`.xsb`) are part of Microsoft's **XACT audio
system**. Audio data is encoded as **XMA** (Xbox Media Audio), a proprietary
Microsoft codec based on WMA Pro.
---
## Useful External References
- [xboxdevwiki.net](https://xboxdevwiki.net) — Community Xbox 360 hardware documentation
- [Xenia Canary source](https://github.com/xenia-canary/xenia-canary) — GPU/kernel RE reference
- [xdvdfs](https://github.com/antangelo/xdvdfs) — Pure Rust XISO reader (a dependency of `sylpheed-formats`)
- [binrw](https://binrw.rs) — Derive-macro binary format parsing (a dependency of `sylpheed-formats`)
- [Free60 Project](https://free60project.github.io/wiki/) — Original Xbox 360 open-source hardware documentation