crash2-native

crash2-native is a Linux port of Crash Bandicoot 2: Cortex Strikes Back built on psxrecomp and recomp-ui with widescreen support.

README

English | Español

crash2-native

Latest Release Platform: Linux x86_64 | AppImage Last Commit

Native Linux port of Crash Bandicoot 2: Cortex Strikes Back (PS1, USA, SCUS-94154) built on psxrecomp and recomp-ui, backed by independent clean-room reverse engineering.

Important

No game data or Sony BIOS is included. This repository and its AppImage releases contain zero disc images (.bin, .cue, .chd, .iso), extracted executables, or copyrighted assets. You must provide your own legitimate USA copy of Crash Bandicoot 2 (SCUS-94154), strictly verified against Redump digests (CRC-32: 395c0916, MD5: 3c31b5e038f025098a2fdfa70c8213f2, SHA-1: 3d37fe4288a83b01f1a0edbf78e76e0fede6bc22, 192,814,608 bytes).

Warning

Active development & noncommercial restriction. Phases 0 through 5 (base compilation, clean-room reverse engineering of timing/camera/entities, verify-disc, CI, v0.1.0 AppImage release verified on ubuntu:22.04 and Arch, 512x216 overscan crop, and 16:9 widescreen mod) are complete; high-FPS interpolation (Phase 6) and deterministic regression tests (Phase 7) are next. Any binary linked against psxrecomp is subject to the PolyForm Noncommercial License 1.0.0.

Note

Built with AI assistance, verified by a human. Port code, infrastructure, and reverse-engineering notes are produced with AI coding agents under human review, following the clean-room rules in AGENTS.md. Nothing is published on an agent's word alone: only the maintainer promotes a symbol, and only after it has been confirmed in the emulator. See AI-Assisted Development.


Project Goals & Technical Design

  • Linux-first native port: Uses psxrecomp + recomp-ui with a native OpenGL launcher, in-game menu (F10 / Ctrl+L / Select+L3), and first-run setup wizard (Generate & rebuild).
  • Clean-room reverse engineering: All function names, addresses, and memory layouts in re/symbols.csv, re/structs.h, and re/NOTES.md are independently observed on SCUS_941.54 in Ghidra (ghidra_psx_ldr) and verified dynamically in PCSX-Redux (re/experiments/001 through 008).
  • Strict disc validation: Both psxrecomp and the standalone Rust tool tools/verify-disc reject mismatched or altered disc images before code generation.
  • Portable AppImage with user-side compilation: Bundles a setup host, prebuilt recompiler emitters (psxrecomp-game, psxrecomp-bios), vendored offline dependencies (SDL3, zlib, libwebp, libchdr), Zig 0.17.1 (-target x86_64-linux-gnu.2.28), trimmed CMake 3.31.6, Ninja 1.12.1, and tomli (for Python 3.10 compatibility during runtime GOOL MIPS block compilation).
  • Planned enhancements (Phases 5–7):
    • Widescreen: Crop the 12-line top/bottom black borders (DRAWENV 512x216 at y=12) and expand horizontal framing while preserving the engine's 5/8 (512/320) vertical scaling across all three confirmed GTE paths.
    • High FPS via interpolation: Keep game logic at the original 30 Hz (RCntCNT2 / quantize_frame_ticks) and interpolate camera and active GoolObject transforms walked via the 8 root buckets (gool_root_buckets), verified bit-for-bit against stock logic by tools/regress.

Status

See docs/ROADMAP.md for the full phase breakdown and rationale.

PhaseMilestoneStatus
0–2Repo layout, psxrecomp + recomp-ui integration, Redump config, 30 FPS Linux buildComplete
3Clean-room RE (001–008): timing, NSD/NSF paging, GOOL MIPS blocks, camera, 5/8 scaling, GoolObject, PadState, RNG, 60 confirmed symbols, re/structs.h, 803 seedsComplete
4tools/verify-disc (Rust), LICENSE/NOTICE, ubuntu:22.04 CI, self-contained AppImage + release.ymlComplete (v0.1.0 published; verified on ubuntu:22.04 and Arch)
5Widescreen: 512x216 (40:27) overscan crop + Widescreen (16:9) mod (1.125x/1.10x/1.20x FOV opening) preserving 5/8 GTE scalingComplete
6–7Frame interpolation (60/120/144 Hz), tools/regress replay checks, public releasePlanned

Running the AppImage

Download the .AppImage and SHA256SUMS from Releases, verify the checksum, and make the file executable:

sha256sum -c SHA256SUMS
chmod +x crash2-native-*-x86_64.AppImage

Note

The AppImage bundles Zig, CMake, Ninja, prebuilt emitters, and offline dependency archives, and never packages host GL/DRM libraries (libGL, libOpenGL, libGLX, libdrm). You only need Python 3 and minimal OpenGL / X11 / ALSA development headers on the host so SDL3 and the OpenGL target can link cleanly against your system drivers on first build.

Check host prerequisites or verify your disc before launching:

./crash2-native-*-x86_64.AppImage --check-prereqs
./crash2-native-*-x86_64.AppImage --verify-disc --disc "/path/to/Crash Bandicoot 2 - Cortex Strikes Back (USA).cue"
./crash2-native-*-x86_64.AppImage

On first launch, the setup wizard extracts SCUS_941.54, generates C code, and compiles the native binary into ~/.local/share/crash2-native/ (override with CRASH2NATIVE_DATA_DIR). Useful options and environment variables:

  • --setup: Re-open the setup/rebuild wizard even if a compiled binary already exists.
  • CRASH2NATIVE_DISC=/path/to/disc.cue: Pre-select the disc path in game.toml.
  • CRASH2NATIVE_USE_SYSTEM_CC=1: Use system cc/c++/cmake/ninja instead of the bundled Zig toolchain.

If --check-prereqs reports missing packages, install them for your distribution:

  • Ubuntu / Debian:
    sudo apt update && sudo apt install -y \
      python3 libgl-dev libx11-dev libxext-dev libxcursor-dev libxfixes-dev \
      libxi-dev libxrandr-dev libxss-dev libxtst-dev libasound2-dev
    
  • Arch Linux / derivatives:
    sudo pacman -S --needed \
      python libglvnd libx11 libxext libxcursor libxfixes libxi libxrandr \
      libxss libxtst alsa-lib
    
  • Fedora:
    sudo dnf install -y \
      python3 mesa-libGL-devel libX11-devel libXext-devel libXcursor-devel \
      libXfixes-devel libXi-devel libXrandr-devel libXScrnSaver-devel \
      libXtst-devel alsa-lib-devel
    

Building from Source (Linux)

  1. Clone with submodules and verify tool dependencies + disc image (disc/ must point to a directory containing your Redump .bin + .cue):

    git clone --recursive https://github.com/Alejandro-Estrada-1/crash2-native.git
    cd crash2-native
    ./scripts/setup.sh
    

    (Use ./scripts/setup.sh --sin-disco for disc-less setup or CI environments.)

  2. Generate C code from the disc and compile the native runtime:

    ./scripts/build_linux.sh -j 4
    

    (Pass --sin-generar to rebuild C/C++ changes without regenerating, --sin-ui to build without recomp-ui, or --setup-host to build only the setup wizard without a disc.)

  3. Run the disc verifier unit tests (no game disc required):

    cargo test --manifest-path tools/verify-disc/Cargo.toml
    
  4. Optional: build an AppImage locally on Ubuntu 22.04:

    ./packaging/appimage/build-appimage.sh --jobs 4
    

Repository Structure & Documentation

PathDescriptionDocs
src/Title setup host, recomp-ui in-game menu provider, and widescreen hooks—
mods/preloaded/Preloaded title mod packages (e.g., Widescreen (16:9) with 1.125x/1.10x/1.20x FOV choices)—
re/Clean-room symbols (symbols.csv), verified C structs (structs.h), logs, and GDB/Lua experimentsre/NOTES.md
seeds/Verified function start addresses for static recompilation (ghidra_funcs.txt)—
patches/psxrecomp/Minimal framework patches and upstream issue notesUPSTREAM.md
tools/verify-disc/Zero-dependency Rust Redump verifierREADME.md
tools/regress/Planned deterministic logical-state regression verifierREADME.md
packaging/appimage/Portable AppImage builder, AppRun, desktop entry, and Ubuntu 22.04 check findingsCHECK_FINDINGS.md
scripts/Setup, Linux build, PCSX-Redux GDB wrapper, and save backup utilities—
docs/Architecture decisions, Redump reference, and roadmapROADMAP.md
CHANGELOG.mdPer-release additions and fixes (English + Spanish mirror)CHANGELOG.md
AGENTS.md, CLAUDE.md, GEMINI.mdWorking rules for humans and AI agents: clean-room policy, per-role scope, and the mandatory verification cycleAGENTS.md

AI-Assisted Development

This project is developed by a human maintainer working with AI coding agents. That is stated plainly on purpose: it is part of the method, not something to hide.

  • Infrastructure (build scripts, CI, packaging, Rust tools, and port code in src/) is written by an AI agent under human review in a dedicated worktree.
  • Reverse engineering is also agent-assisted, but under a strict clean-room rule. Every address, structure, and constant published in re/ was observed on SCUS-94154 in Ghidra and then confirmed dynamically in PCSX-Redux with a reproducible experiment that declares its preconditions and pass/fail criteria. Proposals stay in re/provisional_symbols.csv; only the human promotes them to re/symbols.csv.
  • No AI-generated game data. Models never receive the disc, the executable, BIOS dumps, or memory cards, and nothing derived from them is committed.
  • The rules are public. AGENTS.md, CLAUDE.md, and GEMINI.md document roles, forbidden actions, and the verification cycle in full, so any finding here can be audited or reproduced. They are process documentation: safe to ignore if you only care about the port.

Agents are tools. Every published fact is checked against the game by the maintainer, and any remaining error is the maintainer's responsibility.


Licensing

  • Original code, tools, reverse engineering notes, and scripts in this repository are licensed under the MIT License (LICENSE).
  • Linked binaries and AppImage distributions rely on psxrecomp, governed by the PolyForm Noncommercial License 1.0.0 (noncommercial use only).
  • Full third-party notices and licenses for recomp-ui, OpenBIOS, SDL3, Zig, CMake, Ninja, tomli, and AppImage type2-runtime are documented in NOTICE.