don't click here

Crash Bandicoot decompilation

Discussion in 'Technical Discussion' started by Wurly, Dec 13, 2023.

  1. Wurly

    Wurly

    :| Tech Member
    Hey guys, it's been a good minute since I last posted here (like 13 years lmao).

    Some of you may know me as JJFTails/JJ-Fox or may be familiar with my "Sonic in Chaotix" hack.

    These days I'm pretty out of the loop on Sonic-related things, though I still occasionally check these forums for new discoveries about the Genesis/MD era games. It is hard to believe that unused content is still being found to this day. The recent Cyber City level/map reconstruction in particular (whether or not it is partially up to Hez's interpretation) was really neat to see come together and a prime example of the sort of "video game archaeology" that makes many of these discoveries so interesting.

    Anyways, onto the thread topic. My focus as of late has been on hacking/reversing the Crash Bandicoot games for the psx. I have reversed and hand decompiled almost 100% of the code for Crash 1 and now have a fully functional* port/rewrite in C (*not including bugs). The code is designed to compile for and run on pc as well as psx, though the psx specific code currently does not build. You can take a look at the code at https://github.com/wurlyfox/c1. I have also added some new features such as an in-game ImGui based debug menu as well as 120fps and camera control modes.

    One interesting thing to note about this game and its sequels is that all of the object logic was originally written in GOOL (Game Object Oriented Lisp), a custom Lisp dialect that Naughty Dog developed specifically for the Crash games. Object code exists in compiled form as 'executable bytecode' type game asset files which run in a vm. A given object instance executes its bytecode when the game reaches GoolInterpret() function in gool.c, which is essentially a loop enclosing a gigantic case statement that runs code according to the opcode of the currently executing bytecode instruction. The object engine handles scheduling so that all object instances get to run their own burst of code within a frame of game execution. A decent portion of the game logic is encoded in these bytecode files, though I have not attempted to reconstruct the original corresponding GOOL/Lisp code as simply not enough is known about the language itself. A separate effort exists to decompile this bytecode into a more C-like equivalent language dubbed "GOOC" (https://github.com/ManDude/goocdump, https://github.com/ManDude/gooc).

    Though I'm posting this here mainly to get the word out, for now I've taken a brief hiatus from this project. At some point I'll fix the remaining bugs and work on getting the psx-specific code to build.

    Regardless, if you are into this sort of thing, I definitely recommend taking a look at some of the code because there is some c r a z y stuff that Naughty Dog is doing to really push the limits (and work within the limitations) of the psx.
     
    Last edited: Dec 13, 2023
  2. aria

    aria

    growl from the digital haze Member
    182
    100
    43
    i saw soned2 supports chaotix five minutes ago
    This is super cool! Thank you for all of the hard work you've done.
     
  3. Pinkerton

    Pinkerton

    サメジマ・マミミ Oldbie
    Is the 32-bit limitation a memory-map thing or...?

    It'd be interesting to see a build on macOS, for instance.