.IDSP added (Chronicles of Narnia Wii)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@436 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-09-23 05:13:53 +00:00
parent 7a12a632cf
commit 021d10a4ac
9 changed files with 201 additions and 36 deletions

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="9,00"
Name="ext_libs"
ProjectGUID="{10E6BFC6-1E5B-46E4-BA42-F04DFBD0ABFF}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@ -58,30 +59,6 @@
<References>
</References>
<Files>
<File
RelativePath=".\libvorbis.def"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libvorbis.def /machine:x86"
Outputs="libvorbis.lib libvorbis.exp"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libvorbis.def /machine:x86"
Outputs="libvorbis.lib libvorbis.exp"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\libmpg123-0.dll.def"
>
@ -91,7 +68,7 @@
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libmpg123-0.def /machine:x86"
CommandLine="lib /def:libmpg123-0.def /machine:x86&#x0D;&#x0A;"
Outputs="libmpg123-0.lib libmpg123-0.exp"
/>
</FileConfiguration>
@ -101,11 +78,35 @@
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libmpg123-0.def /machine:x86"
CommandLine="lib /def:libmpg123-0.def /machine:x86&#x0D;&#x0A;"
Outputs="libmpg123-0.lib libmpg123-0.exp"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\libvorbis.def"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libvorbis.def /machine:x86&#x0D;&#x0A;"
Outputs="libvorbis.lib libvorbis.exp"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Building library stub"
CommandLine="lib /def:libvorbis.def /machine:x86&#x0D;&#x0A;"
Outputs="libvorbis.lib libvorbis.exp"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>

View File

@ -275,6 +275,10 @@
RelativePath=".\meta\halpst.c"
>
</File>
<File
RelativePath=".\meta\idsp.c"
>
</File>
<File
RelativePath=".\meta\ivb.c"
>

79
src/meta/idsp.c Normal file
View File

@ -0,0 +1,79 @@
#include "meta.h"
#include "../util.h"
/* IDSP (Chronicles of Narnia, Super Mario Strikers) */
VGMSTREAM * init_vgmstream_idsp(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("idsp",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x49445350) /* "IDSP" */
goto fail;
loop_flag = 0;
channel_count = read_32bitBE(0x04,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0xD0;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x28,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x20,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitBE(0x20,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x0C,streamFile);
vgmstream->meta_type = meta_IDSP;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x3C+i*2,streamFile);
}
if (vgmstream->channels) {
for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x9C+i*2,streamFile);
}
}
}
/* 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;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -223,4 +223,6 @@ VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_xa2(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_idsp(STREAMFILE * streamFile);
#endif

78
src/meta/ngc_str.c Normal file
View File

@ -0,0 +1,78 @@
#include "meta.h"
#include "../util.h"
/* STR (Final Fantasy - Crystal Chronicles) */
VGMSTREAM * init_vgmstream_ngc_ffcc(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("str",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x53545200) /* "STR\0" */
goto fail;
loop_flag = read_32bitBE(0x0C,streamFile);
channel_count = read_32bitBE(0x18,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x1000;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = (read_32bitBE(0x08,streamFile)-0x1000);
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitBE(0x0C,streamFile)-0x1000);
vgmstream->loop_end_sample = (read_32bitBE(0x08,streamFile)-0x1000);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x1000;
vgmstream->meta_type = meta_NGC_FFCC;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x20+i*2,streamFile);
}
if (vgmstream->channels) {
for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x4E +i*2,streamFile);
}
}
}
/* 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;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -127,6 +127,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_kraw,
init_vgmstream_ps2_omu,
init_vgmstream_ps2_xa2,
init_vgmstream_idsp,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))

View File

@ -233,6 +233,7 @@ typedef enum {
meta_KRAW, /* Geometry Wars - Galaxies */
meta_PS2_OMU, /* PS2 Int file with Header */
meta_PS2_XA2, /* XA2 XG3 file */
meta_IDSP, /* Chronicles of Narnia */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvgmstream", "src\libvgmstream.vcproj", "{54A6AD11-5369-4895-A06F-E255ABB99B11}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "in_vgmstream", "winamp\in_vgmstream.vcproj", "{42D86561-8CE4-40F5-86CE-58C986B77502}"

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="9,00"
Name="in_vgmstream"
ProjectGUID="{42D86561-8CE4-40F5-86CE-58C986B77502}"
RootNamespace="in_vgmstream"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@ -64,6 +65,8 @@
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@ -84,9 +87,6 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -140,6 +140,8 @@
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@ -160,9 +162,6 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>