From 37d0614b855d7a9dc50253033e508905d59e802a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Aug 2025 22:27:30 -0400 Subject: [PATCH] sync script update --- dump_effect_sbin.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/dump_effect_sbin.py b/dump_effect_sbin.py index d27325366..d8cc477f9 100644 --- a/dump_effect_sbin.py +++ b/dump_effect_sbin.py @@ -3,6 +3,8 @@ import dataclasses import os import re import struct +import subprocess +import tempfile import typing ROM_VADDR = 0x08000000 @@ -128,14 +130,14 @@ def dump_efbg( if effect_header.unk8 != 0 and effect_header.unkC != 0: baserom.seek(effect_header.unkC - ROM_VADDR) - binfilename = f"{dir}/{prefix}_unkC.4bpp" + binfilename = f"{dir}/{prefix}.4bpp" with open(binfilename, "wb") as ofp: ofp.write(baserom.read(32 * (effect_header.unk8 + 1))) addrs[effect_header.unkC] = binfilename if effect_header.unk10 != 0: baserom.seek(effect_header.unk10 - ROM_VADDR) - binfilename = f"{dir}/{prefix}_unk10.pmdpal" + binfilename = f"{dir}/{prefix}.pmdpal" with open(binfilename, "wb") as ofp: ofp.write(baserom.read(0x400)) addrs[effect_header.unk10] = binfilename @@ -378,6 +380,30 @@ def dump_effect_sbin( except Exception as e: raise ValueError(f"failed to process {prefix}") from e + subprocess.check_call( + [ + "tools/gbagfx/gbagfx", + f"{dir}/{prefix}.pmdpal", + f"{dir}/{prefix}.pal", + ] + ) + with tempfile.NamedTemporaryFile(suffix=".gbapal") as gbapal: + subprocess.check_call( + ["tools/gbagfx/gbagfx", f"{dir}/{prefix}.pal", gbapal.name] + ) + png_args = [ + "tools/gbagfx/gbagfx", + f"{dir}/{prefix}.4bpp", + f"{dir}/{prefix}.png", + "-palette", + gbapal.name, + ] + if prefix.startswith("efob"): + png_args.append("-object") + else: + assert gbapal.truncate(32) == 32 + subprocess.check_call(png_args) + def main(): pat = re.compile(r'\[\d+\] = \{ "(\w+)", &gUnknown_([0-9A-F]{7}), \},')