diff --git a/src/formats.c b/src/formats.c index 9d589319..e625cb3f 100644 --- a/src/formats.c +++ b/src/formats.c @@ -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"}, diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 7f20fbc5..6bfc9274 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -566,7 +566,6 @@ - @@ -598,6 +597,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 6a03b7e6..101f799e 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1519,9 +1519,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1615,6 +1612,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index 788cddf5..b00af1cd 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -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); diff --git a/src/meta/ps2_rstm.c b/src/meta/ps2_rstm.c deleted file mode 100644 index 664a2439..00000000 --- a/src/meta/ps2_rstm.c +++ /dev/null @@ -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; -} diff --git a/src/meta/rstm_rockstar.c b/src/meta/rstm_rockstar.c new file mode 100644 index 00000000..abb77086 --- /dev/null +++ b/src/meta/rstm_rockstar.c @@ -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; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 64ca770b..a038e82d 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -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, diff --git a/src/vgmstream_types.h b/src/vgmstream_types.h index 88f263ab..e83577e9 100644 --- a/src/vgmstream_types.h +++ b/src/vgmstream_types.h @@ -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,