Don't call block_update_x manually when using vgmstream_open_stream

This commit is contained in:
bnnm 2018-08-26 13:47:48 +02:00
parent c2a0311584
commit bc62a689c0
24 changed files with 83 additions and 144 deletions

View File

@ -2,7 +2,7 @@
#include "../layout/layout.h"
/* for reading integers inexplicably packed into 80 bit floats */
/* for reading integers inexplicably packed into 80-bit ('double extended') floats */
static uint32_t read80bitSANE(off_t offset, STREAMFILE *streamFile) {
uint8_t buf[10];
int32_t exponent;
@ -286,10 +286,6 @@ VGMSTREAM * init_vgmstream_aifc(STREAMFILE *streamFile) {
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
if (vgmstream->layout_type == layout_blocked_xa_aiff)
block_update_xa_aiff(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -156,13 +156,8 @@ VGMSTREAM * init_vgmstream_awc(STREAMFILE *streamFile) {
}
/* open files; channel offsets are updated below */
if (!vgmstream_open_stream(vgmstream,streamFile,awc.stream_offset))
goto fail;
if (vgmstream->layout_type == layout_blocked_awc)
block_update_awc(awc.stream_offset, vgmstream);
return vgmstream;
fail:

View File

@ -54,9 +54,6 @@ VGMSTREAM * init_vgmstream_caf(STREAMFILE *streamFile) {
if ( !vgmstream_open_stream(vgmstream,streamFile,start_offset) )
goto fail;
block_update_caf(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -13,14 +13,16 @@ VGMSTREAM * init_vgmstream_dec(STREAMFILE *streamFile) {
int loop_flag, channel_count, sample_rate, loop_start = 0, loop_end = 0;
/* check extension (.dec: main, .de2: Gurumin) */
/* checks
* .dec: main,
* .de2: Gurumin (PC) */
if ( !check_extensions(streamFile,"dec,de2") )
goto fail;
/* Gurumin has extra data, maybe related to rhythm (~0x50000) */
if (check_extensions(streamFile,"de2")) {
/* still not sure what this is for, but consistently 0xb */
if (read_32bitLE(0x04,streamFile) != 0xb) goto fail;
if (read_32bitLE(0x04,streamFile) != 0x0b) goto fail;
/* legitimate! really! */
riff_off = 0x10 + (read_32bitLE(0x0c,streamFile) ^ read_32bitLE(0x04,streamFile));
@ -67,6 +69,7 @@ VGMSTREAM * init_vgmstream_dec(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_DEC;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = pcm_size / 2 / channel_count;
vgmstream->loop_start_sample = loop_start;
@ -76,14 +79,8 @@ VGMSTREAM * init_vgmstream_dec(STREAMFILE *streamFile) {
vgmstream->interleave_block_size = 0x800;
vgmstream->layout_type = layout_blocked_dec;
vgmstream->meta_type = meta_DEC;
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
block_update_dec(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -97,12 +97,9 @@ VGMSTREAM * init_vgmstream_ea_1snh(STREAMFILE *streamFile) {
goto fail;
}
/* open files; channel offsets are updated below */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
block_update_ea_1snh(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -676,10 +676,6 @@ static VGMSTREAM * init_vgmstream_eaaudiocore_header(STREAMFILE * streamHead, ST
if (!vgmstream_open_stream(vgmstream,temp_streamFile ? temp_streamFile : streamData,start_offset))
goto fail;
if (vgmstream->layout_type == layout_blocked_ea_sns)
block_update_ea_sns(start_offset, vgmstream);
close_streamfile(temp_streamFile);
return vgmstream;

View File

@ -75,14 +75,8 @@ VGMSTREAM * init_vgmstream_ea_schl_fixed(STREAMFILE *streamFile) {
}
/* open files; channel offsets are updated below */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
/* setup first block to update offsets */
block_update_ea_schl(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -61,7 +61,7 @@ VGMSTREAM * init_vgmstream_ea_swvr(STREAMFILE *streamFile) {
total_subsongs = 1;
block_id = read_32bit(start_offset, streamFile);
/* files are basically headerless so we inspect blocks the first block
/* files are basically headerless so we inspect the first block
* Freekstyle uses multiblocks/subsongs (though some subsongs may be clones?) */
switch(block_id) {
case 0x5641474D: /* "VAGM" */
@ -121,12 +121,12 @@ VGMSTREAM * init_vgmstream_ea_swvr(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_EA_SWVR;
vgmstream->sample_rate = sample_rate;
vgmstream->codec_endian = big_endian;
vgmstream->num_streams = total_subsongs;
vgmstream->stream_size = get_streamfile_size(streamFile) / total_subsongs; /* approx... */
vgmstream->meta_type = meta_EA_SWVR;
vgmstream->coding_type = coding;
vgmstream->layout_type = layout_blocked_ea_swvr;
/* DSP coefs are loaded per block */
@ -141,7 +141,7 @@ VGMSTREAM * init_vgmstream_ea_swvr(STREAMFILE *streamFile) {
vgmstream->stream_index = target_subsong; /* needed to skip other subsong-blocks */
vgmstream->next_block_offset = start_offset;
do {
block_update_ea_swvr(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
switch(vgmstream->coding_type) {
case coding_PSX: num_samples = ps_bytes_to_samples(vgmstream->current_block_size,1); break;
case coding_NGC_DSP: num_samples = dsp_bytes_to_samples(vgmstream->current_block_size,1); break;
@ -151,6 +151,7 @@ VGMSTREAM * init_vgmstream_ea_swvr(STREAMFILE *streamFile) {
vgmstream->num_samples += num_samples;
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
if (loop_flag) {
@ -158,7 +159,6 @@ VGMSTREAM * init_vgmstream_ea_swvr(STREAMFILE *streamFile) {
vgmstream->loop_end_sample = vgmstream->num_samples;
}
block_update_ea_swvr(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -39,14 +39,13 @@ VGMSTREAM * init_vgmstream_ea_wve_ad10(STREAMFILE *streamFile) {
{
vgmstream->next_block_offset = start_offset;
do {
block_update_ea_wve_ad10(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
block_update_ea_wve_ad10(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -28,8 +28,8 @@ VGMSTREAM * init_vgmstream_ea_wve_au00(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = 22050;
vgmstream->meta_type = meta_EA_WVE_AU00;
vgmstream->sample_rate = 22050;
/* You'd think they'd use coding_EA_XA_int but instead it's PS-ADPCM without flags and 0x0f frame size
* (equivalent to configurable PS-ADPCM), surely to shoehorn EA-XA sizes into the PS1 hardware decoder */
@ -44,13 +44,13 @@ VGMSTREAM * init_vgmstream_ea_wve_au00(STREAMFILE *streamFile) {
{
vgmstream->next_block_offset = start_offset;
do {
block_update_ea_wve_au00(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += ps_cfg_bytes_to_samples(vgmstream->current_block_size, vgmstream->interleave_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
block_update_ea_wve_au00(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -2,10 +2,10 @@
#include "../layout/layout.h"
#include "../coding/coding.h"
/* GSP+GSB - from Tecmo's Super Swing Golf 1 & 2 (WII), Quantum Theory (PS3/X360) */
/* GSP+GSB - from Tecmo's Super Swing Golf 1 & 2 (Wii), Quantum Theory (PS3/X360) */
VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
STREAMFILE * streamFileGSP = NULL;
STREAMFILE * streamHeader = NULL;
int loop_flag, channel_count;
off_t start_offset, chunk_offset, first_offset;
size_t datasize;
@ -16,68 +16,70 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) {
if (!check_extensions(streamFile,"gsb"))
goto fail;
streamFileGSP = open_streamfile_by_ext(streamFile, "gsp");
if (!streamFileGSP) goto fail;
streamHeader = open_streamfile_by_ext(streamFile, "gsp");
if (!streamHeader) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFileGSP) != 0x47534E44) /* "GSND" */
if (read_32bitBE(0x00,streamHeader) != 0x47534E44) /* "GSND" */
goto fail;
/* 0x04: version?, 0x08: 1?, 0x0c: 0?, */
first_offset = read_32bitBE(0x10,streamFileGSP); /* usually 0x14*/
first_offset = read_32bitBE(0x10,streamHeader); /* usually 0x14*/
if (!find_chunk_be(streamHeader, 0x44415441,first_offset,1, &chunk_offset,NULL)) goto fail; /*"DATA"*/
channel_count = read_16bitBE(chunk_offset+0x0e,streamHeader);
if (!find_chunk_be(streamHeader, 0x42534943,first_offset,1, &chunk_offset,NULL)) goto fail; /*"BSIC"*/
loop_flag = read_8bit(chunk_offset+0x0c,streamHeader);
start_offset = 0x00;
if (!find_chunk_be(streamFileGSP, 0x44415441,first_offset,1, &chunk_offset,NULL)) goto fail; /*"DATA"*/
channel_count = read_16bitBE(chunk_offset+0x0e,streamFileGSP);
if (!find_chunk_be(streamFileGSP, 0x42534943,first_offset,1, &chunk_offset,NULL)) goto fail; /*"BSIC"*/
loop_flag = read_8bit(chunk_offset+0x0c,streamFileGSP);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_GSP_GSB;
if (!find_chunk_be(streamFileGSP, 0x48454144,first_offset,1, &chunk_offset,NULL)) goto fail; /*"HEAD"*/
if (!find_chunk_be(streamHeader, 0x48454144,first_offset,1, &chunk_offset,NULL)) goto fail; /*"HEAD"*/
/* 0x00: header_size, 0x04: num_chunks */
if (!find_chunk_be(streamFileGSP, 0x44415441,first_offset,1, &chunk_offset,NULL)) goto fail; /*"DATA"*/
if (!find_chunk_be(streamHeader, 0x44415441,first_offset,1, &chunk_offset,NULL)) goto fail; /*"DATA"*/
/* 0x00: filesize, 0x0c: always 10?, 0x10: always 0?, 0x18: always 0? */
datasize = read_32bitBE(chunk_offset+0x00,streamFileGSP);
codec_id = read_32bitBE(chunk_offset+0x04,streamFileGSP);
vgmstream->sample_rate = read_32bitBE(chunk_offset+0x08,streamFileGSP);
vgmstream->channels = channel_count; /* 0x0e */
vgmstream->num_samples = read_32bitBE(chunk_offset+0x14,streamFileGSP);
datasize = read_32bitBE(chunk_offset+0x00,streamHeader);
codec_id = read_32bitBE(chunk_offset+0x04,streamHeader);
vgmstream->sample_rate = read_32bitBE(chunk_offset+0x08,streamHeader);
vgmstream->num_samples = read_32bitBE(chunk_offset+0x14,streamHeader);
/* 0x1c: unk (varies with codec_id) */
if (!find_chunk_be(streamFileGSP, 0x42534943,first_offset,1, &chunk_offset,NULL)) goto fail; /*"BSIC"*/
if (!find_chunk_be(streamHeader, 0x42534943,first_offset,1, &chunk_offset,NULL)) goto fail; /*"BSIC"*/
/* 0x00+: probably volume/pan/etc */
vgmstream->loop_start_sample = read_32bitBE(chunk_offset+0x10,streamFileGSP);
vgmstream->loop_end_sample = read_32bitBE(chunk_offset+0x14,streamFileGSP);
vgmstream->loop_start_sample = read_32bitBE(chunk_offset+0x10,streamHeader);
vgmstream->loop_end_sample = read_32bitBE(chunk_offset+0x14,streamHeader);
//if (!find_chunk_be(streamFileGSP, 0x4E414D45,first_offset,1, &chunk_offset,NULL)) goto fail; /*"NAME"*/
//if (!find_chunk_be(streamHeader, 0x4E414D45,first_offset,1, &chunk_offset,NULL)) goto fail; /*"NAME"*/
/* 0x00: name_size, 0x04+: name*/
start_offset = 0x0;
switch (codec_id) {
case 4: { /* DSP */
case 0x04: { /* DSP [Super Swing Golf (Wii)] */
size_t block_header_size;
size_t num_blocks;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_blocked_gsb;
if (!find_chunk_be(streamFileGSP, 0x47434558,first_offset,1, &chunk_offset,NULL)) goto fail; /*"GCEX"*/
if (!find_chunk_be(streamHeader, 0x47434558,first_offset,1, &chunk_offset,NULL)) goto fail; /*"GCEX"*/
//vgmstream->current_block_size = read_32bitBE(chunk_offset+0x00,streamFileGSP);
block_header_size = read_32bitBE(chunk_offset+0x04,streamFileGSP);
num_blocks = read_32bitBE(chunk_offset+0x08,streamFileGSP);
//vgmstream->current_block_size = read_32bitBE(chunk_offset+0x00,streamHeader);
block_header_size = read_32bitBE(chunk_offset+0x04,streamHeader);
num_blocks = read_32bitBE(chunk_offset+0x08,streamHeader);
vgmstream->num_samples = (datasize - block_header_size * num_blocks) / 8 / vgmstream->channels * 14;
/* 0x0c+: unk */
dsp_read_coefs_be(vgmstream, streamFileGSP, chunk_offset+0x18, 0x30);
dsp_read_coefs_be(vgmstream, streamHeader, chunk_offset+0x18, 0x30);
break;
}
#ifdef VGM_USE_FFMPEG
case 8: { /* ATRAC3 */
case 0x08: { /* ATRAC3 [Quantum Theory (PS3)] */
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
int32_t bytes, block_size, encoder_delay, joint_stereo, max_samples;
@ -105,15 +107,15 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) {
break;
}
case 9: { /* XMA2 */
case 0x09: { /* XMA2 [Quantum Theory (PS3)] */
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[200];
int32_t bytes;
if (!find_chunk_be(streamFileGSP, 0x584D4558,first_offset,1, &chunk_offset,NULL)) goto fail; /*"XMEX"*/
if (!find_chunk_be(streamHeader, 0x584D4558,first_offset,1, &chunk_offset,NULL)) goto fail; /*"XMEX"*/
/* 0x00: fmt0x166 header (BE), 0x34: seek table */
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,200, chunk_offset,0x34, datasize, streamFileGSP, 1);
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,200, chunk_offset,0x34, datasize, streamHeader, 1);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,datasize);
@ -128,18 +130,15 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) {
default:
goto fail;
}
vgmstream->meta_type = meta_GSP_GSB;
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
close_streamfile(streamFileGSP);
close_streamfile(streamHeader);
return vgmstream;
fail:
if (streamFileGSP) close_streamfile(streamFileGSP);
close_streamfile(streamHeader);
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -89,17 +89,18 @@ VGMSTREAM * init_vgmstream_h4m(STREAMFILE *streamFile) {
/* calc num_samples manually */
{
vgmstream->stream_index = target_subsong; /* extra setup for H4M */
vgmstream->full_block_size = 0; /* extra setup for H4M */
vgmstream->next_block_offset = start_offset;
do {
block_update_h4m(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += vgmstream->current_block_samples;
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
vgmstream->full_block_size = 0; /* extra cleanup for H4M */
block_update(start_offset, vgmstream);
}
block_update_h4m(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -73,10 +73,6 @@ VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile) {
if (!vgmstream_open_stream(vgmstream,streamFile,ivaud.stream_offset))
goto fail;
if (vgmstream->layout_type == layout_blocked_ivaud)
block_update_ivaud(ivaud.stream_offset, vgmstream);
return vgmstream;
fail:

View File

@ -12,8 +12,6 @@ VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile) {
/* .hwas: usually in archives but also found named (ex. Guitar Hero On Tour) */
if (!check_extensions(streamFile,"hwas"))
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x73617768) /* "sawh" */
goto fail;
@ -27,23 +25,18 @@ VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_NDS_HWAS;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->num_samples = ima_bytes_to_samples(read_32bitLE(0x14,streamFile), channel_count);
vgmstream->loop_start_sample = ima_bytes_to_samples(read_32bitLE(0x10,streamFile), channel_count); //assumed, always 0
vgmstream->loop_end_sample = ima_bytes_to_samples(read_32bitLE(0x18,streamFile), channel_count);
vgmstream->meta_type = meta_NDS_HWAS;
vgmstream->coding_type = coding_IMA_int;
vgmstream->layout_type = layout_blocked_hwas;
vgmstream->full_block_size = read_32bitLE(0x04,streamFile); /* usually 0x2000, 0x4000 or 0x8000 */
/* open the file for reading by each channel */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
block_update_hwas(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -32,8 +32,8 @@ VGMSTREAM * init_vgmstream_ps2_adm(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = 44100;
vgmstream->meta_type = meta_PS2_ADM;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_blocked_adm;
@ -44,19 +44,18 @@ VGMSTREAM * init_vgmstream_ps2_adm(STREAMFILE *streamFile) {
{
vgmstream->next_block_offset = start_offset;
do {
block_update_adm(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
if (loop_flag && vgmstream->current_block_offset == loop_start_offset)
vgmstream->loop_start_sample = vgmstream->num_samples;
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset,vgmstream);
if (loop_flag)
vgmstream->loop_end_sample = vgmstream->num_samples;
}
block_update_adm(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -40,13 +40,13 @@ VGMSTREAM * init_vgmstream_ps2_iab(STREAMFILE *streamFile) {
{
vgmstream->next_block_offset = start_offset;
do {
block_update_ps2_iab(vgmstream->next_block_offset, vgmstream);
block_update(vgmstream->next_block_offset, vgmstream);
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
block_update_ps2_iab(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -2,7 +2,7 @@
#include "../layout/layout.h"
#include "../coding/coding.h"
/* STR - The Bouncer (PS2) */
/* .vs/STRx - from The Bouncer (PS2) */
VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int channel_count, loop_flag;
@ -10,11 +10,11 @@ VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE *streamFile) {
/* checks */
/* .vs: real extension (from .nam container) , .str: partial header id */
/* .vs: real extension (from .nam container)
* .str: fake, partial header id */
if (!check_extensions(streamFile, "vs,str"))
goto fail;
/* check header */
if (!(read_32bitBE(0x000,streamFile) == 0x5354524C && /* "STRL" */
read_32bitBE(0x800,streamFile) == 0x53545252) && /* "STRR" */
read_32bitBE(0x00,streamFile) != 0x5354524D) /* "STRM" */
@ -29,11 +29,10 @@ VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_PS2_STRLR;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_blocked_ps2_strlr;
vgmstream->meta_type = meta_PS2_STRLR;
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
@ -42,13 +41,13 @@ VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE *streamFile) {
{
vgmstream->next_block_offset = start_offset;
do {
block_update_ps2_strlr(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
block_update_ps2_strlr(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -158,18 +158,16 @@ VGMSTREAM * init_vgmstream_cdxa(STREAMFILE *streamFile) {
/* calc num_samples as blocks may be empty or smaller than usual depending on flags */
vgmstream->next_block_offset = start_offset;
do {
block_update_xa(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += vgmstream->current_block_samples;
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset,vgmstream);
}
else {
vgmstream->num_samples = xa_bytes_to_samples(file_size - start_offset, channel_count, is_blocked);
}
if (vgmstream->layout_type == layout_blocked_xa)
block_update_xa(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -242,10 +242,10 @@ VGMSTREAM * init_vgmstream_rws(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(rws.channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_RWS;
vgmstream->sample_rate = rws.sample_rate;
vgmstream->num_streams = total_subsongs;
vgmstream->stream_size = stream_size;
vgmstream->meta_type = meta_RWS;
if (name_offset)
read_string(vgmstream->stream_name,STREAM_NAME_SIZE, name_offset,streamFile);
@ -300,9 +300,6 @@ VGMSTREAM * init_vgmstream_rws(STREAMFILE *streamFile) {
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
block_update_rws(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -28,8 +28,9 @@ VGMSTREAM * init_vgmstream_sthd(STREAMFILE *streamFile) {
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x20, streamFile); /* repeated ~8 times? */
vgmstream->meta_type = meta_STHD;
vgmstream->sample_rate = read_32bitLE(0x20, streamFile); /* repeated ~8 times? */
vgmstream->coding_type = coding_XBOX_IMA_int;
vgmstream->layout_type = layout_blocked_sthd;
@ -45,8 +46,7 @@ VGMSTREAM * init_vgmstream_sthd(STREAMFILE *streamFile) {
vgmstream->next_block_offset = start_offset;
do {
block_update_sthd(vgmstream->next_block_offset,vgmstream);
block_update(vgmstream->next_block_offset,vgmstream);
if (block_count == loop_start_block)
vgmstream->loop_start_sample = vgmstream->num_samples;
if (block_count == loop_end_block)
@ -56,10 +56,9 @@ VGMSTREAM * init_vgmstream_sthd(STREAMFILE *streamFile) {
block_count++;
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
block_update_sthd(start_offset, vgmstream);
return vgmstream;
fail:

View File

@ -103,10 +103,6 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
if (vgmstream->layout_type == layout_blocked_vawx)
block_update_vawx(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -50,25 +50,22 @@ VGMSTREAM * init_vgmstream_vgs(STREAMFILE *streamFile) {
channel_count++;
}
start_offset = 0x80;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
start_offset = 0x80;
vgmstream->meta_type = meta_VGS;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = ps_bytes_to_samples(channel_size*channel_count, channel_count);
vgmstream->coding_type = coding_PSX_badflags; /* flag = stream/channel number */
vgmstream->layout_type = layout_blocked_vgs;
vgmstream->meta_type = meta_VGS;
/* open files; channel offsets are updated below */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
block_update_vgs(start_offset, vgmstream);
return vgmstream;
fail:
close_vgmstream(vgmstream);

View File

@ -9,10 +9,10 @@ VGMSTREAM * init_vgmstream_xbox_xvas(STREAMFILE *streamFile) {
int loop_flag, channel_count;
size_t data_size;
/* check extension */
/* checks */
if (!check_extensions(streamFile,"xvas"))
goto fail;
if (read_32bitLE(0x00,streamFile) != 0x69 && /* codec */
read_32bitLE(0x08,streamFile) != 0x48) /* block size (probably 0x24 for mono) */
goto fail;
@ -23,10 +23,12 @@ VGMSTREAM * init_vgmstream_xbox_xvas(STREAMFILE *streamFile) {
data_size = read_32bitLE(0x24,streamFile);
data_size -= (data_size / 0x20000) * 0x20; /* blocks of 0x20000 with padding */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_XBOX_XVAS;
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
vgmstream->num_samples = xbox_ima_bytes_to_samples(data_size, vgmstream->channels);
if(loop_flag) {
@ -38,12 +40,9 @@ VGMSTREAM * init_vgmstream_xbox_xvas(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_blocked_xvas;
vgmstream->meta_type = meta_XBOX_XVAS;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
block_update_xvas(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -207,13 +207,8 @@ VGMSTREAM * init_vgmstream_xvag(STREAMFILE *streamFile) {
}
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream,temp_streamFile ? temp_streamFile : streamFile,start_offset))
goto fail;
if (vgmstream->layout_type == layout_blocked_xvag_subsong)
block_update_xvag_subsong(start_offset, vgmstream);
close_streamfile(temp_streamFile);
return vgmstream;