sotn-decomp/diff_settings.py
Luciano Ciccariello d91155004a
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
MAR duplicates (#1618)
Matches 72% of the entire overlay in one go. Around 80% of the overlay
code is made of duplicate function.

A few observations:
* `func_us_8018AC0C` seems to be an older, buggy version of
`func_801B246C` and it seem to indicate `ObjInit2` was either a `u16`
array or there were macros involved.
* `e_breakable` is the same function, but the data changes in most
overlays; I had to pull the data out. The SFX ID is also different.

Data handled through the asset manager and BSS will come as part of a
separate PR.
2024-09-16 18:19:29 +01:00

120 lines
4.3 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_psx_boss(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"BOSS/{name}/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/bo{name}.map"
config["source_directories"] = [
f"src/boss/{name}",
f"src/boss/{name}_psp",
"include",
f"asm/{version}/boss/{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("st"):
apply_psx_stage(config, version, name[2:])
elif name.startswith("bo/"):
apply_psx_boss(config, version, name[3:])
elif name.startswith("bo"):
apply_psx_boss(config, version, name[2:])
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"