mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
cleanup: misc
This commit is contained in:
parent
978dab14e6
commit
5673a3c636
@ -999,7 +999,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_LEG, "Legaia 2 - Duel Saga LEG Header"},
|
{meta_LEG, "Legaia 2 - Duel Saga LEG Header"},
|
||||||
{meta_FILP, "Bio Hazard - Gun Survivor FILp Header"},
|
{meta_FILP, "Bio Hazard - Gun Survivor FILp Header"},
|
||||||
{meta_IKM, "MiCROViSiON IKM header"},
|
{meta_IKM, "MiCROViSiON IKM header"},
|
||||||
{meta_SFS, "Baroque SFS Header"},
|
{meta_SFS, "String .SFS header"},
|
||||||
{meta_SAT_DVI, "Konami KCEN DVI. header"},
|
{meta_SAT_DVI, "Konami KCEN DVI. header"},
|
||||||
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
|
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
|
||||||
{meta_BG00, "Falcom BG00 Header"},
|
{meta_BG00, "Falcom BG00 Header"},
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
|
|
||||||
|
|
||||||
/* XVAG with subsongs layers, interleaves chunks of each subsong (a hack to support them) */
|
/* XVAG with subsongs layers, interleaves chunks of each subsong (a hack to support them) */
|
||||||
void block_update_xvag_subsong(off_t block_offset, VGMSTREAM * vgmstream) {
|
void block_update_xvag_subsong(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||||
int i;
|
int i;
|
||||||
size_t channel_size = 0x10;
|
size_t channel_size = 0x10;
|
||||||
|
|
||||||
/* set offsets */
|
/* set offsets */
|
||||||
for (i = 0; i < vgmstream->channels; i++) {
|
for (i = 0; i < vgmstream->channels; i++) {
|
||||||
vgmstream->ch[i].offset = block_offset + channel_size*i;
|
vgmstream->ch[i].offset = block_offset + channel_size*i;
|
||||||
}
|
}
|
||||||
|
|
||||||
//vgmstream->current_block_size = ; /* fixed */
|
//vgmstream->current_block_size = ; /* fixed */
|
||||||
vgmstream->current_block_offset = block_offset;
|
vgmstream->current_block_offset = block_offset;
|
||||||
vgmstream->next_block_offset = block_offset + vgmstream->full_block_size;
|
vgmstream->next_block_offset = block_offset + vgmstream->full_block_size;
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,47 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* .208 - from Ocean game(s?) [Last Rites (PC)] */
|
/* .208 - from Ocean game(s?) [Last Rites (PC)] */
|
||||||
VGMSTREAM * init_vgmstream_208(STREAMFILE *streamFile) {
|
VGMSTREAM* init_vgmstream_208(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset, data_size;
|
||||||
int loop_flag, channel_count, sample_rate;
|
int loop_flag, channels, sample_rate;
|
||||||
size_t data_size;
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
/* checks */
|
if (!check_extensions(sf, "208"))
|
||||||
if (!check_extensions(streamFile, "208"))
|
goto fail;
|
||||||
goto fail;
|
/* possible validation: (0x04 == 0 and 0xcc == 0x1F7D984D) or 0x04 == 0xf0 and 0xcc == 0) */
|
||||||
/* possible validation: (0x04 == 0 and 0xcc == 0x1F7D984D) or 0x04 == 0xf0 and 0xcc == 0) */
|
if (!((read_u32le(0x04,sf) == 0x00 && read_u32be(0xcc,sf) == 0x1F7D984D) ||
|
||||||
if (!((read_32bitLE(0x04,streamFile) == 0x00 && read_32bitBE(0xcc,streamFile) == 0x1F7D984D) ||
|
(read_u32le(0x04,sf) == 0xF0 && read_u32be(0xcc,sf) == 0x00000000)))
|
||||||
(read_32bitLE(0x04,streamFile) == 0xF0 && read_32bitBE(0xcc,streamFile) == 0x00000000)))
|
goto fail;
|
||||||
goto fail;
|
|
||||||
|
start_offset = read_s32le(0x00,sf);
|
||||||
start_offset = read_32bitLE(0x00,streamFile);
|
data_size = read_s32le(0x0c,sf);
|
||||||
data_size = read_32bitLE(0x0c,streamFile);
|
sample_rate = read_s32le(0x34,sf);
|
||||||
sample_rate = read_32bitLE(0x34,streamFile);
|
channels = read_s32le(0x3C,sf); /* assumed */
|
||||||
channel_count = read_32bitLE(0x3C,streamFile); /* assumed */
|
loop_flag = 0;
|
||||||
loop_flag = 0;
|
|
||||||
|
if (start_offset + data_size != get_streamfile_size(sf))
|
||||||
if (start_offset + data_size != get_streamfile_size(streamFile))
|
goto fail;
|
||||||
goto fail;
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
/* build the VGMSTREAM */
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
if (!vgmstream) goto fail;
|
||||||
if (!vgmstream) goto fail;
|
|
||||||
|
vgmstream->meta_type = meta_208;
|
||||||
vgmstream->meta_type = meta_208;
|
vgmstream->sample_rate = sample_rate;
|
||||||
vgmstream->sample_rate = sample_rate;
|
vgmstream->num_samples = pcm8_bytes_to_samples(data_size, channels);
|
||||||
vgmstream->num_samples = pcm_bytes_to_samples(data_size, channel_count, 8);
|
vgmstream->coding_type = coding_PCM8_U;
|
||||||
vgmstream->coding_type = coding_PCM8_U;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->interleave_block_size = 0x1;
|
||||||
vgmstream->interleave_block_size = 0x1;
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
|
||||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
goto fail;
|
||||||
goto fail;
|
return vgmstream;
|
||||||
return vgmstream;
|
|
||||||
|
fail:
|
||||||
fail:
|
close_vgmstream(vgmstream);
|
||||||
close_vgmstream(vgmstream);
|
return NULL;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
@ -153,7 +153,7 @@ static inline void test_key(hca_codec_data* hca_data, uint64_t key, uint16_t sub
|
|||||||
static void find_hca_key(hca_codec_data* hca_data, uint64_t* p_keycode, uint16_t subkey) {
|
static void find_hca_key(hca_codec_data* hca_data, uint64_t* p_keycode, uint16_t subkey) {
|
||||||
const size_t keys_length = sizeof(hcakey_list) / sizeof(hcakey_info);
|
const size_t keys_length = sizeof(hcakey_list) / sizeof(hcakey_info);
|
||||||
int best_score = -1;
|
int best_score = -1;
|
||||||
int i,j;
|
int i;
|
||||||
|
|
||||||
*p_keycode = 0xCC55463930DBE1AB; /* defaults to PSO2 key, most common */
|
*p_keycode = 0xCC55463930DBE1AB; /* defaults to PSO2 key, most common */
|
||||||
|
|
||||||
@ -166,6 +166,8 @@ static void find_hca_key(hca_codec_data* hca_data, uint64_t* p_keycode, uint16_t
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
size_t subkeys_size = hcakey_list[i].subkeys_size;
|
size_t subkeys_size = hcakey_list[i].subkeys_size;
|
||||||
const uint16_t *subkeys = hcakey_list[i].subkeys;
|
const uint16_t *subkeys = hcakey_list[i].subkeys;
|
||||||
if (subkeys_size > 0 && subkey == 0) {
|
if (subkeys_size > 0 && subkey == 0) {
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* .str - Cauldron/Conan mini-header + interleaved dsp data [Conan (GC)] */
|
/* .str - Cauldron/Conan mini-header + interleaved dsp data [Conan (GC)] */
|
||||||
VGMSTREAM * init_vgmstream_ngc_str(STREAMFILE *streamFile) {
|
VGMSTREAM* init_vgmstream_ngc_str(STREAMFILE *sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int channel_count, loop_flag;
|
int channels, loop_flag;
|
||||||
|
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
if (!check_extensions(streamFile, "str"))
|
if (!check_extensions(sf, "str"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (read_32bitBE(0x00,streamFile) != 0xFAAF0001) /* header id */
|
if (read_u32be(0x00,sf) != 0xFAAF0001) /* header id */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
channel_count = 2; /* always loop & stereo */
|
channels = 2; /* always loop & stereo */
|
||||||
loop_flag = 1;
|
loop_flag = 1;
|
||||||
start_offset = 0x60;
|
start_offset = 0x60;
|
||||||
|
|
||||||
|
|
||||||
/* 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;
|
||||||
|
|
||||||
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
|
vgmstream->sample_rate = read_s32be(0x04,sf);
|
||||||
vgmstream->num_samples = read_32bitBE(0x08,streamFile);
|
vgmstream->num_samples = read_s32be(0x08,sf);
|
||||||
vgmstream->loop_start_sample = 0;
|
vgmstream->loop_start_sample = 0;
|
||||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
|
|
||||||
vgmstream->meta_type = meta_DSP_STR;
|
vgmstream->meta_type = meta_DSP_STR;
|
||||||
vgmstream->coding_type = coding_NGC_DSP;
|
vgmstream->coding_type = coding_NGC_DSP;
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->interleave_block_size = read_32bitBE(0x0C,streamFile);
|
vgmstream->interleave_block_size = read_u32be(0x0C,sf);
|
||||||
|
|
||||||
dsp_read_coefs_be(vgmstream, streamFile, 0x10, 0x20);
|
dsp_read_coefs_be(vgmstream, sf, 0x10, 0x20);
|
||||||
|
|
||||||
|
|
||||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
|
||||||
goto fail;
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,53 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* SFS (from Baroque) */
|
/* SFS - from Sting games [Baroque (PS2)] */
|
||||||
VGMSTREAM * init_vgmstream_sfs(STREAMFILE *streamFile) {
|
VGMSTREAM* init_vgmstream_sfs(STREAMFILE* sf) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag;
|
int loop_flag, channels, sample_rate;
|
||||||
int channel_count;
|
size_t channel_size, loop_start;
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("sfs",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
/* checks */
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x53544552) /* "STER" */
|
/* .sfs: bigfile extension (no apparent names) */
|
||||||
|
if (!check_extensions(sf, "sfs"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
loop_flag = (read_32bitLE(0x08,streamFile)!=0xFFFFFFFF);
|
if (!is_id32be(0x00,sf, "STER"))
|
||||||
channel_count = 2;
|
goto fail;
|
||||||
|
channel_size = read_u32le(0x04, sf);
|
||||||
|
loop_start = read_u32le(0x08, sf); /* absolute (ex. offset 0x50 for full loops) */
|
||||||
|
/* 0x0c: data size BE */
|
||||||
|
sample_rate = read_s32be(0x10,sf);
|
||||||
|
|
||||||
|
loop_flag = loop_start != 0xFFFFFFFF;
|
||||||
|
channels = 2;
|
||||||
|
start_offset = 0x30;
|
||||||
|
|
||||||
|
|
||||||
/* 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->meta_type = meta_SFS;
|
||||||
start_offset = 0x30;
|
vgmstream->sample_rate = sample_rate;
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
|
||||||
vgmstream->coding_type = coding_PSX;
|
|
||||||
vgmstream->num_samples = (read_32bitLE(0x04,streamFile)*2)*28/16/channel_count;
|
|
||||||
if (loop_flag) {
|
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile)*28/16/channel_count;
|
|
||||||
vgmstream->loop_end_sample = (read_32bitLE(0x04,streamFile)*2)*28/16/channel_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vgmstream->num_samples = ps_bytes_to_samples(channel_size, 1);
|
||||||
|
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start - start_offset, channels);
|
||||||
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
|
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->interleave_block_size = 0x10;
|
vgmstream->interleave_block_size = 0x10;
|
||||||
vgmstream->meta_type = meta_SFS;
|
|
||||||
|
|
||||||
/* open the file for reading */
|
read_string(vgmstream->stream_name,0x10+1, 0x20,sf);
|
||||||
{
|
|
||||||
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, start_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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user