mirror of
https://github.com/encounter/dtk-template.git
synced 2025-08-13 23:59:07 +00:00
Support clean_extab feature
See documentation for more details.
This commit is contained in:
parent
30945827b0
commit
dbad3087b6
@ -96,6 +96,14 @@ export_all: true
|
||||
# See https://github.com/encounter/decomp-toolkit/blob/main/assets/ldscript.lcf
|
||||
ldscript_template: config/GAMEID/module/ldscript.tpl
|
||||
|
||||
# (optional) Scrub uninitialized data from the extab section.
|
||||
# Certain extab acctions contain uninitialized data from the compiler.
|
||||
# Affected games can use `dtk extab clean in.dol out.dol` to get a DOL with
|
||||
# the uninitialized data zeroed out. When targeting a cleaned DOL hash,
|
||||
# this option can be set to true to scrub the uninitialized data from
|
||||
# the extab section in the split objects.
|
||||
clean_extab: false
|
||||
|
||||
# (optional) Configuration for modules.
|
||||
modules:
|
||||
|
||||
|
@ -151,7 +151,7 @@ if not config.non_matching:
|
||||
# Tool versions
|
||||
config.binutils_tag = "2.42-1"
|
||||
config.compilers_tag = "20250520"
|
||||
config.dtk_tag = "v1.5.1"
|
||||
config.dtk_tag = "v1.6.0"
|
||||
config.objdiff_tag = "v3.0.0-beta.8"
|
||||
config.sjiswrap_tag = "v1.2.1"
|
||||
config.wibo_tag = "0.6.16"
|
||||
|
@ -54,6 +54,7 @@ class Object:
|
||||
"asflags": None,
|
||||
"asm_dir": None,
|
||||
"cflags": None,
|
||||
"clean_extab": None,
|
||||
"extra_asflags": [],
|
||||
"extra_cflags": [],
|
||||
"extra_clang_flags": [],
|
||||
@ -89,6 +90,7 @@ class Object:
|
||||
set_default("add_to_all", True)
|
||||
set_default("asflags", config.asflags)
|
||||
set_default("asm_dir", config.asm_dir)
|
||||
set_default("clean_extab", False)
|
||||
set_default("mw_version", config.linker_version)
|
||||
set_default("scratch_preset_id", config.scratch_preset_id)
|
||||
set_default("shift_jis", config.shift_jis)
|
||||
@ -646,6 +648,12 @@ def generate_build_ninja(
|
||||
mwcc_sjis_cmd = f"{wrapper_cmd}{sjiswrap} {mwcc} $cflags -MMD -c $in -o $basedir"
|
||||
mwcc_sjis_implicit: List[Optional[Path]] = [*mwcc_implicit, sjiswrap]
|
||||
|
||||
# MWCC with extab post-processing
|
||||
mwcc_extab_cmd = f"{CHAIN}{mwcc_cmd} && {dtk} extab clean $out $out"
|
||||
mwcc_extab_implicit: List[Optional[Path]] = [*mwcc_implicit, dtk]
|
||||
mwcc_sjis_extab_cmd = f"{CHAIN}{mwcc_sjis_cmd} && {dtk} extab clean $out $out"
|
||||
mwcc_sjis_extab_implicit: List[Optional[Path]] = [*mwcc_sjis_implicit, dtk]
|
||||
|
||||
# MWLD
|
||||
mwld = compiler_path / "mwldeppc.exe"
|
||||
mwld_cmd = f"{wrapper_cmd}{mwld} $ldflags -o $out @$out.rsp"
|
||||
@ -665,8 +673,12 @@ def generate_build_ninja(
|
||||
transform_dep = config.tools_dir / "transform_dep.py"
|
||||
mwcc_cmd += f" && $python {transform_dep} $basefile.d $basefile.d"
|
||||
mwcc_sjis_cmd += f" && $python {transform_dep} $basefile.d $basefile.d"
|
||||
mwcc_extab_cmd += f" && $python {transform_dep} $basefile.d $basefile.d"
|
||||
mwcc_sjis_extab_cmd += f" && $python {transform_dep} $basefile.d $basefile.d"
|
||||
mwcc_implicit.append(transform_dep)
|
||||
mwcc_sjis_implicit.append(transform_dep)
|
||||
mwcc_extab_implicit.append(transform_dep)
|
||||
mwcc_sjis_extab_implicit.append(transform_dep)
|
||||
|
||||
n.comment("Link ELF file")
|
||||
n.rule(
|
||||
@ -706,6 +718,25 @@ def generate_build_ninja(
|
||||
)
|
||||
n.newline()
|
||||
|
||||
n.comment("MWCC build (with extab post-processing)")
|
||||
n.rule(
|
||||
name="mwcc_extab",
|
||||
command=mwcc_extab_cmd,
|
||||
description="MWCC $out",
|
||||
depfile="$basefile.d",
|
||||
deps="gcc",
|
||||
)
|
||||
n.newline()
|
||||
|
||||
n.comment("MWCC build (with UTF-8 to Shift JIS wrapper and extab post-processing)")
|
||||
n.rule(
|
||||
name="mwcc_sjis_extab",
|
||||
command=mwcc_sjis_extab_cmd,
|
||||
description="MWCC $out",
|
||||
depfile="$basefile.d",
|
||||
deps="gcc",
|
||||
)
|
||||
|
||||
n.comment("Assemble asm")
|
||||
n.rule(
|
||||
name="as",
|
||||
@ -894,10 +925,21 @@ def generate_build_ninja(
|
||||
|
||||
# Add MWCC build rule
|
||||
lib_name = obj.options["lib"]
|
||||
build_rule = "mwcc"
|
||||
build_implcit = mwcc_implicit
|
||||
if obj.options["shift_jis"] and obj.options["clean_extab"]:
|
||||
build_rule = "mwcc_sjis_extab"
|
||||
build_implcit = mwcc_sjis_extab_implicit
|
||||
elif obj.options["shift_jis"]:
|
||||
build_rule = "mwcc_sjis"
|
||||
build_implcit = mwcc_sjis_implicit
|
||||
elif obj.options["clean_extab"]:
|
||||
build_rule = "mwcc_extab"
|
||||
build_implcit = mwcc_extab_implicit
|
||||
n.comment(f"{obj.name}: {lib_name} (linked {obj.completed})")
|
||||
n.build(
|
||||
outputs=obj.src_obj_path,
|
||||
rule="mwcc_sjis" if obj.options["shift_jis"] else "mwcc",
|
||||
rule=build_rule,
|
||||
inputs=src_path,
|
||||
variables={
|
||||
"mw_version": Path(obj.options["mw_version"]),
|
||||
@ -905,9 +947,7 @@ def generate_build_ninja(
|
||||
"basedir": os.path.dirname(obj.src_obj_path),
|
||||
"basefile": obj.src_obj_path.with_suffix(""),
|
||||
},
|
||||
implicit=(
|
||||
mwcc_sjis_implicit if obj.options["shift_jis"] else mwcc_implicit
|
||||
),
|
||||
implicit=build_implcit,
|
||||
order_only="pre-compile",
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user