Updated vgmstream to revision 1039
parent
cb1a699647
commit
9bc9e47781
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
|
||||
<false/>
|
||||
<key>IDESourceControlProjectIdentifier</key>
|
||||
<string>811E8515-6C50-44FF-ACDB-088BB9917E26</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>EF1CF5E1F342919DE309B5C9DAEDDCF1D12D0402</key>
|
||||
<string>https://github.com/andymatuschak/Sparkle.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>EF1CF5E1F342919DE309B5C9DAEDDCF1D12D0402</key>
|
||||
<string>Sparkle/</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>https://github.com/andymatuschak/Sparkle.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>111</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>EF1CF5E1F342919DE309B5C9DAEDDCF1D12D0402</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>EF1CF5E1F342919DE309B5C9DAEDDCF1D12D0402</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>Sparkle</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -581,8 +581,8 @@ VGMSTREAM * init_vgmstream_fsb_mpeg(STREAMFILE *streamFile) {
|
|||
start_offset = fsb_mainheader_len+fsb_subheader_len+0x10;
|
||||
|
||||
/* Check the MPEG Sync Header */
|
||||
mp3ID = read_16bitLE(start_offset,streamFile);
|
||||
if ((mp3ID&0x7FF) != 0x7FF)
|
||||
mp3ID = read_16bitBE(start_offset,streamFile);
|
||||
if ((mp3ID&0xFFE0) != 0xFFE0)
|
||||
goto fail;
|
||||
|
||||
channel_count = read_16bitLE(fsb_mainheader_len+0x3E,streamFile);
|
||||
|
@ -717,8 +717,8 @@ VGMSTREAM * init_vgmstream_fsb5_mpeg(STREAMFILE *streamFile) {
|
|||
start_offset = fsb_mainheader_len+fsb_subheader_len+0x10;
|
||||
|
||||
/* Check the MPEG Sync Header */
|
||||
mp3ID = read_16bitLE(start_offset,streamFile);
|
||||
if ((mp3ID&0x7FF) != 0x7FF)
|
||||
mp3ID = read_16bitBE(start_offset,streamFile);
|
||||
if ((mp3ID&0xFFE0) != 0xFFE0)
|
||||
goto fail;
|
||||
|
||||
channel_count = read_16bitLE(fsb_mainheader_len+0x3E,streamFile);
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "../vgmstream.h"
|
||||
|
||||
VGMSTREAM * init_vgmstream_3ds_idsp(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_afc(STREAMFILE *streamFile);
|
||||
|
@ -31,6 +33,8 @@ VGMSTREAM * init_vgmstream_ngc_mpdsp(STREAMFILE *streamFile);
|
|||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_std_int(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_csmp(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile);
|
||||
|
@ -632,4 +636,6 @@ VGMSTREAM * init_vgmstream_otm(STREAMFILE* streamFile);
|
|||
|
||||
VGMSTREAM * init_vgmstream_bcstm(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_bfwav(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -596,6 +596,124 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* 3DS IDSP two standard DSP headers (SSB4) */
|
||||
VGMSTREAM * init_vgmstream_3ds_idsp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
off_t start_offset;
|
||||
off_t interleave;
|
||||
|
||||
struct dsp_header ch0_header,ch1_header;
|
||||
int i;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("idsp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header magic */
|
||||
if (read_32bitBE(0x0,streamFile) != 0x49445350) goto fail; /* "IDSP" */
|
||||
|
||||
channel_count = read_32bitBE(0x8, streamFile);
|
||||
if (channel_count != 2) goto fail;
|
||||
|
||||
if (read_dsp_header(&ch0_header, 0x40, streamFile)) goto fail;
|
||||
if (channel_count == 2 && read_dsp_header(&ch1_header, 0xa0, streamFile)) goto fail;
|
||||
|
||||
start_offset = read_32bitBE(0x28,streamFile);
|
||||
interleave = 16;
|
||||
|
||||
/* check initial predictor/scale */
|
||||
if (ch0_header.initial_ps != (uint8_t)read_8bit(start_offset,streamFile))
|
||||
goto fail;
|
||||
if (channel_count == 2 && ch1_header.initial_ps != (uint8_t)read_8bit(start_offset+interleave,streamFile))
|
||||
goto fail;
|
||||
|
||||
/* check type==0 and gain==0 */
|
||||
if (ch0_header.format || ch0_header.gain ||
|
||||
(channel_count == 2 &&(ch1_header.format || ch1_header.gain)))
|
||||
goto fail;
|
||||
|
||||
/* check for agreement */
|
||||
if ( channel_count == 2 &&(
|
||||
ch0_header.sample_count != ch1_header.sample_count ||
|
||||
ch0_header.nibble_count != ch1_header.nibble_count ||
|
||||
ch0_header.sample_rate != ch1_header.sample_rate ||
|
||||
ch0_header.sample_rate != read_32bitBE(0xc, streamFile) ||
|
||||
ch0_header.loop_flag != ch1_header.loop_flag ||
|
||||
ch0_header.loop_start_offset != ch1_header.loop_start_offset ||
|
||||
ch0_header.loop_end_offset != ch1_header.loop_end_offset
|
||||
)) goto fail;
|
||||
|
||||
if (ch0_header.loop_flag) {
|
||||
off_t loop_off;
|
||||
/* check loop predictor/scale */
|
||||
loop_off = ch0_header.loop_start_offset/8/channel_count*8;
|
||||
loop_off = (loop_off/interleave*interleave*channel_count) + (loop_off%interleave);
|
||||
if (ch0_header.loop_ps != (uint8_t)read_8bit(start_offset+loop_off,streamFile))
|
||||
goto fail;
|
||||
if (channel_count == 2 &&
|
||||
ch1_header.loop_ps != (uint8_t)read_8bit(start_offset+loop_off+interleave,streamFile))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
vgmstream = allocate_vgmstream(channel_count,ch0_header.loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = ch0_header.sample_count;
|
||||
vgmstream->sample_rate = ch0_header.sample_rate;
|
||||
|
||||
/* TODO: adjust for interleave? */
|
||||
vgmstream->loop_start_sample = dsp_nibbles_to_samples(
|
||||
ch0_header.loop_start_offset);
|
||||
vgmstream->loop_end_sample = dsp_nibbles_to_samples(
|
||||
ch0_header.loop_end_offset)+1;
|
||||
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = channel_count == 2 ? layout_interleave : layout_none;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
vgmstream->meta_type = meta_3DS_IDSP;
|
||||
|
||||
/* coeffs */
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = ch0_header.coef[i];
|
||||
if (channel_count == 2)
|
||||
vgmstream->ch[1].adpcm_coef[i] = ch1_header.coef[i];
|
||||
}
|
||||
|
||||
/* initial history */
|
||||
/* always 0 that I've ever seen, but for completeness... */
|
||||
vgmstream->ch[0].adpcm_history1_16 = ch0_header.initial_hist1;
|
||||
vgmstream->ch[0].adpcm_history2_16 = ch0_header.initial_hist2;
|
||||
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (channel_count == 2) {
|
||||
vgmstream->ch[1].adpcm_history1_16 = ch1_header.initial_hist1;
|
||||
vgmstream->ch[1].adpcm_history2_16 = ch1_header.initial_hist2;
|
||||
vgmstream->ch[1].streamfile = vgmstream->ch[0].streamfile;
|
||||
}
|
||||
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
/* open the file for reading */
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+i*interleave;
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* sadb - .SAD files, two standard DSP headers */
|
||||
VGMSTREAM * init_vgmstream_sadb(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
|
@ -2462,3 +2580,133 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* the csmp format from Metroid Prime 3 and DKCR */
|
||||
|
||||
#define CSMP_MAGIC 0x43534D50
|
||||
#define CSMP_DATA 0x44415441
|
||||
|
||||
struct csmp_chunk {
|
||||
uint32_t id;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_csmp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
struct dsp_header header;
|
||||
const off_t start_offset = 0x60;
|
||||
int i;
|
||||
int csmp_magic;
|
||||
int csmp_version;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("csmp",filename_extension(filename))) goto fail;
|
||||
|
||||
off_t current_offset = 0;
|
||||
|
||||
csmp_magic = read_32bitBE(current_offset, streamFile);
|
||||
if (csmp_magic != CSMP_MAGIC) goto fail;
|
||||
|
||||
current_offset += 4;
|
||||
|
||||
csmp_version = read_32bitBE(current_offset, streamFile);
|
||||
if (csmp_version != 1) goto fail;
|
||||
|
||||
current_offset += 4;
|
||||
|
||||
int tries =0;
|
||||
while (1)
|
||||
{
|
||||
if (tries > 4)
|
||||
goto fail;
|
||||
|
||||
struct csmp_chunk chunk;
|
||||
chunk.id = read_32bitBE(current_offset, streamFile);
|
||||
chunk.length = read_32bitBE(current_offset + 4, streamFile);
|
||||
current_offset += 8;
|
||||
if (chunk.id != CSMP_DATA)
|
||||
{
|
||||
current_offset += chunk.length;
|
||||
tries++;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (read_dsp_header(&header, current_offset, streamFile)) goto fail;
|
||||
|
||||
/* check initial predictor/scale */
|
||||
/* Retro doesn't seem to abide by this */
|
||||
//if (header.initial_ps != (uint8_t)read_8bit(current_offset + start_offset,streamFile))
|
||||
// goto fail;
|
||||
|
||||
/* check type==0 and gain==0 */
|
||||
if (header.format || header.gain)
|
||||
goto fail;
|
||||
|
||||
if (header.loop_flag) {
|
||||
off_t loop_off;
|
||||
/* check loop predictor/scale */
|
||||
loop_off = header.loop_start_offset/16*8;
|
||||
/* Retro doesn't seem to abide by this */
|
||||
// if (header.loop_ps != (uint8_t)read_8bit(current_offset + start_offset+loop_off,streamFile))
|
||||
// goto fail;
|
||||
}
|
||||
|
||||
/* compare num_samples with nibble count */
|
||||
/*
|
||||
fprintf(stderr,"num samples (literal): %d\n",read_32bitBE(0,streamFile));
|
||||
fprintf(stderr,"num samples (nibbles): %d\n",dsp_nibbles_to_samples(read_32bitBE(4,streamFile)));
|
||||
*/
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
|
||||
vgmstream = allocate_vgmstream(1,header.loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = header.sample_count;
|
||||
vgmstream->sample_rate = header.sample_rate;
|
||||
|
||||
vgmstream->loop_start_sample = dsp_nibbles_to_samples(
|
||||
header.loop_start_offset);
|
||||
vgmstream->loop_end_sample = dsp_nibbles_to_samples(
|
||||
header.loop_end_offset)+1;
|
||||
|
||||
/* don't know why, but it does happen*/
|
||||
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_DSP_CSMP;
|
||||
|
||||
/* coeffs */
|
||||
for (i=0;i<16;i++)
|
||||
vgmstream->ch[0].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;
|
||||
|
||||
/* open the file for reading */
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[0].offset=current_offset + start_offset;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_adx,
|
||||
init_vgmstream_brstm,
|
||||
init_vgmstream_bfwav,
|
||||
init_vgmstream_nds_strm,
|
||||
init_vgmstream_agsc,
|
||||
init_vgmstream_ngc_adpdtk,
|
||||
|
@ -26,6 +27,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
|||
init_vgmstream_halpst,
|
||||
init_vgmstream_rs03,
|
||||
init_vgmstream_ngc_dsp_std,
|
||||
init_vgmstream_ngc_dsp_csmp,
|
||||
init_vgmstream_Cstr,
|
||||
init_vgmstream_gcsw,
|
||||
init_vgmstream_ps2_ads,
|
||||
|
@ -331,6 +333,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
|||
init_vgmstream_ps2_vbk,
|
||||
init_vgmstream_otm,
|
||||
init_vgmstream_bcstm,
|
||||
init_vgmstream_3ds_idsp,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
|
@ -2142,6 +2145,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||
case meta_DSP_AGSC:
|
||||
snprintf(temp,TEMPSIZE,"Retro Studios AGSC header");
|
||||
break;
|
||||
case meta_DSP_CSMP:
|
||||
snprintf(temp,TEMPSIZE,"Retro Studios CSMP header");
|
||||
break;
|
||||
case meta_NGC_ADPDTK:
|
||||
snprintf(temp,TEMPSIZE,"assumed Nintendo ADP by .adp extension and valid first frame");
|
||||
break;
|
||||
|
@ -3066,6 +3072,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||
case meta_CSTM:
|
||||
snprintf(temp,TEMPSIZE,"Nintendo 3DS CSTM Header");
|
||||
break;
|
||||
case meta_3DS_IDSP:
|
||||
snprintf(temp,TEMPSIZE,"Nintendo 3DS IDSP Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -3084,7 +3093,7 @@ const char * const dfs_pairs[][2] = {
|
|||
|
||||
void try_dual_file_stereo(VGMSTREAM * opened_stream, STREAMFILE *streamFile) {
|
||||
char filename[PATH_LIMIT];
|
||||
char filename2[260];
|
||||
char filename2[PATH_LIMIT];
|
||||
char * ext;
|
||||
int dfs_name= -1; /*-1=no stereo, 0=opened_stream is left, 1=opened_stream is right */
|
||||
VGMSTREAM * new_stream = NULL;
|
||||
|
|
|
@ -16,23 +16,14 @@ enum { PATH_LIMIT = 32768 };
|
|||
#define VGM_USE_MPEG
|
||||
/* disabled by default, defined for builds that support it */
|
||||
//#define VGM_USE_G7221
|
||||
//#define VGM_USE_MP4V2
|
||||
//#define VGM_USE_FDKAAC
|
||||
|
||||
#include "streamfile.h"
|
||||
#ifdef BUILD_VGMSTREAM
|
||||
#include "coding/g72x_state.h"
|
||||
#else
|
||||
#include "g72x_state.h"
|
||||
#endif
|
||||
#ifdef VGM_USE_VORBIS
|
||||
#ifdef __APPLE__
|
||||
#define __MACOSX__
|
||||
#endif
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#endif
|
||||
#ifdef VGM_USE_MPEG
|
||||
#include <mpg123/mpg123.h>
|
||||
#include <mpg123.h>
|
||||
#endif
|
||||
#ifdef VGM_USE_G7221
|
||||
#include "g7221.h"
|
||||
|
@ -51,13 +42,8 @@ enum { PATH_LIMIT = 32768 };
|
|||
#include <maiatrac3plus.h>
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_VGMSTREAM
|
||||
#include "coding/acm_decoder.h"
|
||||
#include "coding/nwa_decoder.h"
|
||||
#else
|
||||
#include "acm_decoder.h"
|
||||
#include "nwa_decoder.h"
|
||||
#endif
|
||||
|
||||
/* The encoding type specifies the format the sound data itself takes */
|
||||
typedef enum {
|
||||
|
@ -227,6 +213,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
/* DSP-specific */
|
||||
meta_DSP_STD, /* standard GC ADPCM (DSP) header */
|
||||
meta_DSP_CSMP, /* Metroid Prime 3, Donkey Kong Country Returns */
|
||||
meta_DSP_CSTR, /* Star Fox Assault "Cstr" */
|
||||
meta_DSP_RS03, /* Metroid Prime 2 "RS03" */
|
||||
meta_DSP_STM, /* Paper Mario 2 STM */
|
||||
|
@ -581,6 +568,7 @@ typedef enum {
|
|||
meta_PS2_VBK,
|
||||
meta_OTM, // Otomedius (Arcade)
|
||||
meta_CSTM, // Nintendo 3DS CSTM
|
||||
meta_3DS_IDSP, // Nintendo 3DS IDSP
|
||||
#ifdef VGM_USE_MP4V2
|
||||
meta_MP4,
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue