mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
commit
ae73eaafd7
@ -88,7 +88,7 @@ static ao_device *device = NULL;
|
||||
static ao_option *device_options = NULL;
|
||||
static ao_sample_format current_sample_format;
|
||||
|
||||
static sample *buffer = NULL;
|
||||
static sample_t *buffer = NULL;
|
||||
static int buffer_size_kb = 16;
|
||||
|
||||
static int repeat = 0;
|
||||
|
@ -782,7 +782,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_DSP_RS03, "Retro Studios RS03 header"},
|
||||
{meta_DSP_STD, "Nintendo DSP header"},
|
||||
{meta_DSP_CSTR, "Namco Cstr header"},
|
||||
{meta_GCSW, "GCSW header"},
|
||||
{meta_GCSW, "MileStone GCSW header"},
|
||||
{meta_PS2_SShd, "Sony ADS header"},
|
||||
{meta_NPS, "Namco NPSF header"},
|
||||
{meta_RWSD, "Nintendo RWSD header (single stream)"},
|
||||
@ -990,7 +990,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_XBOX_HLWAV, "Half Life 2 bgm header"},
|
||||
{meta_STX, "Nintendo .stx header"},
|
||||
{meta_MYSPD, "U-Sing .MYSPD header"},
|
||||
{meta_HIS, "Her Interactive Sound header"},
|
||||
{meta_HIS, "Her Interactive HIS header"},
|
||||
{meta_PS2_AST, "KOEI AST header"},
|
||||
{meta_CAPDSP, "Capcom DSP header"},
|
||||
{meta_DMSG, "RIFF/DMSGsegh header"},
|
||||
@ -1095,8 +1095,8 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_TA_AAC_MOBILE, "tri-Ace AAC (Mobile) header"},
|
||||
{meta_MTA2, "Konami MTA2 header"},
|
||||
{meta_NGC_ULW, "Criterion ULW raw header"},
|
||||
{meta_PC_XA30, "Reflections XA30 PC header"},
|
||||
{meta_WII_04SW, "Reflections 04SW header"},
|
||||
{meta_XA_XA30, "Reflections XA30 header"},
|
||||
{meta_XA_04SW, "Reflections 04SW header"},
|
||||
{meta_TXTH, "TXTH generic header"},
|
||||
{meta_EA_BNK, "Electronic Arts BNK header"},
|
||||
{meta_SK_AUD, "Silicon Knights AUD header"},
|
||||
|
@ -268,6 +268,10 @@
|
||||
RelativePath=".\meta\fsb5_interleave_streamfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\jstm_streamfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\kma9_streamfile.h"
|
||||
>
|
||||
@ -1011,7 +1015,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\pc_xa30.c"
|
||||
RelativePath=".\meta\xa_xa30.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -1131,7 +1135,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_jstm.c"
|
||||
RelativePath=".\meta\jstm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -1631,7 +1635,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\wii_04sw.c"
|
||||
RelativePath=".\meta\xa_04sw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
@ -110,6 +110,7 @@
|
||||
<ClInclude Include="meta\ea_schl_streamfile.h" />
|
||||
<ClInclude Include="meta\fsb_interleave_streamfile.h" />
|
||||
<ClInclude Include="meta\fsb5_interleave_streamfile.h" />
|
||||
<ClInclude Include="meta\jstm_streamfile.h" />
|
||||
<ClInclude Include="meta\kma9_streamfile.h" />
|
||||
<ClInclude Include="meta\ppst_streamfile.h" />
|
||||
<ClInclude Include="meta\vsv_streamfile.h" />
|
||||
@ -361,7 +362,7 @@
|
||||
<ClCompile Include="meta\pc_al2.c" />
|
||||
<ClCompile Include="meta\pc_mxst.c" />
|
||||
<ClCompile Include="meta\sab.c" />
|
||||
<ClCompile Include="meta\pc_xa30.c" />
|
||||
<ClCompile Include="meta\xa_xa30.c" />
|
||||
<ClCompile Include="meta\pcm_sre.c" />
|
||||
<ClCompile Include="meta\scd_pcm.c" />
|
||||
<ClCompile Include="meta\pona.c" />
|
||||
@ -388,7 +389,7 @@
|
||||
<ClCompile Include="meta\ps2_ild.c" />
|
||||
<ClCompile Include="meta\ps2_int.c" />
|
||||
<ClCompile Include="meta\ps2_joe.c" />
|
||||
<ClCompile Include="meta\ps2_jstm.c" />
|
||||
<ClCompile Include="meta\jstm.c" />
|
||||
<ClCompile Include="meta\ps2_kces.c" />
|
||||
<ClCompile Include="meta\ps2_leg.c" />
|
||||
<ClCompile Include="meta\ps2_lpcm.c" />
|
||||
@ -489,7 +490,7 @@
|
||||
<ClCompile Include="meta\wave_segmented.c" />
|
||||
<ClCompile Include="meta\wave.c" />
|
||||
<ClCompile Include="meta\wavebatch.c" />
|
||||
<ClCompile Include="meta\wii_04sw.c" />
|
||||
<ClCompile Include="meta\xa_04sw.c" />
|
||||
<ClCompile Include="meta\wii_bns.c" />
|
||||
<ClCompile Include="meta\wii_mus.c" />
|
||||
<ClCompile Include="meta\wii_sng.c" />
|
||||
|
@ -98,6 +98,9 @@
|
||||
<ClInclude Include="meta\fsb5_interleave_streamfile.h">
|
||||
<Filter>meta\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="meta\jstm_streamfile.h">
|
||||
<Filter>meta\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="meta\kma9_streamfile.h">
|
||||
<Filter>meta\Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -625,7 +628,7 @@
|
||||
<ClCompile Include="meta\sab.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\pc_xa30.c">
|
||||
<ClCompile Include="meta\xa_xa30.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\pcm_sre.c">
|
||||
@ -706,7 +709,7 @@
|
||||
<ClCompile Include="meta\ps2_joe.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_jstm.c">
|
||||
<ClCompile Include="meta\jstm.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_kces.c">
|
||||
@ -1009,7 +1012,7 @@
|
||||
<ClCompile Include="meta\wavebatch.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\wii_04sw.c">
|
||||
<ClCompile Include="meta\xa_04sw.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\wii_bns.c">
|
||||
|
@ -1,62 +1,45 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
|
||||
/* GCSW - from Radirgy GeneriC (GC) */
|
||||
VGMSTREAM * init_vgmstream_gcsw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
int channel_count, loop_flag;
|
||||
off_t start_offset;
|
||||
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("gcw",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if ((uint32_t)read_32bitBE(0,streamFile)!=0x47435357) /* "GCSW" */
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "gcw"))
|
||||
goto fail;
|
||||
|
||||
/* check type details */
|
||||
/* guess */
|
||||
if (read_32bitBE(0,streamFile) != 0x47435357) /* "GCSW" */
|
||||
goto fail;
|
||||
|
||||
start_offset = 0x20;
|
||||
channel_count = read_32bitBE(0x0c,streamFile);
|
||||
loop_flag = read_32bitBE(0x1c,streamFile);
|
||||
channel_count = read_32bitBE(0xc,streamFile);
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->meta_type = meta_GCSW;
|
||||
|
||||
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
|
||||
vgmstream->num_samples = read_32bitBE(0x10,streamFile);
|
||||
vgmstream->sample_rate = read_32bitBE(0x8,streamFile);
|
||||
/* channels and loop flag are set by allocate_vgmstream */
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x18,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_PCM16BE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->meta_type = meta_GCSW;
|
||||
|
||||
vgmstream->interleave_block_size = 0x8000;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=
|
||||
0x20+0x8000*i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
161
src/meta/his.c
161
src/meta/his.c
@ -1,112 +1,99 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* Her Interactive Sound .his (Nancy Drew) */
|
||||
/* A somewhat transformed RIFF WAVE */
|
||||
|
||||
/* HIS - Her Interactive games [Nancy Drew series (PC)] */
|
||||
VGMSTREAM * init_vgmstream_his(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
int channel_count;
|
||||
int loop_flag = 0;
|
||||
int bps = 0;
|
||||
int channel_count, loop_flag = 0, bps, sample_rate, num_samples, version;
|
||||
off_t start_offset;
|
||||
const uint8_t header_magic_expected[0x16] = "Her Interactive Sound\x1a";
|
||||
uint8_t header_magic[0x16];
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("his",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header magic */
|
||||
if (0x16 != streamFile->read(streamFile, header_magic, 0, 0x16)) goto fail;
|
||||
if (memcmp(header_magic_expected, header_magic, 0x16)) goto fail;
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "his"))
|
||||
goto fail;
|
||||
|
||||
/* data chunk label */
|
||||
if (0x64617461 != read_32bitBE(0x24,streamFile)) goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) == 0x48657220) { /* "Her Interactive Sound\x1a" */
|
||||
/* Nancy Drew: Secrets Can Kill (PC) */
|
||||
version = 0;
|
||||
channel_count = read_16bitLE(0x16,streamFile);
|
||||
sample_rate = read_32bitLE(0x18,streamFile);
|
||||
/* 0x1c: bitrate */
|
||||
/* 0x20: block size */
|
||||
bps = read_16bitLE(0x22,streamFile);
|
||||
|
||||
start_offset = 0x2c;
|
||||
if (read_32bitBE(0x24,streamFile) != 0x64617461) /* "data" */
|
||||
goto fail;
|
||||
num_samples = pcm_bytes_to_samples(read_32bitLE(0x28,streamFile), channel_count, bps);
|
||||
|
||||
channel_count = read_16bitLE(0x16,streamFile);
|
||||
start_offset = 0x2c;
|
||||
}
|
||||
else if (read_32bitBE(0x00,streamFile) == 0x48495300) { /* HIS\0 */
|
||||
/* most(?) others */
|
||||
version = read_32bitLE(0x04,streamFile);
|
||||
/* 0x08: codec */
|
||||
channel_count = read_16bitLE(0x0a,streamFile);
|
||||
sample_rate = read_32bitLE(0x0c,streamFile);
|
||||
/* 0x10: bitrate */
|
||||
/* 0x14: block size */
|
||||
bps = read_16bitLE(0x16,streamFile);
|
||||
|
||||
/* 8-bit or 16-bit expected */
|
||||
switch (read_16bitLE(0x22,streamFile))
|
||||
{
|
||||
num_samples = pcm_bytes_to_samples(read_32bitLE(0x18,streamFile), channel_count, bps); /* true even for Ogg */
|
||||
|
||||
/* later games use "OggS" */
|
||||
if (version == 1)
|
||||
start_offset = 0x1c; /* Nancy Drew: The Final Scene (PC) */
|
||||
else if (version == 2 && read_32bitBE(0x1e,streamFile) == 0x4F676753)
|
||||
start_offset = 0x1e; /* Nancy Drew: The Haunted Carousel (PC) */
|
||||
else if (version == 2 && read_32bitBE(0x20,streamFile) == 0x4F676753)
|
||||
start_offset = 0x20; /* Nancy Drew: The Silent Spy (PC) */
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (version == 2) {
|
||||
#ifdef VGM_USE_VORBIS
|
||||
ogg_vorbis_meta_info_t ovmi = {0};
|
||||
|
||||
ovmi.meta_type = meta_HIS;
|
||||
return init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
|
||||
#else
|
||||
goto fail;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_HIS;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = num_samples;
|
||||
|
||||
switch (bps) {
|
||||
case 8:
|
||||
bps = 1;
|
||||
vgmstream->coding_type = coding_PCM8_U;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x01;
|
||||
break;
|
||||
case 16:
|
||||
bps = 2;
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x02;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* check bytes per frame */
|
||||
if (read_16bitLE(0x20,streamFile) != channel_count*bps) goto fail;
|
||||
|
||||
/* check size */
|
||||
/* file size -8 */
|
||||
if ((read_32bitLE(0x1c,streamFile)+8) != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
/* data chunk size, assume it occupies the rest of the file */
|
||||
//if ((read_32bitLE(0x28,streamFile)+start_offset) != get_streamfile_size(streamFile))
|
||||
// goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = read_32bitLE(0x28,streamFile) / channel_count / bps;
|
||||
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
|
||||
|
||||
vgmstream->meta_type = meta_HIS;
|
||||
vgmstream->layout_type = layout_none;
|
||||
if (bps == 2)
|
||||
{
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
if (channel_count == 2)
|
||||
{
|
||||
vgmstream->coding_type = coding_PCM16_int;
|
||||
vgmstream->interleave_block_size = 2;
|
||||
}
|
||||
}
|
||||
else // bps == 1
|
||||
{
|
||||
vgmstream->coding_type = coding_PCM8_U;
|
||||
if (channel_count == 2)
|
||||
{
|
||||
vgmstream->coding_type = coding_PCM8_U_int;
|
||||
vgmstream->interleave_block_size = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[0].streamfile = file;
|
||||
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[0].offset=start_offset;
|
||||
|
||||
if (channel_count == 2)
|
||||
{
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[1].streamfile = file;
|
||||
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[1].offset=start_offset + vgmstream->interleave_block_size;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "jstm_streamfile.h"
|
||||
|
||||
static STREAMFILE* setup_jstm_streamfile(STREAMFILE *streamFile, off_t start_offset);
|
||||
|
||||
/* JSTM - from Tantei Jinguji Saburo - Kind of Blue (PS2) */
|
||||
VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * init_vgmstream_jstm(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE *temp_streamFile = NULL;
|
||||
off_t start_offset;
|
||||
@ -55,49 +55,3 @@ fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
off_t start_offset;
|
||||
} jstm_decryption_data;
|
||||
|
||||
static size_t jstm_decryption_read(STREAMFILE *streamfile, uint8_t *dest, off_t offset, size_t length, jstm_decryption_data* data) {
|
||||
size_t bytes_read;
|
||||
int i;
|
||||
|
||||
bytes_read = streamfile->read(streamfile, dest, offset, length);
|
||||
|
||||
/* decrypt data (xor) */
|
||||
for (i = 0; i < bytes_read; i++) {
|
||||
if (offset+i >= data->start_offset) {
|
||||
dest[i] = dest[i] ^ 0x5A;
|
||||
}
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
static STREAMFILE* setup_jstm_streamfile(STREAMFILE *streamFile, off_t start_offset) {
|
||||
STREAMFILE *temp_streamFile = NULL, *new_streamFile = NULL;
|
||||
jstm_decryption_data io_data = {0};
|
||||
size_t io_data_size = sizeof(jstm_decryption_data);
|
||||
|
||||
/* setup decryption */
|
||||
io_data.start_offset = start_offset;
|
||||
|
||||
|
||||
/* setup custom streamfile */
|
||||
new_streamFile = open_wrap_streamfile(streamFile);
|
||||
if (!new_streamFile) goto fail;
|
||||
temp_streamFile = new_streamFile;
|
||||
|
||||
new_streamFile = open_io_streamfile(temp_streamFile, &io_data,io_data_size, jstm_decryption_read,NULL);
|
||||
if (!new_streamFile) goto fail;
|
||||
temp_streamFile = new_streamFile;
|
||||
|
||||
return temp_streamFile;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
return NULL;
|
||||
}
|
51
src/meta/jstm_streamfile.h
Normal file
51
src/meta/jstm_streamfile.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef _JSTM_STREAMFILE_H_
|
||||
#define _JSTM_STREAMFILE_H_
|
||||
#include "../streamfile.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
off_t start_offset;
|
||||
} jstm_decryption_data;
|
||||
|
||||
static size_t jstm_decryption_read(STREAMFILE *streamfile, uint8_t *dest, off_t offset, size_t length, jstm_decryption_data* data) {
|
||||
size_t bytes_read;
|
||||
int i;
|
||||
|
||||
bytes_read = streamfile->read(streamfile, dest, offset, length);
|
||||
|
||||
/* decrypt data (xor) */
|
||||
for (i = 0; i < bytes_read; i++) {
|
||||
if (offset+i >= data->start_offset) {
|
||||
dest[i] = dest[i] ^ 0x5A;
|
||||
}
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
static STREAMFILE* setup_jstm_streamfile(STREAMFILE *streamFile, off_t start_offset) {
|
||||
STREAMFILE *temp_streamFile = NULL, *new_streamFile = NULL;
|
||||
jstm_decryption_data io_data = {0};
|
||||
size_t io_data_size = sizeof(jstm_decryption_data);
|
||||
|
||||
/* setup decryption */
|
||||
io_data.start_offset = start_offset;
|
||||
|
||||
|
||||
/* setup custom streamfile */
|
||||
new_streamFile = open_wrap_streamfile(streamFile);
|
||||
if (!new_streamFile) goto fail;
|
||||
temp_streamFile = new_streamFile;
|
||||
|
||||
new_streamFile = open_io_streamfile(temp_streamFile, &io_data,io_data_size, jstm_decryption_read,NULL);
|
||||
if (!new_streamFile) goto fail;
|
||||
temp_streamFile = new_streamFile;
|
||||
|
||||
return temp_streamFile;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _JSTM_STREAMFILE_H_ */
|
@ -503,7 +503,7 @@ VGMSTREAM * init_vgmstream_bar(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ffw(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE* streamFile);
|
||||
VGMSTREAM * init_vgmstream_jstm(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_xvag(STREAMFILE* streamFile);
|
||||
|
||||
@ -637,9 +637,9 @@ VGMSTREAM * init_vgmstream_mta2_container(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_ulw(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_pc_xa30(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_xa_xa30(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_wii_04sw(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_xa_04sw(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_txth(STREAMFILE * streamFile);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* 04SW - found in Driver: Parallel Lines (Wii) */
|
||||
VGMSTREAM * init_vgmstream_wii_04sw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * init_vgmstream_xa_04sw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count;
|
||||
@ -44,7 +44,7 @@ VGMSTREAM * init_vgmstream_wii_04sw(STREAMFILE *streamFile) {
|
||||
dsp_read_coefs_be(vgmstream,streamFile,0x20, 0x60);
|
||||
/* the initial history offset seems different thatn standard DSP and possibly always zero */
|
||||
|
||||
vgmstream->meta_type = meta_WII_04SW;
|
||||
vgmstream->meta_type = meta_XA_04SW;
|
||||
/* the rest of the header has unknown values (several repeats) and the filename */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* XA30 - found in Reflections games [Driver: Parallel Lines (PC), Driver 3 (PC)] */
|
||||
VGMSTREAM * init_vgmstream_pc_xa30(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * init_vgmstream_xa_xa30(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count, codec;
|
||||
@ -41,7 +41,7 @@ VGMSTREAM * init_vgmstream_pc_xa30(STREAMFILE *streamFile) {
|
||||
/* 0x20: always IMA=00016000, PCM=00056000 PCM?, rest of the header is null */
|
||||
vgmstream->num_streams = total_subsongs;
|
||||
vgmstream->stream_size = stream_size;
|
||||
vgmstream->meta_type = meta_PC_XA30;
|
||||
vgmstream->meta_type = meta_XA_XA30;
|
||||
|
||||
switch(codec) {
|
||||
case 0x00: /* PCM (rare, seen in Driver 3) */
|
@ -274,7 +274,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_bar,
|
||||
init_vgmstream_ffw,
|
||||
init_vgmstream_dsp_dspw,
|
||||
init_vgmstream_ps2_jstm,
|
||||
init_vgmstream_jstm,
|
||||
init_vgmstream_xvag,
|
||||
init_vgmstream_ps3_cps,
|
||||
init_vgmstream_sqex_scd,
|
||||
@ -349,8 +349,8 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_mta2,
|
||||
init_vgmstream_mta2_container,
|
||||
init_vgmstream_ngc_ulw,
|
||||
init_vgmstream_pc_xa30,
|
||||
init_vgmstream_wii_04sw,
|
||||
init_vgmstream_xa_xa30,
|
||||
init_vgmstream_xa_04sw,
|
||||
init_vgmstream_ea_bnk,
|
||||
init_vgmstream_ea_abk,
|
||||
init_vgmstream_ea_hdr_dat,
|
||||
@ -1027,7 +1027,7 @@ void vgmstream_set_loop_target(VGMSTREAM* vgmstream, int loop_target) {
|
||||
|
||||
|
||||
/* Decode data into sample buffer */
|
||||
void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream) {
|
||||
void render_vgmstream(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream) {
|
||||
switch (vgmstream->layout_type) {
|
||||
case layout_interleave:
|
||||
render_vgmstream_interleave(buffer,sample_count,vgmstream);
|
||||
@ -2498,14 +2498,15 @@ static void try_dual_file_stereo(VGMSTREAM * opened_vgmstream, STREAMFILE *strea
|
||||
{"Left","Right"},
|
||||
{".V0",".V1"}, /* Homura (PS2) */
|
||||
{".L",".R"}, /* Crash Nitro Racing (PS2), Gradius V (PS2) */
|
||||
{"_0","_1"}, //fake for Homura/unneeded?
|
||||
{"_0","_1"}, /* fake for Homura/unneeded? */
|
||||
{".adpcm","_NxEncoderOut_.adpcm"}, /* Kill la Kill: IF (Switch) */ //todo can't match R>L
|
||||
};
|
||||
char new_filename[PATH_LIMIT];
|
||||
char * ext;
|
||||
char * extension;
|
||||
int dfs_pair = -1; /* -1=no stereo, 0=opened_vgmstream is left, 1=opened_vgmstream is right */
|
||||
VGMSTREAM *new_vgmstream = NULL;
|
||||
STREAMFILE *dual_streamFile = NULL;
|
||||
int i,j, dfs_pair_count;
|
||||
int i,j, dfs_pair_count, extension_len, filename_len;
|
||||
|
||||
if (opened_vgmstream->channels != 1)
|
||||
return;
|
||||
@ -2514,48 +2515,54 @@ static void try_dual_file_stereo(VGMSTREAM * opened_vgmstream, STREAMFILE *strea
|
||||
if (opened_vgmstream->codec_data || opened_vgmstream->layout_data)
|
||||
return;
|
||||
|
||||
/* vgmstream's layout stuff currently assumes a single file */
|
||||
// fastelbja : no need ... this one works ok with dual file
|
||||
//todo other layouts work but some stereo codecs do weird things
|
||||
//if (opened_vgmstream->layout != layout_none) return;
|
||||
//todo force layout_none if layout_interleave?
|
||||
|
||||
get_streamfile_name(streamFile,new_filename,sizeof(new_filename));
|
||||
if (strlen(new_filename) < 2) return; /* we need at least a base and a name ending to replace */
|
||||
filename_len = strlen(new_filename);
|
||||
if (filename_len < 2)
|
||||
return;
|
||||
|
||||
ext = (char *)filename_extension(new_filename);
|
||||
if (ext-new_filename >= 1 && ext[-1]=='.') ext--; /* including "." */
|
||||
extension = (char *)filename_extension(new_filename);
|
||||
if (extension - new_filename >= 1 && extension[-1] == '.')
|
||||
extension--; /* must include "." */
|
||||
extension_len = strlen(extension);
|
||||
|
||||
/* find pair from base name and modify new_filename with the opposite */
|
||||
|
||||
/* find pair from base name and modify new_filename with the opposite (tries L>R then R>L) */
|
||||
dfs_pair_count = (sizeof(dfs_pairs)/sizeof(dfs_pairs[0]));
|
||||
for (i = 0; dfs_pair == -1 && i < dfs_pair_count; i++) {
|
||||
for (j = 0; dfs_pair == -1 && j < 2; j++) {
|
||||
const char * this_suffix = dfs_pairs[i][j];
|
||||
const char * that_suffix = dfs_pairs[i][j^1];
|
||||
size_t this_suffix_len = strlen(dfs_pairs[i][j]);
|
||||
const char * other_suffix = dfs_pairs[i][j^1];
|
||||
size_t other_suffix_len = strlen(dfs_pairs[i][j^1]);
|
||||
size_t that_suffix_len = strlen(dfs_pairs[i][j^1]);
|
||||
|
||||
/* if suffix matches copy opposite to ext pointer (thus to new_filename) */
|
||||
if (this_suffix[0] == '.' && strlen(ext) == this_suffix_len) { /* dual extension (ex. Homura PS2) */
|
||||
if ( !memcmp(ext,this_suffix,this_suffix_len) ) {
|
||||
//;VGM_LOG("DFS: l=%s, r=%s\n", this_suffix,that_suffix);
|
||||
|
||||
/* is suffix matches paste opposite suffix (+ terminator) to extension pointer, thus to new_filename */
|
||||
if (this_suffix[0] == '.' && extension_len == this_suffix_len) { /* same extension */
|
||||
//;VGM_LOG("DFS: same ext %s vs %s len %i\n", extension, this_suffix, this_suffix_len);
|
||||
if (memcmp(extension,this_suffix,this_suffix_len) == 0) {
|
||||
dfs_pair = j;
|
||||
memcpy (ext, other_suffix,other_suffix_len); /* overwrite with new extension */
|
||||
memcpy (extension, that_suffix,that_suffix_len+1);
|
||||
}
|
||||
}
|
||||
else { /* dual suffix */
|
||||
if ( !memcmp(ext - this_suffix_len,this_suffix,this_suffix_len) ) {
|
||||
else if (filename_len > this_suffix_len) { /* same suffix (without extension) */
|
||||
//;VGM_LOG("DFS: same suf %s vs %s len %i\n", extension - this_suffix_len, this_suffix, this_suffix_len);
|
||||
if (memcmp(extension - this_suffix_len, this_suffix,this_suffix_len) == 0) {
|
||||
dfs_pair = j;
|
||||
memmove(ext + other_suffix_len - this_suffix_len, ext,strlen(ext)+1); /* move the extension and terminator, too */
|
||||
memcpy (ext - this_suffix_len, other_suffix,other_suffix_len); /* overwrite with new suffix */
|
||||
memmove(extension + that_suffix_len - this_suffix_len, extension,extension_len+1); /* move old extension to end */
|
||||
memcpy (extension - this_suffix_len, that_suffix,that_suffix_len); /* overwrite with new suffix */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* see if the filename had a suitable L/R-pair name */
|
||||
if (dfs_pair == -1)
|
||||
goto fail;
|
||||
|
||||
//;VGM_LOG("DFS: match %i filename=%s\n", dfs_pair, new_filename);
|
||||
|
||||
/* try to init other channel (new_filename now has the opposite name) */
|
||||
dual_streamFile = open_streamfile(streamFile,new_filename);
|
||||
|
@ -629,8 +629,8 @@ typedef enum {
|
||||
meta_TA_AAC_MOBILE, /* tri-Ace AAC (Star Ocean Anamnesis, Heaven x Inferno) */
|
||||
meta_MTA2,
|
||||
meta_NGC_ULW, /* Burnout 1 (GC only) */
|
||||
meta_PC_XA30, /* Driver - Parallel Lines (PC) */
|
||||
meta_WII_04SW, /* Driver - Parallel Lines (Wii) */
|
||||
meta_XA_XA30,
|
||||
meta_XA_04SW,
|
||||
meta_TXTH, /* generic text header */
|
||||
meta_SK_AUD, /* Silicon Knights .AUD (Eternal Darkness GC) */
|
||||
meta_AHX, /* CRI AHX header */
|
||||
@ -1329,7 +1329,7 @@ void close_vgmstream(VGMSTREAM * vgmstream);
|
||||
int32_t get_vgmstream_play_samples(double looptimes, double fadeseconds, double fadedelayseconds, VGMSTREAM * vgmstream);
|
||||
|
||||
/* Decode data into sample buffer */
|
||||
void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
|
||||
void render_vgmstream(sample_t * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
|
||||
|
||||
/* Write a description of the stream into array pointed by desc, which must be length bytes long.
|
||||
* Will always be null-terminated if length > 0 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user