mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Fix EA SCHl ATRAC3 crash
This commit is contained in:
parent
0b88604183
commit
59ff127548
@ -101,6 +101,8 @@ typedef struct {
|
|||||||
int big_endian;
|
int big_endian;
|
||||||
int loop_flag;
|
int loop_flag;
|
||||||
int codec_config;
|
int codec_config;
|
||||||
|
|
||||||
|
size_t stream_size;
|
||||||
} ea_header;
|
} ea_header;
|
||||||
|
|
||||||
static VGMSTREAM * parse_schl_block(STREAMFILE *streamFile, off_t offset, int standalone);
|
static VGMSTREAM * parse_schl_block(STREAMFILE *streamFile, off_t offset, int standalone);
|
||||||
@ -1177,6 +1179,7 @@ static VGMSTREAM * init_vgmstream_ea_variable_header(STREAMFILE *streamFile, ea_
|
|||||||
if (!temp_streamFile) goto fail;
|
if (!temp_streamFile) goto fail;
|
||||||
|
|
||||||
start_offset = 0x00; /* must point to the custom streamfile's beginning */
|
start_offset = 0x00; /* must point to the custom streamfile's beginning */
|
||||||
|
ea->stream_size = get_streamfile_size(temp_streamFile);
|
||||||
|
|
||||||
ffmpeg_data = init_ffmpeg_offset(temp_streamFile, start_offset, get_streamfile_size(temp_streamFile));
|
ffmpeg_data = init_ffmpeg_offset(temp_streamFile, start_offset, get_streamfile_size(temp_streamFile));
|
||||||
close_streamfile(temp_streamFile);
|
close_streamfile(temp_streamFile);
|
||||||
@ -1203,6 +1206,8 @@ static VGMSTREAM * init_vgmstream_ea_variable_header(STREAMFILE *streamFile, ea_
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vgmstream->stream_size = ea->stream_size;
|
||||||
|
|
||||||
/* open files; channel offsets are updated below */
|
/* open files; channel offsets are updated below */
|
||||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -1635,16 +1640,23 @@ fail:
|
|||||||
|
|
||||||
static void update_ea_stream_size_and_samples(STREAMFILE* streamFile, off_t start_offset, VGMSTREAM *vgmstream, int standalone) {
|
static void update_ea_stream_size_and_samples(STREAMFILE* streamFile, off_t start_offset, VGMSTREAM *vgmstream, int standalone) {
|
||||||
uint32_t block_id;
|
uint32_t block_id;
|
||||||
int32_t num_samples;
|
int32_t num_samples = 0;
|
||||||
size_t stream_size, file_size;
|
size_t stream_size = 0, file_size;
|
||||||
int multiple_schl;
|
int multiple_schl = 0;
|
||||||
|
|
||||||
stream_size = 0, num_samples = 0, multiple_schl = 0;
|
|
||||||
file_size = get_streamfile_size(streamFile);
|
file_size = get_streamfile_size(streamFile);
|
||||||
vgmstream->next_block_offset = start_offset;
|
|
||||||
|
|
||||||
|
/* formats with custom codecs */
|
||||||
|
if (vgmstream->layout_type != layout_blocked_ea_schl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* manually read totals */
|
||||||
|
block_update(start_offset, vgmstream);
|
||||||
while (vgmstream->next_block_offset < file_size) {
|
while (vgmstream->next_block_offset < file_size) {
|
||||||
block_update_ea_schl(vgmstream->next_block_offset, vgmstream);
|
block_update_ea_schl(vgmstream->next_block_offset, vgmstream);
|
||||||
|
if (vgmstream->current_block_samples < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
block_id = read_32bitBE(vgmstream->current_block_offset + 0x00, streamFile);
|
block_id = read_32bitBE(vgmstream->current_block_offset + 0x00, streamFile);
|
||||||
if (block_id == EA_BLOCKID_END) { /* banks should never contain movie "SHxx" */
|
if (block_id == EA_BLOCKID_END) { /* banks should never contain movie "SHxx" */
|
||||||
@ -1678,6 +1690,7 @@ static void update_ea_stream_size_and_samples(STREAMFILE* streamFile, off_t star
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vgmstream->stream_size == 0)
|
||||||
vgmstream->stream_size = stream_size;
|
vgmstream->stream_size = stream_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user