mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
cleanup: iivb, etc
This commit is contained in:
parent
b0962ea354
commit
135279b483
@ -1053,7 +1053,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_AIFF, "Apple AIFF header"},
|
{meta_AIFF, "Apple AIFF header"},
|
||||||
{meta_STR_SNDS, "3DO SNDS header"},
|
{meta_STR_SNDS, "3DO SNDS header"},
|
||||||
{meta_WS_AUD, "Westwood Studios .AUD header"},
|
{meta_WS_AUD, "Westwood Studios .AUD header"},
|
||||||
{meta_PS2_IVB, "IVB/BVII header"},
|
{meta_IIVB, "Vingt-et-un IIVB header"},
|
||||||
{meta_SVS, "Square SVS header"},
|
{meta_SVS, "Square SVS header"},
|
||||||
{meta_RIFF_WAVE, "RIFF WAVE header"},
|
{meta_RIFF_WAVE, "RIFF WAVE header"},
|
||||||
{meta_RIFF_WAVE_POS, "RIFF WAVE header (.pos looping)"},
|
{meta_RIFF_WAVE_POS, "RIFF WAVE header (.pos looping)"},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* Ongakukan RIFF with "ADP" extension [Train Simulator: Midousuji-sen (PS2), Mobile Train Simulator (PSP)] */
|
/* Ongakukan RIFF with "ADP" extension [Train Simulator: Midousuji-sen (PS2), Mobile Train Simulator (PSP)] */
|
||||||
VGMSTREAM* init_vgmstream_ongakukan_adp(STREAMFILE* sf) {
|
VGMSTREAM* init_vgmstream_adp_ongakukan(STREAMFILE* sf) {
|
||||||
VGMSTREAM* vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag = 0;
|
int loop_flag = 0;
|
||||||
|
@ -1,60 +1,35 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
#include "../util/meta_utils.h"
|
||||||
|
|
||||||
/* a simple PS2 ADPCM format seen in Langrisser 3 */
|
|
||||||
VGMSTREAM * init_vgmstream_ivb(STREAMFILE *streamFile) {
|
|
||||||
VGMSTREAM * vgmstream = NULL;
|
|
||||||
char filename[PATH_LIMIT];
|
|
||||||
off_t start_offset;
|
|
||||||
off_t stream_length;
|
|
||||||
|
|
||||||
int loop_flag = 0;
|
/* IIVB - from Vingt-et-un Systems games [Langrisser III (PS2), Ururun Quest: Koiyuuki (PS2)] */
|
||||||
int channel_count;
|
VGMSTREAM* init_vgmstream_iivb(STREAMFILE* sf) {
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
/* checks */
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
if (!is_id32be(0x00, sf, "BVII")) /* IIVB LE, given extension */
|
||||||
if (strcasecmp("ivb",filename_extension(filename))) goto fail;
|
return NULL;
|
||||||
|
if (!check_extensions(sf,"ivb"))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* check header */
|
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x42564949) /* "BVII", probably */
|
|
||||||
goto fail; /* supposed to be "IIVB"*/
|
|
||||||
|
|
||||||
loop_flag = 0;
|
meta_header_t h = {
|
||||||
channel_count = 2;
|
.meta = meta_IIVB,
|
||||||
|
};
|
||||||
/* build the VGMSTREAM */
|
h.chan_size = read_u32le(0x04,sf);
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
h.sample_rate = read_s32be(0x08,sf); /* big endian? */
|
||||||
if (!vgmstream) goto fail;
|
// 0c: empty
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
h.channels = 2;
|
||||||
vgmstream->channels = channel_count;
|
h.stream_offset = 0x10;
|
||||||
vgmstream->sample_rate = read_32bitBE(0x8,streamFile); /* big endian? */
|
h.num_samples = ps_bytes_to_samples(h.chan_size, 1);
|
||||||
vgmstream->coding_type = coding_PSX;
|
|
||||||
stream_length = read_32bitLE(0x04,streamFile);
|
|
||||||
start_offset = 0x10;
|
|
||||||
vgmstream->num_samples = stream_length*28/16;
|
|
||||||
|
|
||||||
vgmstream->layout_type = layout_none;
|
h.coding = coding_PSX;
|
||||||
vgmstream->meta_type = meta_PS2_IVB;
|
h.layout = layout_interleave;
|
||||||
|
h.interleave = h.chan_size;
|
||||||
|
|
||||||
/* open the file for reading */
|
h.sf = sf;
|
||||||
{
|
h.open_stream = true;
|
||||||
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;
|
return alloc_metastream(&h);
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
|
||||||
vgmstream->ch[i].offset=start_offset+stream_length*i;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return vgmstream;
|
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ VGMSTREAM * init_vgmstream_ws_aud(STREAMFILE * streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ahx(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_ahx(STREAMFILE * streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ivb(STREAMFILE * streamFile);
|
VGMSTREAM* init_vgmstream_iivb(STREAMFILE* sf);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_svs(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_svs(STREAMFILE * streamFile);
|
||||||
|
|
||||||
@ -1018,6 +1018,6 @@ VGMSTREAM* init_vgmstream_ea_sbk(STREAMFILE* sf);
|
|||||||
|
|
||||||
VGMSTREAM* init_vgmstream_dsp_asura_sfx(STREAMFILE* sf);
|
VGMSTREAM* init_vgmstream_dsp_asura_sfx(STREAMFILE* sf);
|
||||||
|
|
||||||
VGMSTREAM* init_vgmstream_ongakukan_adp(STREAMFILE* sf);
|
VGMSTREAM* init_vgmstream_adp_ongakukan(STREAMFILE* sf);
|
||||||
|
|
||||||
#endif /*_META_H*/
|
#endif /*_META_H*/
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
/* Allocate memory and setup a VGMSTREAM */
|
/* Allocate memory and setup a VGMSTREAM */
|
||||||
VGMSTREAM* alloc_metastream(meta_header_t* h) {
|
VGMSTREAM* alloc_metastream(meta_header_t* h) {
|
||||||
|
|
||||||
if (h->sample_rate <= 0 || h->sample_rate > VGMSTREAM_MAX_SAMPLE_RATE)
|
if (h->sample_rate <= 0 || h->sample_rate > VGMSTREAM_MAX_SAMPLE_RATE) {
|
||||||
|
VGM_LOG("meta: wrong sample rate %i\n", h->sample_rate);
|
||||||
return NULL;
|
return NULL;
|
||||||
if (h->num_samples <= 0 || h->num_samples > VGMSTREAM_MAX_NUM_SAMPLES)
|
}
|
||||||
|
if (h->num_samples <= 0 || h->num_samples > VGMSTREAM_MAX_NUM_SAMPLES) {
|
||||||
|
VGM_LOG("meta: wrong samples %i\n", h->sample_rate);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
VGMSTREAM* vgmstream = allocate_vgmstream(h->channels, h->loop_flag);
|
VGMSTREAM* vgmstream = allocate_vgmstream(h->channels, h->loop_flag);
|
||||||
if (!vgmstream) return NULL;
|
if (!vgmstream) return NULL;
|
||||||
|
@ -66,7 +66,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
|||||||
init_vgmstream_str_snds,
|
init_vgmstream_str_snds,
|
||||||
init_vgmstream_ws_aud,
|
init_vgmstream_ws_aud,
|
||||||
init_vgmstream_ahx,
|
init_vgmstream_ahx,
|
||||||
init_vgmstream_ivb,
|
init_vgmstream_iivb,
|
||||||
init_vgmstream_svs,
|
init_vgmstream_svs,
|
||||||
init_vgmstream_riff,
|
init_vgmstream_riff,
|
||||||
init_vgmstream_rifx,
|
init_vgmstream_rifx,
|
||||||
@ -533,7 +533,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
|||||||
init_vgmstream_dsp_asura_ds2,
|
init_vgmstream_dsp_asura_ds2,
|
||||||
init_vgmstream_dsp_asura_ttss,
|
init_vgmstream_dsp_asura_ttss,
|
||||||
init_vgmstream_dsp_asura_sfx,
|
init_vgmstream_dsp_asura_sfx,
|
||||||
init_vgmstream_ongakukan_adp,
|
init_vgmstream_adp_ongakukan,
|
||||||
|
|
||||||
/* lower priority metas (no clean header identity, somewhat ambiguous, or need extension/companion file to identify) */
|
/* lower priority metas (no clean header identity, somewhat ambiguous, or need extension/companion file to identify) */
|
||||||
init_vgmstream_agsc,
|
init_vgmstream_agsc,
|
||||||
|
@ -318,7 +318,7 @@ typedef enum {
|
|||||||
meta_PWB,
|
meta_PWB,
|
||||||
meta_VPK, /* VPK Audio File */
|
meta_VPK, /* VPK Audio File */
|
||||||
meta_PS2_BMDX, /* Beatmania thing */
|
meta_PS2_BMDX, /* Beatmania thing */
|
||||||
meta_PS2_IVB, /* Langrisser 3 IVB */
|
meta_IIVB,
|
||||||
meta_PS2_SND, /* some Might & Magics SSND header */
|
meta_PS2_SND, /* some Might & Magics SSND header */
|
||||||
meta_SVS, /* Square SVS */
|
meta_SVS, /* Square SVS */
|
||||||
meta_XSS, /* Dino Crisis 3 */
|
meta_XSS, /* Dino Crisis 3 */
|
||||||
|
Loading…
Reference in New Issue
Block a user