Skip to content
Mark Street edited this page Sep 23, 2021 · 4 revisions

Issues / Limitations / TODOs

This is a very rudimentary proof-of-concept. Many things are missing or broken.

Missing Instructions:

Firstly, there are a number of instructions that aren't correctly disassembled by capstone, e.g. lines like:

/* 22D88 80032788 00E8C848 */  .byte      0x00, 0xe8, 0xc8, 0x48
/* 22D94 80032794 00F0C848 */  .byte      0x00, 0xf0, 0xc8, 0x48
/* 22DA0 800327A0 00D0C848 */  .byte      0x00, 0xd0, 0xc8, 0x48
/* 22DAC 800327AC 00D8C848 */  .byte      0x00, 0xd8, 0xc8, 0x48
/* 22DB8 800327B8 00E0C848 */  .byte      0x00, 0xe0, 0xc8, 0x48
/* 22DC0 800327C0 00C0C048 */  .byte      0x00, 0xc0, 0xc0, 0x48
/* 22DC4 800327C4 00C8C048 */  .byte      0x00, 0xc8, 0xc0, 0x48

These should be translated to the GTE macros and/or assembled via ASPSX.EXE rather than the MIPS as binary.

Decompilation Tools

splat

Naive disassembly on mkst/psx branch.

Data/Rodata disassembly is missing (needs little-endian as a minimum)

asm-differ

asm-differ can be used to diff the asm in realtime

python3 tools/asm-differ/diff.py -mwo3 func_DEADBEEF

decomp-permuter

Permuter works out of the box.

Import:

root@0866e9158e8e:/esa# python3 tools/decomp-permuter/import.py esa/src/51374.c esa/asm/nonmatchings/51374/func_80061688.s 
Function name: func_80061688
Compiler: cpp -P -undef -Wall -lang-c -Dmips -D__GNUC__=2 -D__OPTIMIZE__ -D__mips__ -D__mips -Dpsx -D__psx__ -D__psx -D_PSYQ -D__EXTENSIONS__ -D_MIPSEL -D__CHAR_UNSIGNED__ -D_LANGUAGE_C -DLANGUAGE_C -Iinclude -DPERMUTER '|' unix2dos '|' wine tools/psyq/4.6/CC1PSX.EXE -quiet -G0 -Wall -O2 '|' mips-elf-as -EL -march=r3000 -mtune=r3000 -Iinclude {input} -o {output}
Assembler: mips-linux-gnu-as -march=vr4300 -mabi=32 {input} -o {output}
Preserving no macros. Use --preserve-macros='<regex>' to override.
stdin: In function `func_80061688':
stdin:45: warning: implicit declaration of function `func_8007C444'

Done. Imported into nonmatchings/func_80061688

Permute:

root@0866e9158e8e:/esa# python3 tools/decomp-permuter/permuter.py nonmatchings/func_80061688/ --best-only -j3
Loading...
nonmatchings/func_80061688/base.c (func_80061688)
No perm macros found. Defaulting to randomization.
Will try 1 different base sources.
stdin: In function `func_80061688':
stdin:44: warning: implicit declaration of function `func_8007C444'

[func_80061688] base score = 80
iteration 153, 0 errors, score = 510 

Game Info

There are a number of files on the CDROM, explanation are work-in-progress:

Executables:

  • esa.dat; main game (& more?)
  • pt.dat; main menu (& more?)
  • sles_018.71; loader (runs pt.dat/esa.dat)

Data:

  • sv.wad; game data, can be extracted with extract_sv_wad.py in scripts/ directory
  • esa.txt; (more) strings

FMV:

  • sv.str; images/video?
  • stream/*.str; MDEC video stream files
  • stream/*.xa; XA format files

Clone this wiki locally