mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-20 20:41:08 +01:00
Merge pull request #1026 from bnnm/bao-ster
- Fix some .pk DSP in Ubi BAO [We Dare (Wii)] - Unify dupe STER meta [Baroque (PS2), Star Soldier (PS2)]
This commit is contained in:
commit
b0faaff061
4
Makefile
4
Makefile
@ -261,12 +261,12 @@ sourceball:
|
||||
|
||||
bin: vgmstream-cli winamp xmplay
|
||||
mkdir -p bin
|
||||
zip -FS -j "bin/$(BIN_FILE).zip" $(ZIP_FILES)
|
||||
zip -FS -j "bin/$(BIN_FILE)" $(ZIP_FILES)
|
||||
|
||||
#separate since vgmstream123 is kinda untested
|
||||
bin-ex: vgmstream-cli winamp xmplay vgmstream123
|
||||
mkdir -p bin
|
||||
zip -FS -j "bin/$(BIN_FILE).zip" $(ZIP_FILES) $(ZIP_FILES_AO)
|
||||
zip -FS -j "bin/$(BIN_FILE)" $(ZIP_FILES) $(ZIP_FILES_AO)
|
||||
|
||||
vgmstream_cli: vgmstream-cli
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_LEG, "Legaia 2 - Duel Saga LEG Header"},
|
||||
{meta_FILP, "Bio Hazard - Gun Survivor FILp Header"},
|
||||
{meta_IKM, "MiCROViSiON IKM header"},
|
||||
{meta_SFS, "String .SFS header"},
|
||||
{meta_STER, "ALCHEMY STER header"},
|
||||
{meta_SAT_DVI, "Konami KCEN DVI. header"},
|
||||
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
|
||||
{meta_BG00, "Falcom BG00 Header"},
|
||||
@ -1140,7 +1140,6 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_PONA_PSX, "Policenauts BGM header"},
|
||||
{meta_NGC_DSP_AAAP, "Acclaim Austin AAAp DSP header"},
|
||||
{meta_NGC_DSP_KONAMI, "Konami DSP header"},
|
||||
{meta_PS2_STER, "STER Header"},
|
||||
{meta_BNSF, "Namco Bandai BNSF header"},
|
||||
{meta_PS2_WB, "Shooting Love. ~TRIZEAL~ WB header"},
|
||||
{meta_S14, "Namco .S14 raw header"},
|
||||
|
@ -487,12 +487,11 @@
|
||||
<ClCompile Include="meta\ps2_rnd.c" />
|
||||
<ClCompile Include="meta\ps2_rstm.c" />
|
||||
<ClCompile Include="meta\rxws.c" />
|
||||
<ClCompile Include="meta\ps2_sfs.c" />
|
||||
<ClCompile Include="meta\ster.c" />
|
||||
<ClCompile Include="meta\ps2_sl3.c" />
|
||||
<ClCompile Include="meta\ps2_smpl.c" />
|
||||
<ClCompile Include="meta\ps2_snd.c" />
|
||||
<ClCompile Include="meta\ps2_sps.c" />
|
||||
<ClCompile Include="meta\ps2_ster.c" />
|
||||
<ClCompile Include="meta\svag_kcet.c" />
|
||||
<ClCompile Include="meta\svag_snk.c" />
|
||||
<ClCompile Include="meta\ps2_tec.c" />
|
||||
|
@ -940,7 +940,7 @@
|
||||
<ClCompile Include="meta\rxws.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_sfs.c">
|
||||
<ClCompile Include="meta\ster.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_sl3.c">
|
||||
@ -955,9 +955,6 @@
|
||||
<ClCompile Include="meta\ps2_sps.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_ster.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\svag_kcet.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -225,7 +225,7 @@ VGMSTREAM * init_vgmstream_filp(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM* init_vgmstream_ikm(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_sfs(STREAMFILE * streamFile);
|
||||
VGMSTREAM* init_vgmstream_ster(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_sat_dvi(STREAMFILE * streamFile);
|
||||
|
||||
@ -451,8 +451,6 @@ VGMSTREAM * init_vgmstream_dmsg(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_dsp_konami(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_ster(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile);
|
||||
|
@ -1,66 +0,0 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* STER (from Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka) */
|
||||
VGMSTREAM * init_vgmstream_ps2_ster(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("ster",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x53544552) /* "STER" */
|
||||
goto fail;
|
||||
|
||||
|
||||
loop_flag = (read_16bitLE(0xB,streamFile)==0);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x30;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitLE(0x4,streamFile)*56/32;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x8,streamFile)*28/32;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->meta_type = meta_PS2_STER;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* SFS - from Sting games [Baroque (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_sfs(STREAMFILE* sf) {
|
||||
/* STER - from Silicon Studios/Vicarious Visions's ALCHEMY middleware [Baroque (PS2), Star Soldier (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_ster(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channels, sample_rate;
|
||||
@ -10,8 +10,9 @@ VGMSTREAM* init_vgmstream_sfs(STREAMFILE* sf) {
|
||||
|
||||
|
||||
/* checks */
|
||||
/* .sfs: bigfile extension (no apparent names) */
|
||||
if (!check_extensions(sf, "sfs"))
|
||||
/* .ster: header id (no apparent names/extensions)
|
||||
* .sfs: generic bigfile extension (to be removed?)*/
|
||||
if (!check_extensions(sf, "ster,sfs"))
|
||||
goto fail;
|
||||
|
||||
if (!is_id32be(0x00,sf, "STER"))
|
||||
@ -20,9 +21,10 @@ VGMSTREAM* init_vgmstream_sfs(STREAMFILE* sf) {
|
||||
loop_start = read_u32le(0x08, sf); /* absolute (ex. offset 0x50 for full loops) */
|
||||
/* 0x0c: data size BE */
|
||||
sample_rate = read_s32be(0x10,sf);
|
||||
/* 0x14~20: null */
|
||||
|
||||
loop_flag = loop_start != 0xFFFFFFFF;
|
||||
channels = 2;
|
||||
channels = 2; /* mono files are simply .VAG */
|
||||
start_offset = 0x30;
|
||||
|
||||
|
||||
@ -30,7 +32,7 @@ VGMSTREAM* init_vgmstream_sfs(STREAMFILE* sf) {
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_SFS;
|
||||
vgmstream->meta_type = meta_STER;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
|
||||
vgmstream->num_samples = ps_bytes_to_samples(channel_size, 1);
|
@ -32,6 +32,8 @@ typedef struct {
|
||||
off_t audio_stream_type;
|
||||
off_t audio_prefetch_size;
|
||||
size_t audio_interleave;
|
||||
off_t audio_cue_count;
|
||||
off_t audio_cue_size;
|
||||
int audio_fix_psx_samples;
|
||||
int audio_external_and;
|
||||
int audio_loop_and;
|
||||
@ -79,21 +81,21 @@ typedef struct {
|
||||
ubi_bao_config cfg;
|
||||
|
||||
/* header info */
|
||||
off_t header_offset;
|
||||
uint32_t header_offset;
|
||||
uint8_t header_format;
|
||||
uint32_t header_version;
|
||||
uint32_t header_id;
|
||||
uint32_t header_type;
|
||||
size_t header_skip; /* common sub-header size */
|
||||
size_t header_size; /* normal base size (not counting extra tables) */
|
||||
size_t extra_size; /* extra tables size */
|
||||
uint32_t header_skip; /* common sub-header size */
|
||||
uint32_t header_size; /* normal base size (not counting extra tables) */
|
||||
uint32_t extra_size; /* extra tables size */
|
||||
|
||||
uint32_t stream_id;
|
||||
size_t stream_size;
|
||||
off_t stream_offset;
|
||||
uint32_t stream_size;
|
||||
uint32_t stream_offset;
|
||||
uint32_t prefetch_id;
|
||||
size_t prefetch_size;
|
||||
off_t prefetch_offset;
|
||||
uint32_t prefetch_size;
|
||||
uint32_t prefetch_offset;
|
||||
|
||||
size_t memory_skip;
|
||||
size_t stream_skip;
|
||||
@ -265,10 +267,10 @@ static VGMSTREAM* init_vgmstream_ubi_bao_base(ubi_bao_header* bao, STREAMFILE* s
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = bao->stream_size / bao->channels;
|
||||
|
||||
VGM_LOG("dsp=%x, %x, %x\n", bao->header_offset, bao->header_size, bao->extra_size);
|
||||
/* mini DSP header (first 0x10 seem to contain DSP header fields like nibbles and format) */
|
||||
dsp_read_coefs_be(vgmstream, streamHead, bao->header_offset + bao->header_size + 0x10, 0x40);
|
||||
dsp_read_hist_be (vgmstream, streamHead, bao->header_offset + bao->header_size + 0x34, 0x40); /* after gain/initial ps */
|
||||
dsp_read_coefs_be(vgmstream, streamHead, bao->header_offset + bao->header_size + bao->extra_size + 0x10, 0x40);
|
||||
dsp_read_hist_be (vgmstream, streamHead, bao->header_offset + bao->header_size + bao->extra_size + 0x34, 0x40); /* after gain/initial ps */
|
||||
break;
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
@ -638,12 +640,12 @@ static VGMSTREAM* init_vgmstream_ubi_bao_header(ubi_bao_header* bao, STREAMFILE*
|
||||
goto fail; /* not uncommon */
|
||||
}
|
||||
|
||||
//;VGM_LOG("UBI BAO: target at %x, h_id=%08x, s_id=%08x, p_id=%08x\n",
|
||||
// (uint32_t)bao->header_offset, bao->header_id, bao->stream_id, bao->prefetch_id);
|
||||
//;VGM_LOG("UBI BAO: stream=%x, size=%x, res=%s\n",
|
||||
// (uint32_t)bao->stream_offset, bao->stream_size, (bao->is_external ? bao->resource_name : "internal"));
|
||||
//;VGM_LOG("UBI BAO: type=%i, header=%x, extra=%x, prefetch=%x, size=%x\n",
|
||||
// bao->header_type, bao->header_size, bao->extra_size, (uint32_t)bao->prefetch_offset, bao->prefetch_size);
|
||||
;VGM_LOG("UBI BAO: target at %x, h_id=%08x, s_id=%08x, p_id=%08x\n",
|
||||
(uint32_t)bao->header_offset, bao->header_id, bao->stream_id, bao->prefetch_id);
|
||||
;VGM_LOG("UBI BAO: stream=%x, size=%x, res=%s\n",
|
||||
(uint32_t)bao->stream_offset, bao->stream_size, (bao->is_external ? bao->resource_name : "internal"));
|
||||
;VGM_LOG("UBI BAO: type=%i, header=%x, extra=%x, prefetch=%x, size=%x\n",
|
||||
bao->header_type, bao->header_size, bao->extra_size, (uint32_t)bao->prefetch_offset, bao->prefetch_size);
|
||||
|
||||
|
||||
switch(bao->type) {
|
||||
@ -830,6 +832,12 @@ static int parse_type_audio(ubi_bao_header* bao, off_t offset, STREAMFILE* sf) {
|
||||
bao->channels = read_32bit(h_offset + bao->cfg.audio_channels, sf);
|
||||
bao->sample_rate = read_32bit(h_offset + bao->cfg.audio_sample_rate, sf);
|
||||
|
||||
/* extra cue table, rare (found with DSP) [We Dare (Wii)] */
|
||||
if (bao->cfg.audio_cue_size) {
|
||||
//bao->cfg.audio_cue_count //not needed?
|
||||
bao->extra_size = read_32bit(h_offset + bao->cfg.audio_cue_size, sf);
|
||||
}
|
||||
|
||||
/* prefetch data is in another internal BAO right after the base header */
|
||||
if (bao->cfg.audio_prefetch_size) {
|
||||
bao->prefetch_size = read_32bit(h_offset + bao->cfg.audio_prefetch_size, sf);
|
||||
@ -1570,6 +1578,12 @@ static void config_bao_audio_m(ubi_bao_header* bao, off_t channels, off_t sample
|
||||
bao->cfg.audio_prefetch_size = prefetch_size;
|
||||
}
|
||||
|
||||
static void config_bao_audio_c(ubi_bao_header* bao, off_t cue_count, off_t cue_size) {
|
||||
/* audio header extra */
|
||||
bao->cfg.audio_cue_count = cue_count;
|
||||
bao->cfg.audio_cue_size = cue_size;
|
||||
}
|
||||
|
||||
static void config_bao_sequence(ubi_bao_header* bao, off_t sequence_count, off_t sequence_single, off_t sequence_loop, off_t entry_size) {
|
||||
/* sequence header and chain table */
|
||||
bao->cfg.sequence_sequence_count = sequence_count;
|
||||
@ -1768,6 +1782,9 @@ static int config_bao_version(ubi_bao_header* bao, STREAMFILE* sf) {
|
||||
|
||||
if (version == 0x0022000D) /* Just Dance (Wii) oddity */
|
||||
bao->cfg.audio_ignore_resource_size = 1;
|
||||
if (version == 0x0022000D) /* We Dare (Wii) */
|
||||
config_bao_audio_c(bao, 0x68, 0x78);
|
||||
|
||||
return 1;
|
||||
|
||||
case 0x00220015: /* James Cameron's Avatar: The Game (PSP)-package */
|
||||
|
@ -93,7 +93,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||
init_vgmstream_leg,
|
||||
init_vgmstream_filp,
|
||||
init_vgmstream_ikm,
|
||||
init_vgmstream_sfs,
|
||||
init_vgmstream_ster,
|
||||
init_vgmstream_bg00,
|
||||
init_vgmstream_sat_dvi,
|
||||
init_vgmstream_dc_kcey,
|
||||
@ -216,7 +216,6 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
||||
init_vgmstream_dmsg,
|
||||
init_vgmstream_ngc_dsp_aaap,
|
||||
init_vgmstream_ngc_dsp_konami,
|
||||
init_vgmstream_ps2_ster,
|
||||
init_vgmstream_ps2_wb,
|
||||
init_vgmstream_bnsf,
|
||||
init_vgmstream_ps2_gcm,
|
||||
|
@ -383,7 +383,7 @@ typedef enum {
|
||||
meta_LEG, /* Legaia 2 [no header_id] */
|
||||
meta_FILP, /* Resident Evil - Dead Aim */
|
||||
meta_IKM,
|
||||
meta_SFS, /* Baroque */
|
||||
meta_STER,
|
||||
meta_BG00, /* Ibara, Mushihimesama */
|
||||
meta_PS2_RSTM, /* Midnight Club 3 */
|
||||
meta_PS2_KCES, /* Dance Dance Revolution */
|
||||
@ -513,7 +513,6 @@ typedef enum {
|
||||
meta_AST_MMV,
|
||||
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
|
||||
meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */
|
||||
meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */
|
||||
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
|
||||
meta_S14, /* raw Siren 14, 24kbit mono */
|
||||
meta_SSS, /* raw Siren 14, 48kbit stereo */
|
||||
|
Loading…
x
Reference in New Issue
Block a user