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:
bnnm 2023-07-08 10:52:28 +02:00
parent de9ad32a47
commit fc7848bfd3
11 changed files with 261 additions and 419 deletions

View File

@ -217,7 +217,6 @@ static const char* extension_list[] = {
"hd3", "hd3",
"hdr", "hdr",
"hdt", "hdt",
"hgc1",
"his", "his",
"hps", "hps",
"hsf", "hsf",
@ -501,7 +500,6 @@ static const char* extension_list[] = {
"sgd", "sgd",
"sgt", "sgt",
"sgx", "sgx",
"sl3",
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)] "slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
"sli", "sli",
"smc", "smc",
@ -1025,8 +1023,8 @@ static const meta_info meta_info_list[] = {
{meta_SADL, "Procyon Studio SADL header"}, {meta_SADL, "Procyon Studio SADL header"},
{meta_PS2_BMDX, "Beatmania .bmdx header"}, {meta_PS2_BMDX, "Beatmania .bmdx header"},
{meta_DSP_WSI, "Alone in the Dark .WSI header"}, {meta_DSP_WSI, "Alone in the Dark .WSI header"},
{meta_AIFC, "Apple AIFF-C (Audio Interchange File Format) header"}, {meta_AIFC, "Apple AIFF-C header"},
{meta_AIFF, "Apple AIFF (Audio Interchange File Format) 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_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_NWAINFOINI, "VisualArt's NWA header (NWAINFO.INI looping)"},
{meta_NWA_GAMEEXEINI, "VisualArt's NWA header (Gameexe.ini looping)"}, {meta_NWA_GAMEEXEINI, "VisualArt's NWA header (Gameexe.ini looping)"},
{meta_XSS, "Dino Crisis 3 XSS File"}, {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_AUS, "Capcom AUS Header"},
{meta_RWS, "RenderWare RWS header"}, {meta_RWS, "RenderWare RWS header"},
{meta_EA_1SNH, "Electronic Arts 1SNh 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_YMF, "Yuke's .YMF Header"},
{meta_FAG, "Radical .FAG Header"}, {meta_FAG, "Radical .FAG Header"},
{meta_PS2_MIHB, "Sony MultiStream MIC 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_WII_SNG, "SNG DSP Header"},
{meta_RSD, "Radical RSD header"}, {meta_RSD, "Radical RSD header"},
{meta_DC_ASD, "ASD 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_AAAP, "Acclaim Austin AAAp DSP header"},
{meta_NGC_DSP_KONAMI, "Konami DSP header"}, {meta_NGC_DSP_KONAMI, "Konami DSP header"},
{meta_BNSF, "Namco Bandai BNSF 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_S14, "Namco .S14 raw header"},
{meta_SSS, "Namco .SSS raw header"}, {meta_SSS, "Namco .SSS raw header"},
{meta_PS2_GCM, "Namco GCM header"}, {meta_PS2_GCM, "Namco GCM header"},

View File

@ -300,7 +300,7 @@ VGMSTREAM * init_vgmstream_ps2_mihb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_pdt_split(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ngc_pdt_split(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_pdt(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); 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_bnsf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile); VGMSTREAM* init_vgmstream_wb(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_raw_s14_sss(STREAMFILE* sf); VGMSTREAM* init_vgmstream_raw_s14_sss(STREAMFILE* sf);

View File

@ -1,65 +1,46 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../coding/coding.h"
/* BG0 (from Ibara, Mushihimesama) /* BG00 - from Cave games [Ibara (PS2), Mushihime-sama (PS2)] */
Note: Seems the Loop Infos are stored external... */ VGMSTREAM* init_vgmstream_bg00(STREAMFILE* sf) {
VGMSTREAM * init_vgmstream_bg00(STREAMFILE *streamFile) { VGMSTREAM* vgmstream = NULL;
VGMSTREAM * vgmstream = NULL; uint32_t start_offset;
char filename[PATH_LIMIT]; int channels, loop_flag = 0;
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("bg00",filename_extension(filename))) goto fail;
/* check header */ /* check */
if (read_32bitBE(0x00,streamFile) != 0x42473030) /* "BG00" */ if (!is_id32be(0x00,sf, "BG00"))
goto fail; return NULL;
loop_flag = (read_32bitLE(0x08,streamFile)!=0); /* .bg00: header ID (no filenames or debug strings) */
channel_count = 2; if (!check_extensions(sf,"bg00"))
return NULL;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); 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; 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->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 */ vgmstream->coding_type = coding_PSX;
{ vgmstream->layout_type = layout_interleave;
int i; vgmstream->interleave_block_size = read_32bitLE(0x10,sf);
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;
} }

View File

@ -1,67 +1,55 @@
#include "meta.h" #include "meta.h"
#include "../layout/layout.h" #include "../layout/layout.h"
#include "../util.h" #include "../coding/coding.h"
/* FILp (Resident Evil - Dead Aim) */
VGMSTREAM * init_vgmstream_filp(STREAMFILE *streamFile) { /* FILp - from Resident Evil: Dead Aim (PS2) */
VGMSTREAM * vgmstream = NULL; VGMSTREAM* init_vgmstream_filp(STREAMFILE* sf) {
char filename[PATH_LIMIT]; VGMSTREAM* vgmstream = NULL;
off_t start_offset; uint32_t start_offset;
int loop_flag = 0; int channels, loop_flag;
int channel_count;
int i;
/* checks */
/* check extension, case insensitive */ if (!is_id32be(0x00,sf, "FILp"))
streamFile->get_name(streamFile,filename,sizeof(filename)); return NULL;
if (strcasecmp("filp",filename_extension(filename))) goto fail; /* .fil: extension in bigfile */
if (!check_extensions(sf,"fil"))
/* check header */ return NULL;
if (read_32bitBE(0x0,streamFile) != 0x46494C70) /* "FILp" */
goto fail; channels = read_s32le(0x04,sf); /* stereo only though */
if (read_32bitBE(0x100,streamFile) != 0x56414770) /* "VAGp" */ if (read_32bitLE(0x0C,sf) != get_streamfile_size(sf))
goto fail; goto fail;
if (read_32bitBE(0x130,streamFile) != 0x56414770) /* "VAGp" */ loop_flag = (read_u32le(0x34,sf) == 0x00); /* 00/01/02 */
goto fail;
if (get_streamfile_size(streamFile) != read_32bitLE(0xC,streamFile)) if (!is_id32be(0x100,sf, "VAGp"))
goto fail; return NULL;
if (!is_id32be(0x130,sf, "VAGp"))
loop_flag = (read_32bitLE(0x34,streamFile) == 0); return NULL;
channel_count = read_32bitLE(0x4,streamFile);
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(channel_count,loop_flag);
if (!vgmstream) goto fail; /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
/* fill in the vital statistics */ if (!vgmstream) goto fail;
start_offset = 0x0;
vgmstream->channels = channel_count; vgmstream->meta_type = meta_FILP;
vgmstream->sample_rate = read_32bitLE(0x110,streamFile); vgmstream->sample_rate = read_s32le(0x110,sf);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_blocked_filp; vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x10C,sf), 1); /* channel size for the whole stream */
vgmstream->meta_type = meta_FILP; vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples;
/* open the file for reading */
{ vgmstream->coding_type = coding_PSX;
STREAMFILE * file; vgmstream->layout_type = layout_blocked_filp;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail; if (!vgmstream_open_stream(vgmstream, sf, start_offset))
for (i=0;i<channel_count;i++) { goto fail;
vgmstream->ch[i].streamfile = file; block_update(start_offset, vgmstream);
}
} return vgmstream;
fail:
block_update_filp(start_offset,vgmstream); close_vgmstream(vgmstream);
vgmstream->num_samples = read_32bitLE(0x10C,streamFile)/16*28; return NULL;
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;
}

View File

@ -1,64 +1,41 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../coding/coding.h"
/* hgC1 (from Knights of the Temple 2) */ /* hgC1 - from Knights of the Temple 2 (PS2) */
VGMSTREAM * init_vgmstream_hgc1(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_hgc1(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
char filename[PATH_LIMIT]; uint32_t start_offset;
off_t start_offset; int channels, loop_flag = 0;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */ /* checks */
streamFile->get_name(streamFile,filename,sizeof(filename)); if (!is_id32be(0x00,sf, "hgC1"))
if (strcasecmp("hgc1",filename_extension(filename))) goto fail; return NULL;
if (!is_id32be(0x04,sf, "strm"))
/* check header */ return NULL;
if (read_32bitBE(0x00,streamFile) != 0x68674331) /* "hgC1" */ if (!check_extensions(sf,"str"))
goto fail; return NULL;
start_offset = 0x20;
loop_flag = 0; loop_flag = 0;
channel_count = read_32bitLE(0x08,streamFile); channels = read_s32le(0x08,sf); /* always stereo? */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ vgmstream->meta_type = meta_HGC1;
start_offset = 0x40; vgmstream->sample_rate = read_s32le(0x10,sf);
vgmstream->channels = channel_count; vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x0C,sf) * 0x10, 1); /* mono frames*/
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->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_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; 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

@ -1,41 +1,37 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
/* SL3 - Atari Melbourne House games [ Test Drive Unlimited (PS2), Transformers (PS2)] */ /* SL3 - Winky Soft / Atari Melbourne House games [Test Drive Unlimited (PS2), Transformers 2003/2004 (PS2)] */
VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_sl3(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
off_t start_offset; off_t start_offset;
int loop_flag = 0, channel_count; int loop_flag = 0, channels;
/* checks */ /* checks */
/* .ms: actual extension, sl3: header id */ if (!is_id32be(0x00,sf, "SL3\0"))
if (!check_extensions(streamFile, "ms,sl3"))
goto fail; goto fail;
if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */ /* .ms: actual extension */
if (!check_extensions(sf, "ms"))
goto fail; goto fail;
loop_flag = 0; loop_flag = 0;
channel_count = read_32bitLE(0x14,streamFile); channels = read_32bitLE(0x14,sf);
start_offset = 0x8000; /* also at 0x24? */ start_offset = 0x8000; /* also at 0x24? */
/* 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_32bitLE(0x18,streamFile); vgmstream->meta_type = meta_SL3;
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(streamFile)-start_offset,channel_count); vgmstream->sample_rate = read_32bitLE(0x18,sf);
if (loop_flag) { vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(sf)-start_offset,channels);
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
}
vgmstream->coding_type = coding_PSX; vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x20,streamFile); vgmstream->interleave_block_size = read_32bitLE(0x20,sf);
vgmstream->meta_type = meta_SL3;
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset)) if (!vgmstream_open_stream(vgmstream,sf,start_offset))
goto fail; goto fail;
return vgmstream; return vgmstream;

View File

@ -1,64 +1,45 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../coding/coding.h"
/* WB (from Shooting Love. ~TRIZEAL~) */
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE *streamFile) { /* .WB - from Shooting Love. ~TRIZEAL~ */
VGMSTREAM * vgmstream = NULL; VGMSTREAM* init_vgmstream_wb(STREAMFILE* sf) {
char filename[PATH_LIMIT]; VGMSTREAM* vgmstream = NULL;
off_t start_offset; uint32_t start_offset;
int channels, loop_flag;
int loop_flag;
int channel_count; /* check header */
if (read_u32le(0x00,sf) != 0x00000000)
/* check extension, case insensitive */ return NULL;
streamFile->get_name(streamFile,filename,sizeof(filename)); if (read_u32le(0x0c,sf) + 0x10 != get_streamfile_size(sf))
if (strcasecmp("wb",filename_extension(filename))) goto fail; return NULL;
/* check header */ /* .wb: actual extension */
if (read_32bitBE(0,streamFile) != 0x00000000) if (!check_extensions(sf,"wb"))
goto fail; goto fail;
loop_flag = read_32bitLE(0x4,streamFile); channels = 2;
channel_count = 2; start_offset = 0x10;
loop_flag = read_32bitLE(0x04,sf) > 0; /* loop end may be defined */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); /* build the VGMSTREAM */
if (!vgmstream) goto fail; vgmstream = allocate_vgmstream(channels,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x10; vgmstream->meta_type = meta_WB;
vgmstream->channels = channel_count; vgmstream->sample_rate = 48000;
vgmstream->sample_rate = 48000; vgmstream->num_samples = pcm16_bytes_to_samples(read_u32le(0x0C,sf), channels);
vgmstream->coding_type = coding_PCM16LE; vgmstream->loop_start_sample = read_s32le(0x04,sf);
vgmstream->num_samples = read_32bitLE(0xC,streamFile)/4; vgmstream->loop_end_sample = read_s32le(0x08,sf);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x4,streamFile); vgmstream->coding_type = coding_PCM16LE;
vgmstream->loop_end_sample = read_32bitLE(0x8,streamFile); vgmstream->layout_type = layout_interleave;
} vgmstream->interleave_block_size = 2;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 2; if (!vgmstream_open_stream(vgmstream, sf, start_offset))
vgmstream->meta_type = meta_PS2_WB; goto fail;
return vgmstream;
/* open the file for reading */ fail:
{ close_vgmstream(vgmstream);
int i; return NULL;
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;
}

View File

@ -1,124 +1,56 @@
#include "meta.h" #include "meta.h"
#include "../layout/layout.h" #include "../layout/layout.h"
#include "../coding/coding.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; /* .mus - from Star Wars: The Force Unleashed (Wii) */
off_t interleave; 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 */ /* checks */
streamFile->get_name(streamFile,filename,sizeof(filename)); num_samples = read_s32be(0x00,sf);
if (strcasecmp("mus",filename_extension(filename))) goto fail; interleave = read_s32be(0x04,sf);
start_offset = read_u32be(0x08,sf);
data_size = read_u32be(0x0c,sf);
start_offset = read_32bitBE(0x08,streamFile); if (interleave != 0x8000)
interleave = read_32bitBE(0x04,streamFile); 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++) if (!check_extensions(sf,"mus"))
{ return NULL;
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);
}
/* 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 */ channels = 2;
if (channel[0].gain || loop_flag = 0;
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
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
vgmstream = allocate_vgmstream(2,0);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ vgmstream->meta_type = meta_MUS_KRONE;
vgmstream->num_samples = read_32bitBE(0x0,streamFile); vgmstream->num_samples = num_samples;
vgmstream->sample_rate = (uint16_t)read_16bitBE(0x6c,streamFile); vgmstream->sample_rate = read_u16be(0x6c,sf);
/* 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->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 = interleave; vgmstream->interleave_block_size = interleave; /* no last block size unlike similar DSPs */
vgmstream->meta_type = meta_DSP_WII_MUS;
/* coeffs */ dsp_read_coefs_be(vgmstream, sf, 0x10, 0x2e);
for (i=0;i<16;i++) { dsp_read_hist_be(vgmstream, sf, 0x10 + 0x24, 0x2e);
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;
}
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream; return vgmstream;
fail: fail:
/* clean up anything we may have opened */ close_vgmstream(vgmstream);
if (vgmstream) {
if (vgmstream->ch[0].streamfile) close_streamfile(vgmstream->ch[0].streamfile);
close_vgmstream(vgmstream);
}
return NULL; return NULL;
} }

View File

@ -1,72 +1,61 @@
#include "meta.h" #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 */ /* .XSS - found in Dino Crisis 3 (Xbox) */
streamFile->get_name(streamFile,filename,sizeof(filename)); VGMSTREAM* init_vgmstream_xss(STREAMFILE* sf) {
if (strcasecmp("xss",filename_extension(filename))) goto fail; VGMSTREAM* vgmstream = NULL;
uint32_t start_offset;
int channels, loop_flag, sample_rate;
/* check header */ /* checks */
if ((uint16_t)read_16bitLE(0x15A,streamFile) != 0x10) /* 00: name + garbage data up to ?
goto fail; * (due to garbage it's hard which values are from this header, but these seem consistent) */
if (read_32bitLE(0x154,streamFile) / read_32bitLE(0x150,streamFile) != if (read_u32le(0x0c,sf) != 0x3a)
(uint16_t)read_16bitLE(0x158,streamFile)) return NULL;
goto fail; if (read_u32le(0x10,sf) != 0x00)
return NULL;
loop_flag = (read_32bitLE(0x144,streamFile)!=0); if (!check_extensions(sf,"xss"))
channel_count = (uint16_t)read_16bitLE(0x14E,streamFile); 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 */ /* 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 */
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->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 */ vgmstream->coding_type = coding_PCM16LE;
{ vgmstream->layout_type = layout_interleave;
int i; vgmstream->interleave_block_size = 0x2;
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;
} }

View File

@ -130,7 +130,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_ps2_mihb, init_vgmstream_ps2_mihb,
init_vgmstream_ngc_pdt_split, init_vgmstream_ngc_pdt_split,
init_vgmstream_ngc_pdt, init_vgmstream_ngc_pdt,
init_vgmstream_wii_mus, init_vgmstream_mus_krone,
init_vgmstream_dc_asd, init_vgmstream_dc_asd,
init_vgmstream_spsd, init_vgmstream_spsd,
init_vgmstream_rsd, init_vgmstream_rsd,
@ -201,7 +201,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_dmsg, init_vgmstream_dmsg,
init_vgmstream_ngc_dsp_aaap, init_vgmstream_ngc_dsp_aaap,
init_vgmstream_ngc_dsp_konami, init_vgmstream_ngc_dsp_konami,
init_vgmstream_ps2_wb, init_vgmstream_wb,
init_vgmstream_bnsf, init_vgmstream_bnsf,
init_vgmstream_ps2_gcm, init_vgmstream_ps2_gcm,
init_vgmstream_smpl, init_vgmstream_smpl,

View File

@ -258,7 +258,7 @@ typedef enum {
meta_DSP_SADB, /* .sad */ meta_DSP_SADB, /* .sad */
meta_DSP_WSI, /* .wsi */ meta_DSP_WSI, /* .wsi */
meta_IDSP_TT, /* Traveller's Tales games */ meta_IDSP_TT, /* Traveller's Tales games */
meta_DSP_WII_MUS, /* .mus */ meta_MUS_KRONE,
meta_DSP_WII_WSD, /* Phantom Brave (WII) */ meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */ meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ 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_AST_MMV,
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */ 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_S14, /* raw Siren 14, 24kbit mono */
meta_SSS, /* raw Siren 14, 48kbit stereo */ meta_SSS, /* raw Siren 14, 48kbit stereo */
meta_PS2_GCM, /* NamCollection */ meta_PS2_GCM, /* NamCollection */