mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
cleanup: hgc1, filp, wii_mus, sl3, wb, xss
- Remove fake extension .hgc1 (use .str) - Remove fake extension .filp (use .fil) - Remove fake extension .sl3 (use .ms)
This commit is contained in:
parent
de9ad32a47
commit
fc7848bfd3
@ -217,7 +217,6 @@ static const char* extension_list[] = {
|
||||
"hd3",
|
||||
"hdr",
|
||||
"hdt",
|
||||
"hgc1",
|
||||
"his",
|
||||
"hps",
|
||||
"hsf",
|
||||
@ -501,7 +500,6 @@ static const char* extension_list[] = {
|
||||
"sgd",
|
||||
"sgt",
|
||||
"sgx",
|
||||
"sl3",
|
||||
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
|
||||
"sli",
|
||||
"smc",
|
||||
@ -1025,8 +1023,8 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_SADL, "Procyon Studio SADL header"},
|
||||
{meta_PS2_BMDX, "Beatmania .bmdx header"},
|
||||
{meta_DSP_WSI, "Alone in the Dark .WSI header"},
|
||||
{meta_AIFC, "Apple AIFF-C (Audio Interchange File Format) header"},
|
||||
{meta_AIFF, "Apple AIFF (Audio Interchange File Format) header"},
|
||||
{meta_AIFC, "Apple AIFF-C header"},
|
||||
{meta_AIFF, "Apple AIFF header"},
|
||||
{meta_STR_SNDS, "3DO SNDS header"},
|
||||
{meta_WS_AUD, "Westwood Studios .AUD header"},
|
||||
{meta_PS2_IVB, "IVB/BVII header"},
|
||||
@ -1037,7 +1035,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_NWA_NWAINFOINI, "VisualArt's NWA header (NWAINFO.INI looping)"},
|
||||
{meta_NWA_GAMEEXEINI, "VisualArt's NWA header (Gameexe.ini looping)"},
|
||||
{meta_XSS, "Dino Crisis 3 XSS File"},
|
||||
{meta_HGC1, "Knights of the Temple 2 hgC1 Header"},
|
||||
{meta_HGC1, "Cauldron HGC1 header"},
|
||||
{meta_AUS, "Capcom AUS Header"},
|
||||
{meta_RWS, "RenderWare RWS header"},
|
||||
{meta_EA_1SNH, "Electronic Arts 1SNh header"},
|
||||
@ -1093,7 +1091,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_YMF, "Yuke's .YMF Header"},
|
||||
{meta_FAG, "Radical .FAG Header"},
|
||||
{meta_PS2_MIHB, "Sony MultiStream MIC header"},
|
||||
{meta_DSP_WII_MUS, "mus header"},
|
||||
{meta_MUS_KRONE, "Krone .MUS header"},
|
||||
{meta_WII_SNG, "SNG DSP Header"},
|
||||
{meta_RSD, "Radical RSD header"},
|
||||
{meta_DC_ASD, "ASD Header"},
|
||||
@ -1168,7 +1166,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_NGC_DSP_AAAP, "Acclaim Austin AAAp DSP header"},
|
||||
{meta_NGC_DSP_KONAMI, "Konami DSP header"},
|
||||
{meta_BNSF, "Namco Bandai BNSF header"},
|
||||
{meta_PS2_WB, "Shooting Love. ~TRIZEAL~ WB header"},
|
||||
{meta_WB, "Triangle Service .WB header"},
|
||||
{meta_S14, "Namco .S14 raw header"},
|
||||
{meta_SSS, "Namco .SSS raw header"},
|
||||
{meta_PS2_GCM, "Namco GCM header"},
|
||||
|
@ -300,7 +300,7 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ngc_pdt_split(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ngc_pdt(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_wii_mus(STREAMFILE * streamFile);
|
||||
VGMSTREAM* init_vgmstream_mus_krone(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM * init_vgmstream_rsd(STREAMFILE * streamFile);
|
||||
|
||||
@ -433,7 +433,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_konami(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile);
|
||||
VGMSTREAM* init_vgmstream_wb(STREAMFILE* sf);
|
||||
|
||||
VGMSTREAM* init_vgmstream_raw_s14_sss(STREAMFILE* sf);
|
||||
|
||||
|
@ -1,65 +1,46 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* BG0 (from Ibara, Mushihimesama)
|
||||
Note: Seems the Loop Infos are stored external... */
|
||||
VGMSTREAM * init_vgmstream_bg00(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
/* BG00 - from Cave games [Ibara (PS2), Mushihime-sama (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_bg00(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset;
|
||||
int channels, loop_flag = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("bg00",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x42473030) /* "BG00" */
|
||||
goto fail;
|
||||
/* check */
|
||||
if (!is_id32be(0x00,sf, "BG00"))
|
||||
return NULL;
|
||||
|
||||
loop_flag = (read_32bitLE(0x08,streamFile)!=0);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
/* .bg00: header ID (no filenames or debug strings) */
|
||||
if (!check_extensions(sf,"bg00"))
|
||||
return NULL;
|
||||
|
||||
if (!is_id32be(0x40,sf, "VAGp"))
|
||||
return NULL;
|
||||
if (!is_id32be(0x70,sf, "VAGp"))
|
||||
return NULL;
|
||||
|
||||
loop_flag = 0; /* flag at 0x08? loop points seem external */
|
||||
channels = 2; /* mono files use regular VAG */
|
||||
start_offset = 0x800;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x80,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = (read_32bitBE(0x4C,streamFile)*2)*28/16/channel_count;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitBE(0x4C,streamFile)*2)*28/16/channel_count;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x10,streamFile);
|
||||
vgmstream->meta_type = meta_BG00;
|
||||
vgmstream->sample_rate = read_s32be(0x80,sf);
|
||||
vgmstream->num_samples = ps_bytes_to_samples(read_32bitBE(0x4C,sf), 1);
|
||||
|
||||
/* 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;
|
||||
|
||||
}
|
||||
}
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x10,sf);
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,67 +1,55 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* FILp (Resident Evil - Dead Aim) */
|
||||
VGMSTREAM * init_vgmstream_filp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("filp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x0,streamFile) != 0x46494C70) /* "FILp" */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x100,streamFile) != 0x56414770) /* "VAGp" */
|
||||
goto fail;
|
||||
if (read_32bitBE(0x130,streamFile) != 0x56414770) /* "VAGp" */
|
||||
goto fail;
|
||||
if (get_streamfile_size(streamFile) != read_32bitLE(0xC,streamFile))
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_32bitLE(0x34,streamFile) == 0);
|
||||
channel_count = read_32bitLE(0x4,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x0;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x110,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_blocked_filp;
|
||||
vgmstream->meta_type = meta_FILP;
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
block_update_filp(start_offset,vgmstream);
|
||||
vgmstream->num_samples = read_32bitLE(0x10C,streamFile)/16*28;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
|
||||
/* FILp - from Resident Evil: Dead Aim (PS2) */
|
||||
VGMSTREAM* init_vgmstream_filp(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset;
|
||||
int channels, loop_flag;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!is_id32be(0x00,sf, "FILp"))
|
||||
return NULL;
|
||||
/* .fil: extension in bigfile */
|
||||
if (!check_extensions(sf,"fil"))
|
||||
return NULL;
|
||||
|
||||
channels = read_s32le(0x04,sf); /* stereo only though */
|
||||
if (read_32bitLE(0x0C,sf) != get_streamfile_size(sf))
|
||||
goto fail;
|
||||
loop_flag = (read_u32le(0x34,sf) == 0x00); /* 00/01/02 */
|
||||
|
||||
if (!is_id32be(0x100,sf, "VAGp"))
|
||||
return NULL;
|
||||
if (!is_id32be(0x130,sf, "VAGp"))
|
||||
return NULL;
|
||||
|
||||
start_offset = 0x00; /* multiple FILp blocks pasted together (each including VAGps, but their sizes refer to the whole thing) */
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_FILP;
|
||||
vgmstream->sample_rate = read_s32le(0x110,sf);
|
||||
|
||||
vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x10C,sf), 1); /* channel size for the whole stream */
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_blocked_filp;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
block_update(start_offset, vgmstream);
|
||||
|
||||
return vgmstream;
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,64 +1,41 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* hgC1 (from Knights of the Temple 2) */
|
||||
VGMSTREAM * init_vgmstream_hgc1(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
/* hgC1 - from Knights of the Temple 2 (PS2) */
|
||||
VGMSTREAM* init_vgmstream_hgc1(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset;
|
||||
int channels, loop_flag = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("hgc1",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x68674331) /* "hgC1" */
|
||||
goto fail;
|
||||
/* checks */
|
||||
if (!is_id32be(0x00,sf, "hgC1"))
|
||||
return NULL;
|
||||
if (!is_id32be(0x04,sf, "strm"))
|
||||
return NULL;
|
||||
if (!check_extensions(sf,"str"))
|
||||
return NULL;
|
||||
|
||||
start_offset = 0x20;
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x08,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
channels = read_s32le(0x08,sf); /* always stereo? */
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x40;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = (read_32bitLE(0x0C,streamFile)*32)/channel_count/16*28;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitLE(0x0C,streamFile)*32)/channel_count/16*28;
|
||||
}
|
||||
vgmstream->meta_type = meta_HGC1;
|
||||
vgmstream->sample_rate = read_s32le(0x10,sf);
|
||||
vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x0C,sf) * 0x10, 1); /* mono frames*/
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->meta_type = meta_HGC1;
|
||||
|
||||
/* 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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,41 +1,37 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* SL3 - Atari Melbourne House games [ Test Drive Unlimited (PS2), Transformers (PS2)] */
|
||||
VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
/* SL3 - Winky Soft / Atari Melbourne House games [Test Drive Unlimited (PS2), Transformers 2003/2004 (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_sl3(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag = 0, channel_count;
|
||||
int loop_flag = 0, channels;
|
||||
|
||||
/* checks */
|
||||
/* .ms: actual extension, sl3: header id */
|
||||
if (!check_extensions(streamFile, "ms,sl3"))
|
||||
if (!is_id32be(0x00,sf, "SL3\0"))
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */
|
||||
/* .ms: actual extension */
|
||||
if (!check_extensions(sf, "ms"))
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x14,streamFile);
|
||||
channels = read_32bitLE(0x14,sf);
|
||||
start_offset = 0x8000; /* also at 0x24? */
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
|
||||
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(streamFile)-start_offset,channel_count);
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
|
||||
}
|
||||
vgmstream->meta_type = meta_SL3;
|
||||
vgmstream->sample_rate = read_32bitLE(0x18,sf);
|
||||
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(sf)-start_offset,channels);
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x20,streamFile);
|
||||
vgmstream->meta_type = meta_SL3;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x20,sf);
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
|
@ -1,64 +1,45 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* WB (from Shooting Love. ~TRIZEAL~) */
|
||||
VGMSTREAM * init_vgmstream_ps2_wb(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("wb",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0,streamFile) != 0x00000000)
|
||||
goto fail;
|
||||
|
||||
loop_flag = read_32bitLE(0x4,streamFile);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x10;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 48000;
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->num_samples = read_32bitLE(0xC,streamFile)/4;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x4,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x8,streamFile);
|
||||
}
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 2;
|
||||
vgmstream->meta_type = meta_PS2_WB;
|
||||
|
||||
/* 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;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
|
||||
/* .WB - from Shooting Love. ~TRIZEAL~ */
|
||||
VGMSTREAM* init_vgmstream_wb(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset;
|
||||
int channels, loop_flag;
|
||||
|
||||
/* check header */
|
||||
if (read_u32le(0x00,sf) != 0x00000000)
|
||||
return NULL;
|
||||
if (read_u32le(0x0c,sf) + 0x10 != get_streamfile_size(sf))
|
||||
return NULL;
|
||||
|
||||
/* .wb: actual extension */
|
||||
if (!check_extensions(sf,"wb"))
|
||||
goto fail;
|
||||
|
||||
channels = 2;
|
||||
start_offset = 0x10;
|
||||
loop_flag = read_32bitLE(0x04,sf) > 0; /* loop end may be defined */
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channels,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_WB;
|
||||
vgmstream->sample_rate = 48000;
|
||||
vgmstream->num_samples = pcm16_bytes_to_samples(read_u32le(0x0C,sf), channels);
|
||||
vgmstream->loop_start_sample = read_s32le(0x04,sf);
|
||||
vgmstream->loop_end_sample = read_s32le(0x08,sf);
|
||||
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 2;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,124 +1,56 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* .mus, as seen in Star Wars The Force Unleashed for Wii */
|
||||
/* Doesn't seem to be working quite right yet, coef table looks odd */
|
||||
VGMSTREAM * init_vgmstream_wii_mus(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
off_t start_offset;
|
||||
off_t interleave;
|
||||
/* .mus - from Star Wars: The Force Unleashed (Wii) */
|
||||
VGMSTREAM* init_vgmstream_mus_krone(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset, data_size;
|
||||
int channels, loop_flag, interleave;
|
||||
int32_t num_samples;
|
||||
|
||||
int i;
|
||||
struct {
|
||||
uint16_t gain;
|
||||
uint16_t initial_ps;
|
||||
uint16_t initial_hist1;
|
||||
uint16_t initial_hist2;
|
||||
uint16_t loop_ps;
|
||||
/*
|
||||
uint16_t loop_hist1;
|
||||
uint16_t loop_hist2;
|
||||
*/
|
||||
} channel[2];
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("mus",filename_extension(filename))) goto fail;
|
||||
/* checks */
|
||||
num_samples = read_s32be(0x00,sf);
|
||||
interleave = read_s32be(0x04,sf);
|
||||
start_offset = read_u32be(0x08,sf);
|
||||
data_size = read_u32be(0x0c,sf);
|
||||
|
||||
start_offset = read_32bitBE(0x08,streamFile);
|
||||
interleave = read_32bitBE(0x04,streamFile);
|
||||
if (interleave != 0x8000)
|
||||
return NULL;
|
||||
if (start_offset != 0x80)
|
||||
return NULL;
|
||||
if (data_size + start_offset != get_streamfile_size(sf))
|
||||
return NULL;
|
||||
/* could test gain/initial ps at 0x10 + 0x20 too */
|
||||
|
||||
for (i=0;i<2;i++)
|
||||
{
|
||||
channel[i].gain = read_16bitBE(0x30+i*0x2e,streamFile);
|
||||
channel[i].initial_ps = read_16bitBE(0x32+i*0x2e,streamFile);
|
||||
channel[i].initial_hist1 = read_16bitBE(0x34+i*0x2e,streamFile);
|
||||
channel[i].initial_hist2 = read_16bitBE(0x36+i*0x2e,streamFile);
|
||||
channel[i].loop_ps = read_16bitBE(0x38+i*0x2e,streamFile);
|
||||
}
|
||||
if (!check_extensions(sf,"mus"))
|
||||
return NULL;
|
||||
|
||||
/* check initial predictor/scale */
|
||||
if (channel[0].initial_ps != (uint8_t)read_8bit(start_offset,streamFile))
|
||||
goto fail;
|
||||
if (channel[1].initial_ps != (uint8_t)read_8bit(start_offset+interleave,streamFile))
|
||||
goto fail;
|
||||
|
||||
/* check type==0 and gain==0 */
|
||||
if (channel[0].gain ||
|
||||
channel[1].gain)
|
||||
goto fail;
|
||||
|
||||
#if 0
|
||||
if (ch0_header.loop_flag) {
|
||||
off_t loop_off;
|
||||
/* check loop predictor/scale */
|
||||
loop_off = ch0_header.loop_start_offset/16*8;
|
||||
loop_off = (loop_off/interleave*interleave*2) + (loop_off%interleave);
|
||||
if (ch0_header.loop_ps != (uint8_t)read_8bit(start_offset+loop_off,streamFile))
|
||||
goto fail;
|
||||
if (ch1_header.loop_ps != (uint8_t)read_8bit(start_offset+loop_off+interleave,streamFile))
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
channels = 2;
|
||||
loop_flag = 0;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
vgmstream = allocate_vgmstream(2,0);
|
||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = read_32bitBE(0x0,streamFile);
|
||||
vgmstream->sample_rate = (uint16_t)read_16bitBE(0x6c,streamFile);
|
||||
|
||||
/* TODO: adjust for interleave? */
|
||||
#if 0
|
||||
vgmstream->loop_start_sample = dsp_nibbles_to_samples(
|
||||
ch0_header.loop_start_offset);
|
||||
vgmstream->loop_end_sample = dsp_nibbles_to_samples(
|
||||
ch0_header.loop_end_offset)+1;
|
||||
#endif
|
||||
vgmstream->meta_type = meta_MUS_KRONE;
|
||||
vgmstream->num_samples = num_samples;
|
||||
vgmstream->sample_rate = read_u16be(0x6c,sf);
|
||||
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
vgmstream->meta_type = meta_DSP_WII_MUS;
|
||||
vgmstream->interleave_block_size = interleave; /* no last block size unlike similar DSPs */
|
||||
|
||||
/* coeffs */
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x10 + i*2,streamFile);
|
||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x3e + i*2,streamFile);
|
||||
}
|
||||
|
||||
/* initial history */
|
||||
/* always 0 that I've ever seen, but for completeness... */
|
||||
vgmstream->ch[0].adpcm_history1_16 = channel[0].initial_hist1;
|
||||
vgmstream->ch[0].adpcm_history2_16 = channel[0].initial_hist2;
|
||||
vgmstream->ch[1].adpcm_history1_16 = channel[1].initial_hist1;
|
||||
vgmstream->ch[1].adpcm_history2_16 = channel[1].initial_hist2;
|
||||
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
vgmstream->ch[1].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[1].streamfile) goto fail;
|
||||
|
||||
/* open the file for reading */
|
||||
for (i=0;i<2;i++) {
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+i*interleave;
|
||||
}
|
||||
dsp_read_coefs_be(vgmstream, sf, 0x10, 0x2e);
|
||||
dsp_read_hist_be(vgmstream, sf, 0x10 + 0x24, 0x2e);
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
/* clean up anything we may have opened */
|
||||
if (vgmstream) {
|
||||
if (vgmstream->ch[0].streamfile) close_streamfile(vgmstream->ch[0].streamfile);
|
||||
close_vgmstream(vgmstream);
|
||||
}
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
101
src/meta/xss.c
101
src/meta/xss.c
@ -1,72 +1,61 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* XSS (found in Dino Crisis 3) */
|
||||
VGMSTREAM * init_vgmstream_xss(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("xss",filename_extension(filename))) goto fail;
|
||||
/* .XSS - found in Dino Crisis 3 (Xbox) */
|
||||
VGMSTREAM* init_vgmstream_xss(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
uint32_t start_offset;
|
||||
int channels, loop_flag, sample_rate;
|
||||
|
||||
/* check header */
|
||||
if ((uint16_t)read_16bitLE(0x15A,streamFile) != 0x10)
|
||||
goto fail;
|
||||
if (read_32bitLE(0x154,streamFile) / read_32bitLE(0x150,streamFile) !=
|
||||
(uint16_t)read_16bitLE(0x158,streamFile))
|
||||
goto fail;
|
||||
/* checks */
|
||||
/* 00: name + garbage data up to ?
|
||||
* (due to garbage it's hard which values are from this header, but these seem consistent) */
|
||||
if (read_u32le(0x0c,sf) != 0x3a)
|
||||
return NULL;
|
||||
if (read_u32le(0x10,sf) != 0x00)
|
||||
return NULL;
|
||||
|
||||
loop_flag = (read_32bitLE(0x144,streamFile)!=0);
|
||||
channel_count = (uint16_t)read_16bitLE(0x14E,streamFile);
|
||||
if (!check_extensions(sf,"xss"))
|
||||
return NULL;
|
||||
|
||||
/* some floats and stuff up to 0x100, then some sizes, then RIFF fmt-like header */
|
||||
|
||||
uint32_t head_offset = 0x140;
|
||||
if (read_u32le(head_offset+0x00, sf) != 0x40)
|
||||
return NULL;
|
||||
|
||||
loop_flag = (read_u32le(head_offset + 0x04,sf) != 0);
|
||||
if (read_u16le(head_offset + 0x0c,sf) != 0x01)
|
||||
return NULL;
|
||||
channels = read_u16le(head_offset + 0x0E,sf);
|
||||
sample_rate = read_u32le(head_offset + 0x10,sf);
|
||||
/* 14: bitrate */
|
||||
/* 18: block size */
|
||||
if (read_u16le(head_offset + 0x1A,sf) != 0x10)
|
||||
return NULL;
|
||||
|
||||
start_offset = 0x800;
|
||||
|
||||
|
||||
/* 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 = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x150,streamFile);
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/2/channel_count;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x144,streamFile)/2/channel_count;
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x148,streamFile)/2/channel_count;
|
||||
}
|
||||
|
||||
if (vgmstream->channels == 1) {
|
||||
vgmstream->layout_type = layout_none;
|
||||
} else if (vgmstream->channels > 1) {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x2;
|
||||
}
|
||||
|
||||
vgmstream->meta_type = meta_XSS;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = pcm16_bytes_to_samples(get_streamfile_size(sf) - start_offset, channels);
|
||||
vgmstream->loop_start_sample = pcm16_bytes_to_samples(read_u32le(head_offset + 0x04,sf), channels);
|
||||
vgmstream->loop_end_sample = pcm16_bytes_to_samples(read_u32le(head_offset + 0x08,sf), channels);
|
||||
|
||||
/* 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;
|
||||
|
||||
}
|
||||
}
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x2;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_ps2_mihb,
|
||||
init_vgmstream_ngc_pdt_split,
|
||||
init_vgmstream_ngc_pdt,
|
||||
init_vgmstream_wii_mus,
|
||||
init_vgmstream_mus_krone,
|
||||
init_vgmstream_dc_asd,
|
||||
init_vgmstream_spsd,
|
||||
init_vgmstream_rsd,
|
||||
@ -201,7 +201,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_dmsg,
|
||||
init_vgmstream_ngc_dsp_aaap,
|
||||
init_vgmstream_ngc_dsp_konami,
|
||||
init_vgmstream_ps2_wb,
|
||||
init_vgmstream_wb,
|
||||
init_vgmstream_bnsf,
|
||||
init_vgmstream_ps2_gcm,
|
||||
init_vgmstream_smpl,
|
||||
|
@ -258,7 +258,7 @@ typedef enum {
|
||||
meta_DSP_SADB, /* .sad */
|
||||
meta_DSP_WSI, /* .wsi */
|
||||
meta_IDSP_TT, /* Traveller's Tales games */
|
||||
meta_DSP_WII_MUS, /* .mus */
|
||||
meta_MUS_KRONE,
|
||||
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) */
|
||||
@ -455,7 +455,7 @@ typedef enum {
|
||||
meta_AST_MMV,
|
||||
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
|
||||
meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */
|
||||
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
|
||||
meta_WB,
|
||||
meta_S14, /* raw Siren 14, 24kbit mono */
|
||||
meta_SSS, /* raw Siren 14, 48kbit stereo */
|
||||
meta_PS2_GCM, /* NamCollection */
|
||||
|
Loading…
x
Reference in New Issue
Block a user