mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
Add .RSM extension (Bully PS2)
This commit is contained in:
parent
10aac03cd5
commit
8592aeea3d
@ -238,6 +238,7 @@ VGMSTREAM_DECLARE_FILE_TYPE("RND", rnd);
|
|||||||
VGMSTREAM_DECLARE_FILE_TYPE("RRDS", rrds);
|
VGMSTREAM_DECLARE_FILE_TYPE("RRDS", rrds);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("RSD", rsd);
|
VGMSTREAM_DECLARE_FILE_TYPE("RSD", rsd);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("RSF", rsf);
|
VGMSTREAM_DECLARE_FILE_TYPE("RSF", rsf);
|
||||||
|
VGMSTREAM_DECLARE_FILE_TYPE("RSM", rsm);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("RSTM", rstm);
|
VGMSTREAM_DECLARE_FILE_TYPE("RSTM", rstm);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("RVWS", rvws);
|
VGMSTREAM_DECLARE_FILE_TYPE("RVWS", rvws);
|
||||||
VGMSTREAM_DECLARE_FILE_TYPE("RWAR", rwar);
|
VGMSTREAM_DECLARE_FILE_TYPE("RWAR", rwar);
|
||||||
|
@ -233,7 +233,8 @@ static const char* extension_list[] = {
|
|||||||
"rrds",
|
"rrds",
|
||||||
"rsd",
|
"rsd",
|
||||||
"rsf",
|
"rsf",
|
||||||
"rstm",
|
"rsm",
|
||||||
|
"rstm", //rsm header id
|
||||||
"rvws",
|
"rvws",
|
||||||
"rwar",
|
"rwar",
|
||||||
"rwav",
|
"rwav",
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* RSTM (from Midnight Club 3, Bully - Canis Canim Edit) */
|
/* RSTM - from Rockstar games [Midnight Club 3, Bully - Canis Canim Edit (PS2)] */
|
||||||
VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
char filename[PATH_LIMIT];
|
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag = 0;
|
int loop_flag, channel_count;
|
||||||
int channel_count;
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
/* check extension (.rsm: in filelist, .rstm: renamed to header id) */
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
if ( !check_extensions(streamFile,"rsm,rstm") )
|
||||||
if (strcasecmp("rstm",filename_extension(filename))) goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* check header */
|
/* check header */
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x5253544D) /* "RSTM" */
|
if (read_32bitBE(0x00,streamFile) != 0x5253544D) /* "RSTM" */
|
||||||
@ -19,46 +17,28 @@ VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
loop_flag = (read_32bitLE(0x24,streamFile)!=0xFFFFFFFF);
|
loop_flag = (read_32bitLE(0x24,streamFile)!=0xFFFFFFFF);
|
||||||
channel_count = read_32bitLE(0x0C,streamFile);
|
channel_count = read_32bitLE(0x0C,streamFile);
|
||||||
|
start_offset = 0x800;
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
start_offset = 0x800;
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
|
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
|
||||||
vgmstream->coding_type = coding_PSX;
|
vgmstream->num_samples = ps_bytes_to_samples(read_32bitLE(0x20,streamFile),channel_count);
|
||||||
vgmstream->num_samples = read_32bitLE(0x20,streamFile)*28/16/channel_count;
|
vgmstream->loop_start_sample = ps_bytes_to_samples(read_32bitLE(0x24,streamFile),channel_count);
|
||||||
if (loop_flag) {
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x24,streamFile)*28/16/channel_count;
|
|
||||||
vgmstream->loop_end_sample = read_32bitLE(0x20,streamFile)*28/16/channel_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->interleave_block_size = 0x10;
|
vgmstream->interleave_block_size = 0x10;
|
||||||
vgmstream->meta_type = meta_PS2_RSTM;
|
vgmstream->meta_type = meta_PS2_RSTM;
|
||||||
|
|
||||||
/* open the file for reading */
|
/* open the file for reading */
|
||||||
{
|
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||||
int i;
|
goto fail;
|
||||||
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;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user