From 21c9f44273dafad25890da2007ad68e9665a721e Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 13 May 2017 13:01:16 +0200 Subject: [PATCH] Rename ps2_rxw to ps2_rxws and do some cleanup --- src/formats.c | 2 +- src/libvgmstream.vcproj | 2 +- src/libvgmstream.vcxproj | 2 +- src/libvgmstream.vcxproj.filters | 2 +- src/meta/meta.h | 32 +++------------ src/meta/ps2_rxw.c | 70 -------------------------------- src/meta/ps2_rxws.c | 49 ++++++++++++++++++++++ src/vgmstream.h | 2 +- 8 files changed, 59 insertions(+), 102 deletions(-) delete mode 100644 src/meta/ps2_rxw.c create mode 100644 src/meta/ps2_rxws.c diff --git a/src/formats.c b/src/formats.c index 49bdffc0..f416ec3f 100644 --- a/src/formats.c +++ b/src/formats.c @@ -551,7 +551,7 @@ static const meta_info meta_info_list[] = { {meta_CWAV, "Nintendo CWAV header"}, {meta_FWAV, "Nintendo FWAV header"}, {meta_PSX_XA, "RIFF/CDXA header"}, - {meta_PS2_RXW, "RXWS header)"}, + {meta_PS2_RXWS, "Sony RXWS header)"}, {meta_PS2_RAW, "assumed RAW Interleaved PCM by .int extension"}, {meta_PS2_OMU, "Alter Echo OMU Header"}, {meta_DSP_STM, "Nintendo STM header"}, diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 70a5827c..840dca62 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -835,7 +835,7 @@ > - + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 32d05421..96658cea 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -496,7 +496,7 @@ meta\Source Files - + meta\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index bff90338..1ceb5cc6 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -197,13 +197,9 @@ VGMSTREAM * init_vgmstream_xa30(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_musc(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_musx_v004(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_musx_v005(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_musx_v006(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_musx_v201(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_leg(STREAMFILE * streamFile); @@ -315,28 +311,22 @@ VGMSTREAM * init_vgmstream_ngc_pdt(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_wii_mus(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rsd2vag(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd2pcmb(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd2xadp(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd3pcm(STREAMFILE * streamFile); - +VGMSTREAM * init_vgmstream_rsd3pcmb(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_rsd3gadp(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_rsd3vag(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rsd4pcmb(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd4pcm(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd4radp(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd4vag(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd6vag(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd6wadp(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd6xadp(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_rsd6radp(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE* streamFile); +VGMSTREAM * init_vgmstream_rsd6xma(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE * streamFile); @@ -436,18 +426,12 @@ VGMSTREAM * init_vgmstream_ps2_xa2_rrp(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile); -VGMSTREAM * init_vgmstream_rsd3vag(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE * streamFile); -VGMSTREAM * init_vgmstream_rsd3pcmb(STREAMFILE * streamFile); - -VGMSTREAM * init_vgmstream_rsd3gadp(STREAMFILE * streamFile); - VGMSTREAM * init_vgmstream_sd9(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_2dx9(STREAMFILE * streamFile); @@ -633,8 +617,6 @@ VGMSTREAM * init_vgmstream_ps3_ivag(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ps2_2pfs(STREAMFILE* streamFile); -VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE* streamFile); - VGMSTREAM * init_vgmstream_ubi_ckd(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ps2_vbk(STREAMFILE* streamFile); @@ -669,7 +651,6 @@ VGMSTREAM * init_vgmstream_x360_cxs(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_dsp_adx(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile); - VGMSTREAM * init_vgmstream_akb2_multi(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_x360_ast(STREAMFILE *streamFile); @@ -690,10 +671,7 @@ VGMSTREAM * init_vgmstream_mc3(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_gtd(STREAMFILE *streamFile); -VGMSTREAM * init_vgmstream_rsd6xma(STREAMFILE *streamFile); - VGMSTREAM * init_vgmstream_ta_aac_x360(STREAMFILE *streamFile); - VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile); #endif /*_META_H*/ diff --git a/src/meta/ps2_rxw.c b/src/meta/ps2_rxw.c deleted file mode 100644 index 520a1d0f..00000000 --- a/src/meta/ps2_rxw.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "meta.h" -#include "../util.h" - -/* RXW file (Arc the Lad) */ -VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile) { - VGMSTREAM * vgmstream = NULL; - char filename[PATH_LIMIT]; - int loop_flag=0; - int channel_count; - off_t start_offset; - int i; - - /* check extension, case insensitive */ - streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("rxw",filename_extension(filename))) goto fail; - - /* check RXWS/FORM Header */ - if (!((read_32bitBE(0x00,streamFile) == 0x52585753) && - (read_32bitBE(0x10,streamFile) == 0x464F524D))) - goto fail; - - /* check loop */ - loop_flag = (read_32bitLE(0x3C,streamFile)!=0xFFFFFFFF); - - /* Always stereo files */ - 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_32bitLE(0x2E,streamFile); - - vgmstream->coding_type = coding_PSX; - vgmstream->num_samples = (read_32bitLE(0x38,streamFile)*28/16)/2; - - /* Get loop point values */ - if(vgmstream->loop_flag) { - vgmstream->loop_start_sample = read_32bitLE(0x3C,streamFile)/16*14; - vgmstream->loop_end_sample = read_32bitLE(0x38,streamFile)/16*14; - } - - vgmstream->interleave_block_size = read_32bitLE(0x1c,streamFile)+0x10; - vgmstream->layout_type = layout_interleave; - vgmstream->meta_type = meta_PS2_RXW; - - start_offset = 0x40; - - /* open the file for reading by each channel */ - { - for (i=0;ich[i].streamfile = streamFile->open(streamFile,filename,0x8000); - - if (!vgmstream->ch[i].streamfile) goto fail; - - vgmstream->ch[i].channel_start_offset= - vgmstream->ch[i].offset= - (off_t)(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/meta/ps2_rxws.c b/src/meta/ps2_rxws.c new file mode 100644 index 00000000..64c7812b --- /dev/null +++ b/src/meta/ps2_rxws.c @@ -0,0 +1,49 @@ +#include "meta.h" +#include "../util.h" + +/* .RXW - presumably fake header for split files with joint XWH+XWB (has incorrect chunk sizes) */ +VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + int loop_flag=0, channel_count; + off_t start_offset; + + /* check extension, case insensitive */ + if (!check_extensions(streamFile,"rxw")) goto fail; + + /* check RXWS/FORM Header */ + if (!((read_32bitBE(0x00,streamFile) == 0x52585753) && + (read_32bitBE(0x10,streamFile) == 0x464F524D))) + goto fail; + + loop_flag = (read_32bitLE(0x3C,streamFile)!=0xFFFFFFFF); + channel_count=2; /* Always stereo files */ + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + vgmstream->sample_rate = read_32bitLE(0x2E,streamFile); + vgmstream->num_samples = (read_32bitLE(0x38,streamFile)*28/16)/2; + + /* Get loop point values */ + if(vgmstream->loop_flag) { + vgmstream->loop_start_sample = read_32bitLE(0x3C,streamFile)/16*14; + vgmstream->loop_end_sample = read_32bitLE(0x38,streamFile)/16*14; + } + + vgmstream->interleave_block_size = read_32bitLE(0x1c,streamFile)+0x10; + vgmstream->coding_type = coding_PSX; + vgmstream->layout_type = layout_interleave; + vgmstream->meta_type = meta_PS2_RXWS; + start_offset = 0x40; + + /* open the file for reading */ + if (!vgmstream_open_stream(vgmstream,streamFile,start_offset)) + goto fail; + + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.h b/src/vgmstream.h index f0381ff4..6043aef2 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -311,7 +311,7 @@ typedef enum { meta_PSX_XA, /* CD-ROM XA with RIFF header */ meta_PS2_SShd, /* .ADS with SShd header */ meta_PS2_NPSF, /* Namco Production Sound File */ - meta_PS2_RXW, /* Sony Arc The Lad Sound File */ + meta_PS2_RXWS, /* Sony games (Genji, Okage Shadow King, Arc The Lad Twilight of Spirits) */ meta_PS2_RAW, /* RAW Interleaved Format */ meta_PS2_EXST, /* Shadow of Colossus EXST */ meta_PS2_SVAG, /* Konami SVAG */