mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
add new extension for SGXD/WAVE
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@933 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
c829019e48
commit
0f05f28769
@ -573,4 +573,6 @@ VGMSTREAM * init_vgmstream_eb_sf0(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps3_klbs(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps3_sgx(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -73,3 +73,67 @@ fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps3_sgx(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("sgx",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);
|
||||
|
||||
if (channel_count == 5)
|
||||
goto fail;
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitLE(0x4,streamFile);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x2C,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitLE(0xC,streamFile)*28/16/channel_count;
|
||||
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_32bitLE(0x8,streamFile);
|
||||
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;
|
||||
}
|
||||
|
@ -308,6 +308,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_eb_sfx,
|
||||
init_vgmstream_eb_sf0,
|
||||
init_vgmstream_ps3_klbs,
|
||||
init_vgmstream_ps3_sgx,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2831,6 +2832,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS3_KLBS:
|
||||
snprintf(temp,TEMPSIZE,"klBS Header");
|
||||
break;
|
||||
case meta_PS3_SGX:
|
||||
snprintf(temp,TEMPSIZE,"PS3 SGXD/WAVE header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -521,6 +521,7 @@ typedef enum {
|
||||
meta_EB_SFX, // Excitebots .sfx
|
||||
meta_EB_SF0, // Excitebots .sf0
|
||||
meta_PS3_KLBS, // L@VE ONCE (PS3)
|
||||
meta_PS3_SGX,
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -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",
|
||||
"sgx\0SGX Audio File (*.SGX)\0",
|
||||
"sl3\0SL3 Audio File (*.SL3)\0",
|
||||
"sli\0SLI Audio File (*.SLI)\0",
|
||||
"smp\0SMP Audio File (*.SMP)\0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user