mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 16:30:54 +01:00
add mpdsp
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@122 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
0c6dfd01dd
commit
f5ef146e7e
@ -27,6 +27,8 @@ VGMSTREAM * init_vgmstream_ngc_dsp_std(const char * const filename);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_stm(const char * const filename);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_mpdsp(const char * const filename);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_ads(const char * const filename);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_npsf(const char * const filename);
|
||||
|
@ -336,3 +336,89 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* mpdsp: looks like a standard .dsp header, but the data is actually
|
||||
* interleaved stereo
|
||||
* The files originally had a .dsp extension, we rename them to .mpdsp so we
|
||||
* can catch this.
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_mpdsp(const char * const filename) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * infile = NULL;
|
||||
|
||||
struct dsp_header header;
|
||||
const off_t start_offset = 0x60;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
if (strcasecmp("mpdsp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* try to open the file for header reading */
|
||||
infile = open_streamfile(filename);
|
||||
if (!infile) goto fail;
|
||||
|
||||
if (read_dsp_header(&header, 0, infile)) goto fail;
|
||||
|
||||
/* none have loop flag set, save us from loop code that involves them */
|
||||
if (header.loop_flag) goto fail;
|
||||
|
||||
/* check initial predictor/scale */
|
||||
if (header.initial_ps != (uint8_t)read_8bit(start_offset,infile))
|
||||
goto fail;
|
||||
|
||||
/* check type==0 and gain==0 */
|
||||
if (header.format || header.gain)
|
||||
goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
|
||||
/* no loop flag, but they do loop */
|
||||
vgmstream = allocate_vgmstream(2,0);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = header.sample_count/2;
|
||||
vgmstream->sample_rate = header.sample_rate;
|
||||
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0xf000;
|
||||
vgmstream->meta_type = meta_DSP_MPDSP;
|
||||
|
||||
/* coeffs */
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = header.coef[i];
|
||||
vgmstream->ch[1].adpcm_coef[i] = header.coef[i];
|
||||
}
|
||||
|
||||
/* initial history */
|
||||
/* always 0 that I've ever seen, but for completeness... */
|
||||
vgmstream->ch[0].adpcm_history1_16 = header.initial_hist1;
|
||||
vgmstream->ch[0].adpcm_history2_16 = header.initial_hist2;
|
||||
vgmstream->ch[1].adpcm_history1_16 = header.initial_hist1;
|
||||
vgmstream->ch[1].adpcm_history2_16 = header.initial_hist2;
|
||||
|
||||
close_streamfile(infile); infile=NULL;
|
||||
|
||||
/* open the file for reading */
|
||||
for (i=0;i<2;i++) {
|
||||
vgmstream->ch[i].streamfile = open_streamfile_buffer(filename,
|
||||
vgmstream->interleave_block_size);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+
|
||||
vgmstream->interleave_block_size*i;
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (infile) close_streamfile(infile);
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* List of functions that will recognize files. These should correspond pretty
|
||||
* directly to the metadata types
|
||||
*/
|
||||
#define INIT_VGMSTREAM_FCNS 23
|
||||
#define INIT_VGMSTREAM_FCNS 24
|
||||
VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = {
|
||||
init_vgmstream_adx, /* 0 */
|
||||
init_vgmstream_brstm, /* 1 */
|
||||
@ -40,6 +40,7 @@ VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = {
|
||||
init_vgmstream_ps2_exst, /* 20 */
|
||||
init_vgmstream_ps2_svag, /* 21 */
|
||||
init_vgmstream_ps2_mib, /* 22 */
|
||||
init_vgmstream_ngc_mpdsp, /* 23 */
|
||||
};
|
||||
|
||||
|
||||
@ -613,6 +614,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_PS2_MIB_MIH:
|
||||
snprintf(temp,TEMPSIZE,"assumed MIB with MIH Info Header file by .mib+.mih extension");
|
||||
break;
|
||||
case meta_DSP_MPDSP:
|
||||
snprintf(temp,TEMPSIZE,"Single DSP header stereo by .mpdsp extension");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ typedef enum {
|
||||
meta_DSP_RS03, /* Metroid Prime 2 "RS03" */
|
||||
meta_DSP_STM, /* Paper Mario 2 STM */
|
||||
meta_DSP_HALP, /* SSB:M "HALPST" */
|
||||
meta_DSP_AGSC,
|
||||
meta_DSP_AGSC, /* Metroid Prime 2 title */
|
||||
meta_DSP_MPDSP, /* Monopoly Party single header stereo */
|
||||
/* Nintendo */
|
||||
meta_STRM, /* STRM */
|
||||
meta_RSTM, /* RSTM (similar to STRM) */
|
||||
|
Loading…
Reference in New Issue
Block a user