ninja dis: New phony for disassembling the game

This commit is contained in:
Aetias
2025-05-19 19:12:02 +02:00
parent 8c46d1c7ba
commit fc33dc8574
+26
View File
@@ -172,6 +172,9 @@ class Project:
def arm9_o(self) -> Path:
return self.game_build / "arm9.o"
def arm9_disassembly_dir(self) -> Path:
return self.game_build / "asm"
def objdiff_report(self) -> Path:
return self.game_build / "report.json"
@@ -227,6 +230,12 @@ def main():
)
n.newline()
n.rule(
name="disassemble",
command=f"{DSD} {DSD_BASE_FLAGS} dis --config-path $config_path --asm-path $output_path --ual"
)
n.newline()
# -MMD excludes all includes instead of just system includes for some reason, so use -MD instead.
mwcc_cmd = f'{WINE} "{CC}" {CC_FLAGS} {CC_INCLUDES} $cc_flags -d $game_version -MD -c $in -o $basedir'
mwcc_implicit = [CC]
@@ -312,12 +321,15 @@ def main():
add_download_tool_builds(n, project)
add_extract_build(n, project)
add_delink_and_lcf_builds(n, project)
add_disassemble_builds(n, project)
add_mwcc_builds(n, project, mwcc_implicit)
add_mwld_and_rom_builds(n, project)
add_check_builds(n, project)
add_objdiff_builds(n, project)
add_configure_build(n, project)
n.default(["objdiff", "check", "sha1"])
def add_download_tool_builds(n: ninja_syntax.Writer, project: Project):
if args.dsd is None:
@@ -541,6 +553,20 @@ def add_delink_and_lcf_builds(n: ninja_syntax.Writer, project: Project):
n.newline()
def add_disassemble_builds(n: ninja_syntax.Writer, project: Project):
n.build(
inputs=project.dsd_configs(),
implicit=DSD,
rule="disassemble",
outputs="dis",
variables={
"config_path": str(project.arm9_config_yaml()),
"output_path": str(project.arm9_disassembly_dir()),
}
)
n.newline()
def add_check_builds(n: ninja_syntax.Writer, project: Project):
n.build(
inputs=str(project.arm9_o()),