cleanup: ps2_rstm to rstm_rockstar

This commit is contained in:
bnnm 2023-06-25 16:18:02 +02:00
parent 803db193b7
commit d18e9b5b35
8 changed files with 55 additions and 52 deletions

View File

@ -1060,7 +1060,7 @@ static const meta_info meta_info_list[] = {
{meta_SAT_DVI, "Konami KCEN DVI. header"},
{meta_DC_KCEY, "Konami KCEY KCEYCOMP header"},
{meta_BG00, "Falcom BG00 Header"},
{meta_PS2_RSTM, "Rockstar Games RSTM Header"},
{meta_RSTM_ROCKSTAR, "Rockstar Games RSTM Header"},
{meta_ACM, "InterPlay ACM Header"},
{meta_MUS_ACM, "InterPlay MUS ACM header"},
{meta_PS2_KCES, "Konami KCES Header"},

View File

@ -566,7 +566,6 @@
<ClCompile Include="meta\ps2_p2bt.c" />
<ClCompile Include="meta\ps2_pcm.c" />
<ClCompile Include="meta\ps2_rnd.c" />
<ClCompile Include="meta\ps2_rstm.c" />
<ClCompile Include="meta\ps2_sl3.c" />
<ClCompile Include="meta\ps2_snd.c" />
<ClCompile Include="meta\ps2_sps.c" />
@ -598,6 +597,7 @@
<ClCompile Include="meta\rkv.c" />
<ClCompile Include="meta\rs03.c" />
<ClCompile Include="meta\rsd.c" />
<ClCompile Include="meta\rstm_rockstar.c" />
<ClCompile Include="meta\rwax.c" />
<ClCompile Include="meta\rws.c" />
<ClCompile Include="meta\rwsd.c" />

View File

@ -1519,9 +1519,6 @@
<ClCompile Include="meta\ps2_rnd.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_rstm.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_sl3.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
@ -1615,6 +1612,9 @@
<ClCompile Include="meta\rsd.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\rstm_rockstar.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\rwax.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -233,7 +233,7 @@ VGMSTREAM * init_vgmstream_bg00(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_dc_kcey(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE * streamFile);
VGMSTREAM* init_vgmstream_rstm_rockstar(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_acm(STREAMFILE * streamFile);

View File

@ -1,44 +0,0 @@
#include "meta.h"
#include "../coding/coding.h"
/* RSTM - from Rockstar games [Midnight Club 3, Bully - Canis Canim Edit (PS2)] */
VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* check extension (.rsm: in filelist, .rstm: renamed to header id) */
if ( !check_extensions(streamFile,"rsm,rstm") )
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x5253544D) /* "RSTM" */
goto fail;
loop_flag = (read_32bitLE(0x24,streamFile)!=0xFFFFFFFF);
channel_count = read_32bitLE(0x0C,streamFile);
start_offset = 0x800;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->num_samples = ps_bytes_to_samples(read_32bitLE(0x20,streamFile),channel_count);
vgmstream->loop_start_sample = ps_bytes_to_samples(read_32bitLE(0x24,streamFile),channel_count);
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_PS2_RSTM;
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

47
src/meta/rstm_rockstar.c Normal file
View File

@ -0,0 +1,47 @@
#include "meta.h"
#include "../coding/coding.h"
/* RSTM - from Rockstar games [Midnight Club 3, Bully - Canis Canim Edit (PS2)] */
VGMSTREAM* init_vgmstream_rstm_rockstar(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
uint32_t start_offset;
int channels, loop_flag;
/* checks */
if (!is_id32be(0x00, sf, "RSTM"))
return NULL;
/* .rsm: in filelist
* .rstm: header id */
if (!check_extensions(sf,"rsm,rstm"))
return NULL;
loop_flag = (read_s32le(0x24,sf) > 0);
channels = read_s32le(0x0C,sf);
start_offset = 0x800;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_RSTM_ROCKSTAR;
vgmstream->sample_rate = read_s32le(0x08,sf);
vgmstream->num_samples = ps_bytes_to_samples(read_u32le(0x20,sf),channels);
vgmstream->loop_start_sample = ps_bytes_to_samples(read_u32le(0x24,sf),channels);
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, sf, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -91,7 +91,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_bg00,
init_vgmstream_sat_dvi,
init_vgmstream_dc_kcey,
init_vgmstream_ps2_rstm,
init_vgmstream_rstm_rockstar,
init_vgmstream_acm,
init_vgmstream_mus_acm,
init_vgmstream_ps2_kces,

View File

@ -336,7 +336,7 @@ typedef enum {
meta_IKM,
meta_STER,
meta_BG00, /* Ibara, Mushihimesama */
meta_PS2_RSTM, /* Midnight Club 3 */
meta_RSTM_ROCKSTAR,
meta_PS2_KCES, /* Dance Dance Revolution */
meta_HXD,
meta_VSV,