Support basic custom TU injection for foresta for modding purposes

This commit is contained in:
Cuyler36
2025-10-30 00:02:53 -04:00
parent 09d09071c2
commit e2d9c7ae87
2 changed files with 25 additions and 0 deletions
+21
View File
@@ -4988,8 +4988,29 @@ config.libs = [
Object(Matching, "data/model/int_yos_wheel.c",),
],
),
# custom TUs to be injected into foresta.rel (for modding).
# anything added here should also go into config.add_objects[1].
# example:
# under 'game_custom' lib: Object(Matching, "src/path/to/my/custom/c_file.c"),
# under config.add_obejcts[1]: ""src/path/to/my/custom/c_file.c""
{
"lib": "game_custom",
"cflags": cflags_foresta,
"objects": [
# Object(Matching, "src/path/to/my/custom/c_file.c"),
],
},
]
config.add_objects = {
# module_id => object names
# module_id 0 is DOL
# module_id 1 is foresta.rel
1: [
# "src/path/to/my/custom/c_file.c",
],
}
# Define our custom asset processing scripts
config.custom_build_rules = [
{
+4
View File
@@ -1107,6 +1107,10 @@ def generate_build_ninja(
},
module_link_step,
)
# Add custom TUs into the REL
if config.non_matching:
for unit_name in config.add_objects.get(module["module_id"], []):
add_unit({"object": None, "name": unit_name, "autogenerated": False}, module_link_step)
link_steps.append(module_link_step)
n.newline()