Updated vgmstream
parent
053bda3d92
commit
e0fe917356
|
@ -8,9 +8,11 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
coding_t coding_type;
|
||||
|
||||
off_t head_offset;
|
||||
off_t seek_offset;
|
||||
int codec_number;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
int ima = 0;
|
||||
off_t start_offset;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
|
@ -33,6 +35,10 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
if ((uint32_t)read_32bitBE(head_offset, streamFile) != 0x494E464F) /* "INFO" */
|
||||
goto fail;
|
||||
|
||||
seek_offset = read_32bitLE(0x24, streamFile);
|
||||
|
||||
if ((uint32_t)read_32bitBE(seek_offset, streamFile) != 0x5345454B) /* "SEEK" If this header doesn't exist, assuming that the file is IMA */
|
||||
ima = 1;
|
||||
|
||||
/* check type details */
|
||||
codec_number = read_8bit(head_offset + 0x20, streamFile);
|
||||
|
@ -47,6 +53,9 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
coding_type = coding_PCM16BE;
|
||||
break;
|
||||
case 2:
|
||||
if (ima)
|
||||
coding_type = coding_INT_IMA;
|
||||
else
|
||||
coding_type = coding_NGC_DSP;
|
||||
break;
|
||||
default:
|
||||
|
@ -64,30 +73,59 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
vgmstream->num_samples = read_32bitLE(head_offset + 0x2c, streamFile);
|
||||
vgmstream->sample_rate = (uint16_t)read_16bitLE(head_offset + 0x24, streamFile);
|
||||
/* channels and loop flag are set by allocate_vgmstream */
|
||||
if (ima) //Shift the loop points back slightly to avoid stupid pops in some IMA streams due to DC offsetting
|
||||
{
|
||||
vgmstream->loop_start_sample = read_32bitLE(head_offset + 0x28, streamFile);
|
||||
if (vgmstream->loop_start_sample > 10000)
|
||||
{
|
||||
vgmstream->loop_start_sample -= 5000;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples - 5000;
|
||||
}
|
||||
else
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
else
|
||||
{
|
||||
vgmstream->loop_start_sample = read_32bitLE(head_offset + 0x28, streamFile);
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_type;
|
||||
if (channel_count == 1)
|
||||
vgmstream->layout_type = layout_none;
|
||||
else
|
||||
{
|
||||
if (ima)
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
else
|
||||
vgmstream->layout_type = layout_interleave_shortblock;
|
||||
}
|
||||
vgmstream->meta_type = meta_CSTM;
|
||||
|
||||
if (ima)
|
||||
vgmstream->interleave_block_size = 0x200;
|
||||
else {
|
||||
vgmstream->interleave_block_size = read_32bitLE(head_offset + 0x34, streamFile);
|
||||
vgmstream->interleave_smallblock_size = read_32bitLE(head_offset + 0x44, streamFile);
|
||||
}
|
||||
|
||||
if (vgmstream->coding_type == coding_NGC_DSP) {
|
||||
off_t coef_offset;
|
||||
off_t coef_offset1;
|
||||
off_t coef_offset2;
|
||||
off_t tempoffset = head_offset;
|
||||
int foundcoef = 0;
|
||||
int i, j;
|
||||
int coef_spacing = 0x2E;
|
||||
|
||||
|
||||
coef_offset1 = read_32bitLE(head_offset + 0x1c, streamFile);
|
||||
coef_offset = coef_offset1 + 0x40;
|
||||
|
||||
while (!(foundcoef))
|
||||
{
|
||||
if ((uint32_t)read_32bitLE(tempoffset, streamFile) == 0x00004102)
|
||||
{
|
||||
coef_offset = read_32bitLE(tempoffset + 4, streamFile) + tempoffset + (channel_count * 8) - 4 - head_offset;
|
||||
foundcoef++;
|
||||
break;
|
||||
}
|
||||
tempoffset++;
|
||||
}
|
||||
|
||||
for (j = 0; j<vgmstream->channels; j++) {
|
||||
for (i = 0; i<16; i++) {
|
||||
|
@ -96,8 +134,13 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
}
|
||||
}
|
||||
|
||||
if (ima) // No SEEK (ADPC) header, so just start where the SEEK header is supposed to be.
|
||||
start_offset = seek_offset;
|
||||
else
|
||||
start_offset = read_32bitLE(0x30, streamFile) + 0x20;
|
||||
|
||||
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
int i;
|
||||
|
@ -105,6 +148,9 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
|
|||
if (vgmstream->layout_type == layout_interleave_shortblock)
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename,
|
||||
vgmstream->interleave_block_size);
|
||||
else if (vgmstream->layout_type == layout_interleave)
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename,
|
||||
STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
else
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename,
|
||||
0x1000);
|
||||
|
|
|
@ -13,7 +13,7 @@ VGMSTREAM * init_vgmstream_dc_dcsw_dcs(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileDCSW = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameDCSW[260];
|
||||
char filenameDCSW[PATH_LIMIT];
|
||||
int i;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
|
|
@ -10,7 +10,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_sth_str1(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileSTR = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameSTR[260];
|
||||
char filenameSTR[PATH_LIMIT];
|
||||
int i, j;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
@ -116,7 +116,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_sth_str2(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileSTR = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameSTR[260];
|
||||
char filenameSTR[PATH_LIMIT];
|
||||
int i, j;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
@ -222,7 +222,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_sth_str3(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileSTR = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameSTR[260];
|
||||
char filenameSTR[PATH_LIMIT];
|
||||
int i, j;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
|
|
@ -9,7 +9,7 @@ VGMSTREAM * init_vgmstream_gsp_gsb(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileGSP = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameGSP[260];
|
||||
char filenameGSP[PATH_LIMIT];
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
int header_len;
|
||||
|
|
|
@ -10,7 +10,7 @@ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileISH = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameISH[260];
|
||||
char filenameISH[PATH_LIMIT];
|
||||
int i;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define DIRSEP '/'
|
||||
#endif
|
||||
|
||||
#define NAME_LENGTH 260
|
||||
#define NAME_LENGTH PATH_LIMIT
|
||||
|
||||
int exists(char *filename, STREAMFILE *streamfile) {
|
||||
STREAMFILE * temp =
|
||||
|
|
|
@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_ngc_sck_dsp(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileDSP = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameDSP[260];
|
||||
char filenameDSP[PATH_LIMIT];
|
||||
|
||||
int i;
|
||||
int channel_count;
|
||||
|
|
|
@ -57,9 +57,9 @@ VGMSTREAM * init_vgmstream_nwa(STREAMFILE *streamFile) {
|
|||
|
||||
/* try to locate NWAINFO.INI in the same directory */
|
||||
{
|
||||
char ininame[260];
|
||||
char ininame[PATH_LIMIT];
|
||||
char * ini_lastslash;
|
||||
char namebase_array[260];
|
||||
char namebase_array[PATH_LIMIT];
|
||||
char *namebase;
|
||||
STREAMFILE *inistreamfile;
|
||||
|
||||
|
@ -134,9 +134,9 @@ VGMSTREAM * init_vgmstream_nwa(STREAMFILE *streamFile) {
|
|||
|
||||
/* try to locate Gameexe.ini in the same directory */
|
||||
{
|
||||
char ininame[260];
|
||||
char ininame[PATH_LIMIT];
|
||||
char * ini_lastslash;
|
||||
char namebase_array[260];
|
||||
char namebase_array[PATH_LIMIT];
|
||||
char * namebase;
|
||||
STREAMFILE *inistreamfile;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileWAV = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameWAV[260];
|
||||
char filenameWAV[PATH_LIMIT];
|
||||
|
||||
int i;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
|||
|
||||
off_t readOffset = 0;
|
||||
|
||||
char filenameMIH[260];
|
||||
char filenameMIH[PATH_LIMIT];
|
||||
off_t loopStartPoints[0x10];
|
||||
int loopStartPointsCount=0;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE *streamFile)
|
|||
int shortBlockSize;
|
||||
int lastBlockLocation;
|
||||
|
||||
char filenameWHED[260];
|
||||
char filenameWHED[PATH_LIMIT];
|
||||
STREAMFILE * streamFileWHED = NULL;
|
||||
|
||||
//_TCHAR szBuffer[100];
|
||||
|
|
|
@ -7,7 +7,7 @@ VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE *streamFile) {
|
|||
off_t start_offset = 0;
|
||||
STREAMFILE * streamFileSGH = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameSGH[260];
|
||||
char filenameSGH[PATH_LIMIT];
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ static void parse_adtl(off_t adtl_offset, off_t adtl_length, STREAMFILE *stream
|
|||
VGMSTREAM * init_vgmstream_sfl(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileOGG = NULL;
|
||||
char filenameOGG[260];
|
||||
char filenameOGG[PATH_LIMIT];
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
off_t file_size = -1;
|
||||
|
|
|
@ -19,8 +19,8 @@ VGMSTREAM * init_vgmstream_sli_ogg(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileOGG = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameOGG[260];
|
||||
char linebuffer[260];
|
||||
char filenameOGG[PATH_LIMIT];
|
||||
char linebuffer[PATH_LIMIT];
|
||||
off_t bytes_read;
|
||||
off_t sli_offset;
|
||||
int done;
|
||||
|
|
|
@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_spt_spd(STREAMFILE *streamFile) {
|
|||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileSPT = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
char filenameSPT[260];
|
||||
char filenameSPT[PATH_LIMIT];
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
int i;
|
||||
|
|
|
@ -177,6 +177,8 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
|
|||
|
||||
if (vgmstream->sample_rate == 47999)
|
||||
vgmstream->sample_rate = 48000;
|
||||
if (vgmstream->sample_rate == 44099)
|
||||
vgmstream->sample_rate = 44100;
|
||||
|
||||
mpeg_data = init_mpeg_codec_data(streamFile, start_offset, vgmstream->sample_rate, vgmstream->channels, &ct, NULL, NULL);
|
||||
if (!mpeg_data) goto fail;
|
||||
|
|
Loading…
Reference in New Issue