sotn-decomp/tools
Luciano Ciccariello 791e321b43
Add TT_000 overlay from PSP (#1113)
TT_000 is the first overlay from PlayStation 1 that we are now able to
compile from the source and produce a 1:1 binary. This lead me to start
exploring the same overlay from the game Castlevania: Dracula X
Chronicles, which contains a PSP re-build of Symphony of the Night.

This PR adds all the infrastructure to add the same flow for a PSP
matching decomp. Use `export VERSION=pspeu` and then the usual `sotn`
command to splat the overlay, build it and check if it matches. Running
`make extract_disk` should not be necessary as the same ISO used from
`VERSION=hd` is also used for `pspeu`, so you will probably have it
extracted already.

Some important notes about the PSP build:
* The whole PSP build seems to be compiled with `-O0`, which makes it
much easier to decompile
* Having ŧhe PSX, PSP and Saturn builds will allow to easily
cross-reference the code and reduce fake matches
* `disks/pspeu/PSP_GAME/USRDIR/res/ps/hdbin/tt_000.bin` is the HD PSX
build
* `disks/pspeu/PSP_GAME/USRDIR/res/ps/PSPBIN/tt_000.bin` has the same
code from the HD build, but for PSP
* `disks/pspeu/PSP_GAME/USRDIR/res/ps/PACK_E/TP00.BIN` is the same as
above, but it packs both overlay and graphics. This is the file the PSP
game seems to actually use
* The PSP build uses the Metrowerk CodeWarrior's C compiler, which is
very different from the GCC one used on PSX.
* Thanks to @mkst lead, we found a way to still use the GNU assembler
and linker
* MWCC uses [wibo](https://github.com/decompals/WiBo/), a think
compatibility layer to run Windows CLI tools on Linux. It is much more
lightweight than Wine.
* MWCC does not support the `INCLUDE_ASM` dialect, so the custom
pre-processor `tools/mwcpp` had to be created
* The exact MWCC compiler version is unknown, but I suspect it is `build
147`
* I am not yet sure of any implications for using GNU AS and GNU LD
instead of the MW correspondent tools
* Not all the functions can be correctly disassembled, spimdisasm will
just produce a bunch of `.word 0x________` due to the in-progress effort
of adding the Allegrex-specific opcodes support

---

TO-DO list before marking the PR as ready:
- [X] Add PSP build to the CI
- [x] Add progress reporting to the PSP build
- [x] Integrate source file from `src/servant/tt_000_psp` to
`src/servant/tt_000` to promote the psp build as first-citizen

---

TO-DO in a follow-up PR:
* Figure out what `header` is: can we extract it as assembly code? or
maybe as custom re-compilable asset via splat? Is it a MW stuff or a
Castlevania-specific file?
 * Get rid of the last line in `Makefile.psp.mk`
2024-04-21 02:18:10 +01:00
..
asm-differ@e8bddb0257 Update external tools (#764) 2023-11-19 13:44:44 +00:00
dups Add duplicates report to dups tool (#467) 2023-08-14 09:22:35 -07:00
function_finder Allow function_finder to filter on keywords (#875) 2023-12-20 11:52:18 -05:00
gfxsotn Add tool to export stage graphics into a PNG 2022-11-20 14:04:21 +00:00
lints/sotn-lint Rewrite lints, lint more FIX (#439) 2023-08-05 11:36:00 -07:00
m2c@beb457dabf Update external tools (#764) 2023-11-19 13:44:44 +00:00
maspsx@db2947b709 Update maspsx (#1100) 2024-03-15 14:04:57 -07:00
n64splat@828c34950b TT_000 import BSS section (#1110) 2024-04-03 23:26:07 +01:00
saturn-splitter@8d549a8042 Split saturn libs, add function (#385) 2023-07-21 22:39:37 +01:00
sotn_str POC for JP sotn_strs (#986) 2024-01-17 08:27:17 +00:00
sotn-debugmodule Dedupe DestroyEntity (#920) 2023-12-31 10:54:07 +00:00
sotn-disk Patch DRA stages when rebuilding the disk image 2023-02-21 11:20:04 +00:00
splat_ext Allow spritesheet to be extracted from the CLI (#1035) 2024-02-05 21:57:48 +00:00
split_jpt_yaml Format code 2023-07-25 17:38:30 +00:00
vab-ex Sound effect extraction WIP (#398) 2023-07-31 12:12:07 -07:00
analyze_calls.py DRA RenderEntities (non matching) (#1034) 2024-02-06 10:54:35 -08:00
bin2c.py Format code 2023-07-25 17:38:30 +00:00
decompile.py PSXSDK: libgpu ext, sys (#862) 2023-12-18 16:27:54 -05:00
dirt_patcher.py Import 4A538, demo and 5087C data (#835) 2023-12-12 10:36:34 -08:00
gfxstage.py Split BIN/WEAPON0.BIN (#154) 2023-08-10 23:56:40 +01:00
m2ctx.py Format code 2023-09-19 22:25:08 +00:00
mwcpp_test.py Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
mwcpp.py Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
permuter_settings.toml mostly renamings, one func (#33) 2023-01-02 08:57:53 +00:00
png2bin.py Split BIN/WEAPON0.BIN (#154) 2023-08-10 23:56:40 +01:00
png2s.py Extract BIN/F_GAME.BIN (#886) 2023-12-25 19:23:25 +00:00
progress.py Add main progress (#1051) 2024-02-10 10:37:13 +00:00
requirements-debian.txt Dockerless Saturn build (#266) 2023-06-19 20:10:09 +01:00
requirements-python.txt Add TT_000 overlay from PSP (#1113) 2024-04-21 02:18:10 +01:00
richter_symbols.py Format code 2023-07-25 17:38:30 +00:00
spritesheet.py Add spritesheet tool (#441) 2023-08-06 07:14:14 +01:00
symbols_test.py Extract and document all functions from main.exe (#736) 2023-11-06 14:53:27 -08:00
symbols.py Pass undefined_syms files to linker (#1065) 2024-02-18 14:57:03 +00:00
tools.mk Add tool to automatically perform symbols cross referencing (#413) 2023-07-31 12:14:57 -07:00
update.h Rename two global timers (#624) 2023-09-22 23:42:06 +01:00