diff --git a/bnk-extract/bin.h b/bnk-extract/bin.h index 3b64596..9a3d22c 100644 --- a/bnk-extract/bin.h +++ b/bnk-extract/bin.h @@ -7,6 +7,7 @@ struct string_hash { char* string; uint32_t hash; + uint32_t random_container_id; uint32_t switch_id; }; typedef LIST(struct string_hash) StringHashes; diff --git a/bnk-extract/extract.c b/bnk-extract/extract.c index c628347..a901374 100644 --- a/bnk-extract/extract.c +++ b/bnk-extract/extract.c @@ -73,7 +73,11 @@ StringWithChildren* group_wems(AudioDataList* audio_data, StringHashes* string_h current_root = try_insert(current_root, switch_id); } current_root = try_insert(current_root, current_event->string); - + if (current_event->random_container_id) { + char random_container_id[11]; + sprintf(random_container_id, "%u", current_event->random_container_id); + current_root = try_insert(current_root, random_container_id); + } char wem_name[15]; sprintf(wem_name, "%u.wem", current_audio_data->id); add_object(current_root, (&(StringWithChildren) {.string = strdup(wem_name), .wemData = current_audio_data})); diff --git a/bnk-extract/sound.c b/bnk-extract/sound.c index de80fac..2114232 100644 --- a/bnk-extract/sound.c +++ b/bnk-extract/sound.c @@ -582,7 +582,7 @@ WemInformation* bnk_extract(int argc, char* argv[]) if (sounds.objects[k].sound_object_id == event_action->sound_object_id || sounds.objects[k].self_id == event_action->sound_object_id) { dprintf("Found one!\n"); v_printf(2, "Hash %u of string %s belongs to file \"%u.wem\".\n", hash, read_strings->objects[i].string, sounds.objects[k].file_id); - add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, sounds.objects[k].file_id, 0})); + add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, sounds.objects[k].file_id, 0, 0})); } } for (uint32_t k = 0; k < music_segments.length; k++) { @@ -594,7 +594,7 @@ WemInformation* bnk_extract(int argc, char* argv[]) dprintf("Found one 1!\n"); for (uint32_t m = 0; m < music_track->track_count; m++) { v_printf(2, "Hash %u of string %s belongs to file \"%u.wem\".\n", hash, read_strings->objects[i].string, music_track->file_ids[m]); - add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, music_track->file_ids[m], 0 /*music_segments.objects[k].self_id*/})); + add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, music_track->file_ids[m], 0, 0 /*music_segments.objects[k].self_id*/})); } } } @@ -627,7 +627,7 @@ WemInformation* bnk_extract(int argc, char* argv[]) dprintf("sound id amount? %u\n", random_containers.objects[k].sound_id_amount); dprintf("Found one precisely here.\n"); v_printf(2, "Hash %u of string %s belongs to file \"%u.wem\".\n", hash, read_strings->objects[i].string, sounds.objects[m].file_id); - add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, sounds.objects[m].file_id, random_containers.objects[k].self_id})); + add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, sounds.objects[m].file_id, random_containers.objects[k].self_id, 0})); } } } @@ -642,7 +642,7 @@ WemInformation* bnk_extract(int argc, char* argv[]) if (music_track->switch_ids[l] == event_action->switch_id) { dprintf("Found one 3!\n"); v_printf(2, "Hash %u of string %s belongs to file \"%u.wem\".\n", hash, read_strings->objects[i].string, music_track->file_ids[l]); - add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, music_track->file_ids[l], music_track->switch_group_id})); + add_object(&string_files, (&(struct string_hash) {read_strings->objects[i].string, music_track->file_ids[l], 0, music_track->switch_group_id})); } } }