15 · Appendices
Reimplementation Guide
What must be replicated exactly, what can be freely redesigned, in what
order to build it, and which proofs already exist that the approach works.
15.1Two very different questions
Decompile-and-recompile: NOT feasible
Decompiler output is a reading aid: pseudo-typed pointer arithmetic, invented locals, gotos.
Recompiling requires recovering real struct layouts for 12,135 functions and 3,273 vtables,
plus Itanium exception unwinding. Comparable matching-decompilation projects target ~1 MB of C
and take teams years.
Clean-room reimplementation: feasible
Write new code against the documented behavior in this report. The difference is
stark: you need the formulas, tables, state machines and file formats, all specified here, not the instruction stream.
15.2Per-subsystem confidence
| Layer | Status | Anchor |
|---|---|---|
| Physics integrator (ttTrainGo, resistances, motor/brake tables, limits, ATS/ATC) | Ready | Chapter 7 — every constant and table closed |
| Scoring (15 penalties, 42 bonuses, grades) | Ready | Chapter 8 |
| Progression/unlock + save format | Ready | Chapter 9 (0x1b44 payload exact) |
| Menu/selection/inspection state machines | Ready | Chapter 5 |
| Departure/door-close, win/lose/pause | Ready | Chapters 6, 10 |
| Platform contract (EGL/GLES2, evdev, OpenAL/ALSA, XPlayer, SW2001) | Ready (desktop) | Chapter 2 — the port shim is the existence proof |
| Asset formats (ALLZ/ALAR/ALSN/ALTX/ALIG/TXM/AMS/.dat) | Mostly | Chapter 14 — headers confirmed; .dat internal field naming is the long tail |
| Engine internals (fibers, packet opcodes, shaders, pass order) | Partial | Chapters 3, 12 — architecture complete; shader source recovered; per-frame pass order mapped |
| Map-pack internals (.dat geometry fields without consumers) | Partial | corpus-bounded opaque fields preserved losslessly |
The strongest existence proof
An independent autodrive model built only from this report's physics/scoring
specifications (the 0.00054042/0.004623 integrator, the tables, the judgment thresholds)
completed real routes (Yamanote 01/02/03, Osaka 01/02/03, Tōkaidō 01/03) withh zero penalty
accumulators. The game logic is reproducible from the spec alone.
15.3Must replicate
- Game-logic behavior to formula level — integration constants, resistance formulas, brake/motor tables,
limSpeed[], penalty/bonus tables, stop windows, timetable tiers, unlock graph. - The per-frame pass order (Chapter 4's 34-step loop) — or an equivalent ordering producing the same visible result.
- The save payload — exact 0x1b44 layout at 0x0000/0x004c/0x03b8, wrapped as exactly 0x245c Base64 chars in XML.
- Asset decoding — enough of Chapter 14 to mount the original
Data/tree. Note: adding a route is not data-only: menu entries, route metadata, station/timetable rules and unlock logic live in fixed executable tables. - Platform contracts — GLES2-class rendering; controller detents that persist between polls; audio completion gates (a stubbed backend deadlocks departure; Chapter 6); video callback state machine.
- Rendering output — same visuals, not the same mechanism.
15.4Can skip
- The fiber scheduler's mechanism: coroutines or a fixed-order function list reproduce the behavior; keep only frame-boundary lifecycle semantics and stale-handle validation.
- The deferred draw-packet architecture: you need the output, not the opcode stream (the full opcode table is documented anyway).
- The Aqualead class hierarchy (3,273 vtables): design your own classes around documented behavior.
- ARM/ELF specifics, fixed addresses, the exception machinery.
- The shader-use table (never read by the active path), the PS2-era dead layer, the SW2001 dongle check, weather (never set), the horn bonus (unreachable).
15.5Four ranked paths
| Path | Description | Verdict |
|---|---|---|
| A | Full clean-room C++ clone on a new engine (SDL2/GLFW + GLES2/GL3, OpenAL, ffmpeg), reusing original assets | Feasible. Person-years solo; 6–12 months small team. Risks: shader recovery and .dat layout — both have traced entry points |
| B | Logic reimplementation on an existing engine (Godot/Unity/SDL) with converters or new assets | Feasible. 3–6 months. Lower fidelity, higher productivity |
| C | Selective in-process replacement via the non-PIE fixed addresses (input contract, EGL bridge, video stub, dongle patch) | Feasible, already demonstrated — natural precursor to A |
| D | Run the original binary on new hardware (qemu-user + Mesa, or native ARM SBC via the shim) | Already done — solves "play it", not "rebuild it" |
15.6Suggested build order
- Physics core (Chapter 7): tables from the binary +
ttTrainGo. Unit-test against live-observed accelerations. - Judgment layer (Chapter 8):
subLifePoint+ judges with the profile tables. - Departure/arrival machines (Chapter 6) + GameTask loop (Chapter 4) with a stub renderer.
- Menu system (Chapter 5) + save I/O (Chapter 9).
- Asset pipeline (Chapter 14): ALLZ first (everything depends on it), then ALAR, ALSN, the DAT walker.
- Renderer (Chapter 12): sprites/HUD first (most of the game's feel), 3D world second.
- Audio (Chapter 13) — engine sound table + announcement gates.
- Polish: conductor mode, overtake cinematics, museum, attract loops.
The three traps
1. Audio gates: make every clip complete or departure deadlocks.
2. Frame-order dependence: physics → judgments → rendering, same frame.
3. The power-latch: the original input contract requires
KEY_POWER
held or the game terminates itself within a frame.