Updated VGMStream to r1050-2900-g8638b219
This commit is contained in:
parent
53bfe785bb
commit
798cc4ce43
2 changed files with 85 additions and 65 deletions
|
@ -773,36 +773,36 @@ fail:
|
||||||
|
|
||||||
/* EA Harmony Sample Bank - used in 8th gen EA Sports games */
|
/* EA Harmony Sample Bank - used in 8th gen EA Sports games */
|
||||||
VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE *streamFile) {
|
||||||
uint32_t num_dsets, set_sounds, chunk_id;
|
uint32_t num_dsets, set_sounds, chunk_id, data_offset, table_offset, dset_offset, base_offset, sound_table_offset, sound_offset;
|
||||||
uint32_t i;
|
uint32_t i, j;
|
||||||
uint8_t set_type, flag, offset_size;
|
uint8_t set_type, flag, offset_size;
|
||||||
off_t data_offset, table_offset, dset_offset, base_offset, sound_table_offset, sound_offset;
|
char sound_name[STREAM_NAME_SIZE];
|
||||||
STREAMFILE *sbsFile = NULL, *streamData = NULL;
|
STREAMFILE *sbsFile = NULL, *streamData = NULL;
|
||||||
VGMSTREAM *vgmstream = NULL;
|
VGMSTREAM *vgmstream = NULL;
|
||||||
int target_stream = streamFile->stream_index, total_sounds, local_target, is_streamed = 0;
|
int target_stream = streamFile->stream_index, total_sounds, local_target, is_streamed = 0;
|
||||||
int32_t(*read_32bit)(off_t, STREAMFILE*);
|
uint32_t(*read_u32)(off_t, STREAMFILE*);
|
||||||
int16_t(*read_16bit)(off_t, STREAMFILE*);
|
uint16_t(*read_u16)(off_t, STREAMFILE*);
|
||||||
|
|
||||||
if (!check_extensions(streamFile, "sbr"))
|
if (!check_extensions(streamFile, "sbr"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (read_32bitBE(0x00, streamFile) == 0x53426C65) { /* "SBle" */
|
|
||||||
read_32bit = read_32bitLE;
|
|
||||||
read_16bit = read_16bitLE;
|
|
||||||
/* Logically, big endian version starts with SBbe. However, this format is
|
/* Logically, big endian version starts with SBbe. However, this format is
|
||||||
* only used on 8th gen systems so far so big endian version probably doesn't exist. */
|
* only used on 8th gen systems so far so big endian version probably doesn't exist. */
|
||||||
|
if (read_32bitBE(0x00, streamFile) == 0x53426C65) { /* "SBle" */
|
||||||
|
read_u32 = read_u32le;
|
||||||
|
read_u16 = read_u16le;
|
||||||
#if 0
|
#if 0
|
||||||
} else if (read_32bitBE(0x00, streamFile) == 0x53426265) { /* "SBbe" */
|
} else if (read_32bitBE(0x00, streamFile) == 0x53426265) { /* "SBbe" */
|
||||||
read_32bit = read_32bitBE;
|
read_32bit = read_u32be;
|
||||||
read_16bit = read_16bitBE;
|
read_16bit = read_u16be;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_dsets = read_16bit(0x0a, streamFile);
|
num_dsets = read_u16(0x0a, streamFile);
|
||||||
data_offset = read_32bit(0x20, streamFile);
|
data_offset = read_u32(0x20, streamFile);
|
||||||
table_offset = read_32bit(0x24, streamFile);
|
table_offset = read_u32(0x24, streamFile);
|
||||||
|
|
||||||
if (target_stream == 0) target_stream = 1;
|
if (target_stream == 0) target_stream = 1;
|
||||||
if (target_stream < 0)
|
if (target_stream < 0)
|
||||||
|
@ -814,23 +814,24 @@ VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE *streamFile) {
|
||||||
/* The bank is split into DSET sections each of which references one or multiple sounds. */
|
/* The bank is split into DSET sections each of which references one or multiple sounds. */
|
||||||
/* Each set can contain RAM sounds (stored in SBR in data section) or streamed sounds (stored separately in SBS file). */
|
/* Each set can contain RAM sounds (stored in SBR in data section) or streamed sounds (stored separately in SBS file). */
|
||||||
for (i = 0; i < num_dsets; i++) {
|
for (i = 0; i < num_dsets; i++) {
|
||||||
dset_offset = read_32bit(table_offset + 0x08 * i, streamFile);
|
dset_offset = read_u32(table_offset + 0x08 * i, streamFile);
|
||||||
if (read_32bit(dset_offset, streamFile) != 0x44534554) /* "DSET" */
|
if (read_u32(dset_offset, streamFile) != 0x44534554) /* "DSET" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
set_sounds = read_32bit(dset_offset + 0x38, streamFile);
|
set_sounds = read_u32(dset_offset + 0x38, streamFile);
|
||||||
local_target = target_stream - total_sounds - 1;
|
local_target = target_stream - total_sounds - 1;
|
||||||
dset_offset += 0x48;
|
dset_offset += 0x48;
|
||||||
|
|
||||||
/* Find RAM or OFF chunk */
|
/* Find RAM or OFF chunk */
|
||||||
while(1) {
|
while(1) {
|
||||||
chunk_id = read_32bit(dset_offset, streamFile);
|
chunk_id = read_u32(dset_offset, streamFile);
|
||||||
if (chunk_id == 0x2E52414D) { /* ".RAM" */
|
if (chunk_id == 0x2E52414D) { /* ".RAM" */
|
||||||
break;
|
break;
|
||||||
} else if (chunk_id == 0x2E4F4646) { /* ".OFF" */
|
} else if (chunk_id == 0x2E4F4646) { /* ".OFF" */
|
||||||
break;
|
break;
|
||||||
} else if (chunk_id == 0x2E4C4452 || /* ".LDR" */
|
} else if (chunk_id == 0x2E4C4452 || /* ".LDR" */
|
||||||
chunk_id == 0x2E4F424A || /* ".OBJ" */
|
chunk_id == 0x2E4F424A || /* ".OBJ" */
|
||||||
|
chunk_id == 0x2E445552 || /* ".DUR" */
|
||||||
(chunk_id & 0xFF00FFFF) == 0x2E00534C) { /* ".?SL */
|
(chunk_id & 0xFF00FFFF) == 0x2E00534C) { /* ".?SL */
|
||||||
dset_offset += 0x18;
|
dset_offset += 0x18;
|
||||||
} else {
|
} else {
|
||||||
|
@ -839,59 +840,76 @@ VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE *streamFile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Different set types store offsets differently */
|
/* Different set types store offsets differently */
|
||||||
set_type = read_8bit(dset_offset + 0x05, streamFile);
|
set_type = read_u8(dset_offset + 0x05, streamFile);
|
||||||
|
|
||||||
if (set_type == 0x00) {
|
if (set_type == 0x00) {
|
||||||
total_sounds++;
|
total_sounds++;
|
||||||
if (local_target < 0 || local_target > 0)
|
if (local_target < 0 || local_target > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sound_offset = read_32bit(dset_offset + 0x08, streamFile);
|
sound_offset = read_u32(dset_offset + 0x08, streamFile);
|
||||||
} else if (set_type == 0x01) {
|
} else if (set_type == 0x01) {
|
||||||
total_sounds += 2;
|
total_sounds += 2;
|
||||||
if (local_target < 0 || local_target > 1)
|
if (local_target < 0 || local_target > 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
base_offset = read_32bit(dset_offset + 0x08, streamFile);
|
base_offset = read_u32(dset_offset + 0x08, streamFile);
|
||||||
|
|
||||||
if (local_target == 0) {
|
if (local_target == 0) {
|
||||||
sound_offset = base_offset;
|
sound_offset = base_offset;
|
||||||
} else {
|
} else {
|
||||||
sound_offset = base_offset + (uint16_t)read_16bit(dset_offset + 0x06, streamFile);
|
sound_offset = base_offset + read_u16(dset_offset + 0x06, streamFile);
|
||||||
}
|
|
||||||
} else if (set_type == 0x02 || set_type == 0x03) {
|
|
||||||
flag = read_8bit(dset_offset + 0x06, streamFile);
|
|
||||||
offset_size = read_8bit(dset_offset + 0x07, streamFile);
|
|
||||||
base_offset = read_32bit(dset_offset + 0x08, streamFile);
|
|
||||||
sound_table_offset = read_32bit(dset_offset + 0x10, streamFile);
|
|
||||||
|
|
||||||
if (offset_size == 0x04 && flag != 0x00) {
|
|
||||||
set_sounds = base_offset;
|
|
||||||
}
|
}
|
||||||
|
} else if (set_type == 0x02) {
|
||||||
|
flag = read_u8(dset_offset + 0x06, streamFile);
|
||||||
|
offset_size = read_u8(dset_offset + 0x07, streamFile);
|
||||||
|
base_offset = read_u32(dset_offset + 0x08, streamFile);
|
||||||
|
sound_table_offset = read_u32(dset_offset + 0x10, streamFile);
|
||||||
|
|
||||||
total_sounds += set_sounds;
|
total_sounds += set_sounds;
|
||||||
if (local_target < 0 || local_target >= set_sounds)
|
if (local_target < 0 || local_target >= set_sounds)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (offset_size == 0x02) {
|
if (offset_size == 0x01) {
|
||||||
sound_offset = (uint16_t)read_16bit(sound_table_offset + 0x02 * local_target, streamFile);
|
sound_offset = read_u8(sound_table_offset + 0x01 * local_target, streamFile);
|
||||||
if (flag != 0x00) sound_offset *= (off_t)pow(2, flag);
|
for (j = 0; j < flag; j++) sound_offset *= 2;
|
||||||
sound_offset += base_offset;
|
} else if (offset_size == 0x02) {
|
||||||
|
sound_offset = read_u16(sound_table_offset + 0x02 * local_target, streamFile);
|
||||||
|
for (j = 0; j < flag; j++) sound_offset *= 2;
|
||||||
} else if (offset_size == 0x04) {
|
} else if (offset_size == 0x04) {
|
||||||
sound_offset = read_32bit(sound_table_offset + 0x04 * local_target, streamFile);
|
sound_offset = read_u32(sound_table_offset + 0x04 * local_target, streamFile);
|
||||||
if (flag == 0x00) sound_offset += base_offset;
|
}
|
||||||
|
|
||||||
|
sound_offset += base_offset;
|
||||||
|
} else if (set_type == 0x03) {
|
||||||
|
offset_size = read_u8(dset_offset + 0x07, streamFile);
|
||||||
|
set_sounds = read_u32(dset_offset + 0x08, streamFile);
|
||||||
|
sound_table_offset = read_u32(dset_offset + 0x10, streamFile);
|
||||||
|
|
||||||
|
total_sounds += set_sounds;
|
||||||
|
if (local_target < 0 || local_target >= set_sounds)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (offset_size == 0x01) {
|
||||||
|
sound_offset = read_u8(sound_table_offset + 0x01 * local_target, streamFile);
|
||||||
|
} else if (offset_size == 0x02) {
|
||||||
|
sound_offset = read_u16(sound_table_offset + 0x02 * local_target, streamFile);
|
||||||
|
} else if (offset_size == 0x04) {
|
||||||
|
sound_offset = read_u32(sound_table_offset + 0x04 * local_target, streamFile);
|
||||||
}
|
}
|
||||||
} else if (set_type == 0x04) {
|
} else if (set_type == 0x04) {
|
||||||
total_sounds += set_sounds;
|
total_sounds += set_sounds;
|
||||||
if (local_target < 0 || local_target >= set_sounds)
|
if (local_target < 0 || local_target >= set_sounds)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sound_table_offset = read_32bit(dset_offset + 0x10, streamFile);
|
sound_table_offset = read_u32(dset_offset + 0x10, streamFile);
|
||||||
sound_offset = read_32bit(sound_table_offset + 0x08 * local_target, streamFile);
|
sound_offset = read_u32(sound_table_offset + 0x08 * local_target, streamFile);
|
||||||
} else {
|
} else {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(sound_name, STREAM_NAME_SIZE, "DSET %02d/%04d", i, local_target);
|
||||||
|
|
||||||
if (chunk_id == 0x2E52414D) { /* ".RAM" */
|
if (chunk_id == 0x2E52414D) { /* ".RAM" */
|
||||||
is_streamed = 0;
|
is_streamed = 0;
|
||||||
} else if (chunk_id == 0x2E4F4646) { /* ".OFF" */
|
} else if (chunk_id == 0x2E4F4646) { /* ".OFF" */
|
||||||
|
@ -931,6 +949,7 @@ VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE *streamFile) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
vgmstream->num_streams = total_sounds;
|
vgmstream->num_streams = total_sounds;
|
||||||
|
strncpy(vgmstream->stream_name, sound_name, STREAM_NAME_SIZE);
|
||||||
close_streamfile(sbsFile);
|
close_streamfile(sbsFile);
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,7 @@ VGMSTREAM * init_vgmstream_ea_abk(STREAMFILE *streamFile) {
|
||||||
entry_offset = table_offset + 0x04 + 0x0C * k;
|
entry_offset = table_offset + 0x04 + 0x0C * k;
|
||||||
sound_type = read_8bit(entry_offset + 0x00, streamFile);
|
sound_type = read_8bit(entry_offset + 0x00, streamFile);
|
||||||
|
|
||||||
/* some of these dummies pointing at sound 0 in BNK */
|
/* some of these are dummies pointing at sound 0 in BNK */
|
||||||
if (sound_type == 0x00 && read_32bit(entry_offset + 0x04, streamFile) == 0)
|
if (sound_type == 0x00 && read_32bit(entry_offset + 0x04, streamFile) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -475,9 +475,10 @@ fail:
|
||||||
/* EA HDR/DAT v1 (2004-2005) - used for storing speech and other streamed sounds (except for music) */
|
/* EA HDR/DAT v1 (2004-2005) - used for storing speech and other streamed sounds (except for music) */
|
||||||
VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
||||||
int target_stream = streamFile->stream_index;
|
int target_stream = streamFile->stream_index;
|
||||||
|
uint32_t offset_mult;
|
||||||
uint8_t userdata_size, total_sounds;
|
uint8_t userdata_size, total_sounds;
|
||||||
size_t dat_size;
|
size_t dat_size;
|
||||||
off_t schl_offset, offset_mult;
|
off_t schl_offset;
|
||||||
STREAMFILE *datFile = NULL;
|
STREAMFILE *datFile = NULL;
|
||||||
VGMSTREAM *vgmstream;
|
VGMSTREAM *vgmstream;
|
||||||
|
|
||||||
|
@ -488,8 +489,7 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
||||||
/* main header is machine endian but it's not important here */
|
/* main header is machine endian but it's not important here */
|
||||||
/* 0x00: ID */
|
/* 0x00: ID */
|
||||||
/* 0x02: sub-ID (used for different police voices in NFS games) */
|
/* 0x02: sub-ID (used for different police voices in NFS games) */
|
||||||
/* 0x04: (low nibble) userdata size */
|
/* 0x04: parameters (userdata size, ...)
|
||||||
/* 0x04: (high nibble) ??? */
|
|
||||||
/* 0x05: number of files */
|
/* 0x05: number of files */
|
||||||
/* 0x06: alt number of files? */
|
/* 0x06: alt number of files? */
|
||||||
/* 0x07: offset multiplier flag */
|
/* 0x07: offset multiplier flag */
|
||||||
|
@ -498,11 +498,11 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
||||||
/* 0x0c: table start */
|
/* 0x0c: table start */
|
||||||
|
|
||||||
/* no nice way to validate these so we do what we can */
|
/* no nice way to validate these so we do what we can */
|
||||||
if (read_16bitBE(0x0a, streamFile) != 0)
|
if (read_u16be(0x0a, streamFile) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* first offset is always zero */
|
/* first offset is always zero */
|
||||||
if (read_16bitBE(0x0c, streamFile) != 0)
|
if (read_u16be(0x0c, streamFile) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* must be accompanied by DAT file with SCHl sounds */
|
/* must be accompanied by DAT file with SCHl sounds */
|
||||||
|
@ -510,19 +510,19 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
||||||
if (!datFile)
|
if (!datFile)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (read_32bitBE(0x00, datFile) != EA_BLOCKID_HEADER)
|
if (read_u32be(0x00, datFile) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
userdata_size = read_8bit(0x04, streamFile) & 0x0F;
|
userdata_size = read_u8(0x04, streamFile) & 0x0F;
|
||||||
total_sounds = read_8bit(0x05, streamFile);
|
total_sounds = read_u8(0x05, streamFile);
|
||||||
offset_mult = (uint8_t)read_8bit(0x07, streamFile) * 0x0100 + 0x0100;
|
offset_mult = read_u8(0x07, streamFile) * 0x0100 + 0x0100;
|
||||||
|
|
||||||
if (read_8bit(0x06, streamFile) > total_sounds)
|
if (read_u8(0x06, streamFile) > total_sounds)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
dat_size = get_streamfile_size(datFile);
|
dat_size = get_streamfile_size(datFile);
|
||||||
if ((uint16_t)read_16bitLE(0x08, streamFile) * offset_mult > dat_size &&
|
if (read_u16le(0x08, streamFile) * offset_mult > dat_size &&
|
||||||
(uint16_t)read_16bitBE(0x08, streamFile) * offset_mult > dat_size)
|
read_u16be(0x08, streamFile) * offset_mult > dat_size)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (target_stream == 0) target_stream = 1;
|
if (target_stream == 0) target_stream = 1;
|
||||||
|
@ -530,7 +530,7 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE *streamFile) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* offsets are always big endian */
|
/* offsets are always big endian */
|
||||||
schl_offset = (uint16_t)read_16bitBE(0x0C + (0x02 + userdata_size) * (target_stream - 1), streamFile) * offset_mult;
|
schl_offset = read_u16be(0x0C + (0x02 + userdata_size) * (target_stream - 1), streamFile) * offset_mult;
|
||||||
if (read_32bitBE(schl_offset, datFile) != EA_BLOCKID_HEADER)
|
if (read_32bitBE(schl_offset, datFile) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -550,9 +550,10 @@ fail:
|
||||||
/* EA HDR/DAT v2 (2006-2014) */
|
/* EA HDR/DAT v2 (2006-2014) */
|
||||||
VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
||||||
int target_stream = streamFile->stream_index;
|
int target_stream = streamFile->stream_index;
|
||||||
|
uint32_t offset_mult;
|
||||||
uint8_t userdata_size, total_sounds;
|
uint8_t userdata_size, total_sounds;
|
||||||
size_t dat_size;
|
size_t dat_size;
|
||||||
off_t schl_offset, offset_mult;
|
off_t schl_offset;
|
||||||
STREAMFILE *datFile = NULL;
|
STREAMFILE *datFile = NULL;
|
||||||
VGMSTREAM *vgmstream;
|
VGMSTREAM *vgmstream;
|
||||||
|
|
||||||
|
@ -562,7 +563,7 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
||||||
|
|
||||||
/* main header is machine endian but it's not important here */
|
/* main header is machine endian but it's not important here */
|
||||||
/* 0x00: ID */
|
/* 0x00: ID */
|
||||||
/* 0x02: userdata size */
|
/* 0x02: parameters (userdata size, ...) */
|
||||||
/* 0x03: number of files */
|
/* 0x03: number of files */
|
||||||
/* 0x04: sub-ID (used for different police voices in NFS games) */
|
/* 0x04: sub-ID (used for different police voices in NFS games) */
|
||||||
/* 0x08: alt number of files? */
|
/* 0x08: alt number of files? */
|
||||||
|
@ -572,11 +573,11 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
||||||
/* 0x10: table start */
|
/* 0x10: table start */
|
||||||
|
|
||||||
/* no nice way to validate these so we do what we can */
|
/* no nice way to validate these so we do what we can */
|
||||||
if (read_32bitBE(0x0c, streamFile) != 0)
|
if (read_u32be(0x0c, streamFile) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* first offset is always zero */
|
/* first offset is always zero */
|
||||||
if (read_16bitBE(0x10, streamFile) != 0)
|
if (read_u16be(0x10, streamFile) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* must be accompanied by DAT file with SCHl sounds */
|
/* must be accompanied by DAT file with SCHl sounds */
|
||||||
|
@ -584,19 +585,19 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
||||||
if (!datFile)
|
if (!datFile)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (read_32bitBE(0x00, datFile) != EA_BLOCKID_HEADER)
|
if (read_u32be(0x00, datFile) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
userdata_size = read_8bit(0x02, streamFile);
|
userdata_size = read_u8(0x02, streamFile) & 0x0F;
|
||||||
total_sounds = read_8bit(0x03, streamFile);
|
total_sounds = read_u8(0x03, streamFile);
|
||||||
offset_mult = (uint8_t)read_8bit(0x09, streamFile) * 0x0100 + 0x0100;
|
offset_mult = read_u8(0x09, streamFile) * 0x0100 + 0x0100;
|
||||||
|
|
||||||
if (read_8bit(0x08, streamFile) > total_sounds)
|
if (read_u8(0x08, streamFile) > total_sounds)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
dat_size = get_streamfile_size(datFile);
|
dat_size = get_streamfile_size(datFile);
|
||||||
if ((uint16_t)read_16bitLE(0x0a, streamFile) * offset_mult != dat_size &&
|
if (read_u16le(0x0a, streamFile) * offset_mult > dat_size &&
|
||||||
(uint16_t)read_16bitBE(0x0a, streamFile) * offset_mult != dat_size)
|
read_u16be(0x0a, streamFile) * offset_mult > dat_size)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (target_stream == 0) target_stream = 1;
|
if (target_stream == 0) target_stream = 1;
|
||||||
|
@ -604,7 +605,7 @@ VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE *streamFile) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* offsets are always big endian */
|
/* offsets are always big endian */
|
||||||
schl_offset = (uint16_t)read_16bitBE(0x10 + (0x02 + userdata_size) * (target_stream - 1), streamFile) * offset_mult;
|
schl_offset = read_u16be(0x10 + (0x02 + userdata_size) * (target_stream - 1), streamFile) * offset_mult;
|
||||||
if (read_32bitBE(schl_offset, datFile) != EA_BLOCKID_HEADER)
|
if (read_32bitBE(schl_offset, datFile) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue