mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-31 04:13:47 +01:00
wac, wad, wam fixed
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@490 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
a41c341a18
commit
641d7afaa0
@ -11,6 +11,7 @@ VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
|
||||
int channel_count;
|
||||
int coef1_start;
|
||||
int coef2_start;
|
||||
int second_channel_start;
|
||||
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("waa",filename_extension(filename)) &&
|
||||
@ -43,22 +44,13 @@ VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitLE(0x2A,streamFile))*14/8/channel_count;
|
||||
}
|
||||
|
||||
|
||||
if (channel_count > 1) {
|
||||
vgmstream->interleave_block_size = (read_32bitLE(0x2A,streamFile)/2)+0x2E;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
} else {
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
|
||||
|
||||
vgmstream->meta_type = meta_WAA_WAC_WAD_WAM;
|
||||
|
||||
|
||||
/* Retrieveing the coef tables */
|
||||
/* Retrieveing the coef tables and the start of the second channel*/
|
||||
coef1_start = 0x2E;
|
||||
coef2_start = ((read_32bitLE(0x2A,streamFile)/2)+0x5C);
|
||||
coef2_start = (read_32bitLE(0x2A,streamFile)/2)+0x5C;
|
||||
second_channel_start = coef2_start+0x2E;
|
||||
|
||||
{
|
||||
int i;
|
||||
@ -66,7 +58,7 @@ VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(coef1_start+i*2,streamFile);
|
||||
if (channel_count == 2) {
|
||||
for (i=0;i<16;i++)
|
||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(coef1_start+i*2,streamFile);
|
||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(coef2_start+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,13 +72,23 @@ VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+
|
||||
vgmstream->interleave_block_size*i;
|
||||
/* The first channel */
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[0].offset=start_offset;
|
||||
|
||||
/* The second channel */
|
||||
if (channel_count == 2) {
|
||||
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=second_channel_start;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
|
Loading…
x
Reference in New Issue
Block a user