mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Redo Infernal Engine .smp [Ghostbusters (multi)]
This commit is contained in:
parent
113ff85f58
commit
be9399b370
@ -907,7 +907,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_PS2_JOE, "Asobo Studio .JOE header"},
|
||||
{meta_VGS, "Guitar Hero VGS Header"},
|
||||
{meta_DC_DCSW_DCS, "Evil Twin DCS file with helper"},
|
||||
{meta_WII_SMP, "SMP DSP Header"},
|
||||
{meta_SMP, "Infernal Engine .smp header"},
|
||||
{meta_MUL, "Crystal Dynamics .MUL header"},
|
||||
{meta_THP, "THP Movie File Format Header"},
|
||||
{meta_STS_WII, "Shikigami no Shiro (WII) Header"},
|
||||
@ -969,7 +969,6 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_PS2_GCM, "GCM 'MCG' Header"},
|
||||
{meta_PS2_SMPL, "Homura SMPL header"},
|
||||
{meta_PS2_MSA, "Success .MSA header"},
|
||||
{meta_PC_SMP, "Ghostbusters .smp Header"},
|
||||
{meta_NGC_PDT, "Hudson .PDT header"},
|
||||
{meta_NGC_RKV, "Legacy of Kain - Blood Omen 2 RKV GC header"},
|
||||
{meta_DSP_DDSP, ".DDSP header"},
|
||||
|
@ -922,10 +922,6 @@
|
||||
RelativePath=".\meta\pc_mxst.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\pc_smp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\pc_snds.c"
|
||||
>
|
||||
@ -1390,6 +1386,10 @@
|
||||
RelativePath=".\meta\smc_smh.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\smp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\smv.c"
|
||||
>
|
||||
@ -1550,10 +1550,6 @@
|
||||
RelativePath=".\meta\wii_ras.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\wii_smp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\wii_sng.c"
|
||||
>
|
||||
|
@ -336,7 +336,6 @@
|
||||
<ClCompile Include="meta\p3d.c" />
|
||||
<ClCompile Include="meta\pc_al2.c" />
|
||||
<ClCompile Include="meta\pc_mxst.c" />
|
||||
<ClCompile Include="meta\pc_smp.c" />
|
||||
<ClCompile Include="meta\sab.c" />
|
||||
<ClCompile Include="meta\pc_xa30.c" />
|
||||
<ClCompile Include="meta\pcm_sre.c" />
|
||||
@ -434,6 +433,7 @@
|
||||
<ClCompile Include="meta\sfl.c" />
|
||||
<ClCompile Include="meta\sli.c" />
|
||||
<ClCompile Include="meta\smc_smh.c" />
|
||||
<ClCompile Include="meta\smp.c" />
|
||||
<ClCompile Include="meta\smv.c" />
|
||||
<ClCompile Include="meta\sps_n1.c" />
|
||||
<ClCompile Include="meta\spt_spd.c" />
|
||||
@ -466,7 +466,6 @@
|
||||
<ClCompile Include="meta\wii_04sw.c" />
|
||||
<ClCompile Include="meta\wii_bns.c" />
|
||||
<ClCompile Include="meta\wii_mus.c" />
|
||||
<ClCompile Include="meta\wii_smp.c" />
|
||||
<ClCompile Include="meta\wii_sng.c" />
|
||||
<ClCompile Include="meta\wii_sts.c" />
|
||||
<ClCompile Include="meta\ws_aud.c" />
|
||||
|
@ -565,9 +565,6 @@
|
||||
<ClCompile Include="meta\pc_mxst.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\pc_smp.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\sab.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -859,6 +856,9 @@
|
||||
<ClCompile Include="meta\smc_smh.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\smp.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\smv.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -955,9 +955,6 @@
|
||||
<ClCompile Include="meta\wii_mus.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\wii_smp.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\wii_sng.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -360,8 +360,6 @@ VGMSTREAM * init_vgmstream_vgs(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_dc_dcsw_dcs(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_wii_smp(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_mul(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_thp(STREAMFILE *streamFile);
|
||||
@ -476,8 +474,6 @@ VGMSTREAM * init_vgmstream_ps2_voi(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_khv(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_pc_smp(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ngc_rkv(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_p3d(STREAMFILE* streamFile);
|
||||
@ -827,4 +823,6 @@ VGMSTREAM * init_vgmstream_nus3audio(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_imc(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_imc_container(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_smp(STREAMFILE * streamFile);
|
||||
|
||||
#endif /*_META_H*/
|
||||
|
@ -1,93 +0,0 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* .smp file, with MS ADPCM. From Ghostbusters (PC). */
|
||||
|
||||
VGMSTREAM * init_vgmstream_pc_smp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
int channel_count;
|
||||
off_t start_offset;
|
||||
int interleave;
|
||||
|
||||
int loop_flag = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("smp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* 6? */
|
||||
if (6 != read_32bitLE(0,streamFile)) goto fail;
|
||||
if (0 != read_32bitLE(0x14,streamFile)) goto fail;
|
||||
if (4 != read_32bitLE(0x24,streamFile)) goto fail;
|
||||
if (4 != read_32bitLE(0x2C,streamFile)) goto fail;
|
||||
|
||||
start_offset = read_32bitLE(0x1c, streamFile);
|
||||
/* check body start + body size = total size */
|
||||
if (start_offset + read_32bitLE(0x20,streamFile) != get_streamfile_size(streamFile)) goto fail;
|
||||
|
||||
/* might also be codec id? */
|
||||
channel_count = read_32bitLE(0x28,streamFile);
|
||||
if (channel_count != 1 && channel_count != 2) goto fail;
|
||||
|
||||
/* verify MS ADPCM codec setup */
|
||||
{
|
||||
int i;
|
||||
/* coefficients and statement of 0x100 samples per block?? */
|
||||
static const uint8_t ms_setup[0x20] = {
|
||||
0x00,0x01,0x07,0x00,0x00,0x01,0x00,0x00,
|
||||
0x00,0x02,0x00,0xFF,0x00,0x00,0x00,0x00,
|
||||
0xC0,0x00,0x40,0x00,0xF0,0x00,0x00,0x00,
|
||||
0xCC,0x01,0x30,0xFF,0x88,0x01,0x18,0xFF};
|
||||
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
if ((uint8_t)read_8bit(0x34+i,streamFile) != ms_setup[i]) goto fail;
|
||||
}
|
||||
|
||||
/* verify padding */
|
||||
for (i = 0x20; i+0x34 < start_offset; i++)
|
||||
{
|
||||
if (read_8bit(0x34+i,streamFile) != 0) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = read_32bitLE(0x18,streamFile);
|
||||
vgmstream->sample_rate = read_32bitLE(0x30,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_MSADPCM;
|
||||
vgmstream->layout_type = layout_none; // MS ADPCM does own interleave
|
||||
interleave = 0x86*channel_count;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
|
||||
vgmstream->meta_type = meta_PC_SMP;
|
||||
|
||||
/* open the file, set up each channel */
|
||||
{
|
||||
int i;
|
||||
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = vgmstream->ch[0].streamfile;
|
||||
vgmstream->ch[i].offset = vgmstream->ch[i].channel_start_offset =
|
||||
start_offset;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
130
src/meta/smp.c
Normal file
130
src/meta/smp.c
Normal file
@ -0,0 +1,130 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
|
||||
/* .smp - Terminal Reality's Infernal Engine 'samples' [Ghostbusters: The Video Game (PS2/PS3/X360/PC/PSP), Chandragupta (PS2/PSP)] */
|
||||
VGMSTREAM * init_vgmstream_smp(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count, sample_rate, codec, version, num_samples, bps;
|
||||
size_t data_size;
|
||||
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "smp"))
|
||||
goto fail;
|
||||
|
||||
version = read_32bitLE(0x00,streamFile);
|
||||
if (version != 0x05 && /* Ghostbusters (PS2), Mushroom Men (Wii) */
|
||||
version != 0x06 && /* Ghostbusters (PS3/X360/PC) */
|
||||
version != 0x07 && /* Ghostbusters (PSP) */
|
||||
version != 0x08) /* Chandragupta (PS2/PSP), Street Cricket Champions 1/2 (PSP) */
|
||||
goto fail;
|
||||
|
||||
/* 0x04~14: guid? */
|
||||
if (read_32bitLE(0x14,streamFile) != 0) /* reserved? */
|
||||
goto fail;
|
||||
num_samples = read_32bitLE(0x18,streamFile);
|
||||
start_offset = read_32bitLE(0x1c,streamFile);
|
||||
data_size = read_32bitLE(0x20,streamFile);
|
||||
codec = read_32bitLE(0x24,streamFile);
|
||||
channel_count = read_32bitLE(0x28,streamFile);
|
||||
bps = read_32bitLE(0x2c,streamFile);
|
||||
sample_rate = read_32bitLE(0x30,streamFile);
|
||||
|
||||
loop_flag = 0;
|
||||
if (start_offset + data_size != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_SMP;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = num_samples;
|
||||
|
||||
switch(codec) {
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case 0x01: {
|
||||
uint8_t buf[0x100];
|
||||
int bytes, block_size, joint_stereo, skip_samples;
|
||||
|
||||
if (bps != 16) goto fail;
|
||||
|
||||
block_size = 0x98 * vgmstream->channels;
|
||||
joint_stereo = 0;
|
||||
skip_samples = 0; /* unknown */
|
||||
|
||||
bytes = ffmpeg_make_riff_atrac3(buf,sizeof(buf), vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, skip_samples);
|
||||
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case 0x02:
|
||||
if (bps != 4) goto fail;
|
||||
if (channel_count > 1) goto fail; /* not known */
|
||||
/* 0x34: standard DSP header, but LE */
|
||||
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_none;
|
||||
dsp_read_coefs_le(vgmstream,streamFile,0x50,0x00);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
if (bps != 4) goto fail;
|
||||
/* 0x34: standard MSADPCM coef table */
|
||||
|
||||
vgmstream->coding_type = coding_MSADPCM;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->interleave_block_size = 0x86*channel_count;
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
if (bps != 4) goto fail;
|
||||
if (channel_count > 1) goto fail; /* not known */
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_none;
|
||||
break;
|
||||
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case 0x07: {
|
||||
uint8_t buf[0x100];
|
||||
int bytes, block_size, block_count;
|
||||
|
||||
if (bps != 16) goto fail;
|
||||
/* 0x34(0x28): XMA config/table? */
|
||||
|
||||
block_size = 0x8000; /* assumed, @0x3e(2)? */
|
||||
block_count = data_size / block_size + (data_size % block_size ? 1 : 0); /* @0x54(2)? */
|
||||
|
||||
bytes = ffmpeg_make_riff_xma2(buf,0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
|
||||
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
//xma_fix_raw_samples(vgmstream, streamFile, start_offset,data_size, 0, ); //todo
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* SMP (Mushroom Men: The Spore Wars ) */
|
||||
VGMSTREAM * init_vgmstream_wii_smp(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("smp",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x05000000) /* 0x05000000 */
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x28,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitLE(0x1C,streamFile);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x30,streamFile);
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->num_samples = read_32bitLE(0x34,streamFile)/2;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x34,streamFile)/2;
|
||||
}
|
||||
|
||||
/* We have no interleave, so we have no layout */
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_WII_SMP;
|
||||
|
||||
/* 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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*Retrieving the coef table...
|
||||
This game has an exception, the coefs are stored in Little Endian... */
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<16;i++) {
|
||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitLE(0x50+i*2,streamFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -192,7 +192,6 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_joe,
|
||||
init_vgmstream_vgs,
|
||||
init_vgmstream_dc_dcsw_dcs,
|
||||
init_vgmstream_wii_smp,
|
||||
init_vgmstream_mul,
|
||||
init_vgmstream_thp,
|
||||
init_vgmstream_wii_sts,
|
||||
@ -255,7 +254,6 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_msa,
|
||||
init_vgmstream_ps2_voi,
|
||||
init_vgmstream_ps2_khv,
|
||||
init_vgmstream_pc_smp,
|
||||
init_vgmstream_ngc_rkv,
|
||||
init_vgmstream_dsp_ddsp,
|
||||
init_vgmstream_p3d,
|
||||
@ -462,6 +460,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_nus3audio,
|
||||
init_vgmstream_imc,
|
||||
init_vgmstream_imc_container,
|
||||
init_vgmstream_smp,
|
||||
|
||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||
|
@ -439,7 +439,7 @@ typedef enum {
|
||||
meta_ZWDSP, /* Zack and Wiki */
|
||||
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
|
||||
meta_DC_DCSW_DCS, /* Evil Twin - Cypriens Chronicles (DC) */
|
||||
meta_WII_SMP, /* Mushroom Men - The Spore Wars */
|
||||
meta_SMP,
|
||||
meta_WII_SNG, /* Excite Trucks */
|
||||
meta_MUL,
|
||||
meta_SAT_BAKA, /* Crypt Killer */
|
||||
@ -531,7 +531,6 @@ typedef enum {
|
||||
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
|
||||
meta_PS2_VOI, /* RAW Danger (Zettaizetsumei Toshi 2 - Itetsuita Kiokutachi) [PS2] */
|
||||
meta_PS2_KHV, /* Kingdom Hearts 2 VAG streams */
|
||||
meta_PC_SMP, /* Ghostbusters PC .smp */
|
||||
meta_P3D, /* Prototype P3D */
|
||||
meta_PS2_TK1, /* Tekken (NamCollection) */
|
||||
meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user