mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Clean psx_gms
This commit is contained in:
parent
badf3477e3
commit
3e4f64fda8
@ -394,6 +394,7 @@ static const char* extension_list[] = {
|
||||
"sd9",
|
||||
"sdf",
|
||||
"sdt",
|
||||
"seb",
|
||||
"seg",
|
||||
"sf0",
|
||||
"sfl",
|
||||
@ -820,8 +821,8 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_PS2_VAGi, "Sony VAGi header"},
|
||||
{meta_PS2_VAGp, "Sony VAGp header"},
|
||||
{meta_PS2_pGAV, "Sony pGAV header"},
|
||||
{meta_PSX_GMS, "assumed Grandia GMS file by .gms extension"},
|
||||
{meta_STR_WAV, "Blitz Games STR+WAV header"},
|
||||
{meta_SEB, "Game Arts .SEB header"},
|
||||
{meta_STR_WAV, "Blitz Games .STR+WAV header"},
|
||||
{meta_PS2_ILD, "ILD header"},
|
||||
{meta_PS2_PNB, "assumed PNB (PsychoNauts Bgm File) by .pnb extension"},
|
||||
{meta_XBOX_WAVM, "Xbox WAVM raw header"},
|
||||
|
@ -88,7 +88,7 @@ VGMSTREAM * init_vgmstream_raw(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_vag(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_psx_gms(STREAMFILE *streamFile);
|
||||
VGMSTREAM * init_vgmstream_seb(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_ild(STREAMFILE *streamFile);
|
||||
|
||||
|
@ -1,76 +1,53 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* GMS
|
||||
|
||||
PSX GMS format has no recognition ID.
|
||||
This format was used essentially in Grandia Games but
|
||||
can be easily used by other header format as the format of the header is very simple
|
||||
|
||||
known extensions : GMS
|
||||
|
||||
2008-05-19 - Fastelbja : First version ...
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_psx_gms(STREAMFILE *streamFile) {
|
||||
/* .seb - Game Arts games [Grandia (PS1), Grandia II/III/X (PS2)] */
|
||||
VGMSTREAM * init_vgmstream_seb(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
int loop_flag=0;
|
||||
int channel_count;
|
||||
off_t start_offset;
|
||||
int i;
|
||||
int loop_flag, channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("gms",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check loop */
|
||||
loop_flag = (read_32bitLE(0x20,streamFile)==0);
|
||||
/* checks */
|
||||
/* .seb: found in Grandia II (PS2) .idx */
|
||||
/* .gms: fake? (.stz+idx bigfile without names, except in Grandia II) */
|
||||
if (!check_extensions(streamFile, "seb,gms,"))
|
||||
goto fail;
|
||||
|
||||
/* Always stereo files */
|
||||
channel_count=read_32bitLE(0x00,streamFile);
|
||||
channel_count = read_32bitLE(0x00,streamFile);
|
||||
if (channel_count > 2) goto fail; /* mono or stereo */
|
||||
/* 0x08/0c: unknown count, possibly related to looping */
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
start_offset = 0x800;
|
||||
|
||||
if (read_32bitLE(0x10,streamFile) > get_streamfile_size(streamFile) || /* loop start offset */
|
||||
read_32bitLE(0x18,streamFile) > get_streamfile_size(streamFile)) /* loop end offset */
|
||||
goto fail;
|
||||
/* in Grandia III sometimes there is a value at 0x24/34 */
|
||||
|
||||
loop_flag = (read_32bitLE(0x20,streamFile) == 0);
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->meta_type = meta_SEB;
|
||||
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitLE(0x1C,streamFile);
|
||||
|
||||
/* Get loop point values */
|
||||
if(vgmstream->loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
|
||||
}
|
||||
vgmstream->num_samples = read_32bitLE(0x1c,streamFile);
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitLE(0x1c,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x800;
|
||||
vgmstream->meta_type = meta_PSX_GMS;
|
||||
|
||||
start_offset = 0x800;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=
|
||||
(off_t)(start_offset+vgmstream->interleave_block_size*i);
|
||||
}
|
||||
}
|
||||
vgmstream->interleave_block_size = 0x800;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_mic,
|
||||
init_vgmstream_ngc_dsp_std_int,
|
||||
init_vgmstream_vag,
|
||||
init_vgmstream_psx_gms,
|
||||
init_vgmstream_seb,
|
||||
init_vgmstream_ps2_ild,
|
||||
init_vgmstream_ps2_pnb,
|
||||
init_vgmstream_xbox_wavm,
|
||||
|
@ -349,7 +349,7 @@ typedef enum {
|
||||
meta_PS2_VAGi, /* VAGi Interleaved File */
|
||||
meta_PS2_VAGp, /* VAGp Mono File */
|
||||
meta_PS2_pGAV, /* VAGp with Little Endian Header */
|
||||
meta_PSX_GMS, /* GMS File (used in PS1 & PS2) [no header_id] */
|
||||
meta_SEB,
|
||||
meta_STR_WAV, /* Blitz Games STR+WAV files */
|
||||
meta_PS2_ILD, /* ILD File */
|
||||
meta_PS2_PNB, /* PsychoNauts Bgm File */
|
||||
|
Loading…
x
Reference in New Issue
Block a user