mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
Add PS2 HSF meta.
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@974 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
3d93bbf02e
commit
4ef19d3820
@ -344,6 +344,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
if(!stricmp_utf8(p_extension,"his")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"hlwav")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"hps")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"hsf")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"hwas")) return 1;
|
||||
|
||||
if(!stricmp_utf8(p_extension,"iab")) return 1;
|
||||
@ -656,6 +657,7 @@ DECLARE_MULTIPLE_FILE_TYPE("HGC1 Audio File (*.HGC1)", hgc1);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("HIS Audio File (*.HIS)", his);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("HLWAV Audio File (*.HLWAV)", hlwav);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("HALPST Audio File (*.HPS)", hps);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("HSF Audio File (*.HSF)", hsf);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("HWAS Audio File (*.HWAS)", hwas);
|
||||
|
||||
DECLARE_MULTIPLE_FILE_TYPE("IDSP Audio File (*.IDSP)", idsp);
|
||||
|
@ -284,7 +284,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/tun.o \
|
||||
meta/wpd.o \
|
||||
meta/mn_str.o \
|
||||
meta/ps2_mss.o
|
||||
meta/ps2_mss.o \
|
||||
meta/ps2_hsf.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"
|
||||
@ -658,6 +658,10 @@
|
||||
RelativePath=".\meta\ps2_hgc1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_hsf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_iab.c"
|
||||
>
|
||||
|
@ -604,4 +604,6 @@ VGMSTREAM * init_vgmstream_mn_str(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_mss(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_hsf(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
100
src/meta/ps2_hsf.c
Normal file
100
src/meta/ps2_hsf.c
Normal file
@ -0,0 +1,100 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* HSF - Found in Lowrider (PS2) - STREAM.BIN archive */
|
||||
VGMSTREAM * init_vgmstream_ps2_hsf(STREAMFILE *streamFile)
|
||||
{
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
size_t fileLength;
|
||||
size_t frequencyFlag;
|
||||
|
||||
off_t readOffset = 0;
|
||||
uint8_t testBuffer[0x10];
|
||||
off_t loopEndOffset;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("hsf",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x48534600) // "HSF"
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = 2;
|
||||
fileLength = get_streamfile_size(streamFile);
|
||||
frequencyFlag = read_32bitLE(0x08, 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 (frequencyFlag == 0x0EB3)
|
||||
{
|
||||
vgmstream->sample_rate = 44100;
|
||||
}
|
||||
else if (frequencyFlag == 0x1000)
|
||||
{
|
||||
vgmstream->sample_rate = 48000;
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = ((fileLength - 0x10) / 16 * 28) / vgmstream->channels;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x0C, streamFile);
|
||||
vgmstream->meta_type = meta_PS2_HSF;
|
||||
|
||||
if (vgmstream->loop_flag)
|
||||
{
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
|
||||
/*
|
||||
readOffset = fileLength - 0x10;
|
||||
|
||||
do
|
||||
{
|
||||
readOffset -=(off_t)read_streamfile(testBuffer, readOffset, 0x10, streamFile);
|
||||
|
||||
if (testBuffer[1] == 0x07)
|
||||
{
|
||||
loopEndOffset = readOffset + 0x10;
|
||||
vgmstream->loop_end_sample = ((loopEndOffset - 0x10) / 16 * 28) / vgmstream->channels;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (readOffset > 0);
|
||||
*/
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
@ -315,6 +315,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps3_sgd,
|
||||
init_vgmstream_mn_str,
|
||||
init_vgmstream_ps2_mss,
|
||||
init_vgmstream_ps2_hsf,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2877,6 +2878,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS2_MSS:
|
||||
snprintf(temp,TEMPSIZE,"ShellShock Nam '67 'MSCC' header");
|
||||
break;
|
||||
case meta_PS2_HSF:
|
||||
snprintf(temp,TEMPSIZE,"Lowrider 'HSF' header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -529,6 +529,7 @@ typedef enum {
|
||||
meta_WPD, // Shuffle! (PC)
|
||||
meta_MN_STR, // Mini Ninjas (PC/PS3/WII)
|
||||
meta_PS2_MSS, // ShellShock Nam '67 (PS2)
|
||||
meta_PS2_HSF, // Lowrider (PS2)
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -91,6 +91,7 @@ gchar *vgmstream_exts [] = {
|
||||
"his",
|
||||
"hlwav",
|
||||
"hps",
|
||||
"hsf",
|
||||
"hwas",
|
||||
|
||||
"iab",
|
||||
|
@ -157,6 +157,7 @@ char * extension_list[] = {
|
||||
"his\0HIS Audio File (*.HIS)\0",
|
||||
"hlwav\0HLWAV Audio File (*.HLWAV)\0",
|
||||
"hps\0HALPST Audio File (*.HPS)\0",
|
||||
"hsf\0HSF Audio File (*.HSF)\0",
|
||||
"hwas\0HWAS Audio File (*.HWAS)\0",
|
||||
|
||||
"iab\0IAB Audio File (*.IAB)\0",
|
||||
|
Loading…
Reference in New Issue
Block a user