Tool:splat
| On this wiki | Facts · Code · Notes · Topics |
|---|
Python binary splitter for N64, PlayStation 1, PlayStation 2, PSP and GBA matching-decompilation projects: a YAML config lists the segments (offset, type, name) and a symbol_addrs.txt gives names; it emits assembly files, data and a linker script.
Overview
splat (https://github.com/ethteck/splat) reads a ROM or executable and a YAML configuration and generates per-file assembly (.s), extracted data and a linker script, so a project can replace assembly with C function by function. It is the first step of the matching-decompilation projects for Platform:Nintendo 64, Platform:PlayStation, Platform:PlayStation 2 and others; see Technique:Matching decompilation.
Configuration
options: holds platform (n64, psx, ps2, psp, gc ...), compiler (e.g. GCC, EEGCC), basename, target_path, base_path, asm_path, src_path, symbol_addrs_path and the sha1 of the input. segments: is a list of [offset, type, name] entries; a segment of type c makes a C file with INCLUDE_ASM stubs, asm only assembly, databin raw bytes, header the 0x800-byte header of a PS-X EXE (as in Software:Castlevania: Symphony of the Night).
symbol_addrs.txt
One symbol per line: name = 0xADDRESS; // type:func size:0x10. The wiki can read such a file with import_symbols. Examples from the Sly Cooper PS2 decompilation: _start = 0x100008; // type:func, _gpReg = 0x2832F0;.
Used on this wiki by Software:Sly Cooper and the Thievius Raccoonus (PS2) and Software:Castlevania: Symphony of the Night (PS1).
PS2 ELF input
For a PS2 game, python3 -m splat create_config SLUS_XXX.YY takes the EE ELF itself (Format:PS2 EE executable (ELF)) and writes a ROM image, a YAML config and a symbol file; the quickstart says relocatable ELFs are not supported. Details read at the cited commits:
- The ROM is made by
objcopy -O binary --gap-fill=0x00 <elf> <name>.rom(mips-linux-gnu-objcopy or mipsel-linux-gnu-objcopy is searched, or--objcopy). The YAML splits that ROM, not the ELF, and getsplatform: ps2,compiler: EEGCC(or MWCCPS2 when a.mwcatssection exists),gp_valuefrom the ELF's MIPS reginfo and anld_gp_expressionbuilt from the first small-data section (Fact:Splat/behavior/PS2 create config output). - Sections become segments through the table in Fact:PS2 EE executable (ELF)/enum/splat ELF section mapping; the first run puts all normal sections in one segment named
cod, and starts a new segment per section only after a PROGBITS section follows a NOBITS one (for example around special sections such as.mfifo). - The ELF is accepted only if it is EXEC, e_machine 8 and has the R5900 flag (Fact:PS2 EE executable (ELF)/behavior/splat accepts only PS2 EXEC ELFs).
- The PS2 platform setup selects the EABI64 ABI, treats
jas a normal (not unconditional-branch) instruction and requires symbol alignment to follow section alignment (Fact:Splat/behavior/PS2 platform init). - Special PS2 segment types exist for
.ctor(words that are pointers to C++ global initialisers, disassembled as s32 references),.lit4,.lit8and.vtables; VU micro-code sections are only dumped as binary (textbin/databin, marked "no proper support yet" in the source).
Only the source was read here; the segment types were not run on a real PS2 ELF.
Code & repositories
- https://github.com/ethteck/splat @
7548b9771e6f8418507b23434187fb07741af6d4· license: MIT
Binary splitter for N64, PSX, PS2, PSP and GBA decompilation projects: YAML config, symbol_addrs.txt and linker script generation.
Tested on: source read, not run: Read the README and the configs of three projects that use it; not run · checked 2026-10-18; last activity 2026-10-10 - https://github.com/pmret/papermario @
1104f1f71b824042a5fa1f958f2d861b603320fd· license: none
Matching decompilation of Paper Mario (US, JP, PAL, iQue) with splat configs and symbol_addrs.txt per version
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-09-26; no license: not reusable