WIP 1:1 decompilation of Super Paper Mario
Go to file
2020-12-22 13:20:57 +00:00
include Began decompiling swdrv.c 2020-12-22 13:20:57 +00:00
src Began decompiling swdrv.c 2020-12-22 13:20:57 +00:00
.gitignore Removed scripts 2020-12-20 22:17:36 +00:00
clean.bat Restructure + evtSearchLabel 2020-12-20 21:25:59 +00:00
README.md Update README.md 2020-12-22 10:56:33 +00:00
spm.bat Restructure + evtSearchLabel 2020-12-20 21:25:59 +00:00
ttyd.bat Restructure + evtSearchLabel 2020-12-20 21:25:59 +00:00

spm-decomp

Decompilation of Super Paper Mario (PAL revision 0). Doesn't produce a dol, asm is just checked by compiling with -S. A small bit of TTYD support.

See also https://github.com/SeekyCt/spm-docs for other documentation

Compiler Notes

Flags

The compiler flags probably aren't fully accurate yet (particularly the inline pragma), and it's likely that some parts of the game will use different flags.

Version

The project currently uses Codewarrior Version 4.1 build 60831, which seems to be a slightly wrong version. The main reason that makes this seem like it could be the case is that to match the variable incrementing order in some loops, while loops have had to be used instead of for loops, like in this code

void evtDeleteID(int id) {
    EvtWork * wp = evtGetWork();
    EvtEntry * entry = wp->entries;
    int i = 0;
    while (i < wp->entryCount) {
        if (entry->flags & 1 != 0 && entry->id == id) {
            evtDelete(entry);
        }
        i++;
        entry++;
    }
}

which matches 1:1 in the Paper Mario 64 decomp as

void kill_script_by_ID(s32 id) {
    s32 i;
    ScriptInstance* scriptContextPtr;

    for (i = 0; i < MAX_SCRIPTS; i++) {
        scriptContextPtr = (*gCurrentScriptListPtr)[i];
        if (scriptContextPtr != NULL && scriptContextPtr->id == id) {
            kill_script(scriptContextPtr);
        }
    }
}

so it seems unlikely the devs would've switched to this weird while format over a for loop.

Matching Notes

  • No attempt is made to match assert line numbers
  • String pool offsets won't match for incomplete files

TTYD Support

TTYD was initially matched too for some of seqdrv, but this was abandoned based on the effort it would've taken to keep doing and also to find the right compiler version & flags for it too. The code that was matched still remains.

Credits

Various members of the TTYD community for their documentation here https://github.com/PistonMiner/ttyd-tools and for porting the demo symbol map to the final game