From 4500ffb579a8fb13b62bf1aff32d4f237f11b674 Mon Sep 17 00:00:00 2001 From: Gregory Heskett Date: Tue, 2 Jul 2024 23:53:46 -0400 Subject: [PATCH] Bugfix: assemble_sound.py build corruption issues (#813) --- tools/assemble_sound.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/assemble_sound.py b/tools/assemble_sound.py index 64141e66..885b1022 100755 --- a/tools/assemble_sound.py +++ b/tools/assemble_sound.py @@ -781,10 +781,15 @@ def write_sequences( defines, is_shindou, ): - bank_names = sorted( - [os.path.splitext(os.path.basename(x))[0] for x in os.listdir(sound_bank_dir)] + bank_names = [] + banks = sorted( + [os.path.basename(x) for x in os.listdir(sound_bank_dir)] ) + for x in banks: + if x.endswith(".json"): + bank_names.append(os.path.splitext(x)[0]) + try: with open(seq_json, "r") as inf: data = inf.read() @@ -842,6 +847,15 @@ def write_sequences( while ind_to_name and json.get(ind_to_name[-1]) is None: ind_to_name.pop() + if ind_to_name: + for x in range(len(ind_to_name)): + if ind_to_name[x] is None: + fail( + "Sequence file index jump detected. " + + "Please make sure your sequence files are labeled correctly " + + "in incremental hexadecimal order." + ) + def serialize_file(name, ser, is_shindou): if json.get(name) is None: return