Minor cleanup

This commit is contained in:
bnnm 2019-03-11 14:49:29 +01:00
parent e9688e540a
commit bdd695b9f9
12 changed files with 48 additions and 36 deletions

View File

@ -403,6 +403,8 @@ int main(int argc, char ** argv) {
strcpy(outfilename_temp, cfg.infilename); strcpy(outfilename_temp, cfg.infilename);
strcat(outfilename_temp, ".wav"); strcat(outfilename_temp, ".wav");
cfg.outfilename = outfilename_temp; cfg.outfilename = outfilename_temp;
/* maybe should avoid overwriting with this auto-name, for the unlikely
* case of file header-body pairs (file.ext+file.ext.wav) */
} }
outfile = fopen(cfg.outfilename,"wb"); outfile = fopen(cfg.outfilename,"wb");
@ -656,6 +658,8 @@ static size_t make_wav_header(uint8_t * buf, size_t buf_size, int32_t sample_cou
put_32bitLE(buf+0x28, (int32_t)data_size); /* size of WAVE data chunk */ put_32bitLE(buf+0x28, (int32_t)data_size); /* size of WAVE data chunk */
} }
/* could try to add channel_layout, but would need to write WAVEFORMATEXTENSIBLE (maybe only if arg flag?) */
return header_size; return header_size;
fail: fail:
return 0; return 0;

View File

@ -764,7 +764,7 @@ static const meta_info meta_info_list[] = {
{meta_DSP_CSTR, "Namco Cstr header"}, {meta_DSP_CSTR, "Namco Cstr header"},
{meta_GCSW, "GCSW header"}, {meta_GCSW, "GCSW header"},
{meta_PS2_SShd, "Sony ADS header"}, {meta_PS2_SShd, "Sony ADS header"},
{meta_PS2_NPSF, "Namco Production Sound File (NPSF) header"}, {meta_NPS, "Namco NPSF header"},
{meta_RWSD, "Nintendo RWSD header (single stream)"}, {meta_RWSD, "Nintendo RWSD header (single stream)"},
{meta_RWAR, "Nintendo RWAR header (single RWAV stream)"}, {meta_RWAR, "Nintendo RWAR header (single RWAV stream)"},
{meta_RWAV, "Nintendo RWAV header"}, {meta_RWAV, "Nintendo RWAV header"},
@ -1011,7 +1011,7 @@ static const meta_info meta_info_list[] = {
{meta_SQEX_SCD, "Square-Enix SCD header"}, {meta_SQEX_SCD, "Square-Enix SCD header"},
{meta_NGC_NST_DSP, "Animaniacs NST header"}, {meta_NGC_NST_DSP, "Animaniacs NST header"},
{meta_BAF, "Bizarre Creations .baf header"}, {meta_BAF, "Bizarre Creations .baf header"},
{meta_PS3_MSF, "Sony MSF header"}, {meta_MSF, "Sony MSF header"},
{meta_NUB_VAG, "Namco NUB VAG header"}, {meta_NUB_VAG, "Namco NUB VAG header"},
{meta_PS3_PAST, "SNDP header"}, {meta_PS3_PAST, "SNDP header"},
{meta_SGXD, "Sony SGXD header"}, {meta_SGXD, "Sony SGXD header"},

View File

@ -1139,11 +1139,11 @@
> >
</File> </File>
<File <File
RelativePath=".\meta\ps2_mtaf.c" RelativePath=".\meta\mtaf.c"
> >
</File> </File>
<File <File
RelativePath=".\meta\ps2_npsf.c" RelativePath=".\meta\nps.c"
> >
</File> </File>
<File <File
@ -1291,11 +1291,11 @@
> >
</File> </File>
<File <File
RelativePath=".\meta\ps3_msf.c" RelativePath=".\meta\msf.c"
> >
</File> </File>
<File <File
RelativePath=".\meta\ps3_mta2.c" RelativePath=".\meta\mta2.c"
> >
</File> </File>
<File <File

View File

@ -175,7 +175,7 @@
<ClCompile Include="meta\ps2_hsf.c" /> <ClCompile Include="meta\ps2_hsf.c" />
<ClCompile Include="meta\ps2_iab.c" /> <ClCompile Include="meta\ps2_iab.c" />
<ClCompile Include="meta\mss.c" /> <ClCompile Include="meta\mss.c" />
<ClCompile Include="meta\ps2_mtaf.c" /> <ClCompile Include="meta\mtaf.c" />
<ClCompile Include="meta\ps2_spm.c" /> <ClCompile Include="meta\ps2_spm.c" />
<ClCompile Include="meta\vs_str.c" /> <ClCompile Include="meta\vs_str.c" />
<ClCompile Include="meta\ps2_wmus.c" /> <ClCompile Include="meta\ps2_wmus.c" />
@ -382,7 +382,7 @@
<ClCompile Include="meta\ps2_mic.c" /> <ClCompile Include="meta\ps2_mic.c" />
<ClCompile Include="meta\ps2_mihb.c" /> <ClCompile Include="meta\ps2_mihb.c" />
<ClCompile Include="meta\ps2_msa.c" /> <ClCompile Include="meta\ps2_msa.c" />
<ClCompile Include="meta\ps2_npsf.c" /> <ClCompile Include="meta\nps.c" />
<ClCompile Include="meta\ps2_p2bt.c" /> <ClCompile Include="meta\ps2_p2bt.c" />
<ClCompile Include="meta\ps2_pcm.c" /> <ClCompile Include="meta\ps2_pcm.c" />
<ClCompile Include="meta\ps2_pnb.c" /> <ClCompile Include="meta\ps2_pnb.c" />
@ -415,8 +415,8 @@
<ClCompile Include="meta\ps2_xa2_rrp.c" /> <ClCompile Include="meta\ps2_xa2_rrp.c" />
<ClCompile Include="meta\ps2_xa30.c" /> <ClCompile Include="meta\ps2_xa30.c" />
<ClCompile Include="meta\ps3_cps.c" /> <ClCompile Include="meta\ps3_cps.c" />
<ClCompile Include="meta\ps3_msf.c" /> <ClCompile Include="meta\msf.c" />
<ClCompile Include="meta\ps3_mta2.c" /> <ClCompile Include="meta\mta2.c" />
<ClCompile Include="meta\xa.c" /> <ClCompile Include="meta\xa.c" />
<ClCompile Include="meta\fag.c" /> <ClCompile Include="meta\fag.c" />
<ClCompile Include="meta\ffdl.c" /> <ClCompile Include="meta\ffdl.c" />

View File

@ -700,7 +700,7 @@
<ClCompile Include="meta\ps2_msa.c"> <ClCompile Include="meta\ps2_msa.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps2_npsf.c"> <ClCompile Include="meta\nps.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps2_p2bt.c"> <ClCompile Include="meta\ps2_p2bt.c">
@ -799,10 +799,10 @@
<ClCompile Include="meta\ps3_cps.c"> <ClCompile Include="meta\ps3_cps.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps3_msf.c"> <ClCompile Include="meta\msf.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps3_mta2.c"> <ClCompile Include="meta\mta2.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\xa.c"> <ClCompile Include="meta\xa.c">
@ -1324,7 +1324,7 @@
<ClCompile Include="meta\opus.c"> <ClCompile Include="meta\opus.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps2_mtaf.c"> <ClCompile Include="meta\mtaf.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\ps2_spm.c"> <ClCompile Include="meta\ps2_spm.c">

View File

@ -58,7 +58,7 @@ VGMSTREAM * init_vgmstream_rfrm(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_ads_container(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_ps2_ads_container(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_nps(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_rs03(STREAMFILE *streamFile); VGMSTREAM * init_vgmstream_rs03(STREAMFILE *streamFile);
@ -512,7 +512,7 @@ VGMSTREAM * init_vgmstream_ngc_nst_dsp(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_baf(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_baf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_baf_badrip(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_baf_badrip(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_msf(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_msf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile);

View File

@ -2,7 +2,7 @@
#include "../coding/coding.h" #include "../coding/coding.h"
/* MSF - Sony's PS3 SDK format (MultiStream File) */ /* MSF - Sony's PS3 SDK format (MultiStream File) */
VGMSTREAM * init_vgmstream_ps3_msf(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_msf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
off_t start_offset; off_t start_offset;
uint32_t data_size, loop_start = 0, loop_end = 0; uint32_t data_size, loop_start = 0, loop_end = 0;
@ -61,7 +61,7 @@ VGMSTREAM * init_vgmstream_ps3_msf(STREAMFILE *streamFile) {
if (vgmstream->sample_rate == 0x00000000) if (vgmstream->sample_rate == 0x00000000)
vgmstream->sample_rate = 48000; vgmstream->sample_rate = 48000;
vgmstream->meta_type = meta_PS3_MSF; vgmstream->meta_type = meta_MSF;
switch (codec_id) { switch (codec_id) {
case 0x00: /* PCM (Big Endian) */ case 0x00: /* PCM (Big Endian) */

View File

@ -1,13 +1,15 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
/* NPFS - found in Namco PS2/PSP games (Tekken 5, Ace Combat 5, Yumeria, Venus & Braves, Ridge Racer PSP) */ /* NPFS - found in Namco PS2/PSP games [Tekken 5 (PS2), Venus & Braves (PS2), Ridge Racer (PSP)] */
VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_nps(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
off_t start_offset; off_t start_offset;
int loop_flag, channel_count; int loop_flag, channel_count;
/* check extension, case insensitive (should be .nps as per Venus & Braves data files) */ /* checks */
/* .nps: referenced extension (ex. Venus & Braves data files)
* .npsf: header id (Namco Production Sound File?) */
if ( !check_extensions(streamFile,"nps,npsf")) if ( !check_extensions(streamFile,"nps,npsf"))
goto fail; goto fail;
@ -16,6 +18,7 @@ VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile) {
loop_flag = (read_32bitLE(0x14,streamFile) != 0xFFFFFFFF); loop_flag = (read_32bitLE(0x14,streamFile) != 0xFFFFFFFF);
channel_count = read_32bitLE(0x0C,streamFile); channel_count = read_32bitLE(0x0C,streamFile);
start_offset = (off_t)read_32bitLE(0x10,streamFile);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
@ -32,13 +35,9 @@ VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_PSX; vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x04,streamFile) / 2; vgmstream->interleave_block_size = read_32bitLE(0x04,streamFile) / 2;
vgmstream->meta_type = meta_PS2_NPSF; vgmstream->meta_type = meta_NPS;
read_string(vgmstream->stream_name,STREAM_NAME_SIZE, 0x34,streamFile); read_string(vgmstream->stream_name,STREAM_NAME_SIZE, 0x34,streamFile);
start_offset = (off_t)read_32bitLE(0x10,streamFile);
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) ) if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail; goto fail;
return vgmstream; return vgmstream;

View File

@ -98,6 +98,7 @@ static STREAMFILE* setup_sfh_streamfile(STREAMFILE *streamFile, off_t stream_off
io_data.stream_offset = stream_offset; io_data.stream_offset = stream_offset;
io_data.stream_size = get_streamfile_size(streamFile) - stream_offset; io_data.stream_size = get_streamfile_size(streamFile) - stream_offset;
io_data.block_size = block_size; io_data.block_size = block_size;
io_data.logical_offset = -1; /* force phys offset reset */
/* setup subfile */ /* setup subfile */
new_streamFile = open_wrap_streamfile(streamFile); new_streamFile = open_wrap_streamfile(streamFile);

View File

@ -21,7 +21,9 @@ typedef struct {
VGMSTREAM_PLAYER* vgmstream_player_init(...); VGMSTREAM_PLAYER* vgmstream_player_init(...);
VGMSTREAM_PLAYER* vgmstream_player_check_file(...); VGMSTREAM_PLAYER* vgmstream_player_format_check(...);
VGMSTREAM_PLAYER* vgmstream_player_set_format_whilelist(...);
VGMSTREAM_PLAYER* vgmstream_player_set_format_blacklist(...);
VGMSTREAM_PLAYER* vgmstream_player_set_file(...); VGMSTREAM_PLAYER* vgmstream_player_set_file(...);
@ -33,6 +35,12 @@ VGMSTREAM_PLAYER* vgmstream_player_get_buffer(...);
VGMSTREAM_PLAYER* vgmstream_player_get_info(...); VGMSTREAM_PLAYER* vgmstream_player_get_info(...);
VGMSTREAM_PLAYER* vgmstream_player_describe(...);
VGMSTREAM_PLAYER* vgmstream_player_get_title(...);
VGMSTREAM_PLAYER* vgmstream_player_get_tagfile(...);
VGMSTREAM_PLAYER* vgmstream_player_play(...); VGMSTREAM_PLAYER* vgmstream_player_play(...);
VGMSTREAM_PLAYER* vgmstream_player_seek(...); VGMSTREAM_PLAYER* vgmstream_player_seek(...);

View File

@ -40,7 +40,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_cstr, init_vgmstream_cstr,
init_vgmstream_gcsw, init_vgmstream_gcsw,
init_vgmstream_ps2_ads, init_vgmstream_ps2_ads,
init_vgmstream_ps2_npsf, init_vgmstream_nps,
init_vgmstream_rwsd, init_vgmstream_rwsd,
init_vgmstream_xa, init_vgmstream_xa,
init_vgmstream_ps2_rxws, init_vgmstream_ps2_rxws,
@ -281,7 +281,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_nst_dsp, init_vgmstream_ngc_nst_dsp,
init_vgmstream_baf, init_vgmstream_baf,
init_vgmstream_baf_badrip, init_vgmstream_baf_badrip,
init_vgmstream_ps3_msf, init_vgmstream_msf,
init_vgmstream_nub_vag, init_vgmstream_nub_vag,
init_vgmstream_ps3_past, init_vgmstream_ps3_past,
init_vgmstream_sgxd, init_vgmstream_sgxd,

View File

@ -5,7 +5,7 @@
#ifndef _VGMSTREAM_H #ifndef _VGMSTREAM_H
#define _VGMSTREAM_H #define _VGMSTREAM_H
/* reasonable limits */ /* reasonable limits */
enum { PATH_LIMIT = 32768 }; enum { PATH_LIMIT = 32768 };
enum { STREAM_NAME_SIZE = 255 }; enum { STREAM_NAME_SIZE = 255 };
enum { VGMSTREAM_MAX_CHANNELS = 64 }; enum { VGMSTREAM_MAX_CHANNELS = 64 };
@ -337,7 +337,7 @@ typedef enum {
meta_XA, /* CD-ROM XA */ meta_XA, /* CD-ROM XA */
meta_PS2_SShd, /* .ADS with SShd header */ meta_PS2_SShd, /* .ADS with SShd header */
meta_PS2_NPSF, /* Namco Production Sound File */ meta_NPS,
meta_PS2_RXWS, /* Sony games (Genji, Okage Shadow King, Arc The Lad Twilight of Spirits) */ meta_PS2_RXWS, /* Sony games (Genji, Okage Shadow King, Arc The Lad Twilight of Spirits) */
meta_PS2_RAW, /* RAW Interleaved Format */ meta_PS2_RAW, /* RAW Interleaved Format */
meta_PS2_EXST, /* Shadow of Colossus EXST */ meta_PS2_EXST, /* Shadow of Colossus EXST */
@ -568,7 +568,7 @@ typedef enum {
meta_BAF, /* Bizarre Creations (Blur, James Bond) */ meta_BAF, /* Bizarre Creations (Blur, James Bond) */
meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_PS3_CPS, /* Eternal Sonata (PS3) */ meta_PS3_CPS, /* Eternal Sonata (PS3) */
meta_PS3_MSF, /* MSF header */ meta_MSF,
meta_NUB_VAG, /* Namco VAG from NUB archives */ meta_NUB_VAG, /* Namco VAG from NUB archives */
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */ meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */ meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */