Skip to content

Repository files navigation

CTR Native

A native PC port of Crash Team Racing (PS1, 1999), built on top of the CTR-ModSDK decompilation project BUT with mod support and more extras

Philosophy

  • No byte budget. Game source lives in game/ as our own copies. Edit freely.
  • No PSX toolchain. Targets Windows and Linux with SDL3. No MIPS compiler needed.
  • Clean platform layer. main.c owns process startup; host details stay in platform/native_*.
  • No build system nonsense. Just build.bat / build.sh.
  • Fully static build. Single executable, zero dependencies. SDL3 is compiled from vendored source and linked statically.

Directory Layout

ctr_native/
  main.c              Entrypoint and unity include manifest
  platform.h          Platform API the game calls through
  platform/           Native-owned audio, input, memcard, CD, and PSX facade glue
  game_includes.h     Ordered include chain for all game source files
  build.bat           Windows build (MinGW32)
  build.sh            Linux build
  README.md           This file
          game/               Our copies of all decompiled game source (943 files)
          include/            Project headers (structs, globals, declarations)
          externals/
            SDL/              SDL3 source (static build)

Prerequisites

Windows

  1. Install MSYS2
  2. In an MSYS2 terminal:
    pacman -S mingw-w64-i686-gcc mingw-w64-i686-tools-git
    
  3. Add C:\msys64\mingw32\bin to your system PATH

That's it. SDL3 is compiled from vendored source -- no separate install needed.

Linux (Debian/Ubuntu)

sudo apt install gcc-multilib
sudo apt install libx11-dev libxext-dev libgl1-mesa-dev libasound2-dev libudev-dev libdbus-1-dev

Building

build.bat            # Windows
chmod +x build.sh
./build.sh           # Linux

First build compiles SDL3 from source. This is cached as a static library in build/ -- subsequent builds only recompile touched native sources.

Output: build/ctr_native.exe (Windows) or build/ctr_native (Linux)

Clean build

rm -rf build/        # Delete cached libraries
build.bat            # Rebuild everything

Running

  1. Create an assets/ directory next to the executable for packaged builds, or next to the source files for development builds run from build/
  2. Extract the following from a CTR NTSC-U retail disc image:
    • BIGFILE.BIG
    • SOUNDS/KART.HWL
    • TEST.STR
    • XA/ENG.XNF
    • XA/ENG/EXTRA/S00.XA through S05.XA
    • XA/ENG/GAME/S00.XA through S20.XA
    • XA/MUSIC/S00.XA through S01.XA
  3. Run build/ctr_native.exe

Packaged directory structure:

CTR-Native/
  ctr_native.exe
  assets/
    BIGFILE.BIG
    SOUNDS/KART.HWL
    TEST.STR
    XA/
      ENG.XNF
      ENG/EXTRA/S00.XA ... S05.XA
      ENG/GAME/S00.XA ... S20.XA
      MUSIC/S00.XA ... S01.XA

Development directory structure:

ctr_native/
  build/
    ctr_native.exe
  assets/
    BIGFILE.BIG
    SOUNDS/KART.HWL
    TEST.STR
    XA/
      ENG.XNF
      ENG/EXTRA/S00.XA ... S05.XA
      ENG/GAME/S00.XA ... S20.XA
      MUSIC/S00.XA ... S01.XA

Bug Replays

Internal builds can record a small bug report folder. See docs/REPLAYS.md.

Netplay

CTR-Native soporta partidas online de hasta 8 jugadores vía UDP, con sincronización de items, chat en lobby, y selección de interfaz de red 100% desde el menú ingame (sin tocar la consola). Ver docs/NETPLAY.md para el protocolo completo.

Flujo ingame (recomendado)

  1. Ejecutá ctr_native.exe (sin argumentos).
  2. Main menu → Online.
  3. Elegí Host o Connect.
    • Host: te aparece la lista de interfaces de red con sus IPs. Elegís la que vas a compartir con los demás.
    • Connect: tipeás la IP del host con el teclado virtual onscreen.
  4. Lobby: SQR para ready. El chat se escribe en una ventana de consola separada que se abre automáticamente (con tu teclado de PC, no con el controller). El host arranca con START cuando todos están ready.
  5. Al terminar, el host puede mandar "volver al lobby" para jugar otra pista sin reconectar.

CLI (opcional, para debug)

ctr_native.exe --host --name "Host" --players 4
ctr_native.exe --connect 192.168.1.100 --name "Player2"
ctr_native.exe --list-interfaces

Architecture

main.c (entrypoint)
  |
  +-- platform/native_* (platform shell, audio, input, memcard, CD, renderer, PSX facade glue)
  |
  +-- game_includes.h
        |
        +-- game/ (all decompiled game source)
              |
              +-- include/ (headers: structs, globals, declarations)
  • CTR_NATIVE is defined for native host/platform-specific code
  • The build currently uses 32-bit mode because some native paths still pack host pointers into retail-shaped 24-bit GPU primitive links. See docs/MEMORY_MODEL.md for the roadmap to replace that with an explicit native GPU link bridge.

Roadmap

  • Clean up game/ copies strip byte budget hacks and route platform-specific code through CTR_NATIVE
  • Replace low-address primitive-link assumptions with an explicit native GPU link bridge, remove the 32-bit constraint, and keep pruning inherited compatibility code now owned in include/ and platform/.

Credits

  • CTR-ModSDK — the decompilation project this is built on
  • PsyCross — original PS1 compatibility code from which parts of CTR Native's owned platform layer and PsyQ facade headers are derived
  • SDL3 — cross-platform multimedia
  • Crash Team Racing is a trademark of Sony Computer Entertainment / Naughty Dog
  • Faradise Team for the principal fork and more help
  • Aalhendi Code Base
  • LoloTheSamurai for testing
  • TDYU for testing
  • Yostifu for testing
  • CTR Community

About

A PC Port From Crash Team Racing

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages