mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Fix some .baf [James Bond 007: Blood Stone (X360)]
This commit is contained in:
parent
3dc52c5fae
commit
a49d9851a1
@ -27,7 +27,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
/* 0x04: bank size */
|
/* 0x04: bank size */
|
||||||
version = read_32bit(0x08,streamFile);
|
version = read_32bit(0x08,streamFile);
|
||||||
if (version != 0x03 && version != 0x04)
|
if (version != 0x03 && version != 0x04 && version != 0x05)
|
||||||
goto fail;
|
goto fail;
|
||||||
total_subsongs = read_32bit(0x0c,streamFile);
|
total_subsongs = read_32bit(0x0c,streamFile);
|
||||||
if (target_subsong == 0) target_subsong = 1;
|
if (target_subsong == 0) target_subsong = 1;
|
||||||
@ -35,7 +35,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
|||||||
/* - in v3 */
|
/* - in v3 */
|
||||||
/* 0x10: 0? */
|
/* 0x10: 0? */
|
||||||
/* 0x11: bank name */
|
/* 0x11: bank name */
|
||||||
/* - in v4 */
|
/* - in v4/5 */
|
||||||
/* 0x10: 1? */
|
/* 0x10: 1? */
|
||||||
/* 0x11: padding flag? */
|
/* 0x11: padding flag? */
|
||||||
/* 0x12: bank name */
|
/* 0x12: bank name */
|
||||||
@ -49,6 +49,11 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
|||||||
if (i+1 == target_subsong)
|
if (i+1 == target_subsong)
|
||||||
break;
|
break;
|
||||||
offset += read_32bit(offset+0x04, streamFile); /* WAVE size, variable per codec */
|
offset += read_32bit(offset+0x04, streamFile); /* WAVE size, variable per codec */
|
||||||
|
|
||||||
|
/* skip companion "CUE " (found in 007: Blood Stone, contains segment cues) */
|
||||||
|
if (read_32bitBE(offset+0x00, streamFile) == 0x43554520) {
|
||||||
|
offset += read_32bit(offset+0x04, streamFile); /* CUE size */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
header_offset = offset;
|
header_offset = offset;
|
||||||
}
|
}
|
||||||
@ -60,38 +65,63 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
|||||||
name_offset = header_offset + 0x0c;
|
name_offset = header_offset + 0x0c;
|
||||||
start_offset = read_32bit(header_offset+0x2c, streamFile);
|
start_offset = read_32bit(header_offset+0x2c, streamFile);
|
||||||
stream_size = read_32bit(header_offset+0x30, streamFile);
|
stream_size = read_32bit(header_offset+0x30, streamFile);
|
||||||
|
|
||||||
switch(codec) {
|
switch(codec) {
|
||||||
case 0x03:
|
case 0x03:
|
||||||
switch(version) {
|
switch(version) {
|
||||||
case 0x03: /* Geometry Wars (PC) */
|
case 0x03: /* Geometry Wars (PC) */
|
||||||
sample_rate = read_32bit(header_offset + 0x38, streamFile);
|
sample_rate = read_32bit(header_offset+0x38, streamFile);
|
||||||
channel_count = read_32bit(header_offset + 0x40, streamFile);
|
channel_count = read_32bit(header_offset+0x40, streamFile);
|
||||||
/* no actual flag, just loop +15sec songs */
|
/* no actual flag, just loop +15sec songs */
|
||||||
loop_flag = (pcm_bytes_to_samples(stream_size, channel_count, 16) > 15*sample_rate);
|
loop_flag = (pcm_bytes_to_samples(stream_size, channel_count, 16) > 15*sample_rate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x04: /* Project Gotham Racing 4 (X360) */
|
case 0x04: /* Project Gotham Racing 4 (X360) */
|
||||||
sample_rate = read_32bit(header_offset + 0x3c, streamFile);
|
sample_rate = read_32bit(header_offset+0x3c, streamFile);
|
||||||
channel_count = read_32bit(header_offset + 0x44, streamFile);
|
channel_count = read_32bit(header_offset+0x44, streamFile);
|
||||||
loop_flag = read_8bit(header_offset+0x4b, streamFile);
|
loop_flag = read_8bit(header_offset+0x4b, streamFile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07: /* Blur (PS3) */
|
case 0x07:
|
||||||
sample_rate = read_32bit(header_offset+0x40, streamFile);
|
switch(version) {
|
||||||
loop_flag = read_8bit(header_offset+0x48, streamFile);
|
case 0x04: /* Blur (PS3) */
|
||||||
channel_count = read_8bit(header_offset+0x4b, streamFile);
|
case 0x05: /* James Bond 007: Blood Stone (X360) */
|
||||||
|
sample_rate = read_32bit(header_offset+0x40, streamFile);
|
||||||
|
loop_flag = read_8bit(header_offset+0x48, streamFile);
|
||||||
|
channel_count = read_8bit(header_offset+0x4b, streamFile);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x08: /* Project Gotham Racing (X360) */
|
|
||||||
sample_rate = read_32bit(header_offset+0x3c, streamFile);
|
case 0x08:
|
||||||
channel_count = read_32bit(header_offset+0x44, streamFile);
|
switch(version) {
|
||||||
loop_flag = read_8bit(header_offset+0x54, streamFile) != 0;
|
case 0x04: /* Project Gotham Racing (X360) */
|
||||||
|
sample_rate = read_32bit(header_offset+0x3c, streamFile);
|
||||||
|
channel_count = read_32bit(header_offset+0x44, streamFile);
|
||||||
|
loop_flag = read_8bit(header_offset+0x54, streamFile) != 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x05: /* James Bond 007: Blood Stone (X360) */
|
||||||
|
sample_rate = read_32bit(header_offset+0x40, streamFile);
|
||||||
|
channel_count = read_32bit(header_offset+0x48, streamFile);
|
||||||
|
loop_flag = read_8bit(header_offset+0x58, streamFile) != 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VGM_LOG("BAF: unknown version %x\n", version);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
/* others: pan/vol? fixed values? (0x19, 0x10) */
|
/* others: pan/vol? fixed values? (0x19, 0x10) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user