Merge pull request #526 from NicknineTheEagle/musx

Musx
This commit is contained in:
NicknineTheEagle 2019-12-05 20:06:21 +03:00 committed by GitHub
commit f70327d7b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -239,7 +239,7 @@ static int ps_find_loop_offsets_internal(STREAMFILE *streamFile, off_t start_off
int detect_full_loops = config & 1;
if (data_size == 0 || channels == 0 || (channels > 0 && interleave == 0))
if (data_size == 0 || channels == 0 || (channels > 1 && interleave == 0))
return 0;
while (offset < max_offset) {

View File

@ -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 */