diff --git a/tools/configure.py b/tools/configure.py index df13abd1..d9e1016a 100755 --- a/tools/configure.py +++ b/tools/configure.py @@ -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()),