OpenRAC/rac2-gc-decomp is the same disc as ours, verified rather than assumed:
ours 3,828,350,976 9db2e33e...b1ce5
theirs 3,828,350,976 9db2e33e...b1ce5
Vendored read-only under vendor/ (already gitignored) and added to PROVENANCE.
It names two constants this parser had measured but never explained:
* overlay.bin +0x00 = 1,735,808 = 0x1A7C80, the .lit load base. It is constant
across all 27 levels because every level's literal section loads at the same
address. So the first header word is the load base of the section the file IS,
which also establishes that overlay.bin is that section -- it holds both code
and the debug string pool. $gp = 0x1AEFF0 comes with it, and that closes the
roadmap's open "$gp for this game" item.
The program around it is seven sections -- .lit .bss .data vtbl camvtbl sndvtbl
.text -- which is precisely the "seven-section parser and relocation" Phase 3
item for this format. Known target now rather than a guess.
I then tested the obvious follow-up and it is wrong: if +0x00 is the .lit load
base, +0x0c ought to be the .lit size. It is SMALLER than the file on 16 of 27
levels, by up to 8.9% (level11: file 3,151,128 vs 2,870,792). Excluded by sign,
not by a near miss. Still unnamed.
Collision: still blocked, but no longer blocked on tooling. The decomp names
Camera_CollPrimTest(void *prim, void *grid) without decompiling it, so the cell
layout is not handed over. What it does supply is $gp, and that is enough to
start. "Camera_CollPrimTest WARNING! - grid out of bounds! (RAR)" is at
overlay+0xd18, the only copy in the file, so:
string overlay+0xd18 -> RAM 0x1a8998; delta to $gp -0x6658; $lo 0x99a8
MIPS puts the $lo half in bytes 1..3 of a 4-byte instruction. Searching the whole
overlay instruction-aligned gives exactly ONE hit:
0x354cc8 (overlay+0x1ad048)
One occurrence in 2.75 MB of code is unambiguous: that is the instruction
materialising the assert string, and its enclosing function is
Camera_CollPrimTest. That is the route in, and it needs no symbols.
tools/overlay-anchors does this step, dependency-free. I started this with
capstone for the disassembly proper and dropped it: capstone 0.14 does not
re-export Mode/Endian from a public path, and an excluded-from-the-workspace
native dependency is a poor trade for a step that does not need one yet. The
anchor search is pure byte work, so it is pure Rust. No native dependency is
added anywhere, and the tool is an ordinary workspace member.
Surveyed the rest of that project against our open items: no volume structures,
no tie vertex layouts, no SBlk/DAW fields, no wavelet tables. It is a guide to
the code, not a replacement for reading it.
121 lines
5.9 KiB
Markdown
121 lines
5.9 KiB
Markdown
# PROVENANCE
|
|
|
|
This project is built on the work of other people. Their licences apply to their
|
|
code, and those notices travel with anything derived from it.
|
|
|
|
## Summary
|
|
|
|
| Project | Role | Licence | Code copied into this repo? |
|
|
|---|---|---|---|
|
|
| [OpenRAC/rac2-gc-decomp](https://github.com/OpenRAC/rac2-gc-decomp) | Byte-exact reconstruction research for the same disc (SHA-256 verified identical) -- supplied `$gp`, the `.lit` load base and the seven-section program layout | GPL-3.0-or-later | Not yet; vendored read-only at `vendor/rac2-gc-decomp` |
|
|
| [ReRAC](https://github.com/re-rac/rerac) | Native Rust/Bevy port of Ratchet & Clank (2002) — the architecture this follows | ISC | Not yet; derived from, attribute when used |
|
|
| [OpenRAC / rac2-gc-decomp](https://github.com/OpenRAC/rac2-gc-decomp) | Matching decompilation research for this game | MIT | No — consulted for documentation |
|
|
| [rac2-gc-decomp community reference](https://github.com/OpenRAC/rac2-gc-decomp/blob/RAC2/docs/COMMUNITY-ENGINE-REFERENCE.md) | Engine architecture notes, moby struct layout | MIT | Documentation only |
|
|
| [Wrench](https://github.com/chaoticgd/wrench) | Insomniac container format documentation | GPLv3 | **No.** Specification reference only |
|
|
| [RAC2Decomp](https://github.com/platypet2217-star/RAC2Decomp) | Functional decompilation, PAL | MIT | **Not used** — see below |
|
|
|
|
## Game content: none
|
|
|
|
No game assets, disc images, extracted data, BIOS dumps or proprietary
|
|
toolchains are or may be committed to this repository. The build takes the
|
|
user's own legally obtained disc as input. This is enforced by
|
|
`.githooks/pre-commit`.
|
|
|
|
Ratchet & Clank is a trademark of Sony Interactive Entertainment. This is an
|
|
unofficial fan project, not affiliated with or endorsed by Sony Interactive
|
|
Entertainment or Insomniac Games.
|
|
|
|
---
|
|
|
|
## ReRAC — ISC
|
|
|
|
The direct model for this project. ReRAC re-implements the *first* Ratchet &
|
|
Clank as a native Rust application on Bevy, reading assets from the player's own
|
|
disc. This project follows the same architecture for the second game.
|
|
|
|
What we take from ReRAC:
|
|
|
|
- **The architecture.** Crate split (`formats` / `extract` / `game` / `engine` /
|
|
`video`), Bevy 0.19.1, the PS2 float-model discipline, and the milestone
|
|
gating style.
|
|
- **Overlay relocation.** `rc-formats::level_overlay` implements
|
|
relocation-tolerant code-identity matching so one level's function can be
|
|
found on every other level. R&C2's 27 overlays have the same seven-section
|
|
layout (`.lit`, `.bss`, `.data`, `lvl.vtbl`, `lvl.camvtbl`, `lvl.sndvtbl`,
|
|
`.text`), so this machinery transfers directly. It is the single most
|
|
valuable thing we inherit.
|
|
- **Verified format specs.** `docs/formats/disc_layout.md` documents all four
|
|
R&C games' container layouts, derived from behavioural analysis.
|
|
- **Discipline worth copying.** Golden tests against committed snapshot hashes;
|
|
bit-exact CPU/GPU identity checks; documenting negative results.
|
|
|
|
ISC permits use, modification and redistribution with the notice intact. When
|
|
code is derived from ReRAC it must carry:
|
|
|
|
```
|
|
Copyright (c) 2026 ReRAC contributors
|
|
Licensed under the ISC License.
|
|
```
|
|
|
|
Pinned checkout: `vendor/rerac` at commit
|
|
`d00cb00ad4018f776556e72640dcba438d098a77` (2026-10-09). Not tracked by git —
|
|
clone it yourself; the commit is recorded so everyone uses the same one.
|
|
|
|
Note that ReRAC targets a *different game*. Its per-level documentation is a
|
|
useful hint about Insomniac's engine in general, but R&C2's spherical worlds
|
|
changed roughly 50,000 lines of gameplay code, so nothing about R&C1's
|
|
movement, camera or level geometry should be treated as directly applicable.
|
|
|
|
## OpenRAC / rac2-gc-decomp — MIT
|
|
|
|
Matching decompilation research for **this** game, targeting exactly our disc
|
|
(`SCUS_972.68` v1.01). It reconstructs the boot ELF and all 27 level overlays
|
|
byte-for-byte, and publishes verified struct layouts, symbol names and engine
|
|
documentation.
|
|
|
|
We use it as a **reference**, not as source. Its value is that it tells us what
|
|
the structures *are*, which saves a great deal of guessing.
|
|
|
|
Its matching progress is low (~1.6% of code in C) and byte-matching is not a
|
|
prerequisite for this port anyway — it is a verification technique. We are not
|
|
pursuing a byte-identical rebuild.
|
|
|
|
## Wrench — GPLv3, specification reference only
|
|
|
|
Community documentation and tooling for Insomniac's container formats. We use
|
|
the written format *specifications* as a reference for how the data is laid
|
|
out.
|
|
|
|
**No Wrench code is copied into this repository.** That is deliberate and
|
|
load-bearing: copying GPLv3 code would impose GPLv3 terms on everything derived
|
|
from it. Clean-room reimplementation from a written specification does not. If
|
|
this boundary is ever crossed, the licensing of this project changes and
|
|
`AGENTS.md` must be updated to say so.
|
|
|
|
## RAC2Decomp — not used
|
|
|
|
A functional (non-byte-matching) decompilation of the PAL release. It is
|
|
recorded here only so its absence is a decision rather than an oversight.
|
|
|
|
The `rac2-gc-decomp` community reference explicitly flags it as *"criticized by
|
|
community for questionable provenance and non-clean-room C code. Avoid
|
|
copying."* Given that we are building a reimplementation and its provenance is
|
|
disputed, we do not use it. It is also the wrong region: PAL, 50 Hz.
|
|
|
|
## Third-party libraries
|
|
|
|
Rust dependencies keep their own licences; see `Cargo.lock` and each crate's
|
|
`LICENSE` file. Notable ones:
|
|
|
|
- **Bevy** (MIT / Apache-2.0) — application framework and wgpu renderer.
|
|
- **wgpu / wgpu-hal / wgpu-types** (MIT / Apache-2.0) — GPU abstraction used for
|
|
the Graphics Synthesizer reimplementation.
|
|
- **bytemuck** (Zlib OR Apache-2.0 OR MIT) — zero-copy casts over asset
|
|
structures.
|
|
- **thiserror**, **anyhow** (MIT OR Apache-2.0) — error handling.
|
|
|
|
## When you add a dependency or port code
|
|
|
|
1. Record it in this file, with its licence and what you took.
|
|
2. Keep the upstream notice intact in any file containing derived code.
|
|
3. If it would change this project's licensing terms, stop and say so first. |