Improve Tiger .com validations and lower priority

This commit is contained in:
bnnm 2022-05-01 18:57:22 +02:00
parent 1849395b8e
commit 61e82459b2
2 changed files with 18 additions and 6 deletions

View File

@ -2,24 +2,36 @@
#include "../coding/coding.h"
/* Tiger Game.com ADPCM file */
VGMSTREAM * init_vgmstream_tgc(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
VGMSTREAM* init_vgmstream_tgc(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
uint16_t size;
off_t start_offset;
/* checks */
if (!check_extensions(streamFile, "4"))
if (read_u8(0x00, sf) != 0)
goto fail;
if (!check_extensions(sf, "4"))
goto fail;
size = read_u16be(0x01, sf);
if (size != get_streamfile_size(sf))
goto fail;
start_offset = 0x03;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(1, 0);
if (!vgmstream) goto fail;
vgmstream->sample_rate = 8000;
vgmstream->num_samples = ((uint16_t)read_16bitBE(1, streamFile) - 3) * 2;
vgmstream->num_samples = (size - 0x03) * 2;
vgmstream->meta_type = meta_TGC;
vgmstream->layout_type = layout_none;
vgmstream->coding_type = coding_TGC;
if (!vgmstream_open_stream(vgmstream, streamFile, 3))
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;

View File

@ -470,7 +470,6 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_csb,
init_vgmstream_fwse,
init_vgmstream_fda,
init_vgmstream_tgc,
init_vgmstream_kwb,
init_vgmstream_lrmd,
init_vgmstream_bkhd,
@ -538,6 +537,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_seb,
init_vgmstream_ps2_pnb,
init_vgmstream_sli_ogg,
init_vgmstream_tgc,
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */