sotn-decomp/diff_settings.py
Luciano Ciccariello 5362c8b8da
Add ST/WRP from PSP (#1172)
Extract ST/WRP out of #1119 . All the function symbols should have been
cross-referenced. There as some PSX functions missing from PSP and some
new functions from PSP that are not present on PSX (e.g.
`st_init_wrp.c`).

The files `st_debug.c` and `e_breakable.c` are shared between WRP PSX
and WRP PSP. Everything else from PSP is isolated into its own folder. I
had to do some tricks on the YAML config to allow shared code.

`ST_WRP_MERGE = st_debug e_breakable` in the `Makefile` is a bit
annoying as MWCC complains about every single minute detail from the C
source that has been already decompiled for the PSX US build.

`EntityWarpSmallRocks` is matching on PSP but I couldn't extract the
rodata without having a bunch of linker errors. This might be a Splat
issue. I need to investigate further.

`func_psp_09244760` is soooo interesting. The values from `0x11` to
`0x17` matches the Entity IDs that are unique to the WRP overlay. This
aligns to what we have in `typedef enum EntityIDs`.

Overall I am very excited to the recent discoveries from the PSP build!
2024-05-25 11:56:06 -07:00

101 lines
3.6 KiB
Python

#!/usr/bin/env python3
import os
def add_custom_arguments(parser):
parser.add_argument(
"--version",
default=None,
dest="version",
help="Decide what version of the game to use (us, jp12, pspeu, etc.)",
)
parser.add_argument(
"--overlay",
default="dra",
dest="overlay",
help="Defines which overlay to use for the diff (main, dra, st/mad, etc.)",
)
def apply_psx_base(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"{name}.bin").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [f"src/{name}", "include", f"asm/{version}/{name}"]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_bin(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"BIN/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [f"src/{name}", "include", f"asm/{version}/{name}"]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_servant(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"SERVANT/{name}.bin").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [
f"src/servant/{name}",
"include",
f"asm/{version}/servant/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_weapon(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"SERVANT/{name}.bin").upper()
config["myimg"] = f"build/{version}/weapon/w0_{name[2:]}.bin"
config["mapfile"] = f"build/{version}/weapon/w0_{name[2:]}.map"
config["source_directories"] = [
f"src/weapon/{name}",
"include",
f"asm/{version}/weapon/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_stage(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"ST/{name}/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/st{name}.map"
config["source_directories"] = [
f"src/st/{name}",
f"src/st/{name}_psp",
"include",
f"asm/{version}/st/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_saturn(config, name):
config["arch"] = "sh2"
config["baseimg"] = f"disks/saturn" + (f"/{name}.PRG").upper()
config["myimg"] = f"build/saturn" + (f"/{name}.PRG").upper()
config["mapfile"] = f"build/saturn/{name}.map"
config["source_directories"] = [f"src/saturn/"]
config["objdump_executable"] = "sh-elf-objdump"
def apply(config, args):
version = args.version or os.getenv("VERSION") or "us"
if version == "saturn":
apply_saturn(config, args.overlay)
else:
name = args.overlay or "dra"
if name.startswith("st/"):
apply_psx_stage(config, version, name[3:])
elif name.startswith("tt_"):
apply_psx_servant(config, version, name)
elif name.startswith("w_"):
apply_psx_weapon(config, version, name)
elif name == "dra" or name == "main":
apply_psx_base(config, version, name)
else:
apply_psx_bin(config, version, name)
config["arch"] = "mipsel:4000" if version == "pspeu" else "mipsel"
config["objdump_executable"] = "mipsel-linux-gnu-objdump"