mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Added initial support for SGH+SGB file pairs from Folklore (PS3)
No support for individual SGB and Non-PS ADPCM files. git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@867 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
f4217ef4e6
commit
87bc10bd82
@ -418,6 +418,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
|||||||
if(!stricmp_utf8(p_extension,"seg")) return 1;
|
if(!stricmp_utf8(p_extension,"seg")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sfl")) return 1;
|
if(!stricmp_utf8(p_extension,"sfl")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sfs")) return 1;
|
if(!stricmp_utf8(p_extension,"sfs")) return 1;
|
||||||
|
if(!stricmp_utf8(p_extension,"sgb")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sl3")) return 1;
|
if(!stricmp_utf8(p_extension,"sl3")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sli")) return 1;
|
if(!stricmp_utf8(p_extension,"sli")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"smp")) return 1;
|
if(!stricmp_utf8(p_extension,"smp")) return 1;
|
||||||
@ -703,6 +704,7 @@ DECLARE_MULTIPLE_FILE_TYPE("SDT Audio File (*.SDT)", sdt);
|
|||||||
DECLARE_MULTIPLE_FILE_TYPE("SEG Audio File (*.SEG)", seg);
|
DECLARE_MULTIPLE_FILE_TYPE("SEG Audio File (*.SEG)", seg);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SFL Audio File (*.SFL)", sfl);
|
DECLARE_MULTIPLE_FILE_TYPE("SFL Audio File (*.SFL)", sfl);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SFS Audio File (*.SFS)", sfs);
|
DECLARE_MULTIPLE_FILE_TYPE("SFS Audio File (*.SFS)", sfs);
|
||||||
|
DECLARE_MULTIPLE_FILE_TYPE("SGB Audio File (*.SGB)", sgb);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SL3 Audio File (*.SL3)", sl3);
|
DECLARE_MULTIPLE_FILE_TYPE("SL3 Audio File (*.SL3)", sl3);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SLI Audio File (*.SLI)", sli);
|
DECLARE_MULTIPLE_FILE_TYPE("SLI Audio File (*.SLI)", sli);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SMP Audio File (*.SMP)", smp);
|
DECLARE_MULTIPLE_FILE_TYPE("SMP Audio File (*.SMP)", smp);
|
||||||
|
@ -258,7 +258,8 @@ META_OBJS=meta/adx_header.o \
|
|||||||
meta/baf.o \
|
meta/baf.o \
|
||||||
meta/ps3_msf.o \
|
meta/ps3_msf.o \
|
||||||
meta/nub.o \
|
meta/nub.o \
|
||||||
meta/ps3_past.o
|
meta/ps3_past.o \
|
||||||
|
meta/ps3_sgb_sgh.o
|
||||||
|
|
||||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9,00"
|
Version="9.00"
|
||||||
Name="libvgmstream"
|
Name="libvgmstream"
|
||||||
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
||||||
RootNamespace="libvgmstream"
|
RootNamespace="libvgmstream"
|
||||||
@ -830,6 +830,10 @@
|
|||||||
RelativePath=".\meta\ps3_past.c"
|
RelativePath=".\meta\ps3_past.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\meta\ps3_sgh_sgb.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\meta\ps3_xvag.c"
|
RelativePath=".\meta\ps3_xvag.c"
|
||||||
>
|
>
|
||||||
|
@ -211,5 +211,6 @@ libmeta_la_SOURCES += baf.c
|
|||||||
libmeta_la_SOURCES += ps3_msf.c
|
libmeta_la_SOURCES += ps3_msf.c
|
||||||
libmeta_la_SOURCES += nub.c
|
libmeta_la_SOURCES += nub.c
|
||||||
libmeta_la_SOURCES += ps3_past.c
|
libmeta_la_SOURCES += ps3_past.c
|
||||||
|
libmeta_la_SOURCES += ps3_sgh_sgb.c
|
||||||
|
|
||||||
EXTRA_DIST = meta.h
|
EXTRA_DIST = meta.h
|
||||||
|
@ -537,5 +537,7 @@ VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE* streamFile);
|
VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE* streamFile);
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE* streamFile);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
76
src/meta/ps3_sgh_sgb.c
Normal file
76
src/meta/ps3_sgh_sgb.c
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#include "meta.h"
|
||||||
|
#include "../util.h"
|
||||||
|
|
||||||
|
/* SGH+SGB (from Folklore) */
|
||||||
|
VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
off_t start_offset;
|
||||||
|
STREAMFILE * streamFileSGH = NULL;
|
||||||
|
char filename[260];
|
||||||
|
char filenameSGH[260];
|
||||||
|
int i;
|
||||||
|
int channel_count;
|
||||||
|
int loop_flag;
|
||||||
|
|
||||||
|
/* check extension, case insensitive */
|
||||||
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
|
if (strcasecmp("sgb",filename_extension(filename))) goto fail;
|
||||||
|
|
||||||
|
strcpy(filenameSGH,filename);
|
||||||
|
strcpy(filenameSGH+strlen(filenameSGH)-3,"sgh");
|
||||||
|
|
||||||
|
streamFileSGH = streamFile->open(streamFile,filenameSGH,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
|
if (!streamFileSGH) goto fail;
|
||||||
|
|
||||||
|
/* check header */
|
||||||
|
if (read_32bitBE(0x00,streamFileSGH) != 0x53475844) /* "SGXD" */
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
channel_count = read_32bitLE(0x6C,streamFileSGH);
|
||||||
|
if (read_32bitBE(0x44,streamFileSGH)==0xFFFFFFFF)
|
||||||
|
loop_flag = 0;
|
||||||
|
else
|
||||||
|
loop_flag = 1;
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
/* fill in the vital statistics */
|
||||||
|
vgmstream->channels = channel_count;
|
||||||
|
vgmstream->sample_rate = read_32bitLE(0x2C,streamFileSGH);
|
||||||
|
vgmstream->num_samples = read_32bitLE(0xC,streamFileSGH)*28/32;
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
if(loop_flag) {
|
||||||
|
vgmstream->loop_start_sample = read_32bitLE(0x44,streamFileSGH);
|
||||||
|
vgmstream->loop_end_sample = read_32bitLE(0x48,streamFileSGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = 0x10;
|
||||||
|
vgmstream->meta_type = meta_PS3_SGH_SGB;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
@ -290,7 +290,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
|||||||
init_vgmstream_fsb_mpeg,
|
init_vgmstream_fsb_mpeg,
|
||||||
init_vgmstream_nub_vag,
|
init_vgmstream_nub_vag,
|
||||||
init_vgmstream_ps3_past,
|
init_vgmstream_ps3_past,
|
||||||
|
init_vgmstream_ps3_sgh_sgb,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||||
@ -2707,6 +2707,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
break;
|
break;
|
||||||
case meta_PS3_PAST:
|
case meta_PS3_PAST:
|
||||||
snprintf(temp,TEMPSIZE,"SNDP header");
|
snprintf(temp,TEMPSIZE,"SNDP header");
|
||||||
|
break;
|
||||||
|
case meta_PS3_SGH_SGB:
|
||||||
|
snprintf(temp,TEMPSIZE,"SGH+SGB SGXD header");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||||
|
@ -494,6 +494,7 @@ typedef enum {
|
|||||||
meta_PS3_MSF, /* MSF header */
|
meta_PS3_MSF, /* MSF header */
|
||||||
meta_NUB_VAG, /* VAG from Nub archives */
|
meta_NUB_VAG, /* VAG from Nub archives */
|
||||||
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
|
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
|
||||||
|
meta_PS3_SGH_SGB, /* Folklore (PS3) */
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -179,6 +179,7 @@ gchar *vgmstream_exts [] = {
|
|||||||
"seg",
|
"seg",
|
||||||
"sfl",
|
"sfl",
|
||||||
"sfs",
|
"sfs",
|
||||||
|
"sgb",
|
||||||
"sl3",
|
"sl3",
|
||||||
"sli",
|
"sli",
|
||||||
"smp",
|
"smp",
|
||||||
|
@ -246,6 +246,7 @@ char * extension_list[] = {
|
|||||||
"seg\0SEG Audio File (*.SEG)\0",
|
"seg\0SEG Audio File (*.SEG)\0",
|
||||||
"sfl\0SFL Audio File (*.SFL)\0",
|
"sfl\0SFL Audio File (*.SFL)\0",
|
||||||
"sfs\0SFS Audio File (*.SFS)\0",
|
"sfs\0SFS Audio File (*.SFS)\0",
|
||||||
|
"sgb\0SGB Audio File (*.SGB)\0",
|
||||||
"sl3\0SL3 Audio File (*.SL3)\0",
|
"sl3\0SL3 Audio File (*.SL3)\0",
|
||||||
"sli\0SLI Audio File (*.SLI)\0",
|
"sli\0SLI Audio File (*.SLI)\0",
|
||||||
"smp\0SMP Audio File (*.SMP)\0",
|
"smp\0SMP Audio File (*.SMP)\0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user