Fix TXTH default subfile size

This commit is contained in:
bnnm 2019-10-06 23:32:41 +02:00
parent 2ed3d8c00d
commit 786c75aa73

View File

@ -552,8 +552,15 @@ static VGMSTREAM *init_subfile(txth_header * txth) {
STREAMFILE * streamSubfile = NULL;
if (txth->subfile_size == 0)
txth->subfile_size = txth->data_size - txth->subfile_offset;
if (txth->subfile_size == 0) {
if (txth->data_size_set)
txth->subfile_size = txth->data_size;
else
txth->subfile_size = txth->data_size - txth->subfile_offset;
if (txth->subfile_size + txth->subfile_offset > get_streamfile_size(txth->streamBody))
txth->subfile_size = get_streamfile_size(txth->streamBody) - txth->subfile_offset;
}
if (txth->subfile_extension[0] == '\0')
get_streamfile_ext(txth->streamFile,txth->subfile_extension,sizeof(txth->subfile_extension));