diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 57cecb30..bf84c8f7 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -436,6 +436,10 @@ RelativePath=".\meta\ps2_rkv.c" > + + diff --git a/src/meta/meta.h b/src/meta/meta.h index 9e939af2..a04e3801 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -213,4 +213,6 @@ VGMSTREAM * init_vgmstream_sat_sap(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_dc_idvi(STREAMFILE *streamFile); +VGMSTREAM * init_vgmstream_ps2_rnd(STREAMFILE *streamFile); + #endif diff --git a/src/meta/ps2_ads.c b/src/meta/ps2_ads.c index e8706949..a51abb7d 100644 --- a/src/meta/ps2_ads.c +++ b/src/meta/ps2_ads.c @@ -10,7 +10,6 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) { int loop_flag=0; int channel_count; off_t start_offset,test_offset; - int ads_type_2=0; int i; /* check extension, case insensitive */ @@ -45,7 +44,7 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) { /* Check for Compression Scheme */ vgmstream->coding_type = coding_PSX; - vgmstream->num_samples = read_32bitLE(0x24,streamFile)/16*28/vgmstream->channels; + vgmstream->num_samples = (read_32bitLE(0x24,streamFile)-0x40)/16*28/vgmstream->channels; /* SS2 container with RAW Interleaved PCM */ if (read_32bitLE(0x08,streamFile)!=0x10) { @@ -61,7 +60,7 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) { if(vgmstream->loop_flag) { if(vgmstream->interleave_block_size==0x10) { vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile); - vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile); + vgmstream->loop_end_sample = vgmstream->num_samples; } else { vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*0x10)/16*28; vgmstream->loop_end_sample = (read_32bitLE(0x1C,streamFile)*0x10)/16*28; @@ -75,16 +74,8 @@ VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) { start_offset=0x28; // Hack for files with start_offset = 0x800 - ads_type_2=1; - - for(test_offset=start_offset;test_offset<0x800;test_offset+=4) { - if (read_32bitLE(test_offset,streamFile)!=0) - ads_type_2=0; - } - - if((ads_type_2==1)){ + if(get_streamfile_size(streamFile)-read_32bitLE(0x24,streamFile)>=0x800) start_offset=0x800; - } /* open the file for reading by each channel */ { diff --git a/src/meta/ps2_aus.c b/src/meta/ps2_aus.c index a951a64e..2e7181ea 100644 --- a/src/meta/ps2_aus.c +++ b/src/meta/ps2_aus.c @@ -18,7 +18,7 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x41555320) /* "AUS " */ goto fail; - loop_flag = (read_32bitLE(0x4,streamFile)!=0); + loop_flag = (read_32bitLE(0x0c,streamFile)!=0); channel_count = read_32bitLE(0xC,streamFile); /* build the VGMSTREAM */ @@ -29,16 +29,23 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE *streamFile) { start_offset = 0x800; vgmstream->channels = channel_count; vgmstream->sample_rate = read_32bitLE(0x10,streamFile); - vgmstream->coding_type = coding_PSX; - vgmstream->num_samples = read_32bitLE(0x08,streamFile); - if (loop_flag) { - vgmstream->loop_start_sample = read_32bitLE(0x4,streamFile); - vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile); - } + vgmstream->num_samples = read_32bitLE(0x08,streamFile); - vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = 0x800; - vgmstream->meta_type = meta_AUS; + if(read_16bitLE(0x06,streamFile)==0x02) { + vgmstream->coding_type = coding_XBOX; + vgmstream->layout_type=layout_none; + } else { + vgmstream->coding_type = coding_PSX; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x800; + } + + if (loop_flag) { + vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile); + vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile); + } + + vgmstream->meta_type = meta_AUS; /* open the file for reading */ { diff --git a/src/meta/ps2_rnd.c b/src/meta/ps2_rnd.c new file mode 100644 index 00000000..fe397344 --- /dev/null +++ b/src/meta/ps2_rnd.c @@ -0,0 +1,56 @@ +#include "meta.h" +#include "../util.h" + +/* rnd (from Karaoke Revolution) */ +VGMSTREAM * init_vgmstream_ps2_rnd(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + char filename[260]; + off_t start_offset; + + int loop_flag = 0; + int channel_count; + + /* check extension, case insensitive */ + streamFile->get_name(streamFile,filename,sizeof(filename)); + if (strcasecmp("rnd",filename_extension(filename))) goto fail; + + loop_flag = 0; + channel_count = read_32bitLE(0x00,streamFile); + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x10; + vgmstream->channels = channel_count; + vgmstream->sample_rate = read_32bitLE(0x04,streamFile); + vgmstream->coding_type = coding_PSX; + vgmstream->num_samples = (get_streamfile_size(streamFile)-0x10)/16*28/vgmstream->channels; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x2000; + vgmstream->meta_type = meta_HGC1; + + /* open the file for reading */ + { + int i; + STREAMFILE * file; + file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); + if (!file) goto fail; + for (i=0;ich[i].streamfile = file; + + vgmstream->ch[i].channel_start_offset= + vgmstream->ch[i].offset=start_offset+ + vgmstream->interleave_block_size*i; + + } + } + + return vgmstream; + + /* clean up anything we may have opened */ +fail: + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 8ecb2ee7..369fcf95 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -122,6 +122,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ngc_bh2pcm, init_vgmstream_sat_sap, init_vgmstream_dc_idvi, + init_vgmstream_ps2_rnd, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index d27c6780..1b2d8004 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -179,6 +179,7 @@ char * extension_list[] = { "bh2pcm\0BH2PCM Audio File (*.BH2PCM)\0", "sap\0SAP Audio File (*.SAP)\0", "idvi\0IDVI Audio File (*.IDVI)\0", + "rnd\0RND Audio File (*.RND)\0", }; void about(HWND hwndParent) {