Cleanup and renames

This commit is contained in:
bnnm 2019-07-28 15:11:17 +02:00
parent 53f5dbc607
commit b3c507b3ed
13 changed files with 101 additions and 105 deletions

View File

@ -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;

View File

@ -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"},

View File

@ -268,6 +268,10 @@
RelativePath=".\meta\fsb5_interleave_streamfile.h"
>
</File>
<File
RelativePath=".\meta\jstm_streamfile.h"
>
</File>
<File
RelativePath=".\meta\kma9_streamfile.h"
>
@ -1131,7 +1135,7 @@
>
</File>
<File
RelativePath=".\meta\ps2_jstm.c"
RelativePath=".\meta\jstm.c"
>
</File>
<File

View 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" />
@ -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" />

View File

@ -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>
@ -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">

View File

@ -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;
}

View File

@ -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;
}

View 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_ */

View File

@ -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);

View File

@ -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 */

View File

@ -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) */

View File

@ -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);

View File

@ -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 */