From 0c228d0bac3fa3b8847cc831b8f97ce83ea92c86 Mon Sep 17 00:00:00 2001 From: Adam Gashlin Date: Sun, 9 Jul 2023 19:10:21 -0700 Subject: [PATCH] Allow a str+wav header to end at table1 Fixes Bad Boys: Miami Takedown (aka Bad Boys II) (PC) --- src/meta/str_wav.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/meta/str_wav.c b/src/meta/str_wav.c index 18fc59d9..3fa77f3e 100644 --- a/src/meta/str_wav.c +++ b/src/meta/str_wav.c @@ -583,11 +583,17 @@ static int parse_header(STREAMFILE* sf_h, STREAMFILE* sf_b, strwav_header* strwa return 1; } + /* Bad Boys II (PC)[2004] */ /* Pac-Man World 3 (PC)[2005] */ if ((read_u32be(0x04,sf_h) == 0x00000800 || read_u32be(0x04,sf_h) == 0x01000800) && /* rare, mu_spectral1_explore_2 */ read_u32le(0x24,sf_h) == read_u32le(0x114,sf_h) && /* sample rate repeat */ - read_u32le(0x130,sf_h) + read_u32le(0x134,sf_h) * 0x40 == header_size /* ~0x140 + cues */ + ( + // check if the header ends at table1 (Bad Boys) + read_u32le(0x128,sf_h) * 0x4 + read_u32le(0x12c, sf_h) == header_size || + // otherwise it ends at table2 + read_u32le(0x130,sf_h) + read_u32le(0x134,sf_h) * 0x40 == header_size /* ~0x140 + cues */ + ) ) { /* 0x08: null */ /* 0x0c: hashname */