mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
commit
83b463bffd
@ -314,7 +314,7 @@ VGMSTREAM * init_vgmstream_ea_sbr(STREAMFILE *streamFile) {
|
||||
uint32_t i, num_sounds, type_desc;
|
||||
uint16_t num_metas, meta_type;
|
||||
off_t table_offset, types_offset, entry_offset, metas_offset, data_offset, snr_offset, sns_offset;
|
||||
STREAMFILE *sbsFile = NULL, *streamData = NULL;
|
||||
STREAMFILE *sbsFile = NULL;
|
||||
VGMSTREAM *vgmstream = NULL;
|
||||
int target_stream = streamFile->stream_index;
|
||||
|
||||
@ -359,13 +359,30 @@ VGMSTREAM * init_vgmstream_ea_sbr(STREAMFILE *streamFile) {
|
||||
}
|
||||
}
|
||||
|
||||
if (snr_offset == 0xFFFFFFFF)
|
||||
if (snr_offset == 0xFFFFFFFF && sns_offset == 0xFFFFFFFF)
|
||||
goto fail;
|
||||
|
||||
if (sns_offset == 0xFFFFFFFF) {
|
||||
if (snr_offset == 0xFFFFFFFF) {
|
||||
/* SPS file */
|
||||
sbsFile = open_streamfile_by_ext(streamFile, "sbs");
|
||||
if (!sbsFile)
|
||||
goto fail;
|
||||
|
||||
if (read_32bitBE(0x00, sbsFile) != 0x53424B53) /* "SBKS" */
|
||||
goto fail;
|
||||
|
||||
snr_offset = sns_offset;
|
||||
sns_offset = snr_offset + (read_32bitBE(snr_offset, sbsFile) & 0x00FFFFFF);
|
||||
snr_offset += 0x04;
|
||||
vgmstream = init_vgmstream_eaaudiocore_header(sbsFile, sbsFile, snr_offset, sns_offset, meta_EA_SNR_SNS);
|
||||
if (!vgmstream)
|
||||
goto fail;
|
||||
} else if (sns_offset == 0xFFFFFFFF) {
|
||||
/* RAM asset */
|
||||
streamData = streamFile;
|
||||
sns_offset = snr_offset + get_snr_size(streamFile, snr_offset);
|
||||
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, snr_offset, sns_offset, meta_EA_SNR_SNS);
|
||||
if (!vgmstream)
|
||||
goto fail;
|
||||
} else {
|
||||
/* streamed asset */
|
||||
sbsFile = open_streamfile_by_ext(streamFile, "sbs");
|
||||
@ -375,13 +392,11 @@ VGMSTREAM * init_vgmstream_ea_sbr(STREAMFILE *streamFile) {
|
||||
if (read_32bitBE(0x00, sbsFile) != 0x53424B53) /* "SBKS" */
|
||||
goto fail;
|
||||
|
||||
streamData = sbsFile;
|
||||
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, sbsFile, snr_offset, sns_offset, meta_EA_SNR_SNS);
|
||||
if (!vgmstream)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamData, snr_offset, sns_offset, meta_EA_SNR_SNS);
|
||||
if (!vgmstream)
|
||||
goto fail;
|
||||
|
||||
vgmstream->num_streams = num_sounds;
|
||||
close_streamfile(sbsFile);
|
||||
return vgmstream;
|
||||
|
@ -377,7 +377,7 @@ VGMSTREAM * init_vgmstream_ea_abk(STREAMFILE *streamFile) {
|
||||
if (!bnk_offset)
|
||||
goto fail;
|
||||
|
||||
bnk_target_stream = read_32bit(target_entry_offset + 0x04, streamFile) + 1;
|
||||
bnk_target_stream = read_32bit(target_entry_offset + 0x04, streamFile);
|
||||
vgmstream = parse_bnk_header(streamFile, bnk_offset, bnk_target_stream, 1);
|
||||
if (!vgmstream)
|
||||
goto fail;
|
||||
@ -873,7 +873,7 @@ static VGMSTREAM * parse_bnk_header(STREAMFILE *streamFile, off_t offset, int ta
|
||||
goto fail;
|
||||
|
||||
entry_offset = offset + table_offset + 0x04 * target_stream;
|
||||
header_offset = entry_offset + read_32bit(offset + entry_offset, streamFile);
|
||||
header_offset = entry_offset + read_32bit(entry_offset, streamFile);
|
||||
} else {
|
||||
/* some of these are dummies with zero offset, skip them when opening standalone BNK */
|
||||
for (i = 0; i < num_sounds; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user