WIP 1:1 decompilation of Super Paper Mario
Go to file
2021-01-15 18:14:20 +00:00
include Started wpadmgr 2021-01-15 18:14:20 +00:00
src Started wpadmgr 2021-01-15 18:14:20 +00:00
.gitignore Fixed fileGarbageMoveMem, attempted nandmgrInit 2020-12-31 00:36:30 +00:00
clean.bat Restructure + evtSearchLabel 2020-12-20 21:25:59 +00:00
filemap.txt Small bits of documentation 2021-01-15 00:37:51 +00:00
README.md Update README.md 2020-12-23 19:27:12 +00:00
spm.bat Fixed japanese assert text being utf-8 instead of shift jis 2020-12-25 18:34:28 +00:00
ttyd.bat Fixed japanese assert text being utf-8 instead of shift jis 2020-12-25 18:34:28 +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 and for porting the demo symbol map to the final game
  • The PM64 decomp team for decompiling many of the same functions, which are useful to check against