Add SGD file type, an SGH/SGB style file [Boku no Natsuyasumi 3 (PS3)].

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@956 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
snakemeat 2011-05-31 15:01:04 +00:00
parent a4c132bddc
commit 2b1a89dfd7
7 changed files with 73 additions and 3 deletions

View File

@ -444,6 +444,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"sfs")) return 1;
if(!stricmp_utf8(p_extension,"sfx")) return 1;
if(!stricmp_utf8(p_extension,"sgb")) return 1;
if(!stricmp_utf8(p_extension,"sgd")) return 1;
if(!stricmp_utf8(p_extension,"sl3")) return 1;
if(!stricmp_utf8(p_extension,"sli")) return 1;
if(!stricmp_utf8(p_extension,"smp")) return 1;
@ -753,6 +754,7 @@ DECLARE_MULTIPLE_FILE_TYPE("SFL Audio File (*.SFL)", sfl);
DECLARE_MULTIPLE_FILE_TYPE("SFS Audio File (*.SFS)", sfs);
DECLARE_MULTIPLE_FILE_TYPE("SFX Audio File (*.SFX)", sfx);
DECLARE_MULTIPLE_FILE_TYPE("SGB Audio File (*.SGB)", sgb);
DECLARE_MULTIPLE_FILE_TYPE("SGD Audio File (*.SGD)", sgd);
DECLARE_MULTIPLE_FILE_TYPE("SL3 Audio File (*.SL3)", sl3);
DECLARE_MULTIPLE_FILE_TYPE("SLI Audio File (*.SLI)", sli);
DECLARE_MULTIPLE_FILE_TYPE("SMP Audio File (*.SMP)", smp);

View File

@ -594,4 +594,6 @@ VGMSTREAM * init_vgmstream_tun(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_wpd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sgd(STREAMFILE* streamFile);
#endif

View File

@ -70,7 +70,8 @@ VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE *streamFile) {
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
if (streamFileSGH) close_streamfile(streamFileSGH);
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
@ -132,6 +133,68 @@ VGMSTREAM * init_vgmstream_ps3_sgx(STREAMFILE *streamFile) {
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
VGMSTREAM * init_vgmstream_ps3_sgd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("sgd",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x53475844) /* "SGXD" */
goto fail;
loop_flag = (read_32bitLE(0x44,streamFile) != 0xFFFFFFFF);
channel_count = read_8bit(0x29,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x8,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x2C,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x40,streamFile)/16/channel_count*28;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x44,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x48,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_8bit(0x39,streamFile); // just a guess, all of my samples seem to be 0x10 interleave
vgmstream->meta_type = meta_PS3_SGX;
/* 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

@ -312,6 +312,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_mtaf,
init_vgmstream_tun,
init_vgmstream_wpd,
init_vgmstream_ps3_sgd,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))

View File

@ -520,7 +520,7 @@ typedef enum {
meta_EB_SFX, // Excitebots .sfx
meta_EB_SF0, // Excitebots .sf0
meta_PS3_KLBS, // L@VE ONCE (PS3)
meta_PS3_SGX,
meta_PS3_SGX, // Boku no Natsuyasumi 3 (PS3)
meta_PS2_MTAF, // Metal Gear Solid 3 MTAF
meta_PS2_VAG1, // Metal Gear Solid 3 VAG1
meta_PS2_VAG2, // Metal Gear Solid 3 VAG2

View File

@ -190,6 +190,7 @@ gchar *vgmstream_exts [] = {
"sfs",
"sfx",
"sgb",
"sgd",
"sl3",
"sli",
"smp",

View File

@ -259,6 +259,7 @@ char * extension_list[] = {
"sfs\0SFS Audio File (*.SFS)\0",
"sfx\0SFX Audio File (*.SFX)\0",
"sgb\0SGB Audio File (*.SGB)\0",
"sgd\0SGD Audio File (*.SGD)\0",
"sgx\0SGX Audio File (*.SGX)\0",
"sl3\0SL3 Audio File (*.SL3)\0",
"sli\0SLI Audio File (*.SLI)\0",