mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-23 22:41:05 +01:00
cleanup: misc meta stuff
This commit is contained in:
parent
6628099255
commit
2bd2c3e5e9
@ -342,7 +342,7 @@ static int play_vgmstream(const char* filename, song_settings_t* cfg) {
|
||||
if (!buffer) goto fail;
|
||||
}
|
||||
|
||||
max_buffer_samples = buffer_size / (input_channels * sizeof(sample));
|
||||
max_buffer_samples = buffer_size / (input_channels * sizeof(sample_t));
|
||||
|
||||
vgmstream_mixing_enable(vgmstream, max_buffer_samples, NULL, NULL); /* enable */
|
||||
|
||||
@ -423,7 +423,7 @@ static int play_vgmstream(const char* filename, song_settings_t* cfg) {
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
if (!ao_play(device, (char *)buffer, to_do * output_channels * sizeof(sample))) {
|
||||
if (!ao_play(device, (char *)buffer, to_do * output_channels * sizeof(sample_t))) {
|
||||
fputs("\nAudio playback error\n", stderr);
|
||||
ao_close(device);
|
||||
device = NULL;
|
||||
|
@ -502,7 +502,7 @@ int decode_get_samples_per_frame(VGMSTREAM* vgmstream) {
|
||||
return (0x40-0x04) * 2;
|
||||
case coding_NDS_PROCYON:
|
||||
return 30;
|
||||
case coding_L5_555:
|
||||
case coding_LEVEL5:
|
||||
return 32;
|
||||
case coding_LSF:
|
||||
return 54;
|
||||
@ -729,7 +729,7 @@ int decode_get_frame_size(VGMSTREAM* vgmstream) {
|
||||
return 0x40;
|
||||
case coding_NDS_PROCYON:
|
||||
return 0x10;
|
||||
case coding_L5_555:
|
||||
case coding_LEVEL5:
|
||||
return 0x12;
|
||||
case coding_LSF:
|
||||
return 0x1C;
|
||||
@ -1447,7 +1447,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
|
||||
vgmstream->channels, vgmstream->samples_into_block, samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_L5_555:
|
||||
case coding_LEVEL5:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_l5_555(&vgmstream->ch[ch], buffer+ch,
|
||||
vgmstream->channels, vgmstream->samples_into_block, samples_to_do);
|
||||
|
@ -864,7 +864,7 @@ static const coding_info coding_info_list[] = {
|
||||
{coding_NXAP, "Nex NXAP 4-bit ADPCM"},
|
||||
{coding_TGC, "Tiger Game.com 4-bit ADPCM"},
|
||||
{coding_NDS_PROCYON, "Procyon Studio Digital Sound Elements NDS 4-bit APDCM"},
|
||||
{coding_L5_555, "Level-5 0x555 4-bit ADPCM"},
|
||||
{coding_LEVEL5, "Level-5 4-bit ADPCM"},
|
||||
{coding_LSF, "Gizmondo Studios Helsingborg LSF 4-bit ADPCM"},
|
||||
{coding_MTAF, "Konami MTAF 4-bit ADPCM"},
|
||||
{coding_MTA2, "Konami MTA2 4-bit ADPCM"},
|
||||
@ -1096,7 +1096,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_RIFX_WAVE_smpl, "RIFX WAVE header (smpl looping)"},
|
||||
{meta_XNB, "Microsoft XNA Game Studio header"},
|
||||
{meta_SCD_PCM, "Lunar: Eternal Blue .PCM header"},
|
||||
{meta_PS2_PCM, "Konami .PCM header"},
|
||||
{meta_PCM_KCEJE, "Konami .PCM header"},
|
||||
{meta_PS2_RKV, "Legacy of Kain - Blood Omen 2 RKV PS2 header"},
|
||||
{meta_VAS_KCEO, "Konami .VAS header"},
|
||||
{meta_LP_AP_LEP, "Konami LP/AP/LEP header"},
|
||||
@ -1120,8 +1120,8 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_RSD, "Radical RSD header"},
|
||||
{meta_ASD_NAXAT, "Naxat .ASD header"},
|
||||
{meta_SPSD, "Sega Naomi SPSD header"},
|
||||
{meta_FFXI_BGW, "Square Enix .BGW header"},
|
||||
{meta_FFXI_SPW, "Square Enix .SPW header"},
|
||||
{meta_BGW, "Square Enix BGMStream header"},
|
||||
{meta_SPW, "Square Enix SeWave header"},
|
||||
{meta_PS2_ASS, "SystemSoft .ASS header"},
|
||||
{meta_NUB, "Namco NUB header"},
|
||||
{meta_IDSP_NL, "Next Level IDSP header"},
|
||||
@ -1168,7 +1168,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_NAOMI_ADPCM, "NAOMI/NAOMI2 Arcade games ADPCM header"},
|
||||
{meta_SD9, "beatmania IIDX SD9 header"},
|
||||
{meta_2DX9, "beatmania IIDX 2DX9 header"},
|
||||
{meta_DSP_YGO, "Konami custom DSP Header"},
|
||||
{meta_DSP_KCEJE, "Konami .DSP Header"},
|
||||
{meta_PS2_VGV, "Rune: Viking Warlord VGV Header"},
|
||||
{meta_GCUB, "Sega GCub header"},
|
||||
{meta_NGC_SCK_DSP, "The Scorpion King SCK Header"},
|
||||
|
131
src/meta/bgw.c
131
src/meta/bgw.c
@ -4,47 +4,45 @@
|
||||
|
||||
|
||||
/* BGW - from Final Fantasy XI (PC) music files */
|
||||
VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM* init_vgmstream_bgw(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE *temp_streamFile = NULL;
|
||||
STREAMFILE* temp_sf = NULL;
|
||||
uint32_t codec, file_size, block_size, sample_rate, block_align;
|
||||
int32_t loop_start;
|
||||
off_t start_offset;
|
||||
|
||||
int channel_count, loop_flag = 0;
|
||||
int channels, loop_flag = 0;
|
||||
|
||||
/* check extensions */
|
||||
if ( !check_extensions(streamFile, "bgw") )
|
||||
goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x42474d53 || /* "BGMS" */
|
||||
read_32bitBE(0x04,streamFile) != 0x74726561 || /* "trea" */
|
||||
read_32bitBE(0x08,streamFile) != 0x6d000000 ) /* "m\0\0\0" */
|
||||
goto fail;
|
||||
/* checks */
|
||||
if (!is_id32be(0x00,sf, "BGMS") || !is_id32be(0x04,sf, "trea") || !is_id32be(0x08,sf, "m\0\0\0"))
|
||||
return NULL;
|
||||
|
||||
codec = read_32bitLE(0x0c,streamFile);
|
||||
file_size = read_32bitLE(0x10,streamFile);
|
||||
/* file_id = read_32bitLE(0x14,streamFile); */
|
||||
block_size = read_32bitLE(0x18,streamFile);
|
||||
loop_start = read_32bitLE(0x1c,streamFile);
|
||||
sample_rate = (read_32bitLE(0x20,streamFile) + read_32bitLE(0x24,streamFile)) & 0x7FFFFFFF; /* bizarrely obfuscated sample rate */
|
||||
start_offset = read_32bitLE(0x28,streamFile);
|
||||
/* 0x2c: unk (vol?) */
|
||||
/* 0x2d: unk (0x10?) */
|
||||
channel_count = read_8bit(0x2e,streamFile);
|
||||
block_align = (uint8_t)read_8bit(0x2f,streamFile);
|
||||
if (!check_extensions(sf, "bgw"))
|
||||
return NULL;
|
||||
|
||||
if (file_size != get_streamfile_size(streamFile))
|
||||
codec = read_u32le(0x0c,sf);
|
||||
file_size = read_u32le(0x10,sf);
|
||||
//14: file_id
|
||||
block_size = read_u32le(0x18,sf);
|
||||
loop_start = read_s32le(0x1c,sf);
|
||||
sample_rate = (read_u32le(0x20,sf) + read_u32le(0x24,sf)) & 0x7FFFFFFF; /* bizarrely obfuscated sample rate */
|
||||
start_offset = read_u32le(0x28,sf);
|
||||
//2c: unk (vol?)
|
||||
//2d: unk (bps?)
|
||||
channels = read_s8(0x2e,sf);
|
||||
block_align = read_u8(0x2f,sf);
|
||||
|
||||
if (file_size != get_streamfile_size(sf))
|
||||
goto fail;
|
||||
|
||||
loop_flag = (loop_start > 0);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channels,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_FFXI_BGW;
|
||||
vgmstream->meta_type = meta_BGW;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
|
||||
switch (codec) {
|
||||
@ -64,16 +62,16 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case 3: { /* ATRAC3 (encrypted) */
|
||||
size_t data_size = file_size - start_offset;
|
||||
int encoder_delay, block_align;
|
||||
int encoder_delay, frame_size;
|
||||
|
||||
encoder_delay = 1024*2 + 69*2; /* observed value, all files start at +2200 (PS-ADPCM also starts around 50-150 samples in) */
|
||||
block_align = 0xC0 * vgmstream->channels; /* 0x00 in header */
|
||||
frame_size = 0xC0 * vgmstream->channels; /* 0x00 in header */
|
||||
vgmstream->num_samples = block_size - encoder_delay; /* atrac3_bytes_to_samples gives block_size */
|
||||
|
||||
temp_streamFile = setup_bgw_atrac3_streamfile(streamFile, start_offset,data_size, 0xC0,channel_count);
|
||||
if (!temp_streamFile) goto fail;
|
||||
temp_sf = setup_bgw_atrac3_streamfile(sf, start_offset,data_size, 0xC0,channels);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream->codec_data = init_ffmpeg_atrac3_raw(temp_streamFile, 0x00,data_size, vgmstream->num_samples,vgmstream->channels,vgmstream->sample_rate, block_align, encoder_delay);
|
||||
vgmstream->codec_data = init_ffmpeg_atrac3_raw(temp_sf, 0x00, data_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, frame_size, encoder_delay);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
@ -83,7 +81,8 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
close_streamfile(temp_streamFile);
|
||||
close_streamfile(temp_sf);
|
||||
temp_sf = NULL;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -93,59 +92,57 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
|
||||
}
|
||||
|
||||
|
||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
close_streamfile(temp_sf);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* SPW (SEWave) - from PlayOnline viewer for Final Fantasy XI (PC) */
|
||||
VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM* init_vgmstream_spw(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE *temp_streamFile = NULL;
|
||||
STREAMFILE* temp_sf = NULL;
|
||||
uint32_t codec, file_size, block_size, sample_rate, block_align;
|
||||
int32_t loop_start;
|
||||
off_t start_offset;
|
||||
|
||||
int channel_count, loop_flag = 0;
|
||||
int channels, loop_flag = 0;
|
||||
|
||||
/* check extensions */
|
||||
if ( !check_extensions(streamFile, "spw") )
|
||||
goto fail;
|
||||
/* checks */
|
||||
if (!is_id32be(0x00,sf, "SeWa") || !is_id32be(0x04,sf, "ve\0\0"))
|
||||
return NULL;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0,streamFile) != 0x53655761 || /* "SeWa" */
|
||||
read_32bitBE(4,streamFile) != 0x76650000) /* "ve\0\0" */
|
||||
goto fail;
|
||||
if (!check_extensions(sf, "spw"))
|
||||
return NULL;
|
||||
|
||||
file_size = read_32bitLE(0x08,streamFile);
|
||||
codec = read_32bitLE(0x0c,streamFile);
|
||||
/* file_id = read_32bitLE(0x10,streamFile);*/
|
||||
block_size = read_32bitLE(0x14,streamFile);
|
||||
loop_start = read_32bitLE(0x18,streamFile);
|
||||
sample_rate = (read_32bitLE(0x1c,streamFile) + read_32bitLE(0x20,streamFile)) & 0x7FFFFFFF; /* bizarrely obfuscated sample rate */
|
||||
start_offset = read_32bitLE(0x24,streamFile);
|
||||
/* 0x2c: unk (0x00?) */
|
||||
/* 0x2d: unk (0x00/01?) */
|
||||
channel_count = read_8bit(0x2a,streamFile);
|
||||
file_size = read_u32le(0x08,sf);
|
||||
codec = read_u32le(0x0c,sf);
|
||||
//10: file_id
|
||||
block_size = read_u32le(0x14,sf);
|
||||
loop_start = read_s32le(0x18,sf);
|
||||
sample_rate = (read_u32le(0x1c,sf) + read_u32le(0x20,sf)) & 0x7FFFFFFF; /* bizarrely obfuscated sample rate */
|
||||
start_offset = read_u32le(0x24,sf);
|
||||
// 2c: unk (0x00?)
|
||||
// 2d: unk (0x00/01?)
|
||||
channels = read_s8(0x2a,sf);
|
||||
/*0x2b: unk (0x01 when PCM, 0x10 when VAG?) */
|
||||
block_align = read_8bit(0x2c,streamFile);
|
||||
block_align = read_u8(0x2c,sf);
|
||||
|
||||
if (file_size != get_streamfile_size(streamFile))
|
||||
if (file_size != get_streamfile_size(sf))
|
||||
goto fail;
|
||||
|
||||
loop_flag = (loop_start > 0);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channels,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_FFXI_SPW;
|
||||
vgmstream->meta_type = meta_SPW;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
|
||||
switch (codec) {
|
||||
@ -178,16 +175,16 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case 3: { /* ATRAC3 (encrypted) */
|
||||
size_t data_size = file_size - start_offset;
|
||||
int encoder_delay, block_align;
|
||||
int encoder_delay, frame_size;
|
||||
|
||||
encoder_delay = 1024*2 + 69*2; /* observed value, all files start at +2200 (PS-ADPCM also starts around 50-150 samples in) */
|
||||
block_align = 0xC0 * vgmstream->channels; /* 0x00 in header */
|
||||
frame_size = 0xC0 * vgmstream->channels; /* 0x00 in header */
|
||||
vgmstream->num_samples = block_size - encoder_delay; /* atrac3_bytes_to_samples gives block_size */
|
||||
|
||||
temp_streamFile = setup_bgw_atrac3_streamfile(streamFile, start_offset,data_size, 0xC0,channel_count);
|
||||
if (!temp_streamFile) goto fail;
|
||||
temp_sf = setup_bgw_atrac3_streamfile(sf, start_offset,data_size, 0xC0, channels);
|
||||
if (!temp_sf) goto fail;
|
||||
|
||||
vgmstream->codec_data = init_ffmpeg_atrac3_raw(temp_streamFile, 0x00,data_size, vgmstream->num_samples,vgmstream->channels,vgmstream->sample_rate, block_align, encoder_delay);
|
||||
vgmstream->codec_data = init_ffmpeg_atrac3_raw(temp_sf, 0x00, data_size, vgmstream->num_samples, vgmstream->channels, vgmstream->sample_rate, frame_size, encoder_delay);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
@ -197,7 +194,8 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
close_streamfile(temp_streamFile);
|
||||
close_streamfile(temp_sf);
|
||||
temp_sf = NULL;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -206,15 +204,12 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
/* open the file for reading */
|
||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_streamfile(temp_streamFile);
|
||||
close_streamfile(temp_sf);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ VGMSTREAM * init_vgmstream_mus_acm(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_scd_pcm(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_pcm(STREAMFILE * streamFile);
|
||||
VGMSTREAM* init_vgmstream_pcm_kceje(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_rkv(STREAMFILE * streamFile);
|
||||
|
||||
@ -394,7 +394,7 @@ VGMSTREAM * init_vgmstream_sd9(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_2dx9(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE * streamFile);
|
||||
VGMSTREAM* init_vgmstream_dsp_kceje(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_vgv(STREAMFILE * streamFile);
|
||||
|
||||
|
@ -1,75 +1,52 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* .dsp found in:
|
||||
Hikaru No Go 3 (NGC)
|
||||
Yu-Gi-Oh! The Falsebound Kingdom (NGC)
|
||||
|
||||
2010-01-31 - added loop stuff and some header checks...
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE *streamFile) {
|
||||
/* .dsp - from KCE Japan East GC games [Yu-Gi-Oh! The Falsebound Kingdom (GC), Hikaru No Go 3 (GC)] */
|
||||
VGMSTREAM* init_vgmstream_dsp_kceje(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
int channels, loop_flag;
|
||||
off_t start_offset;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("dsp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check file size with size given in header */
|
||||
if ((read_32bitBE(0x0,streamFile)+0xE0) != (get_streamfile_size(streamFile)))
|
||||
goto fail;
|
||||
/* checks */
|
||||
if (read_u32be(0x00,sf) + 0xE0 != get_streamfile_size(sf))
|
||||
return NULL;
|
||||
if (read_u32be(0x04,sf) != 0x01)
|
||||
return NULL;
|
||||
if (read_u32be(0x08,sf) != 0x10000000)
|
||||
return NULL;
|
||||
if (read_u32be(0x0c,sf) != 0x00)
|
||||
return NULL;
|
||||
|
||||
loop_flag = (uint16_t)(read_16bitBE(0x2C,streamFile) != 0x0);
|
||||
channel_count = 1;
|
||||
/* .dsp: assumed (no names in .pac bigfile and refs to DSP streams) */
|
||||
if (!check_extensions(sf, "dsp"))
|
||||
return NULL;
|
||||
|
||||
channels = 1;
|
||||
loop_flag = read_u16be(0x2C,sf) != 0x00;
|
||||
start_offset = 0xE0;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0xE0;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x28,streamFile);
|
||||
vgmstream->sample_rate = read_u32be(0x28,sf);
|
||||
vgmstream->num_samples = read_u32be(0x20,sf);
|
||||
vgmstream->loop_start_sample = dsp_bytes_to_samples(read_u32be(0x30,sf), 2);
|
||||
vgmstream->loop_end_sample = dsp_bytes_to_samples(read_u32be(0x34,sf), 2);
|
||||
vgmstream->allow_dual_stereo = true;
|
||||
|
||||
vgmstream->meta_type = meta_DSP_KCEJE;
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = read_32bitBE(0x20,streamFile);
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_DSP_YGO;
|
||||
vgmstream->allow_dual_stereo = 1;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (read_32bitBE(0x30,streamFile)*14/16);
|
||||
vgmstream->loop_end_sample = (read_32bitBE(0x34,streamFile)*14/16);
|
||||
}
|
||||
|
||||
// read coef stuff
|
||||
{
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x3C+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
dsp_read_coefs_be(vgmstream, sf, 0x3c, 0x00);
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,44 +1,42 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* .PCM - KCE Japan East PS2 games (Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades) */
|
||||
VGMSTREAM * init_vgmstream_ps2_pcm(STREAMFILE *streamFile) {
|
||||
/* .PCM - from KCE Japan East PS2 games [Ephemeral Fantasia (PS2), Yu-Gi-Oh! The Duelists of the Roses (PS2), 7 Blades (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_pcm_kceje(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count;
|
||||
int loop_flag, channels;
|
||||
|
||||
/* check extension */
|
||||
if ( !check_extensions(streamFile,"pcm") )
|
||||
goto fail;
|
||||
/* checks */
|
||||
uint32_t data_size = read_u32le(0x00,sf);
|
||||
if (data_size > 0x00 && data_size + 0x800 >= get_streamfile_size(sf) && data_size + 0x1000 <= get_streamfile_size(sf))
|
||||
return NULL; /* usually 0x800 but may be padded */
|
||||
if (pcm16_bytes_to_samples(data_size, 2) != read_u32le(0x04,sf))
|
||||
return NULL;
|
||||
|
||||
/* check header (data_size vs num_samples) */
|
||||
if (pcm_bytes_to_samples(read_32bitLE(0x00,streamFile), 2, 16) != read_32bitLE(0x04,streamFile))
|
||||
goto fail;
|
||||
/* should work too */
|
||||
//if (read_32bitLE(0x00,streamFile)+0x800 != get_streamfile_size(streamFile))
|
||||
// goto fail;
|
||||
if (!check_extensions(sf,"pcm"))
|
||||
return NULL;
|
||||
|
||||
loop_flag = (read_32bitLE(0x0C,streamFile) != 0x00);
|
||||
channel_count = 2;
|
||||
loop_flag = (read_s32le(0x0C,sf) != 0x00);
|
||||
channels = 2;
|
||||
start_offset = 0x800;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->channels = channels;
|
||||
vgmstream->sample_rate = 24000;
|
||||
vgmstream->num_samples = read_32bitLE(0x04,streamFile);
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile);
|
||||
vgmstream->num_samples = read_s32le(0x04,sf);
|
||||
vgmstream->loop_start_sample = read_s32le(0x08,sf);
|
||||
vgmstream->loop_end_sample = read_s32le(0x0C,sf);
|
||||
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x2;
|
||||
vgmstream->meta_type = meta_PS2_PCM;
|
||||
vgmstream->interleave_block_size = 0x02;
|
||||
vgmstream->meta_type = meta_PCM_KCEJE;
|
||||
|
||||
/* open the file for reading */
|
||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
|
@ -244,8 +244,8 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t offset, riff_fmt_chunk
|
||||
/* real 0x300 is "Fujitsu FM Towns SND" with block align 0x01 */
|
||||
break;
|
||||
|
||||
case 0x0555: /* Level-5 0x555 ADPCM (unofficial) */
|
||||
fmt->coding_type = coding_L5_555;
|
||||
case 0x0555: /* Level-5 ADPCM (unofficial) */
|
||||
fmt->coding_type = coding_LEVEL5;
|
||||
fmt->interleave = 0x12;
|
||||
break;
|
||||
|
||||
@ -738,7 +738,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||
vgmstream->num_samples = pcm_bytes_to_samples(data_size, fmt.channels, fmt.bps);
|
||||
break;
|
||||
|
||||
case coding_L5_555:
|
||||
case coding_LEVEL5:
|
||||
vgmstream->num_samples = data_size / 0x12 / fmt.channels * 32;
|
||||
|
||||
/* coefs */
|
||||
@ -912,7 +912,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
||||
vgmstream->loop_end_sample = loop_end_wsmp;
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_wsmp;
|
||||
}
|
||||
else if (fmt.coding_type == coding_L5_555 && mwv_ctrl_offset) {
|
||||
else if (fmt.coding_type == coding_LEVEL5 && mwv_ctrl_offset) {
|
||||
vgmstream->loop_start_sample = read_s32le(mwv_ctrl_offset + 0x0c, sf);
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_MWV;
|
||||
|
@ -81,7 +81,6 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_vig_kces,
|
||||
init_vgmstream_hxd,
|
||||
init_vgmstream_vsv,
|
||||
init_vgmstream_ps2_pcm,
|
||||
init_vgmstream_ps2_rkv,
|
||||
init_vgmstream_lp_ap_lep,
|
||||
init_vgmstream_sdt,
|
||||
@ -158,7 +157,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_naomi_adpcm,
|
||||
init_vgmstream_sd9,
|
||||
init_vgmstream_2dx9,
|
||||
init_vgmstream_dsp_ygo,
|
||||
init_vgmstream_dsp_kceje,
|
||||
init_vgmstream_ps2_vgv,
|
||||
init_vgmstream_gcub,
|
||||
init_vgmstream_maxis_xa,
|
||||
@ -527,6 +526,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_tgc,
|
||||
init_vgmstream_rage_aud,
|
||||
init_vgmstream_asd_naxat,
|
||||
init_vgmstream_pcm_kceje,
|
||||
/* need companion files */
|
||||
init_vgmstream_pos,
|
||||
init_vgmstream_sli_loops,
|
||||
|
@ -106,7 +106,7 @@ typedef enum {
|
||||
coding_TGC, /* Tiger Game.com 4-bit ADPCM */
|
||||
|
||||
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
|
||||
coding_L5_555, /* Level-5 0x555 ADPCM */
|
||||
coding_LEVEL5, /* Level-5 ADPCM */
|
||||
coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/
|
||||
coding_MTAF, /* Konami MTAF ADPCM */
|
||||
coding_MTA2, /* Konami MTA2 ADPCM */
|
||||
@ -265,7 +265,7 @@ typedef enum {
|
||||
meta_MUS_KROME,
|
||||
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
|
||||
meta_WII_NDP, /* Vertigo (Wii) */
|
||||
meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
|
||||
meta_DSP_KCEJE,
|
||||
|
||||
meta_STRM, /* Nintendo STRM */
|
||||
meta_RSTM, /* Nintendo RSTM (Revolution Stream, similar to STRM) */
|
||||
@ -345,7 +345,7 @@ typedef enum {
|
||||
meta_HXD,
|
||||
meta_VSV,
|
||||
meta_SCD_PCM, /* Lunar - Eternal Blue */
|
||||
meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */
|
||||
meta_PCM_KCEJE,
|
||||
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */
|
||||
meta_VAS_KCEO,
|
||||
meta_LP_AP_LEP,
|
||||
@ -429,8 +429,8 @@ typedef enum {
|
||||
meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */
|
||||
meta_DEC, /* Falcom PC games (Xanadu Next, Gurumin) */
|
||||
meta_VS, /* Men in Black .vs */
|
||||
meta_FFXI_BGW, /* FFXI (PC) BGW */
|
||||
meta_FFXI_SPW, /* FFXI (PC) SPW */
|
||||
meta_BGW,
|
||||
meta_SPW,
|
||||
meta_STS,
|
||||
meta_P2BT_MOVE_VISA,
|
||||
meta_GBTS,
|
||||
@ -505,7 +505,7 @@ typedef enum {
|
||||
meta_EB_SF0, /* Excitebots .sf0 */
|
||||
meta_MTAF,
|
||||
meta_ALP,
|
||||
meta_WPD, /* Shuffle! (PC) */
|
||||
meta_WPD,
|
||||
meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */
|
||||
meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */
|
||||
meta_PS2_HSF, /* Lowrider (PS2) */
|
||||
|
Loading…
Reference in New Issue
Block a user