Merge pull request #1619 from bnnm/vas-etc

- Fix some .vas + unify variations [TMNT 2: Battle Nexus (PC)]
- Fix rare .str [Planet Laika (PS1)]
- Remove fake .xvas extension (use .vas)
This commit is contained in:
bnnm 2024-10-20 23:19:47 +02:00 committed by GitHub
commit 48ed3daa19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 198 additions and 205 deletions

View File

@ -161,7 +161,7 @@ different internally (encrypted, different versions, etc) and not always can be
- Codecs: PCM16BE
- **ads.c**
- Sony ADS header [*ADS*]
- *ads*: `.ads .ss2 .pcm .adx .(extensionless) .800`
- *ads*: `.ads .ss2 .pcm .adx .(extensionless) .800 .sdl`
- *ads_container*: `.ads .cads`
- Subfiles: *ads*
- Codecs: PCM16LE DVI_IMA_int PSX
@ -270,7 +270,7 @@ different internally (encrypted, different versions, etc) and not always can be
- RIFF WAVE header (ctrl looping) [*RIFF_WAVE_MWV*]
- RIFX WAVE header [*RIFX_WAVE*]
- RIFX WAVE header (smpl looping) [*RIFX_WAVE_smpl*]
- *riff*: `.wav .lwav .xwav .mwv .da .dax .cd .med .snd .adx .adp .xss .xsew .adpcm .adw .wd .(extensionless) .sbv .wvx .str .at3 .rws .aud .at9 .ckd .saf .ima .nsa .pcm .xvag .ogg .logg .p1d .xms .mus .dat .ldat .wma .lwma .caf .wax .voi .se`
- *riff*: `.wav .lwav .xwav .mwv .da .dax .cd .med .snd .adx .adp .xss .xsew .adpcm .adw .wd .(extensionless) .sbv .wvx .str .at3 .rws .aud .at9 .ckd .saf .ima .nsa .pcm .xvag .ogg .logg .p1d .xms .mus .dat .ldat .wma .lwma .caf .wax .voi .se .v`
- *rifx*: `.wav .lwav`
- Codecs: AICA_int PCM32LE PCM24LE PCM16BE PCM16LE PCM8_U MSADPCM IMA PCMFLOAT MS_IMA AICA MPEG_custom XBOX_IMA MS_IMA_3BIT DVI_IMA LEVEL5 OGG_VORBIS ATRAC9 ATRAC3 MPEG MSADPCM_mono
- **nwa.c**
@ -422,10 +422,6 @@ different internally (encrypted, different versions, etc) and not always can be
- Outrage XMU header [*XMU*]
- *xmu*: `.xmu`
- Codecs: XBOX_IMA
- **xvas.c**
- Konami .XVAS header [*XVAS*]
- *xvas*: `.xvas`
- Codecs: XBOX_IMA
- **sat_sap.c**
- VING .SAP header [*SAP*]
- *sat_sap*: `.sap`
@ -733,10 +729,6 @@ different internally (encrypted, different versions, etc) and not always can be
- (container)
- *dmsg*: `.sgt .dmsg`
- Subfiles: *riff*
- **ngc_dsp_konami.c**
- Konami DSP header [*NGC_DSP_KONAMI*]
- *ngc_dsp_konami*: `.dsp`
- Codecs: NGC_DSP
- **wb.c**
- Triangle Service .WB header [*WB*]
- *wb*: `.wb`
@ -1195,7 +1187,7 @@ different internally (encrypted, different versions, etc) and not always can be
- Square Enix MAB header [*SQEX_MAB*]
- *sqex_sead*: `.sab .mab .sbin`
- Subfiles: *ogg_vorbis_config hca*
- Codecs: PCM16LE MSADPCM OGG ATRAC9 MPEG
- Codecs: PCM16LE MSADPCM OGG ATRAC9 XMA2 MPEG
- **waf.c**
- KID WAF header [*WAF*]
- *waf*: `.waf`
@ -1300,8 +1292,8 @@ different internally (encrypted, different versions, etc) and not always can be
- Codecs: PSX
- **bnk_sony.c**
- Sony BNK header [*BNK_SONY*]
- *bnk_sony*: `.bnk`
- Subfiles: *riff*
- *bnk_sony*: `.bnk + .(external)`
- Subfiles: *xvag riff*
- Codecs: ATRAC9 MPEG PCM16BE PCM16LE PSX HEVAG
- **nus3bank.c**
- (container)
@ -1834,10 +1826,10 @@ different internally (encrypted, different versions, etc) and not always can be
- Codecs: PCM8_SB
- **vas_kceo.c**
- Konami .VAS header [*VAS_KCEO*]
- *vas_kceo*: `.vas`
- *vas_kceo*: `.vas .dsp`
- *vas_kceo_container*: `.vas`
- Subfiles: *vas_kceo*
- Codecs: PSX
- Codecs: PCM16LE XBOX_IMA PSX NGC_DSP
- **ps2_wmus.c**
- assumed The Warriors Sony ADPCM by .wmus extension [*PS2_WMUS*]
- *ps2_wmus*: `.wmus`

View File

@ -687,7 +687,6 @@ static const char* extension_list[] = {
"xsew",
"xss",
"xvag",
"xvas",
"xwav", //fake extension for .wav (renamed, to be removed)
"xwb",
"xmd",
@ -956,7 +955,7 @@ static const layout_info layout_info_list[] = {
{layout_blocked_ea_1snh, "blocked (EA 1SNh)"},
{layout_blocked_caf, "blocked (CAF)"},
{layout_blocked_wsi, "blocked (WSI)"},
{layout_blocked_xvas, "blocked (.xvas)"},
{layout_blocked_xvas, "blocked (.vas)"},
{layout_blocked_str_snds, "blocked (.str SNDS)"},
{layout_blocked_ws_aud, "blocked (Westwood Studios .aud)"},
{layout_blocked_dec, "blocked (DEC)"},
@ -1110,7 +1109,6 @@ static const meta_info meta_info_list[] = {
{meta_STR_SEGA, "Sega Stream Asset Builder header"},
{meta_STR_SEGA_custom, "Sega Stream Asset Builder header (custom)"},
{meta_XMU, "Outrage XMU header"},
{meta_XVAS, "Konami .XVAS header"},
{meta_XA2_ACCLAIM, "Acclaim .XA2 header"},
{meta_SAP, "VING .SAP header"},
{meta_DC_IDVI, "Capcom IDVI header"},
@ -1191,7 +1189,6 @@ static const meta_info meta_info_list[] = {
{meta_PONA_3DO, "Policenauts BGM header"},
{meta_PONA_PSX, "Policenauts BGM header"},
{meta_NGC_DSP_AAAP, "Acclaim Austin AAAp DSP header"},
{meta_NGC_DSP_KONAMI, "Konami DSP header"},
{meta_BNSF, "Namco Bandai BNSF header"},
{meta_WB, "Triangle Service .WB header"},
{meta_S14, "Namco .S14 raw header"},

View File

@ -91,6 +91,7 @@
<ClInclude Include="vgmstream_types.h" />
<ClInclude Include="base\api_internal.h" />
<ClInclude Include="base\decode.h" />
<ClInclude Include="base\decode_state.h" />
<ClInclude Include="base\mixer.h" />
<ClInclude Include="base\mixer_priv.h" />
<ClInclude Include="base\mixing.h" />
@ -577,7 +578,6 @@
<ClCompile Include="meta\nds_strm_ffta2.c" />
<ClCompile Include="meta\ngc_adpdtk.c" />
<ClCompile Include="meta\ngc_dsp_asura.c" />
<ClCompile Include="meta\ngc_dsp_konami.c" />
<ClCompile Include="meta\ngc_dsp_mpds.c" />
<ClCompile Include="meta\ngc_dsp_std.c" />
<ClCompile Include="meta\ngc_ffcc_str.c" />
@ -784,7 +784,6 @@
<ClCompile Include="meta\xss.c" />
<ClCompile Include="meta\xssb.c" />
<ClCompile Include="meta\xvag.c" />
<ClCompile Include="meta\xvas.c" />
<ClCompile Include="meta\xwav.c" />
<ClCompile Include="meta\xwb.c" />
<ClCompile Include="meta\xwc.c" />

View File

@ -107,6 +107,9 @@
<ClInclude Include="base\decode.h">
<Filter>base\Header Files</Filter>
</ClInclude>
<ClInclude Include="base\decode_state.h">
<Filter>base\Header Files</Filter>
</ClInclude>
<ClInclude Include="base\mixer.h">
<Filter>base\Header Files</Filter>
</ClInclude>
@ -1561,9 +1564,6 @@
<ClCompile Include="meta\ngc_dsp_asura.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ngc_dsp_konami.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ngc_dsp_mpds.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
@ -2182,9 +2182,6 @@
<ClCompile Include="meta\xvag.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\xvas.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\xwav.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -271,8 +271,6 @@ VGMSTREAM* init_vgmstream_vs_mh(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_xmu(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_xvas(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_sat_sap(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dc_idvi(STREAMFILE *streamFile);
@ -427,8 +425,6 @@ VGMSTREAM* init_vgmstream_ast_mmv(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_dmsg(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngc_dsp_konami(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile);
VGMSTREAM* init_vgmstream_wb(STREAMFILE* sf);

View File

@ -1,78 +0,0 @@
#include "meta.h"
#include "../util.h"
/* DSP
Teenage Mutant Ninja Turtles 2 (NGC)
*/
VGMSTREAM * init_vgmstream_ngc_dsp_konami(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
int loop_flag = 0;
int channel_count;
int i, j;
off_t ch1_start;
off_t ch2_start;
off_t coef_table[2] = {0x90, 0xD0};
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("dsp",filename_extension(filename)))
goto fail;
/* check header */
if ((read_32bitBE(0x00,streamFile)+0x800) != (get_streamfile_size(streamFile)))
goto fail;
loop_flag = (read_32bitBE(0x10,streamFile) != 0x0);
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = (read_32bitBE(0x00,streamFile)/channel_count/8*14);
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitBE(0x14,streamFile)/channel_count/8*14);
vgmstream->loop_end_sample = (read_32bitBE(0x00,streamFile)/channel_count/8*14);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x100;
vgmstream->meta_type = meta_NGC_DSP_KONAMI;
ch1_start = 0x800;
ch2_start = 0x800 + vgmstream->interleave_block_size;
// COEFFS
{
for (j=0;j<vgmstream->channels;j++) {
for (i=0;i<16;i++) {
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
}
}
}
/* open the file for reading */
/* Channel 1 */
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!vgmstream->ch[0].streamfile)
goto fail;
vgmstream->ch[0].channel_start_offset = vgmstream->ch[0].offset=ch1_start;
/* Channel 1 */
vgmstream->ch[1].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!vgmstream->ch[1].streamfile)
goto fail;
vgmstream->ch[1].channel_start_offset = vgmstream->ch[1].offset=ch2_start;
return vgmstream;
fail:
/* clean up anything we may have opened */
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -1,43 +1,165 @@
#include "meta.h"
#include "../coding/coding.h"
typedef enum { PSX, DSP, IMA, PCM } vas_codec_t;
/* .VAS - from Konami Computer Enterntainment Osaka games [Jikkyou Powerful Pro Yakyuu 8 (PS2), Jikkyou World Soccer 2000 (PS2)] */
/* .VAS - from Konami Computer Enterntainment Osaka games [Jikkyou Powerful Pro Yakyuu 8 (PS2), TMNT 2: Battle Nexus (multi)] */
VGMSTREAM* init_vgmstream_vas_kceo(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
int loop_flag, channels;
int loop_flag, channels, block_size, sample_rate, volume, dummy;
uint32_t loop_start, loop_end, data_size;
vas_codec_t codec;
/* checks */
if (!check_extensions(sf, "vas"))
return NULL;
if (read_u32le(0x00,sf) + 0x800 != get_streamfile_size(sf))
/* .vas: bigfile extension (internally files just seem to be referred as 'bgm' or 'stream')
* .dsp: assumed (GC bigfile is just .bin and has no table) */
if (!check_extensions(sf, "vas,dsp"))
return NULL;
if (read_u32le(0x00, sf) == 0x01) { /* PC */
channels = read_u32le(0x04, sf);
block_size = read_u32le(0x08, sf);
sample_rate = read_s32le(0x0c, sf);
loop_start = read_u32le(0x10, sf);
loop_end = read_u32le(0x14, sf);
volume = read_u32le(0x18, sf);
loop_flag = read_u32le(0x1c, sf) != 0; // unknown size (low-ish), 0 if no loop
// 20: 0x8000 if loop?
data_size = read_u32le(0x24, sf);
// 28: null?
// 2c: null?
dummy = read_u32le(0x30, sf);
if (block_size != channels * 0x02)
return NULL;
codec = PCM;
}
else if (read_u32le(0x00, sf) == 0x69) { /* Xbox */
channels = read_u32le(0x04, sf);
block_size = read_u32le(0x08, sf);
sample_rate = read_s32le(0x0c, sf);
loop_start = read_u32le(0x10, sf);
loop_end = read_u32le(0x14, sf);
volume = read_u32le(0x18, sf);
loop_flag = read_u32le(0x1c, sf) != 0; // unknown size (low-ish), 0 if no loop
// 20: 0x8000 if loop?
data_size = read_u32le(0x24, sf);
// 28: null or some kind of hash (TMNT3)
// 2c: null or codec + channels (TMNT3)
dummy = read_u32le(0x30, sf);
if (block_size != channels * 0x24)
return NULL;
codec = IMA;
}
else if (read_u32le(0x00,sf) + 0x800 == get_streamfile_size(sf)) { /* PS2 */
data_size = read_u32le(0x00, sf);
sample_rate = read_s32le(0x04,sf);
volume = read_u32le(0x08, sf);
dummy = read_u32le(0x0c, sf);
loop_flag = read_u32le(0x10, sf) != 0; // 0/1
loop_start = read_u32le(0x14,sf);
channels = 2;
codec = PSX;
loop_end = data_size;
if (!ps_check_format(sf, 0x800, 0x1000))
return NULL;
}
else if (read_u32be(0x00,sf) + 0x800 == get_streamfile_size(sf)) { /* GC */
data_size = read_u32be(0x00, sf);
sample_rate = read_s32be(0x04,sf);
volume = read_u32be(0x08, sf);
dummy = read_u32be(0x0c, sf);
loop_flag = read_u32be(0x10, sf) != 0; // 0/1
loop_start = read_u32be(0x14,sf);
channels = 2;
codec = DSP;
loop_end = data_size;
// DSP header variation at 0x80 (loop_end seems smaller but not correct?)
if (read_u32be(0x8c, sf) != 0x0002) // codec
return NULL;
}
else {
return NULL;
}
/* simple header so do a few extra checks */
if (channels != 2) // voices have a slightly different, simpler format
return NULL;
if (sample_rate > 48000 || sample_rate < 8000)
return NULL;
if (volume <= 0x00 || volume > 0xFF) /* typically 0x96, some PS2 use ~0xC0 */
return NULL;
if (dummy != 0)
return NULL;
loop_flag = (read_u32le(0x10,sf) != 0);
channels = 2;
start_offset = 0x800;
/* header is too simple so test a bit */
if (!ps_check_format(sf, start_offset, 0x1000))
goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_VAS_KCEO;
vgmstream->sample_rate = read_s32le(0x04,sf);
vgmstream->sample_rate = sample_rate;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x200;
switch (codec) {
case PCM:
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x02;
vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x00,sf), channels);
vgmstream->loop_start_sample = ps_bytes_to_samples(read_u32le(0x14,sf), channels);
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->num_samples = pcm16_bytes_to_samples(data_size, vgmstream->channels);
vgmstream->loop_start_sample = pcm16_bytes_to_samples(loop_start, vgmstream->channels);
vgmstream->loop_end_sample = pcm16_bytes_to_samples(loop_end, vgmstream->channels);
break;
case IMA:
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_blocked_xvas;
/* blocks of 0x20000 with padding */
data_size -= (data_size / 0x20000) * 0x20;
loop_start -= (loop_start / 0x20000) * 0x20;
loop_end -= (loop_end / 0x20000) * 0x20;
vgmstream->num_samples = xbox_ima_bytes_to_samples(data_size, vgmstream->channels);
vgmstream->loop_start_sample = xbox_ima_bytes_to_samples(loop_start, vgmstream->channels);
vgmstream->loop_end_sample = xbox_ima_bytes_to_samples(loop_end, vgmstream->channels);
break;
case PSX:
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x200;
vgmstream->num_samples = ps_bytes_to_samples(data_size, channels);
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, channels);
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, channels);
break;
case DSP:
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x100;
vgmstream->num_samples = dsp_bytes_to_samples(data_size, channels);
vgmstream->loop_start_sample = dsp_bytes_to_samples(loop_start, channels);
vgmstream->loop_end_sample = dsp_bytes_to_samples(loop_end, channels);
dsp_read_coefs_be(vgmstream, sf, 0x90, 0x40);
break;
default:
goto fail;
}
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
@ -53,8 +175,8 @@ fail:
VGMSTREAM* init_vgmstream_vas_kceo_container(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
STREAMFILE* temp_sf = NULL;
off_t subfile_offset = 0;
size_t subfile_size = 0;
uint32_t subfile_offset = 0;
uint32_t subfile_size = 0;
int total_subsongs, target_subsong = sf->stream_index;
@ -62,23 +184,26 @@ VGMSTREAM* init_vgmstream_vas_kceo_container(STREAMFILE* sf) {
if (!check_extensions(sf, "vas"))
return NULL;
if (read_u32be(0x00, sf) == 0xAB8A5A00) { /* fixed value */
if (read_u32be(0x00, sf) == 0xAB8A5A00) { /* PS2 (fixed value) */
/* just in case */
/* unknown size/id */
if (read_u32le(0x04, sf) * 0x800 + 0x800 != get_streamfile_size(sf))
goto fail;
return NULL;
total_subsongs = read_s32le(0x08, sf); /* also at 0x10 */
if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
if (total_subsongs > 0x100) /* arbitrary max */
return NULL;
/* check offset table flag, 0x98 has table size */
if (read_32bitLE(0x94, sf)) {
if (read_u32le(0x94, sf)) {
off_t header_offset = 0x800 + 0x10*(target_subsong-1);
/* some values are repeats found in the file sub-header */
subfile_offset = read_32bitLE(header_offset + 0x00,sf) * 0x800;
subfile_size = read_32bitLE(header_offset + 0x08,sf) + 0x800;
subfile_offset = read_u32le(header_offset + 0x00,sf) * 0x800;
subfile_size = read_u32le(header_offset + 0x08,sf) + 0x800;
}
else {
/* a bunch of files */
@ -86,7 +211,7 @@ VGMSTREAM* init_vgmstream_vas_kceo_container(STREAMFILE* sf) {
int i;
for (i = 0; i < total_subsongs; i++) {
size_t size = read_32bitLE(offset, sf) + 0x800;
size_t size = read_u32le(offset, sf) + 0x800;
if (i + 1 == target_subsong) {
subfile_offset = offset;
@ -97,23 +222,43 @@ VGMSTREAM* init_vgmstream_vas_kceo_container(STREAMFILE* sf) {
offset += size;
}
if (i == total_subsongs)
goto fail;
return NULL;
}
}
else if (read_u32le(0x00, sf) == 0x800) { /* Xbox/PC (start?) */
VGM_STEP();
total_subsongs = read_s32le(0x04, sf);
if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
if (total_subsongs > 0x100) /* arbitrary max */
return NULL;
if (read_u32le(0x08, sf) != 0x800)
return NULL;
/* table of offset + ? size */
uint32_t header_offset = 0x08 + 0x08 * (target_subsong - 1);
subfile_offset = read_u32le(header_offset + 0x00,sf);
uint32_t next_offset = (target_subsong == total_subsongs) ?
get_streamfile_size(sf) :
read_u32le(header_offset + 0x08,sf);
subfile_size = next_offset - subfile_offset;
}
else {
/* some .vas are just files pasted together, better extracted externally but whatevs */
size_t file_size = get_streamfile_size(sf);
off_t offset = 0;
uint32_t file_size = get_streamfile_size(sf);
uint32_t offset = 0;
/* must have multiple .vas */
if (read_32bitLE(0x00,sf) + 0x800 >= file_size)
if (read_u32le(0x00,sf) + 0x800 >= file_size)
goto fail;
total_subsongs = 0;
if (target_subsong == 0) target_subsong = 1;
while (offset < file_size) {
size_t size = read_32bitLE(offset,sf) + 0x800;
uint32_t size = read_u32le(offset,sf) + 0x800;
/* some files can be null, ignore */
if (size > 0x800) {
@ -136,7 +281,7 @@ VGMSTREAM* init_vgmstream_vas_kceo_container(STREAMFILE* sf) {
}
temp_sf = setup_subfile_streamfile(sf, subfile_offset,subfile_size, NULL);
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, NULL);
if (!temp_sf) goto fail;
vgmstream = init_vgmstream_vas_kceo(temp_sf);

View File

@ -11,7 +11,7 @@ VGMSTREAM* init_vgmstream_xa(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
uint32_t start_offset, stream_size = 0;
int loop_flag = 0, channels, sample_rate, bps;
int is_riff = 0, is_form2 = 0, is_blocked;
bool is_riff = false, is_form2 = false, is_blocked;
int total_subsongs = 0, target_subsong = sf->stream_index;
uint16_t target_config = 0;
@ -19,13 +19,13 @@ VGMSTREAM* init_vgmstream_xa(STREAMFILE* sf) {
/* checks */
if (read_u32be(0x00,sf) == 0x00FFFFFF && read_u32be(0x04,sf) == 0xFFFFFFFF && read_u32be(0x08,sf) == 0xFFFFFF00) {
/* sector sync word = raw data */
is_blocked = 1;
is_blocked = true;
start_offset = 0x00;
}
else if (is_id32be(0x00,sf, "RIFF") && is_id32be(0x08,sf, "CDXA") && is_id32be(0x0C,sf, "fmt ")) {
/* RIFF header = raw with header (optional, added by CD drivers when copying and not part of the CD data) */
is_blocked = 1;
is_riff = 1;
is_blocked = true;
is_riff = true;
start_offset = 0x2c; /* after "data", ignore RIFF values as often are wrong */
}
else {
@ -49,7 +49,7 @@ VGMSTREAM* init_vgmstream_xa(STREAMFILE* sf) {
/* test for XA data, since format is raw-ish (with RIFF it's assumed to be ok) */
if (!is_riff && !xa_check_format(sf, start_offset, is_blocked))
goto fail;
return NULL;
/* find subsongs as XA can interleave sectors using 'file' and 'channel' makers (see blocked_xa.c) */
if (/*!is_riff &&*/ is_blocked) {
@ -182,12 +182,12 @@ static int xa_check_format(STREAMFILE *sf, off_t offset, int is_blocked) {
for (int i = 0; i < (sector_size / frame_size); i++) {
read_streamfile(frame_hdr, test_offset, sizeof(frame_hdr), sf);
/* XA frame checks: filter indexes should be 0..3, and shifts 0..C */
/* XA frame checks: filter indexes should be 0..3 and shifts 0..C, but somehow Planet Laika movies have D */
for (int j = 0; j < 16; j++) {
uint8_t header = get_u8(frame_hdr + j);
if (((header >> 4) & 0xF) > 0x03)
goto fail;
if (((header >> 0) & 0xF) > 0x0c)
if (((header >> 0) & 0xF) > 0x0d)
goto fail;
}

View File

@ -1,51 +0,0 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
/* XVAS - found in TMNT 2 & TMNT 3 (Xbox) */
VGMSTREAM * init_vgmstream_xvas(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
size_t data_size;
/* 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;
start_offset = 0x800;
channel_count = read_32bitLE(0x04,streamFile); /* always stereo files */
loop_flag = (read_32bitLE(0x14,streamFile) == read_32bitLE(0x24,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_XVAS;
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
vgmstream->num_samples = xbox_ima_bytes_to_samples(data_size, vgmstream->channels);
if(loop_flag) {
size_t loop_size = read_32bitLE(0x10,streamFile);
loop_size -= (loop_size / 0x20000) * 0x20;
vgmstream->loop_start_sample = xbox_ima_bytes_to_samples(loop_size, vgmstream->channels);
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_blocked_xvas;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -90,7 +90,6 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_str_sega_custom,
init_vgmstream_dec,
init_vgmstream_xmu,
init_vgmstream_xvas,
init_vgmstream_sat_sap,
init_vgmstream_dc_idvi,
init_vgmstream_ps2_rnd,
@ -174,7 +173,6 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_ast_mv,
init_vgmstream_dmsg,
init_vgmstream_ngc_dsp_aaap,
init_vgmstream_ngc_dsp_konami,
init_vgmstream_wb,
init_vgmstream_bnsf,
init_vgmstream_ps2_gcm,

View File

@ -391,12 +391,10 @@ typedef enum {
meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */
meta_ADS_MIDWAY,
meta_PS2_SPS, /* Ape Escape 2 */
meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */
meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */
meta_RAW_WAVM,
meta_WVS,
meta_XMU,
meta_XVAS,
meta_EA_SCHL, /* Electronic Arts SCHl with variable header */
meta_EA_SCHL_fixed, /* Electronic Arts SCHl with fixed header */
meta_EA_BNK, /* Electronic Arts BNK */