Files
Going-Commando/crates/gc-engine/src/lib.rs
T
ReaperOfVeriod a02f79a6d1 Initialise native Rust port of Ratchet & Clank: Going Commando
Sets up the foundation for reimplementing the PS2 game in Rust rather than
emulating it. Nothing is implemented yet; this is the scaffold, the verified
target and the working agreements that keep a long project coherent.

Target disc, verified against a real image:

  SCUS_972.68 v1.01, USA Black Label, NTSC 60 Hz
  boot ELF 2,618,684 bytes, SHA-1 bacda860...d098a77, entry 0x00131AE8

The entry point independently matches the value recorded by the rac2-gc-decomp
community reference, which cross-confirms the identification. This is the exact
build the upstream research pins; Greatest Hits v2.00 is a different binary and
is not the target. NTSC matters beyond label compatibility: PAL discs run 50 Hz,
which would make chargeboots and other speed-sensitive movement run at 5/6
speed. Verifying the disc before writing movement code avoids discovering that
in Phase 5.

Contents:

- Five-crate workspace (formats, extract, game, video, engine) on Bevy 0.19.1,
  matching the version ReRAC uses so its Graphics Synthesizer and VU work stays
  portable. `cargo check --workspace` is clean.

- tools/identify-disc.py, which reproduces the identification against any
  disc image and distinguishes a truncated dump from a non-PS2 image.

- .githooks/pre-commit, refusing game data from entering git history: disc
  image extensions, asset directories, container signatures at offset 0, and
  files over 50 MiB. Verified against seven cases including a disc image
  renamed to look like source. Now that this pushes to a remote, this matters
  more than it would have locally.

- AGENTS.md, the operating agreements: no game data ever, reproduce the PS2
  float model rather than approximating it, bound every read, verify against
  the real disc.

- PROVENANCE.md, recording that this follows ReRAC (ISC) and learns from
  rac2-gc-decomp (MIT). Wrench is used as a written specification only and no
  GPLv3 code is copied, since that would relicense everything derived from it.
  RAC2Decomp is explicitly not used: its provenance is disputed in the upstream
  community reference, and it targets the wrong region.

- docs/roadmap.md, phased so the riskiest unknowns are retired early. The two
  that matter: overlay relocation transfers from ReRAC and makes 27 level
  overlays tractable, while VU1 microcode is binary and is the hardest single
  item. Phase 5 is a deliberately scoped Veldin vertical slice as the go/no-go.
2026-10-09 15:42:10 +02:00

35 lines
1.8 KiB
Rust

//! The application: renderer, hardware models, and the frame loop.
//!
//! Reimplements the pieces of the PlayStation 2 that the game talks to, so the
//! game logic in `gc-game` can be written as ordinary Rust that draws and
//! sounds like the original.
//!
//! # Hardware being modelled
//!
//! * **Graphics Synthesizer (GS)** - fixed-function rasteriser. No shaders on
//! the real hardware: the GS does texture mapping, alpha and blend rules,
//! and z/stencil. Here that becomes wgpu plus explicit handling of the GS's
//! own rules (its `round(log2(z/n) + K)` mip selection, its blend and alpha
//! test behaviour, its alpha-0x80-is-1.0 convention).
//! * **VU0 / VU1** - vector units running microcode uploaded from the disc.
//! Skinning, lighting and transform setup live here. The microcode is
//! **binary** in the game's `.vutext` section, so it is reverse engineered
//! rather than parsed: this is the single hardest item in the project.
//! * **DMA and GIF/VIF packets** - the game streams geometry to the GS through
//! tag-split packet lists. Those packet formats are the input to rendering.
//! * **SPU2 / IOP** - audio and the disc interface, in `gc-video` and
//! `gc-extract` respectively.
//!
//! # Divergence from the first game
//!
//! R&C2's levels are spherical worlds, so camera, culling, fog and the sky are
//! all effectively rewritten compared with Ratchet & Clank (2002). Geometry
//! subsystems carry over in shape - `tfrag`, `tie`, `shrub`, `moby` are the
//! same four - but their behaviour on a sphere is new work.
//!
//! # Reference frame
//!
//! The port is validated against PCSX2 by replaying recorded input and
//! comparing frames. Without that loop, "looks close" and "is correct" drift
//! apart, and this game's difficulty and movement make that drift very
//! noticeable.