mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-26 01:48:10 -07:00
Refactor asset packs to build properly with fbt
This commit is contained in:
@@ -67,6 +67,28 @@ def _dolphin_emitter(target, source, env):
|
||||
return target, source
|
||||
|
||||
|
||||
def _packs_emitter(target, source, env):
|
||||
source_dir = source[0]
|
||||
target_dir = target[0]
|
||||
env.Replace(_PACKS_OUT_DIR=target_dir)
|
||||
env.Replace(_PACKS_SRC_DIR=source_dir)
|
||||
|
||||
target = [
|
||||
target_dir.File(source_dir.rel_path(node))
|
||||
for node in env.GlobRecursive("*/Anims/manifest.txt", source_dir.srcnode())
|
||||
]
|
||||
target.extend(
|
||||
target_dir.File(source_dir.rel_path(node).removesuffix(".png") + ".bm")
|
||||
for node in env.GlobRecursive("*/Anims/**/*.png", source_dir.srcnode())
|
||||
)
|
||||
target.extend(
|
||||
target_dir.File(source_dir.rel_path(node).removesuffix(".png") + ".bmx")
|
||||
for node in env.GlobRecursive("*/Icons/**/*.png", source_dir.srcnode())
|
||||
)
|
||||
|
||||
return target, source
|
||||
|
||||
|
||||
def __invoke_git(args, source_dir):
|
||||
cmd = ["git"]
|
||||
cmd.extend(args)
|
||||
@@ -146,6 +168,7 @@ def generate(env):
|
||||
ICONSCOMSTR="\tICONS\t${TARGET}",
|
||||
PROTOCOMSTR="\tPROTO\t${SOURCE}",
|
||||
DOLPHINCOMSTR="\tDOLPHIN\t${DOLPHIN_RES_TYPE}",
|
||||
PACKSCOMSTR="\tPACKS\t${SOURCE}",
|
||||
PBVERCOMSTR="\tPBVER\t${TARGET}",
|
||||
)
|
||||
|
||||
@@ -218,6 +241,21 @@ def generate(env):
|
||||
),
|
||||
emitter=_dolphin_emitter,
|
||||
),
|
||||
"AssetPacksBuilder": Builder(
|
||||
action=Action(
|
||||
[
|
||||
[
|
||||
"${PYTHON3}",
|
||||
"${ASSETS_COMPILER}",
|
||||
"packs",
|
||||
"${_PACKS_SRC_DIR}",
|
||||
"${_PACKS_OUT_DIR}",
|
||||
],
|
||||
],
|
||||
"${PACKSCOMSTR}",
|
||||
),
|
||||
emitter=_packs_emitter,
|
||||
),
|
||||
"ProtoVerBuilder": Builder(
|
||||
action=Action(
|
||||
_proto_ver_generator,
|
||||
|
||||
Reference in New Issue
Block a user