From 23fa661f4a6758d8f66c5433ec4c2498c167ab66 Mon Sep 17 00:00:00 2001 From: NicknineTheEagle Date: Tue, 3 Dec 2019 22:20:03 +0300 Subject: [PATCH] MUSX: Added support for a v10 variation [Spider-Man 4 (Wii)] --- src/meta/musx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/meta/musx.c b/src/meta/musx.c index 4413ffb7..b6fb5045 100644 --- a/src/meta/musx.c +++ b/src/meta/musx.c @@ -358,7 +358,10 @@ static int parse_musx(STREAMFILE *streamFile, musx_header *musx) { /* 0x1c: null */ /* 0x20: hash */ musx->tables_offset = 0; /* no tables */ - musx->big_endian = (musx->platform == 0x5749495F || musx->platform == 0x5053335F); /* "GC__" / "PS3_" (only after header) */ + musx->big_endian = (musx->platform == 0x47435F5F || /* "GC__" */ + musx->platform == 0x58455F5F || /* "XE__" */ + musx->platform == 0x5053335F || /* "PS3_" */ + musx->platform == 0x5749495F); /* "WII_" */ break; default: @@ -444,6 +447,7 @@ static int parse_musx(STREAMFILE *streamFile, musx_header *musx) { uint32_t miniheader = read_32bitBE(0x40, streamFile); switch(miniheader) { case 0x44415434: /* "DAT4" */ + case 0x44415435: /* "DAT5" */ case 0x44415438: /* "DAT8" */ /* found on PS3/Wii (but not always?) */ musx->stream_size = read_32bitLE(0x44, streamFile); @@ -452,7 +456,14 @@ static int parse_musx(STREAMFILE *streamFile, musx_header *musx) { musx->loops_offset = 0x50; break; default: - musx->loops_offset = 0x30; + if (read_32bitBE(0x30, streamFile) == 0x00 && + read_32bitBE(0x34, streamFile) == 0x00) { + /* no subheader [Spider-Man 4 (Wii)] */ + musx->loops_offset = 0x00; + } else { + /* loop info only [G-Force (PS3)] */ + musx->loops_offset = 0x30; + } break; } } @@ -535,9 +546,6 @@ static int parse_musx(STREAMFILE *streamFile, musx_header *musx) { musx->channels = 1; } - - VGM_LOG("to=%lx, %lx, %x\n", target_offset, musx->stream_offset, musx->stream_size); - if (coef_size == 0) musx->coefs_offset = 0; /* disable for later detection */