This commit is contained in:
bnnm 2024-01-20 01:13:29 +01:00
parent 045ca0fb96
commit 08a3196cf5
6 changed files with 53 additions and 66 deletions

View File

@ -1072,7 +1072,7 @@ static const meta_info meta_info_list[] = {
{meta_RSTM_ROCKSTAR, "Rockstar Games RSTM Header"}, {meta_RSTM_ROCKSTAR, "Rockstar Games RSTM Header"},
{meta_ACM, "InterPlay ACM Header"}, {meta_ACM, "InterPlay ACM Header"},
{meta_MUS_ACM, "InterPlay MUS ACM header"}, {meta_MUS_ACM, "InterPlay MUS ACM header"},
{meta_PS2_KCES, "Konami KCES Header"}, {meta_VIG_KCES, "Konami .VIG Header"},
{meta_HXD, "Tecmo HXD Header"}, {meta_HXD, "Tecmo HXD Header"},
{meta_VSV, "Square Enix .vsv Header"}, {meta_VSV, "Square Enix .vsv Header"},
{meta_RIFF_WAVE_labl, "RIFF WAVE header (labl looping)"}, {meta_RIFF_WAVE_labl, "RIFF WAVE header (labl looping)"},

View File

@ -2,11 +2,11 @@
#include "../coding/coding.h" #include "../coding/coding.h"
/* GbTs - from KCES games [Pop'n Music 9/10 (PS2)] */ /* GbTs - from Konami/KCE Studio games [Pop'n Music 9/10 (PS2)] */
VGMSTREAM* init_vgmstream_gbts(STREAMFILE* sf) { VGMSTREAM* init_vgmstream_gbts(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
int loop_flag, channels; uint32_t data_offset, data_size;
uint32_t data_offset, sample_rate, data_size; int loop_flag, channels, sample_rate;
uint32_t loop_start, loop_end; uint32_t loop_start, loop_end;
@ -17,17 +17,19 @@ VGMSTREAM* init_vgmstream_gbts(STREAMFILE* sf) {
if (!check_extensions(sf, "gbts")) if (!check_extensions(sf, "gbts"))
return NULL; return NULL;
/* 04: always 0x24 */ /* 04: always 0x24 */
data_offset = read_u32le(0x08,sf); data_offset = read_u32le(0x08,sf);
data_size = read_u32le(0x0C,sf); data_size = read_u32le(0x0C,sf); /* without padding */
loop_start = read_u32le(0x10,sf); /* (0x20 = start frame if not set) */ loop_start = read_u32le(0x10,sf); /* (0x20 = start frame if not set) */
loop_end = read_u32le(0x14,sf); /* (0x00 if not set) */ loop_end = read_u32le(0x14,sf); /* (0x00 if not set) */
sample_rate = read_s32le(0x18,sf); sample_rate = read_s32le(0x18,sf);
channels = read_s32le(0x1C,sf); channels = read_s32le(0x1C,sf);
/* 20: 1? */ /* 20: 1? */
/* 24: block size? */ /* 24: block size (interleave * channels) */
/* 30+: empty */
loop_flag = loop_end > 0; loop_flag = (loop_end > 0);
loop_end += loop_start; /* loop region matches PS-ADPCM flags */ loop_end += loop_start; /* loop region matches PS-ADPCM flags */
@ -36,7 +38,6 @@ VGMSTREAM* init_vgmstream_gbts(STREAMFILE* sf) {
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->sample_rate = sample_rate; vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = ps_bytes_to_samples(data_size, channels); vgmstream->num_samples = ps_bytes_to_samples(data_size, channels);
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, channels); vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, channels);
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, channels); vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, channels);

View File

@ -234,7 +234,7 @@ VGMSTREAM* init_vgmstream_rstm_rockstar(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_acm(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_acm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE * streamFile); VGMSTREAM* init_vgmstream_vig_kces(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_hxd(STREAMFILE* sf); VGMSTREAM* init_vgmstream_hxd(STREAMFILE* sf);

View File

@ -1,71 +1,57 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../coding/coding.h"
/* KCES (from Dance Dance Revolution) */
VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE *streamFile) { /* .vig - from Konami/KCE Studio games [Pop'n Music 11~14 (PS2), Dance Dance Revolution SuperNova/X (PS2)] */
VGMSTREAM* init_vgmstream_vig_kces(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
char filename[PATH_LIMIT]; uint32_t data_offset, data_size;
off_t start_offset; int loop_flag, channels, sample_rate, interleave;
uint32_t loop_start, loop_end;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */ /* checks */
streamFile->get_name(streamFile,filename,sizeof(filename)); if (read_u32be(0x00,sf) != 0x01006408)
if (strcasecmp("kces",filename_extension(filename)) && return NULL;
strcasecmp("vig",filename_extension(filename))) goto fail; /* .vig: actual extension from DDR exes */
if (!check_extensions(sf, "vig"))
return NULL;
/* check header */ /* note this is almost the same as GbTs, may be fused later */
if (read_32bitBE(0x00,streamFile) != 0x01006408) /* 04: null */
goto fail; data_offset = read_u32le(0x08,sf);
data_size = read_u32le(0x0C,sf); /* without padding */
loop_start = read_u32le(0x10,sf); /* (0x00 if not set) */
loop_end = read_u32le(0x14,sf); /* (0x00 if not set) */
sample_rate = read_s32le(0x18,sf);
channels = read_s32le(0x1C,sf);
/* 20: 0? */
interleave = read_u32le(0x24,sf); /* 0 for mono */
/* 30+: garbage from other data */
loop_flag = (loop_end > 0);
loop_end += loop_start; /* loop region matches PS-ADPCM flags */
loop_flag = (read_32bitLE(0x14,streamFile)!=0);
channel_count = read_32bitLE(0x1C,streamFile);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ vgmstream->sample_rate = sample_rate;
start_offset = read_32bitLE(0x08,streamFile); vgmstream->num_samples = ps_bytes_to_samples(data_size, channels);
vgmstream->channels = channel_count; vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, channels);
vgmstream->sample_rate = read_32bitLE(0x18,streamFile); vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, channels);
vgmstream->coding_type = coding_PSX; vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitLE(0x0C,streamFile)-read_32bitLE(0x14,streamFile))*28/16/channel_count;
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
}
if(vgmstream->channels==1) {
vgmstream->layout_type=layout_none;
} else {
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x24,streamFile); vgmstream->interleave_block_size = interleave;
}
vgmstream->meta_type = meta_PS2_KCES;
/* open the file for reading */ vgmstream->meta_type = meta_VIG_KCES;
{
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;
}
}
if (!vgmstream_open_stream(vgmstream, sf, data_offset))
goto fail;
return vgmstream; return vgmstream;
/* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -93,7 +93,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_rstm_rockstar, init_vgmstream_rstm_rockstar,
init_vgmstream_acm, init_vgmstream_acm,
init_vgmstream_mus_acm, init_vgmstream_mus_acm,
init_vgmstream_ps2_kces, init_vgmstream_vig_kces,
init_vgmstream_hxd, init_vgmstream_hxd,
init_vgmstream_vsv, init_vgmstream_vsv,
init_vgmstream_ps2_pcm, init_vgmstream_ps2_pcm,

View File

@ -337,7 +337,7 @@ typedef enum {
meta_STER, meta_STER,
meta_BG00, /* Ibara, Mushihimesama */ meta_BG00, /* Ibara, Mushihimesama */
meta_RSTM_ROCKSTAR, meta_RSTM_ROCKSTAR,
meta_PS2_KCES, /* Dance Dance Revolution */ meta_VIG_KCES,
meta_HXD, meta_HXD,
meta_VSV, meta_VSV,
meta_SCD_PCM, /* Lunar - Eternal Blue */ meta_SCD_PCM, /* Lunar - Eternal Blue */