mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
brstmspm hack for Super Paper Mario
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@140 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
59d6916187
commit
37f70ab663
@ -12,11 +12,18 @@ VGMSTREAM * init_vgmstream_brstm(const char * const filename) {
|
||||
int codec_number;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
/* Certain Super Paper Mario tracks have a 44.1KHz sample rate in the
|
||||
* header, but they should be played at 22.05KHz. We will make this
|
||||
* correction if we see a file with a .brstmspm extension. */
|
||||
int spm_flag = 0;
|
||||
|
||||
off_t start_offset;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
if (strcasecmp("brstm",filename_extension(filename))) goto fail;
|
||||
if (strcasecmp("brstm",filename_extension(filename))) {
|
||||
if (strcasecmp("brstmspm",filename_extension(filename))) goto fail;
|
||||
else spm_flag = 1;
|
||||
}
|
||||
|
||||
/* try to open the file for header reading */
|
||||
infile = open_streamfile(filename);
|
||||
@ -73,6 +80,11 @@ VGMSTREAM * init_vgmstream_brstm(const char * const filename) {
|
||||
vgmstream->layout_type = layout_interleave_shortblock;
|
||||
vgmstream->meta_type = meta_RSTM;
|
||||
|
||||
if (spm_flag&& vgmstream->sample_rate == 44100) {
|
||||
vgmstream->meta_type = meta_RSTM_SPM;
|
||||
vgmstream->sample_rate = 22050;
|
||||
}
|
||||
|
||||
vgmstream->interleave_block_size = read_32bitBE(head_offset+0x38,infile);
|
||||
vgmstream->interleave_smallblock_size = read_32bitBE(head_offset+0x48,infile);
|
||||
|
||||
|
@ -631,6 +631,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_DSP_GCM:
|
||||
snprintf(temp,TEMPSIZE,"Double DSP header stereo by .gcm extension");
|
||||
break;
|
||||
case meta_RSTM_SPM:
|
||||
snprintf(temp,TEMPSIZE,"Nintendo RSTM header and .brstmspm extension");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ typedef enum {
|
||||
meta_AFC, /* AFC */
|
||||
meta_AST, /* AST */
|
||||
meta_RWSD, /* single-stream RWSD */
|
||||
meta_RSTM_SPM, /* RSTM with 44->22khz hack */
|
||||
/* CRI ADX */
|
||||
meta_ADX_03, /* ADX "type 03" */
|
||||
meta_ADX_04, /* ADX "type 04" */
|
||||
|
@ -74,7 +74,7 @@ char * extension_list[EXTENSION_COUNT] = {
|
||||
"afc\0AFC Audio File (*.AFC)\0",
|
||||
"agsc\0AGSC Audio File (*.AGSC)\0",
|
||||
"ast\0AST Audio File (*.AST)\0",
|
||||
"brstm\0BRSTM Audio File (*.BRSTM)\0",
|
||||
"brstm;brstmspm\0BRSTM Audio File (*.BRSTM)\0",
|
||||
"hps\0HALPST Audio File (*.HPS)\0",
|
||||
"strm\0STRM Audio File (*.STRM)\0",
|
||||
"adp\0ADP Audio File (*.ADP)\0",
|
||||
|
Loading…
Reference in New Issue
Block a user