mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Added .PSND support for Crash Bandicoot Nitro Kart 2 (iOS)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@926 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
1af427264b
commit
e14ce06d23
@ -409,6 +409,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
if(!stricmp_utf8(p_extension,"pos")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"ps2stm")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"psh")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"psnd")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"psw")) return 1;
|
||||
|
||||
if(!stricmp_utf8(p_extension,"ras")) return 1;
|
||||
@ -712,6 +713,7 @@ DECLARE_MULTIPLE_FILE_TYPE("PONA Audio File (*.PONA)", pona);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("POS Audio File (*.POS)", pos);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("PS2STM Audio File (*.PS2STM)", ps2stm);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("PSH Audio File (*.PSH)", psh);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("PSND Audio File (*.PSND)", psnd);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("PSW Audio File (*.PSW)", psw);
|
||||
|
||||
DECLARE_MULTIPLE_FILE_TYPE("RAS Audio File (*.RAS)", ras);
|
||||
|
@ -275,7 +275,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/ps3_vawx.o \
|
||||
meta/pc_snds.o \
|
||||
meta/ps2_wmus.o \
|
||||
meta/mattel_hyperscan.o
|
||||
meta/mattel_hyperscan.o \
|
||||
meta/ios_psnd.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="libvgmstream"
|
||||
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
||||
RootNamespace="libvgmstream"
|
||||
@ -360,6 +360,10 @@
|
||||
RelativePath=".\meta\idsp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ios_psnd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ish_isd.c"
|
||||
>
|
||||
|
@ -223,5 +223,6 @@ libmeta_la_SOURCES += ps3_vawx.c
|
||||
libmeta_la_SOURCES += pc_snds.c
|
||||
libmeta_la_SOURCES += ps2_wmus.c
|
||||
libmeta_la_SOURCES += mattel_hyperscan.c
|
||||
libmeta_la_SOURCES += ios_psnd.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
76
src/meta/ios_psnd.c
Normal file
76
src/meta/ios_psnd.c
Normal file
@ -0,0 +1,76 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* PSND (from Crash Bandicoot Nitro Kart 2 (iOS) */
|
||||
VGMSTREAM * init_vgmstream_ios_psnd(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("psnd",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x50534E44) /* "PSND" */
|
||||
goto fail;
|
||||
|
||||
if (read_16bitBE(0xC,streamFile)==0x2256){
|
||||
loop_flag = 1;
|
||||
}
|
||||
else {
|
||||
loop_flag = 0;
|
||||
}
|
||||
channel_count = read_8bit(0xE,streamFile);
|
||||
|
||||
/* 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;
|
||||
|
||||
if (read_16bitBE(0xC,streamFile)==0x44AC){
|
||||
vgmstream->sample_rate = 44100;
|
||||
}
|
||||
else {
|
||||
vgmstream->sample_rate = read_16bitLE(0xC,streamFile);
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->num_samples = (read_32bitLE(0x4,streamFile)-8)/4;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 2;
|
||||
vgmstream->meta_type = meta_IOS_PSND;
|
||||
|
||||
/* 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;
|
||||
}
|
@ -563,4 +563,6 @@ VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_hyperscan_kvag(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ios_psnd(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -303,6 +303,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_pc_snds,
|
||||
init_vgmstream_ps2_wmus,
|
||||
init_vgmstream_hyperscan_kvag,
|
||||
init_vgmstream_ios_psnd,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2810,6 +2811,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_HYPERSCAN_KVAG:
|
||||
snprintf(temp,TEMPSIZE,"Mattel Hyperscan KVAG");
|
||||
break;
|
||||
case meta_IOS_PSND:
|
||||
snprintf(temp,TEMPSIZE,"PSND Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -516,6 +516,7 @@ typedef enum {
|
||||
meta_PC_SNDS, // Incredibles PC .snds
|
||||
meta_PS2_WMUS, // The Warriors (PS2)
|
||||
meta_HYPERSCAN_KVAG, // Hyperscan KVAG/BVG
|
||||
meta_IOS_PSND, // Crash Bandicoot Nitro Kart 2 (iOS)
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -156,6 +156,7 @@ gchar *vgmstream_exts [] = {
|
||||
"pos",
|
||||
"ps2stm",
|
||||
"psh",
|
||||
"psnd",
|
||||
"psw",
|
||||
|
||||
"ras",
|
||||
|
@ -224,6 +224,7 @@ char * extension_list[] = {
|
||||
"pos\0POS Audio File (*.POS)\0",
|
||||
"ps2stm\0PS2STM Audio File (*.PS2STM)\0",
|
||||
"psh\0PSH Audio File (*.PSH)\0",
|
||||
"psnd\0PSND Audio File (*.PSND)\0",
|
||||
"psw\0PSW Audio File (*.PSW)\0",
|
||||
|
||||
"ras\0RAS Audio File (*.RAS)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user