From 06e43e9c0070e920cdf826383ac02745c0c8f02a Mon Sep 17 00:00:00 2001 From: manakoAT Date: Tue, 16 Dec 2008 15:48:21 +0000 Subject: [PATCH] added new dsp type in .emff.c added block format for gsp+gsb cleaned some metas from useless stuff git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@519 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/layout/Makefile.unix.am | 1 + src/layout/blocked.c | 3 ++ src/layout/gsb_blocked.c | 18 +++++++ src/layout/layout.h | 2 + src/libvgmstream.vcproj | 4 ++ src/meta/dc_asd.c | 15 ++---- src/meta/dc_idvi.c | 12 ++--- src/meta/dc_str.c | 2 - src/meta/dc_wav_dcs.c | 11 +--- src/meta/emff.c | 92 +++++++++++++++++--------------- src/meta/fsb.c | 4 ++ src/meta/gca.c | 9 +--- src/meta/gsp_gsb.c | 54 ++++++++++--------- src/meta/ish_isd.c | 13 +---- src/meta/kraw.c | 2 - src/meta/msvp.c | 5 +- src/meta/musc.c | 12 ++--- src/meta/musx.c | 97 +++++++++++----------------------- src/meta/naomi_spsd.c | 4 +- src/meta/ngc_bh2pcm.c | 80 +++++++++++++--------------- src/meta/ngc_pdt.c | 6 +-- src/meta/ngc_ssm.c | 1 - src/meta/ngc_tydsp.c | 2 - src/meta/ngc_vjdsp.c | 1 - src/meta/ngc_waa_wac_wad_wam.c | 1 - src/meta/ngc_ymf.c | 5 +- src/meta/ps2_ass.c | 18 +------ src/meta/ps2_aus.c | 1 - src/meta/ps2_bg00.c | 6 +-- src/meta/ps2_bmdx.c | 1 - src/meta/ps2_ccc.c | 3 +- src/meta/ps2_dxh.c | 1 - src/meta/ps2_enth.c | 3 -- src/meta/ps2_hgc1.c | 5 +- src/meta/ps2_ikm.c | 7 ++- src/meta/ps2_ild.c | 1 - src/meta/ps2_joe.c | 21 ++------ src/meta/ps2_leg.c | 3 +- src/meta/ps2_mihb.c | 7 ++- src/meta/ps2_psw.c | 12 ++--- src/meta/ps2_rkv.c | 5 +- src/meta/ps2_rstm.c | 1 - src/meta/ps2_rxw.c | 2 - src/meta/ps2_seg.c | 1 - src/meta/ps2_sfs.c | 1 - src/meta/ps2_sl3.c | 4 +- src/meta/ps2_tec.c | 7 +-- src/meta/ps2_vas.c | 3 +- src/meta/ps2_xa30.c | 2 - src/meta/psx_fag.c | 3 +- src/vgmstream.c | 4 ++ src/vgmstream.h | 3 +- 52 files changed, 237 insertions(+), 344 deletions(-) create mode 100644 src/layout/gsb_blocked.c diff --git a/src/layout/Makefile.unix.am b/src/layout/Makefile.unix.am index 436a419e..6b43065c 100644 --- a/src/layout/Makefile.unix.am +++ b/src/layout/Makefile.unix.am @@ -25,5 +25,6 @@ liblayout_la_SOURCES += xvas_block.c liblayout_la_SOURCES += vs_blocked.c liblayout_la_SOURCES += emff_blocked.c liblayout_la_SOURCES += thp_blocked.c +liblayout_la_SOURCES += gsb_blocked.c EXTRA_DIST = layout.h diff --git a/src/layout/blocked.c b/src/layout/blocked.c index bc876b39..7b4e1291 100644 --- a/src/layout/blocked.c +++ b/src/layout/blocked.c @@ -91,6 +91,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM * case layout_emff_ngc_blocked: emff_ngc_block_update(vgmstream->next_block_offset,vgmstream); break; + case layout_gsb_blocked: + gsb_block_update(vgmstream->next_block_offset,vgmstream); + break; case layout_vs_blocked: vs_block_update(vgmstream->next_block_offset,vgmstream); break; diff --git a/src/layout/gsb_blocked.c b/src/layout/gsb_blocked.c new file mode 100644 index 00000000..80ce3eef --- /dev/null +++ b/src/layout/gsb_blocked.c @@ -0,0 +1,18 @@ +#include "layout.h" +#include "../vgmstream.h" + +/* set up for the block at the given offset */ +void gsb_block_update(off_t block_offset, VGMSTREAM * vgmstream) { + int i; + + vgmstream->current_block_offset = block_offset; + vgmstream->current_block_size = 0x10000; /*read_32bitLE( + vgmstream->current_block_offset+0x10, + vgmstream->ch[0].streamfile); */ + vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size+0x20; + vgmstream->current_block_size/=vgmstream->channels; + + for (i=0;ichannels;i++) { + vgmstream->ch[i].offset = vgmstream->current_block_offset+0x20+(vgmstream->current_block_size*i); + } +} diff --git a/src/layout/layout.h b/src/layout/layout.h index 1a98ca25..66fd7dac 100644 --- a/src/layout/layout.h +++ b/src/layout/layout.h @@ -34,6 +34,8 @@ void emff_ps2_block_update(off_t block_offset, VGMSTREAM * vgmstream); void emff_ngc_block_update(off_t block_offset, VGMSTREAM * vgmstream); +void gsb_block_update(off_t block_offset, VGMSTREAM * vgmstream); + void xvas_block_update(off_t block_offset, VGMSTREAM * vgmstream); void thp_block_update(off_t block_offset, VGMSTREAM * vgmstream); diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index ab110c19..fa9323ad 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -874,6 +874,10 @@ RelativePath=".\layout\emff_blocked.c" > + + diff --git a/src/meta/dc_asd.c b/src/meta/dc_asd.c index 7a751823..4b848cc0 100644 --- a/src/meta/dc_asd.c +++ b/src/meta/dc_asd.c @@ -15,19 +15,17 @@ VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE *streamFile) { if (strcasecmp("asd",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x20,streamFile) != 0x00000000) - goto fail; - if (read_32bitBE(0x24,streamFile) != 0x00000000) - goto fail; + if (read_32bitBE(0x20,streamFile) != 0x00000000 && + read_32bitBE(0x24,streamFile) != 0x00000000) + goto fail; - loop_flag = 0; /* (read_32bitLE(0x144,streamFile)!=0); */ + loop_flag = 0; channel_count = read_16bitLE(0x0A,streamFile); /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; - /* fill in the vital statistics */ start_offset = 0x800; vgmstream->channels = channel_count; @@ -35,11 +33,9 @@ VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE *streamFile) { vgmstream->coding_type = coding_PCM16LE; vgmstream->num_samples = read_32bitLE(0x0,streamFile)/2/channel_count; if (loop_flag) { - vgmstream->loop_start_sample = 0; /* read_32bitLE(0x144,streamFile)/2/channel_count; */ + vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = read_32bitLE(0x0,streamFile)/2/channel_count; } - - switch (channel_count) { case 1: @@ -53,7 +49,6 @@ VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE *streamFile) { goto fail; } - vgmstream->meta_type = meta_DC_ASD; /* open the file for reading */ diff --git a/src/meta/dc_idvi.c b/src/meta/dc_idvi.c index 90f6a269..7473fdb7 100644 --- a/src/meta/dc_idvi.c +++ b/src/meta/dc_idvi.c @@ -30,24 +30,22 @@ VGMSTREAM * init_vgmstream_dc_idvi(STREAMFILE *streamFile) { start_offset = 0x800; vgmstream->sample_rate = read_32bitLE(0x08,streamFile); vgmstream->coding_type = coding_INT_DVI_IMA; - vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset); - if (loop_flag) { vgmstream->loop_start_sample = read_32bitLE(0x0C,streamFile); vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-start_offset); } + vgmstream->meta_type = meta_DC_IDVI; - vgmstream->interleave_block_size = 0x400; - if (channel_count > 1) { - vgmstream->interleave_smallblock_size = ((get_streamfile_size(streamFile)-start_offset)%(vgmstream->channels*vgmstream->interleave_block_size))/vgmstream->channels; + /* Calculating the short block... */ + if (channel_count > 1) { + vgmstream->interleave_block_size = 0x400; + vgmstream->interleave_smallblock_size = ((get_streamfile_size(streamFile)-start_offset)%(vgmstream->channels*vgmstream->interleave_block_size))/vgmstream->channels; vgmstream->layout_type = layout_interleave_shortblock; } else { vgmstream->layout_type = layout_none; } - vgmstream->meta_type = meta_DC_IDVI; - /* open the file for reading */ { int i; diff --git a/src/meta/dc_str.c b/src/meta/dc_str.c index d5b595cc..cb441697 100644 --- a/src/meta/dc_str.c +++ b/src/meta/dc_str.c @@ -23,7 +23,6 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) { channel_count = read_32bitLE(0x18,streamFile); samples=read_32bitLE(0x08,streamFile); - vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; @@ -66,7 +65,6 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) { vgmstream->sample_rate = read_32bitLE(0x04,streamFile); vgmstream->meta_type = meta_DC_STR; - /* open the file for reading */ { int i; diff --git a/src/meta/dc_wav_dcs.c b/src/meta/dc_wav_dcs.c index 197ea8a0..fe0a6835 100644 --- a/src/meta/dc_wav_dcs.c +++ b/src/meta/dc_wav_dcs.c @@ -45,14 +45,10 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) { read_32bitBE(0x3C,streamFileWAV) != 0x406E616D) /* "@nam" */ goto fail; - /* scan file until we find a "data" string */ file_size = get_streamfile_size(streamFileWAV); - { - current_chunk = 0; - /* Start at 0 and loop until we reached the file size, or until we found a "data string */ while (!Founddata && current_chunk < file_size) { @@ -67,7 +63,6 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) { current_chunk = current_chunk + 1; } } - if (Founddata == 0) { goto fail; @@ -77,9 +72,9 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) { } loop_flag = 0; - - /* build the VGMSTREAM */ + /* Seems we're dealing with a vaild file+header, + now we can finally build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; @@ -118,8 +113,6 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) { } } - - close_streamfile(streamFileWAV); streamFileWAV=NULL; return vgmstream; diff --git a/src/meta/emff.c b/src/meta/emff.c index 926ecc77..47a0cbf0 100644 --- a/src/meta/emff.c +++ b/src/meta/emff.c @@ -2,11 +2,8 @@ #include "../layout/layout.h" #include "../util.h" -/* -EMFF - Eidos Music File Format (PS2), -found in Tomb Raider Legend/Anniversary, Legacy of Kain - Defiance, possibly more... -*/ - +/* EMFF - Eidos Music File Format (PS2), +found in Tomb Raider Legend/Anniversary, Legacy of Kain - Defiance, possibly more... */ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; @@ -15,7 +12,6 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { int channel_count; int frequency; int i; - int j; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); @@ -24,16 +20,13 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { /* do some checks on the file, cause we have no magic words to check the header... it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1 it has a text section, if both are 1 it's video with a text section included... */ - if (read_32bitBE(0x800,streamFile) == 0x01000000 || /* "0x01000000" */ read_32bitBE(0x804,streamFile) == 0x01000000) /* "0x01000000" */ goto fail; - - frequency = read_32bitLE(0x0,streamFile); + frequency = read_32bitLE(0x0,streamFile); channel_count = read_32bitLE(0xC,streamFile); - if (frequency > 48000 || channel_count > 8) { goto fail; @@ -41,19 +34,15 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { loop_flag = (read_32bitLE(0x4,streamFile) != 0xFFFFFFFF); - /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; /* fill in the vital statistics */ - start_offset = 0x800; vgmstream->sample_rate = frequency; vgmstream->channels = channel_count; vgmstream->coding_type = coding_PSX; - - if (loop_flag) { vgmstream->loop_start_sample = (read_32bitLE(0x28,streamFile)-start_offset)*28/16/channel_count; vgmstream->loop_end_sample = read_32bitLE(0x8,streamFile); @@ -72,7 +61,7 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { vgmstream->ch[i].streamfile = file; } } - + /* Calc num_samples */ emff_ps2_block_update(start_offset,vgmstream); vgmstream->num_samples=0; @@ -85,21 +74,17 @@ VGMSTREAM * init_vgmstream_emff_ps2(STREAMFILE *streamFile) { emff_ps2_block_update(start_offset,vgmstream); - return vgmstream; - /* clean up anything we may have opened */ +/* clean up anything we may have opened */ fail: if (vgmstream) close_vgmstream(vgmstream); return NULL; } -/* -EMFF - Eidos Music File Format (NGC/WII), -found in Tomb Raider Legend/Anniversary, Legacy of Kain - Defiance, possibly more... -*/ - +/* EMFF - Eidos Music File Format (NGC/WII), +found in Tomb Raider Legend/Anniversary, Legacy of Kain - Defiance, possibly more... */ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; @@ -109,49 +94,80 @@ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) { int frequency; int i; int j; - off_t coef_table[8] = {0xC8,0xF6,0x124,0x152,0x180,0x1AE,0x1DC,0x20A}; + off_t coef_table1[8] = {0xC8,0xF6,0x124,0x152,0x180,0x1AE,0x1DC,0x20A}; + off_t coef_table2[8] = {0x2D0,0x2FE,0x32C,0x35A,0x388,0x3B6,0x3E4,0x412}; - /* check extension, case insensitive */ + /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("emff",filename_extension(filename))) goto fail; /* do some checks on the file, cause we have no magic words to check the header... it seems if 0x800 and 0x804 = 0 then the file has only audio, if 0x800 = 1 it has a text section, if both are 1 it's video with a text section included... */ - if (read_32bitBE(0x800,streamFile) == 0x00000001 || /* "0x00000001" */ read_32bitBE(0x804,streamFile) == 0x00000001) /* "0x00000001" */ goto fail; - frequency = read_32bitBE(0x0,streamFile); channel_count = read_32bitBE(0xC,streamFile); - if (frequency > 48000 || channel_count > 8) { goto fail; } loop_flag = (read_32bitBE(0x4,streamFile) != 0xFFFFFFFF); - - + /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; /* fill in the vital statistics */ - start_offset = 0x800; vgmstream->sample_rate = frequency; vgmstream->channels = channel_count; vgmstream->coding_type = coding_NGC_DSP; - + /* Retrieving coefs and loops, depending on the file layout... */ + if (read_32bitBE(0xC8,streamFile) == 0x0 && + read_32bitBE(0xCC,streamFile) == 0x0 && + read_32bitBE(0xD0,streamFile) == 0x0 && + read_32bitBE(0xD4,streamFile) == 0x0 && + read_32bitBE(0xD8,streamFile) == 0x0 && + read_32bitBE(0xDC,streamFile) == 0x0 && + read_32bitBE(0xE0,streamFile) == 0x0 && + read_32bitBE(0xE4,streamFile) == 0x0) { + + for (j=0;jchannels;j++) { + for (i=0;i<16;i++) { + vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table2[j]+i*2,streamFile); + } +} + if (loop_flag) { + vgmstream->loop_start_sample = (read_32bitBE(0x28,streamFile))*14/8/channel_count; + vgmstream->loop_end_sample = read_32bitBE(0x8,streamFile); + } + } else if (read_32bitBE(0x2D0,streamFile) == 0x0 && + read_32bitBE(0x2D4,streamFile) == 0x0 && + read_32bitBE(0x2D8,streamFile) == 0x0 && + read_32bitBE(0x2DC,streamFile) == 0x0 && + read_32bitBE(0x2E0,streamFile) == 0x0 && + read_32bitBE(0x2E4,streamFile) == 0x0 && + read_32bitBE(0x2E8,streamFile) == 0x0 && + read_32bitBE(0x2EC,streamFile) == 0x0) { + + for (j=0;jchannels;j++) { + for (i=0;i<16;i++) { + vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table1[j]+i*2,streamFile); + } +} if (loop_flag) { vgmstream->loop_start_sample = (read_32bitBE(0x28,streamFile)-start_offset)*14/8/channel_count; vgmstream->loop_end_sample = read_32bitBE(0x8,streamFile); - } + } + } else { + goto fail; + } vgmstream->layout_type = layout_emff_ngc_blocked; vgmstream->interleave_block_size = 0x10; @@ -167,15 +183,6 @@ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) { } } - - if (vgmstream->coding_type == coding_NGC_DSP) { - for (j=0;jchannels;j++) { - for (i=0;i<16;i++) { - vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile); - } - } - } - /* Calc num_samples */ emff_ngc_block_update(start_offset,vgmstream); vgmstream->num_samples=0; @@ -188,10 +195,9 @@ VGMSTREAM * init_vgmstream_emff_ngc(STREAMFILE *streamFile) { emff_ngc_block_update(start_offset,vgmstream); - return vgmstream; - /* clean up anything we may have opened */ +/* clean up anything we may have opened */ fail: if (vgmstream) close_vgmstream(vgmstream); return NULL; diff --git a/src/meta/fsb.c b/src/meta/fsb.c index 0962ec89..0e8f9fe6 100644 --- a/src/meta/fsb.c +++ b/src/meta/fsb.c @@ -1,6 +1,10 @@ #include "meta.h" #include "../util.h" +/* comment from hcs: +((uint8_t)read_8bit(offset, file))&0xf for the low nibble, +((uint8_t)read_8bit(offset, file)) >> 4 for the high one +*/ /* FSB1 */ VGMSTREAM * init_vgmstream_fsb1(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; diff --git a/src/meta/gca.c b/src/meta/gca.c index f34d780d..f6ff5bbd 100644 --- a/src/meta/gca.c +++ b/src/meta/gca.c @@ -6,9 +6,8 @@ VGMSTREAM * init_vgmstream_gca(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; - int channel_count; + int channel_count = 1; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); @@ -17,9 +16,6 @@ VGMSTREAM * init_vgmstream_gca(STREAMFILE *streamFile) { /* check header */ if (read_32bitBE(0x00,streamFile) != 0x47434131) /* "GCA1" */ goto fail; - - loop_flag = 0; - channel_count = 1; /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); @@ -49,7 +45,7 @@ VGMSTREAM * init_vgmstream_gca(STREAMFILE *streamFile) { for (i=0;ich[i].streamfile = file; - vgmstream->ch[i].channel_start_offset= + vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=start_offset+ vgmstream->interleave_block_size*i; @@ -63,7 +59,6 @@ VGMSTREAM * init_vgmstream_gca(STREAMFILE *streamFile) { vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x04+i*2,streamFile); } } - return vgmstream; diff --git a/src/meta/gsp_gsb.c b/src/meta/gsp_gsb.c index caf0ae87..168acfea 100644 --- a/src/meta/gsp_gsb.c +++ b/src/meta/gsp_gsb.c @@ -1,10 +1,10 @@ #include "meta.h" #include "../util.h" -/* GSP+GSB +/* GSP+GSB - 2008-11-28 - manakoAT - 2008-11-28 - manakoAT -*/ +Super Swing Golf 1 & 2 (WII) +Note: Block Format missing!!! */ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) { @@ -12,13 +12,13 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) { STREAMFILE * streamFileGSP = NULL; char filename[260]; char filenameGSP[260]; - + off_t start_offset; int i; int channel_count; int loop_flag; int header_len; - int coef1_start; - int coef2_start; + off_t coef1_start; + off_t coef2_start; int dsp_blocks; /* check extension, case insensitive */ @@ -37,11 +37,11 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) { goto fail; channel_count = (uint16_t)read_16bitBE(0x3A,streamFileGSP); - loop_flag = 0; /* read_32bitBE(0x20,streamFileGSP); */ + loop_flag = (read_32bitBE(0x64,streamFileGSP) !=0xFFFFFFFF); header_len = read_32bitBE(0x1C,streamFileGSP); - coef1_start = read_32bitBE(header_len-0x4C,streamFileGSP); - coef2_start = read_32bitBE(header_len-0x1C,streamFileGSP); + coef1_start = header_len-0x4C; + coef2_start = header_len-0x1C; dsp_blocks = read_32bitBE(header_len-0x5C,streamFileGSP); /* build the VGMSTREAM */ @@ -51,41 +51,31 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) { /* fill in the vital statistics */ vgmstream->channels = channel_count; vgmstream->sample_rate = read_32bitBE(0x34,streamFileGSP); - vgmstream->num_samples=read_32bitBE(0x2C,streamFileGSP)*14/8/channel_count; vgmstream->coding_type = coding_NGC_DSP; - if(loop_flag) { - vgmstream->loop_start_sample = 0; /* read_32bitBE(0x20,streamFileGSP)*14/8/channel_count; */ - vgmstream->loop_end_sample = read_32bitBE(0x48,streamFileGSP)*14/8/channel_count; + vgmstream->loop_start_sample = read_32bitBE(0x64,streamFileGSP); + vgmstream->loop_end_sample = read_32bitBE(0x68,streamFileGSP); } if (channel_count == 1) { - vgmstream->layout_type = layout_none; - } else if (channel_count == 2) { - vgmstream->layout_type = layout_interleave; + vgmstream->layout_type = layout_gsb_blocked; + } else if (channel_count > 1) { + vgmstream->layout_type = layout_gsb_blocked; vgmstream->interleave_block_size = read_32bitBE(header_len-0x64,streamFileGSP); } - - vgmstream->meta_type = meta_GSP_GSB; /* open the file for reading */ 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=0; - + vgmstream->ch[0].channel_start_offset=0; 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->interleave_block_size; } - if (vgmstream->coding_type == coding_NGC_DSP) { int i; for (i=0;i<16;i++) { @@ -98,12 +88,24 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) { } } + /* Calc num_samples */ + start_offset = 0x0; + gsb_block_update(start_offset,vgmstream); + vgmstream->num_samples=0; + + do { + + vgmstream->num_samples += vgmstream->current_block_size*14/8; + gsb_block_update(vgmstream->next_block_offset,vgmstream); + } while (vgmstream->next_block_offsetget_name(streamFile,filename,sizeof(filename)); if (strcasecmp("isd",filename_extension(filename))) goto fail; - strcpy(filenameISH,filename); strcpy(filenameISH+strlen(filenameISH)-3,"ISH"); @@ -44,7 +41,6 @@ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) { vgmstream->sample_rate = read_32bitBE(0x08,streamFileISH); vgmstream->num_samples=read_32bitBE(0x0C,streamFileISH); vgmstream->coding_type = coding_NGC_DSP; - if(loop_flag) { vgmstream->loop_start_sample = read_32bitBE(0x20,streamFileISH)*14/8/channel_count; vgmstream->loop_end_sample = read_32bitBE(0x24,streamFileISH)*14/8/channel_count; @@ -57,8 +53,6 @@ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) { vgmstream->interleave_block_size = read_32bitBE(0x18,streamFileISH); } - - vgmstream->meta_type = meta_ISH_ISD; /* open the file for reading */ @@ -70,8 +64,6 @@ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) { if (!vgmstream->ch[i].streamfile) goto fail; } } - - if (vgmstream->coding_type == coding_NGC_DSP) { int i; @@ -85,7 +77,6 @@ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) { } } - close_streamfile(streamFileISH); streamFileISH=NULL; return vgmstream; diff --git a/src/meta/kraw.c b/src/meta/kraw.c index dcf38d70..9a077097 100644 --- a/src/meta/kraw.c +++ b/src/meta/kraw.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_kraw(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -37,7 +36,6 @@ VGMSTREAM * init_vgmstream_kraw(STREAMFILE *streamFile) { } vgmstream->layout_type = layout_none; - /* vgmstream->interleave_block_size = 0x10; */ vgmstream->meta_type = meta_KRAW; /* open the file for reading */ diff --git a/src/meta/msvp.c b/src/meta/msvp.c index d3f47af1..0627dfab 100644 --- a/src/meta/msvp.c +++ b/src/meta/msvp.c @@ -1,12 +1,11 @@ #include "meta.h" #include "../util.h" -/* MSV (from Pocap Hits) */ +/* MSVP (from PoPcap Hits Vol. 1) */ VGMSTREAM * init_vgmstream_msvp(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -36,7 +35,6 @@ VGMSTREAM * init_vgmstream_msvp(STREAMFILE *streamFile) { vgmstream->loop_end_sample = (read_32bitBE(0x0C,streamFile))*28/16/channel_count; } - /* Just to be sure that there comes a 2 channel file */ if (channel_count == 1) { vgmstream->layout_type = layout_none; @@ -45,7 +43,6 @@ VGMSTREAM * init_vgmstream_msvp(STREAMFILE *streamFile) { vgmstream->interleave_block_size = 0x10; /* Unknown for now */ } - vgmstream->meta_type = meta_MSVP; /* open the file for reading */ diff --git a/src/meta/musc.c b/src/meta/musc.c index d52c584e..1abca4ff 100644 --- a/src/meta/musc.c +++ b/src/meta/musc.c @@ -1,12 +1,11 @@ #include "meta.h" #include "../util.h" -/* MUSC/MUSX (near all Spyro games and many other using this) */ +/* MUSC (near all Spyro games and many other using this) */ VGMSTREAM * init_vgmstream_musc(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int musc_version; int loop_flag = 0; int channel_count = 2; @@ -19,7 +18,7 @@ VGMSTREAM * init_vgmstream_musc(STREAMFILE *streamFile) { if (read_32bitBE(0x0,streamFile) != 0x4D555343) /* MUSC */ goto fail; - loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */ + loop_flag = 0; channel_count = 2; /* build the VGMSTREAM */ @@ -36,7 +35,7 @@ VGMSTREAM * init_vgmstream_musc(STREAMFILE *streamFile) { vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (read_32bitLE(0x14,streamFile))*28/16/channel_count; if (loop_flag) { - vgmstream->loop_start_sample = 0; /*(read_32bitLE(0x08,streamFile)-1)*28; */ + vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = (read_32bitLE(0x14,streamFile))*28/16/channel_count; } break; @@ -48,9 +47,7 @@ VGMSTREAM * init_vgmstream_musc(STREAMFILE *streamFile) { vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = (read_32bitLE(0x18,streamFile))/2; vgmstream->meta_type = meta_MUSC; - - - + /* open the file for reading */ { int i; @@ -63,7 +60,6 @@ VGMSTREAM * init_vgmstream_musc(STREAMFILE *streamFile) { vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=start_offset+ vgmstream->interleave_block_size*i; - } } diff --git a/src/meta/musx.c b/src/meta/musx.c index c4bc12b8..e27c1636 100644 --- a/src/meta/musx.c +++ b/src/meta/musx.c @@ -7,9 +7,8 @@ VGMSTREAM * init_vgmstream_musx_v004(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int musx_type; /* determining the decoder by strings like "PS2_", "GC__" and so on */ - int musx_version; /* 0x08 provides a "version" byte??? */ + int musx_version; /* 0x08 provides a "version" byte */ int loop_flag = 0; int channel_count; @@ -18,16 +17,11 @@ VGMSTREAM * init_vgmstream_musx_v004(STREAMFILE *streamFile) { if (strcasecmp("musx",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */ - goto fail; - - if (read_32bitBE(0x08,streamFile) != 0x04000000) /* "0x04000000" */ - goto fail; + if (read_32bitBE(0x00,streamFile) != 0x4D555358 && /* "MUSX" */ + read_32bitBE(0x08,streamFile) != 0x04000000) /* "0x04000000" */ + goto fail; - /* Determine if we have an old MUSX file, - hope this will work, but it seems every new MUSX type has a new "identifer" byte */ - - /* This is tricky, the header changes it's layout if the file is unlooped */ + /* This is tricky, the header changes it's layout if the file is unlooped */ loop_flag = (read_32bitLE(0x840,streamFile)!=0xFFFFFFFF); channel_count = 2; @@ -91,9 +85,8 @@ VGMSTREAM * init_vgmstream_musx_v006(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int musx_type; /* determining the decoder by strings like "PS2_", "GC__" and so on */ - int musx_version; /* 0x08 provides a "version" byte??? */ + int musx_version; /* 0x08 provides a "version" byte */ int loop_flag = 0; int channel_count; @@ -102,16 +95,10 @@ VGMSTREAM * init_vgmstream_musx_v006(STREAMFILE *streamFile) { if (strcasecmp("musx",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */ - goto fail; - - if (read_32bitBE(0x08,streamFile) != 0x06000000) /* "0x06000000" */ - goto fail; - - /* Determine if we have an old MUSX file, - hope this will work, but it seems every new MUSX type has a new "identifer" byte */ - - /* This is tricky, the header changes it's layout if the file is unlooped */ + if (read_32bitBE(0x00,streamFile) != 0x4D555358 && /* "MUSX" */ + read_32bitBE(0x08,streamFile) != 0x06000000) /* "0x06000000" */ + goto fail; + loop_flag = (read_32bitLE(0x840,streamFile)!=0xFFFFFFFF); channel_count = 2; @@ -119,7 +106,6 @@ VGMSTREAM * init_vgmstream_musx_v006(STREAMFILE *streamFile) { vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; - /* fill in the vital statistics */ musx_type=(read_32bitBE(0x10,streamFile)); @@ -168,19 +154,14 @@ fail: } - - - - /* MUSX */ /* New MUSX formats, found in Quantum of Solace, The Mummy 3, possibly more */ VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int musx_type; /* determining the decoder by strings like "PS2_", "GC__" and so on */ - int musx_version; /* 0x08 provides a "version" byte??? */ + int musx_version; /* 0x08 provides a "version" byte */ int loop_flag = 0; int channel_count; @@ -189,16 +170,11 @@ VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE *streamFile) { if (strcasecmp("musx",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */ - goto fail; - - /* Determine if we have an old MUSX file, - hope this will work, but it seems every new MUSX type has a new "identifer" byte */ - if (read_32bitBE(0x08,streamFile) != 0x0A000000) /* "0x0A000000" */ - goto fail; + if (read_32bitBE(0x00,streamFile) != 0x4D555358 && /* "MUSX" */ + read_32bitBE(0x08,streamFile) != 0x0A000000) /* "0x0A000000" */ + goto fail; - /* This is tricky, the header changes it's layout if the file is unlooped */ - loop_flag = (read_32bitLE(0x34,streamFile)!=0x00000000); + loop_flag = (read_32bitLE(0x34,streamFile)!=0x00000000); channel_count = 2; /* build the VGMSTREAM */ @@ -252,16 +228,13 @@ fail: return NULL; } - - /* MUSX */ /* Old MUSX format, this one handles "Sphinx and the cursed Mummy", it's different from the other formats */ VGMSTREAM * init_vgmstream_musx_v201(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - - int musx_version; /* 0x08 provides a "version" byte??? */ + int musx_version; /* 0x08 provides a "version" byte */ int loop_flag; int channel_count; int loop_detect; @@ -272,18 +245,13 @@ VGMSTREAM * init_vgmstream_musx_v201(STREAMFILE *streamFile) { if (strcasecmp("musx",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */ - goto fail; - - /* Determine if we have an old MUSX file, - hope this will work, but it seems every new MUSX type has a new "identifer" byte */ - if (read_32bitBE(0x08,streamFile) != 0xC9000000) /* "0xC9000000" */ - goto fail; + if (read_32bitBE(0x00,streamFile) != 0x4D555358 && /* "MUSX" */ + read_32bitBE(0x08,streamFile) != 0xC9000000) /* "0xC9000000" */ + goto fail; - /* This is tricky, the header changes it's layout if the file is unlooped */ channel_count = 2; + loop_detect = read_32bitBE(0x800,streamFile); - switch (loop_detect) { case 0x02000000: loop_offsets = 0x8E0; @@ -306,28 +274,23 @@ VGMSTREAM * init_vgmstream_musx_v201(STREAMFILE *streamFile) { loop_flag = (read_32bitLE(loop_offsets+0x10,streamFile) !=0x00000000); - /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; - /* fill in the vital statistics */ - start_offset = read_32bitLE(0x18,streamFile); - vgmstream->channels = channel_count; - vgmstream->sample_rate = 32000; - vgmstream->coding_type = coding_PSX; - - vgmstream->num_samples = read_32bitLE(loop_offsets,streamFile)*28/16/channel_count; - if (loop_flag) { + start_offset = read_32bitLE(0x18,streamFile); + vgmstream->channels = channel_count; + vgmstream->sample_rate = 32000; + vgmstream->coding_type = coding_PSX; + vgmstream->num_samples = read_32bitLE(loop_offsets,streamFile)*28/16/channel_count; + if (loop_flag) { vgmstream->loop_start_sample = read_32bitLE(loop_offsets+0x10,streamFile)*28/16/channel_count; vgmstream->loop_end_sample = read_32bitLE(loop_offsets,streamFile)*28/16/channel_count; - } - - - vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = 0x80; - vgmstream->meta_type = meta_MUSX_V201; + } + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x80; + vgmstream->meta_type = meta_MUSX_V201; /* open the file for reading */ { diff --git a/src/meta/naomi_spsd.c b/src/meta/naomi_spsd.c index 480db391..f38e669c 100644 --- a/src/meta/naomi_spsd.c +++ b/src/meta/naomi_spsd.c @@ -6,9 +6,8 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; - int channel_count; + int channel_count; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); @@ -60,7 +59,6 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) { vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=start_offset+ vgmstream->interleave_block_size*i; - vgmstream->ch[i].adpcm_step_index = 0x7f; /* AICA */ } } diff --git a/src/meta/ngc_bh2pcm.c b/src/meta/ngc_bh2pcm.c index f0fa7efb..0894827b 100644 --- a/src/meta/ngc_bh2pcm.c +++ b/src/meta/ngc_bh2pcm.c @@ -6,67 +6,61 @@ VGMSTREAM * init_vgmstream_ngc_bh2pcm(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - - int channel_count=2; + int channel_count; int format_detect; int loop_flag; - /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("bh2pcm",filename_extension(filename))) goto fail; #if 0 /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */ + if (read_32bitBE(0x00,streamFile) != 0x00000000) goto fail; #endif - loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */ + loop_flag = 0; + channel_count = 2; + /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; /* fill in the vital statistics */ - - - format_detect=read_32bitLE(0x00,streamFile); - switch (format_detect) { - case 1: - start_offset = 0x20; - channel_count = 2; - vgmstream->channels = channel_count; - vgmstream->sample_rate = 32000; - vgmstream->num_samples = read_32bitLE(0x04,streamFile)/2; - vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = read_32bitLE(0x04,streamFile); - if (loop_flag) { - vgmstream->loop_start_sample = 0; /* read_32bitLE(0x10,streamFile)/2; */ - vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile); - } - -break; - case 0: - start_offset = 0x20; - channel_count = 1; - vgmstream->channels = channel_count; - vgmstream->sample_rate = 32000; - vgmstream->num_samples = read_32bitLE(0x0C,streamFile); - vgmstream->layout_type = layout_none; - if (loop_flag) { - vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile); - vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile); - } -break; - default: - goto fail; - } - - vgmstream->coding_type = coding_PCM16BE; - vgmstream->meta_type = meta_NGC_BH2PCM; - - + format_detect=read_32bitLE(0x00,streamFile); + switch (format_detect) { + case 1: + start_offset = 0x20; + channel_count = 2; + vgmstream->channels = channel_count; + vgmstream->sample_rate = 32000; + vgmstream->num_samples = read_32bitLE(0x04,streamFile)/2; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = read_32bitLE(0x04,streamFile); + if (loop_flag) { + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample = read_32bitLE(0x14,streamFile); + } + break; + case 0: + start_offset = 0x20; + channel_count = 1; + vgmstream->channels = channel_count; + vgmstream->sample_rate = 32000; + vgmstream->num_samples = read_32bitLE(0x0C,streamFile); + vgmstream->layout_type = layout_none; + if (loop_flag) { + vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile); + vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile); + } + break; + default: + goto fail; + } + vgmstream->coding_type = coding_PCM16BE; + vgmstream->meta_type = meta_NGC_BH2PCM; /* open the file for reading */ { diff --git a/src/meta/ngc_pdt.c b/src/meta/ngc_pdt.c index 2df0ef07..56e70292 100644 --- a/src/meta/ngc_pdt.c +++ b/src/meta/ngc_pdt.c @@ -1,12 +1,11 @@ #include "meta.h" #include "../util.h" -/* PDT (Mario Party) */ +/* PDT - Custom Generated File (Mario Party) */ VGMSTREAM * init_vgmstream_ngc_pdt(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; @@ -38,9 +37,8 @@ VGMSTREAM * init_vgmstream_ngc_pdt(STREAMFILE *streamFile) { vgmstream->loop_end_sample = read_32bitBE(0x08,streamFile)*14/8/channel_count; } - /* dealing with no interleave, 'cause the interleave - for 2 channels is larger than the sample count */ + for 2 channels is larger than the sample count/2 */ vgmstream->layout_type = layout_none; vgmstream->meta_type = meta_NGC_PDT; diff --git a/src/meta/ngc_ssm.c b/src/meta/ngc_ssm.c index 0dcf7f90..7ea40369 100644 --- a/src/meta/ngc_ssm.c +++ b/src/meta/ngc_ssm.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ngc_ssm(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; int coef1_start; diff --git a/src/meta/ngc_tydsp.c b/src/meta/ngc_tydsp.c index ccb862f6..bfce6949 100644 --- a/src/meta/ngc_tydsp.c +++ b/src/meta/ngc_tydsp.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ngc_tydsp(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; @@ -36,7 +35,6 @@ VGMSTREAM * init_vgmstream_ngc_tydsp(STREAMFILE *streamFile) { vgmstream->interleave_block_size = read_32bitBE(0x04,streamFile); vgmstream->meta_type = meta_NGC_TYDSP; - if (vgmstream->coding_type == coding_NGC_DSP) { int i; for (i=0;i<16;i++) { diff --git a/src/meta/ngc_vjdsp.c b/src/meta/ngc_vjdsp.c index 1cac4e0a..028e2ccd 100644 --- a/src/meta/ngc_vjdsp.c +++ b/src/meta/ngc_vjdsp.c @@ -36,7 +36,6 @@ VGMSTREAM * init_vgmstream_ngc_vjdsp(STREAMFILE *streamFile) { vgmstream->interleave_block_size = 0x2000; vgmstream->meta_type = meta_NGC_VJDSP; - if (vgmstream->coding_type == coding_NGC_DSP) { int i; for (i=0;i<16;i++) { diff --git a/src/meta/ngc_waa_wac_wad_wam.c b/src/meta/ngc_waa_wac_wad_wam.c index e9d6a1f3..8738f5fb 100644 --- a/src/meta/ngc_waa_wac_wad_wam.c +++ b/src/meta/ngc_waa_wac_wad_wam.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; int coef1_start; diff --git a/src/meta/ngc_ymf.c b/src/meta/ngc_ymf.c index 48901117..9ca6a294 100644 --- a/src/meta/ngc_ymf.c +++ b/src/meta/ngc_ymf.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ngc_ymf(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; @@ -26,7 +25,7 @@ VGMSTREAM * init_vgmstream_ngc_ymf(STREAMFILE *streamFile) { if (!vgmstream) goto fail; /* fill in the vital statistics */ - start_offset = 0x180; /* read_32bitBE(0x00,streamFile); */ + start_offset = 0x180; vgmstream->channels = channel_count; vgmstream->sample_rate = read_32bitBE(0xA8,streamFile); vgmstream->coding_type = coding_NGC_DSP; @@ -37,7 +36,7 @@ VGMSTREAM * init_vgmstream_ngc_ymf(STREAMFILE *streamFile) { } vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = 0x20000; /* read_32bitBE(0x04,streamFile); */ + vgmstream->interleave_block_size = 0x20000; vgmstream->meta_type = meta_NGC_YMF; diff --git a/src/meta/ps2_ass.c b/src/meta/ps2_ass.c index cb6fcbf1..33271d7a 100644 --- a/src/meta/ps2_ass.c +++ b/src/meta/ps2_ass.c @@ -5,7 +5,6 @@ VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; - char filename[260]; off_t start_offset; uint8_t testBuffer[0x10]; @@ -21,7 +20,7 @@ VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE *streamFile) { if (strcasecmp("ass",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x02000000) /* "00000000" */ + if (read_32bitBE(0x00,streamFile) != 0x02000000) /* "0x02000000" */ goto fail; loop_flag = 1; @@ -37,15 +36,12 @@ VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE *streamFile) { vgmstream->sample_rate = read_32bitLE(0x04,streamFile); vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (read_32bitLE(0x08,streamFile)*2)*28/16/channel_count; - - fileLength = get_streamfile_size(streamFile); do { readOffset+=(off_t)read_streamfile(testBuffer,readOffset,0x10,streamFile); - /* Loop Start */ if(testBuffer[0x01]==0x06) { if(loopStart == 0) loopStart = readOffset-0x10; @@ -56,11 +52,8 @@ VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE *streamFile) { if(loopEnd == 0) loopEnd = readOffset-0x10; /* break; */ } - } while (streamFile->get_offset(streamFile)<(int32_t)fileLength); - - if(loopStart == 0) { loop_flag = 0; vgmstream->num_samples = read_32bitLE(0x4,streamFile)*28/16/channel_count; @@ -70,15 +63,6 @@ VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE *streamFile) { vgmstream->loop_end_sample = (loopEnd-start_offset)*28/16/channel_count; } - - - - - - - - - vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile); vgmstream->meta_type = meta_PS2_ASS; diff --git a/src/meta/ps2_aus.c b/src/meta/ps2_aus.c index 2e7181ea..994b31af 100644 --- a/src/meta/ps2_aus.c +++ b/src/meta/ps2_aus.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; diff --git a/src/meta/ps2_bg00.c b/src/meta/ps2_bg00.c index 3ea99c71..273c08fe 100644 --- a/src/meta/ps2_bg00.c +++ b/src/meta/ps2_bg00.c @@ -1,12 +1,12 @@ #include "meta.h" #include "../util.h" -/* BG0 (from Ibara, Mushihimesama) */ +/* BG0 (from Ibara, Mushihimesama) +Note: Seems the Loop Infos are stored external... */ VGMSTREAM * init_vgmstream_bg00(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -32,7 +32,7 @@ VGMSTREAM * init_vgmstream_bg00(STREAMFILE *streamFile) { vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (read_32bitBE(0x4C,streamFile)*2)*28/16/channel_count; if (loop_flag) { - vgmstream->loop_start_sample = 0; /* (read_32bitBE(0x4C,streamFile))*28/16/channel_count; */ + vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = (read_32bitBE(0x4C,streamFile)*2)*28/16/channel_count; } diff --git a/src/meta/ps2_bmdx.c b/src/meta/ps2_bmdx.c index a7eed8f0..bea1eebc 100644 --- a/src/meta/ps2_bmdx.c +++ b/src/meta/ps2_bmdx.c @@ -4,7 +4,6 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; - int loop_flag=0; int channel_count; off_t start_offset; diff --git a/src/meta/ps2_ccc.c b/src/meta/ps2_ccc.c index dd87a9bc..c665b48a 100644 --- a/src/meta/ps2_ccc.c +++ b/src/meta/ps2_ccc.c @@ -1,12 +1,11 @@ #include "meta.h" #include "../util.h" -/* CCC (from Unlimited Saga) */ +/* CCC */ VGMSTREAM * init_vgmstream_ps2_ccc(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; diff --git a/src/meta/ps2_dxh.c b/src/meta/ps2_dxh.c index e87e1669..2b1d1411 100644 --- a/src/meta/ps2_dxh.c +++ b/src/meta/ps2_dxh.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_dxh(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; diff --git a/src/meta/ps2_enth.c b/src/meta/ps2_enth.c index e7d2c4a9..fa495b79 100644 --- a/src/meta/ps2_enth.c +++ b/src/meta/ps2_enth.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_enth(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int header_check; int loop_flag; int channel_count; @@ -14,7 +13,6 @@ VGMSTREAM * init_vgmstream_ps2_enth(STREAMFILE *streamFile) { /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("enth",filename_extension(filename))) goto fail; - /* check header and loop_flag */ header_check = read_32bitBE(0x00,streamFile); @@ -51,7 +49,6 @@ VGMSTREAM * init_vgmstream_ps2_enth(STREAMFILE *streamFile) { } vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile); break; - case 0x4C455020: /* LEP */ start_offset = 0x800; vgmstream->channels = channel_count; diff --git a/src/meta/ps2_hgc1.c b/src/meta/ps2_hgc1.c index 26c6b1eb..081a2f15 100644 --- a/src/meta/ps2_hgc1.c +++ b/src/meta/ps2_hgc1.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_hgc1(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -18,7 +17,7 @@ VGMSTREAM * init_vgmstream_hgc1(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x68674331) /* "hgC1" */ goto fail; - loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */ + loop_flag = 0; channel_count = read_32bitLE(0x08,streamFile); /* build the VGMSTREAM */ @@ -32,7 +31,7 @@ VGMSTREAM * init_vgmstream_hgc1(STREAMFILE *streamFile) { vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (read_32bitLE(0x0C,streamFile)*32)/channel_count/16*28; if (loop_flag) { - vgmstream->loop_start_sample = 0; /* (read_32bitLE(0x08,streamFile)-1)*28; */ + vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = (read_32bitLE(0x0C,streamFile)*32)/channel_count/16*28; } diff --git a/src/meta/ps2_ikm.c b/src/meta/ps2_ikm.c index d677e987..1364c3e1 100644 --- a/src/meta/ps2_ikm.c +++ b/src/meta/ps2_ikm.c @@ -15,10 +15,9 @@ VGMSTREAM * init_vgmstream_ikm(STREAMFILE *streamFile) { if (strcasecmp("ikm",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x494B4D00) /* "IKM\0" */ - goto fail; - if (read_32bitBE(0x40,streamFile) != 0x41535400) /* AST\0 */ - goto fail; + if (read_32bitBE(0x00,streamFile) != 0x494B4D00 && /* "IKM\0" */ + read_32bitBE(0x40,streamFile) != 0x41535400) /* AST\0 */ + goto fail; loop_flag = (read_32bitLE(0x14,streamFile)!=0); channel_count = read_32bitLE(0x50,streamFile); diff --git a/src/meta/ps2_ild.c b/src/meta/ps2_ild.c index 88e65a3c..5649444b 100644 --- a/src/meta/ps2_ild.c +++ b/src/meta/ps2_ild.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_ild(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; - int loop_flag=0; int channel_count; off_t start_offset; diff --git a/src/meta/ps2_joe.c b/src/meta/ps2_joe.c index aceed3f1..1faf055b 100644 --- a/src/meta/ps2_joe.c +++ b/src/meta/ps2_joe.c @@ -1,15 +1,7 @@ #include "meta.h" #include "../util.h" -/* - -JOE (found in Wall-E and some more Pixar games) - -... 2008-12-03 misses loop searching for now... - -*/ - - +/* JOE (found in Wall-E and some more Pixar games) */ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; @@ -19,7 +11,6 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) { off_t loopEnd = 0; off_t readOffset = 0; size_t fileLength; - int loop_flag; int channel_count; @@ -65,8 +56,6 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) { } while (streamFile->get_offset(streamFile)<(int32_t)fileLength); - - if(loopStart == 0) { loop_flag = 0; vgmstream->num_samples = read_32bitLE(0x4,streamFile)*28/16/channel_count; @@ -76,11 +65,9 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) { vgmstream->loop_end_sample = (loopEnd-start_offset+0x20)*28/16/channel_count; } - - - vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = 0x10; - vgmstream->meta_type = meta_PS2_JOE; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x10; + vgmstream->meta_type = meta_PS2_JOE; /* open the file for reading */ { diff --git a/src/meta/ps2_leg.c b/src/meta/ps2_leg.c index a96178f1..643e8478 100644 --- a/src/meta/ps2_leg.c +++ b/src/meta/ps2_leg.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_leg(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -15,7 +14,7 @@ VGMSTREAM * init_vgmstream_leg(STREAMFILE *streamFile) { if (strcasecmp("leg",filename_extension(filename))) goto fail; /* check header */ - if (read_32bitBE(0x10,streamFile) != 0x00000000) /* 0000" */ + if (read_32bitBE(0x10,streamFile) != 0x00000000) /* 0x00000000" */ goto fail; loop_flag = (read_32bitLE(0x44,streamFile)!=0); diff --git a/src/meta/ps2_mihb.c b/src/meta/ps2_mihb.c index 57a80f09..687157f2 100644 --- a/src/meta/ps2_mihb.c +++ b/src/meta/ps2_mihb.c @@ -6,10 +6,9 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - - int mib_blocks; + int mib_blocks; int loop_flag = 0; - int channel_count; + int channel_count; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); @@ -19,7 +18,7 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x40000000) goto fail; - mib_blocks = read_32bitLE(0x14,streamFile); + mib_blocks = read_32bitLE(0x14,streamFile); loop_flag = 0; channel_count = read_32bitLE(0x08,streamFile); diff --git a/src/meta/ps2_psw.c b/src/meta/ps2_psw.c index 67ec9f97..5321b267 100644 --- a/src/meta/ps2_psw.c +++ b/src/meta/ps2_psw.c @@ -1,12 +1,12 @@ #include "meta.h" #include "../util.h" -/* PSW (from Rayman Raving Rabbids) */ +/* PSW (from Rayman Raving Rabbids) +...coefs are missing for the dsp type... */ VGMSTREAM * init_vgmstream_ps2_psw(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -27,7 +27,7 @@ VGMSTREAM * init_vgmstream_ps2_psw(STREAMFILE *streamFile) { vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; - + /* fill in the vital statistics */ switch ((uint16_t)read_16bitBE(0x14,streamFile)) { case 0xFFFF: start_offset = 0x2E; @@ -57,17 +57,11 @@ VGMSTREAM * init_vgmstream_ps2_psw(STREAMFILE *streamFile) { vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = 0x12C00; vgmstream->meta_type = meta_PS2_PSW; - - - break; default: goto fail; } - - /* fill in the vital statistics */ - /* open the file for reading */ { diff --git a/src/meta/ps2_rkv.c b/src/meta/ps2_rkv.c index 7cd5e7cd..71ee6420 100644 --- a/src/meta/ps2_rkv.c +++ b/src/meta/ps2_rkv.c @@ -6,8 +6,7 @@ VGMSTREAM * init_vgmstream_ps2_rkv(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - - int loop_flag = (read_32bitLE(0x10,streamFile)!=0); + int loop_flag; int channel_count; /* check extension, case insensitive */ @@ -18,7 +17,7 @@ VGMSTREAM * init_vgmstream_ps2_rkv(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x00000000) /* "\0000" */ goto fail; - + loop_flag = (read_32bitLE(0x10,streamFile)!=0); channel_count = 2; /* build the VGMSTREAM */ diff --git a/src/meta/ps2_rstm.c b/src/meta/ps2_rstm.c index 22a26592..d903b38e 100644 --- a/src/meta/ps2_rstm.c +++ b/src/meta/ps2_rstm.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; diff --git a/src/meta/ps2_rxw.c b/src/meta/ps2_rxw.c index c2d074b5..ac48b5aa 100644 --- a/src/meta/ps2_rxw.c +++ b/src/meta/ps2_rxw.c @@ -2,11 +2,9 @@ #include "../util.h" /* RXW file (Arc the Lad) */ - VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; - int loop_flag=0; int channel_count; off_t start_offset; diff --git a/src/meta/ps2_seg.c b/src/meta/ps2_seg.c index 06ede8b2..749892e3 100644 --- a/src/meta/ps2_seg.c +++ b/src/meta/ps2_seg.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_seg(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; diff --git a/src/meta/ps2_sfs.c b/src/meta/ps2_sfs.c index 6ba1ea3c..ce966af4 100644 --- a/src/meta/ps2_sfs.c +++ b/src/meta/ps2_sfs.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_sfs(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; diff --git a/src/meta/ps2_sl3.c b/src/meta/ps2_sl3.c index 8c01cc4d..0f774b9d 100644 --- a/src/meta/ps2_sl3.c +++ b/src/meta/ps2_sl3.c @@ -18,7 +18,7 @@ VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */ goto fail; - loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */ + loop_flag = 0; channel_count = read_32bitLE(0x14,streamFile); /* build the VGMSTREAM */ @@ -32,7 +32,7 @@ VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) { vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (get_streamfile_size(streamFile)-0x8000)*28/16/channel_count; if (loop_flag) { - vgmstream->loop_start_sample = 0; /* (read_32bitLE(0x08,streamFile)-1)*28; */ + vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile); } diff --git a/src/meta/ps2_tec.c b/src/meta/ps2_tec.c index 625999c9..1287d1b0 100644 --- a/src/meta/ps2_tec.c +++ b/src/meta/ps2_tec.c @@ -7,7 +7,6 @@ VGMSTREAM * init_vgmstream_ps2_tec(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; @@ -15,10 +14,6 @@ VGMSTREAM * init_vgmstream_ps2_tec(STREAMFILE *streamFile) { streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("tec",filename_extension(filename))) goto fail; - /* check header */ - /* if (read_16bitBE(0x01,streamFile) != 0x6700) */ - /* goto fail; */ - loop_flag = 0; channel_count = 2; @@ -27,7 +22,7 @@ VGMSTREAM * init_vgmstream_ps2_tec(STREAMFILE *streamFile) { if (!vgmstream) goto fail; /* fill in the vital statistics */ - start_offset = 0x00; + start_offset = 0x0; vgmstream->channels = channel_count; vgmstream->sample_rate = 44100; vgmstream->coding_type = coding_PSX_badflags; diff --git a/src/meta/ps2_vas.c b/src/meta/ps2_vas.c index a24caab7..aa25d2d1 100644 --- a/src/meta/ps2_vas.c +++ b/src/meta/ps2_vas.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_ps2_vas(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag; int channel_count; @@ -16,7 +15,7 @@ VGMSTREAM * init_vgmstream_ps2_vas(STREAMFILE *streamFile) { /* check header */ #if 0 - if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */ + if (read_32bitBE(0x00,streamFile) != 0x00000000) /* 0x0 */ goto fail; #endif diff --git a/src/meta/ps2_xa30.c b/src/meta/ps2_xa30.c index 4351c633..21339e61 100644 --- a/src/meta/ps2_xa30.c +++ b/src/meta/ps2_xa30.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_xa30(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -37,7 +36,6 @@ VGMSTREAM * init_vgmstream_xa30(STREAMFILE *streamFile) { } vgmstream->layout_type = layout_none; - /* vgmstream->interleave_block_size = 0x10; */ vgmstream->meta_type = meta_XA30; /* open the file for reading */ diff --git a/src/meta/psx_fag.c b/src/meta/psx_fag.c index 59bde036..21be33cb 100644 --- a/src/meta/psx_fag.c +++ b/src/meta/psx_fag.c @@ -6,7 +6,6 @@ VGMSTREAM * init_vgmstream_psx_fag(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; - int loop_flag = 0; int channel_count; @@ -15,6 +14,8 @@ VGMSTREAM * init_vgmstream_psx_fag(STREAMFILE *streamFile) { if (strcasecmp("fag",filename_extension(filename))) goto fail; /* check header */ + + /* Look if there's more than 1 one file... */ if (read_32bitBE(0x00,streamFile) != 0x01000000) goto fail; diff --git a/src/vgmstream.c b/src/vgmstream.c index f614355e..27c9ee19 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -535,6 +535,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre case layout_vs_blocked: case layout_emff_ps2_blocked: case layout_emff_ngc_blocked: + case layout_gsb_blocked: case layout_xvas_blocked: case layout_thp_blocked: render_vgmstream_blocked(buffer,sample_count,vgmstream); @@ -1367,6 +1368,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case layout_emff_ngc_blocked: snprintf(temp,TEMPSIZE,"EMFF (NGC/WII) blocked"); break; + case layout_gsb_blocked: + snprintf(temp,TEMPSIZE,"GSB blocked"); + break; case layout_thp_blocked: snprintf(temp,TEMPSIZE,"THP Movie Audio blocked"); break; diff --git a/src/vgmstream.h b/src/vgmstream.h index 7c3a2cfb..34bc7baf 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -122,6 +122,7 @@ typedef enum { layout_vs_blocked, layout_emff_ps2_blocked, layout_emff_ngc_blocked, + layout_gsb_blocked, layout_thp_blocked, #if 0 @@ -292,7 +293,7 @@ typedef enum { meta_WII_SMP, /* Mushroom Men - The Spore Wars */ meta_EMFF_PS2, /* Eidos Music File Format for PS2*/ meta_EMFF_NGC, /* Eidos Music File Format for NGC/WII */ - + meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_WVS, /* XBOX WVS */