mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
cleanup: ps2_xa2 to xa2_acclaim
This commit is contained in:
parent
56c0ece442
commit
c8479a1501
@ -1090,7 +1090,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_DC_STR_V2, "variant of Sega Stream Asset Builder header"},
|
||||
{meta_XMU, "Outrage XMU header"},
|
||||
{meta_XVAS, "Konami .XVAS header"},
|
||||
{meta_PS2_XA2, "Acclaim XA2 Header"},
|
||||
{meta_XA2_ACCLAIM, "Acclaim .XA2 Header"},
|
||||
{meta_SAP, "VING .SAP header"},
|
||||
{meta_DC_IDVI, "Capcom IDVI header"},
|
||||
{meta_KRAW, "Geometry Wars: Galaxies KRAW header"},
|
||||
@ -1145,7 +1145,6 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_DSP_WII_WSD, ".WSD header"},
|
||||
{meta_WII_NDP, "Icon Games NDP header"},
|
||||
{meta_PS2_SPS, "Ape Escape 2 SPS Header"},
|
||||
{meta_PS2_XA2_RRP, "Acclaim XA2 Header"},
|
||||
{meta_NDS_HWAS, "Vicarious Visions HWAS header"},
|
||||
{meta_NGC_LPS, "Rave Master LPS Header"},
|
||||
{meta_NAOMI_ADPCM, "NAOMI/NAOMI2 Arcade games ADPCM header"},
|
||||
|
@ -582,8 +582,6 @@
|
||||
<ClCompile Include="meta\ps2_wad.c" />
|
||||
<ClCompile Include="meta\ps2_wb.c" />
|
||||
<ClCompile Include="meta\ps2_wmus.c" />
|
||||
<ClCompile Include="meta\ps2_xa2.c" />
|
||||
<ClCompile Include="meta\ps2_xa2_rrp.c" />
|
||||
<ClCompile Include="meta\ps2_xa30.c" />
|
||||
<ClCompile Include="meta\ps3_past.c" />
|
||||
<ClCompile Include="meta\psb.c" />
|
||||
@ -707,6 +705,7 @@
|
||||
<ClCompile Include="meta\wwise.c" />
|
||||
<ClCompile Include="meta\wxd_wxh.c" />
|
||||
<ClCompile Include="meta\xa.c" />
|
||||
<ClCompile Include="meta\xa2_acclaim.c" />
|
||||
<ClCompile Include="meta\xau.c" />
|
||||
<ClCompile Include="meta\xau_konami.c" />
|
||||
<ClCompile Include="meta\xavs.c" />
|
||||
|
@ -1567,12 +1567,6 @@
|
||||
<ClCompile Include="meta\ps2_wmus.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_xa2.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_xa2_rrp.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_xa30.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1942,6 +1936,9 @@
|
||||
<ClCompile Include="meta\xa.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\xa2_acclaim.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\xau.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -292,7 +292,7 @@ VGMSTREAM * init_vgmstream_kraw(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_xa2(STREAMFILE * streamFile);
|
||||
VGMSTREAM* init_vgmstream_xa2_acclaim(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_idsp_ie(STREAMFILE * streamFile);
|
||||
|
||||
@ -389,8 +389,6 @@ VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_sps(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_xa2_rrp(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE * streamFile);
|
||||
|
@ -1,60 +0,0 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* XA2 (XG3 Extreme-G Racing) */
|
||||
VGMSTREAM * init_vgmstream_ps2_xa2(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("xa2",filename_extension(filename))) goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x0,streamFile);
|
||||
|
||||
if (read_32bitLE(0x4,streamFile) > 0x1000) goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/channel_count/16*28;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x04,streamFile);
|
||||
vgmstream->meta_type = meta_PS2_XA2;
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+
|
||||
vgmstream->interleave_block_size*i;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
#include "meta.h"
|
||||
|
||||
|
||||
/* XA2 (RC Revenge Pro) */
|
||||
VGMSTREAM * init_vgmstream_ps2_xa2_rrp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("xa2",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x50,streamFile) != 0x00000000)
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x0,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
if (channel_count > 2)
|
||||
vgmstream->interleave_block_size = 0x400;
|
||||
else
|
||||
vgmstream->interleave_block_size = 0x1000;
|
||||
vgmstream->meta_type = meta_PS2_XA2_RRP;
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+
|
||||
vgmstream->interleave_block_size*i;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
60
src/meta/xa2_acclaim.c
Normal file
60
src/meta/xa2_acclaim.c
Normal file
@ -0,0 +1,60 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
|
||||
/* XA2 - from Acclaim games [RC Revenge Pro (PS2), XGIII: Extreme G Racing (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_xa2_acclaim(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset, sizes_offset;
|
||||
int channels, loop_flag = 0, interleave;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (read_u32le(0x00,sf) > 0x10)
|
||||
return NULL;
|
||||
|
||||
if (!check_extensions(sf, "xa2"))
|
||||
return NULL;
|
||||
|
||||
channels = read_s32le(0x00, sf); /* seen +16 */
|
||||
loop_flag = 0;
|
||||
|
||||
if (read_u32le(0x04,sf) > 0x1000) { /* RCRP (no interleave field) */
|
||||
interleave = (channels > 2) ? 0x400 : 0x1000;
|
||||
sizes_offset = 0x04;
|
||||
}
|
||||
else {
|
||||
interleave = read_s32le(0x04,sf);
|
||||
sizes_offset = 0x08;
|
||||
}
|
||||
|
||||
/* N sizes that rougly sum data size (not all the same value), then empty */
|
||||
for (int i = 0; i < channels; i++) {
|
||||
if (read_32bitBE(sizes_offset + 0x04 * i, sf) == 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (read_32bitBE(sizes_offset + 0x04 * channels, sf) != 0)
|
||||
goto fail;
|
||||
|
||||
start_offset = 0x800;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_XA2_ACCLAIM;
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(sf) - start_offset, channels);
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -123,7 +123,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_idsp_tt,
|
||||
init_vgmstream_kraw,
|
||||
init_vgmstream_ps2_omu,
|
||||
init_vgmstream_ps2_xa2,
|
||||
init_vgmstream_xa2_acclaim,
|
||||
init_vgmstream_idsp_nl,
|
||||
init_vgmstream_idsp_ie,
|
||||
init_vgmstream_ymf,
|
||||
@ -177,7 +177,6 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_wii_wsd,
|
||||
init_vgmstream_dsp_ndp,
|
||||
init_vgmstream_ps2_sps,
|
||||
init_vgmstream_ps2_xa2_rrp,
|
||||
init_vgmstream_nds_hwas,
|
||||
init_vgmstream_ngc_lps,
|
||||
init_vgmstream_ps2_snd,
|
||||
|
@ -356,7 +356,7 @@ typedef enum {
|
||||
meta_DC_IDVI, /* Eldorado Gate */
|
||||
meta_KRAW, /* Geometry Wars - Galaxies */
|
||||
meta_PS2_OMU, /* PS2 Int file with Header */
|
||||
meta_PS2_XA2, /* XG3 Extreme-G Racing */
|
||||
meta_XA2_ACCLAIM,
|
||||
meta_NUB,
|
||||
meta_IDSP_NL, /* Mario Strikers Charged (Wii) */
|
||||
meta_IDSP_IE, /* Defencer (GC) */
|
||||
@ -392,7 +392,6 @@ typedef enum {
|
||||
meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */
|
||||
meta_ADS_MIDWAY,
|
||||
meta_PS2_SPS, /* Ape Escape 2 */
|
||||
meta_PS2_XA2_RRP, /* RC Revenge Pro */
|
||||
meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */
|
||||
meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */
|
||||
meta_RAW_WAVM,
|
||||
|
Loading…
Reference in New Issue
Block a user