diff --git a/src/formats.c b/src/formats.c index 1bbb26fd..29e936fc 100644 --- a/src/formats.c +++ b/src/formats.c @@ -845,7 +845,7 @@ static const coding_info coding_info_list[] = { {coding_TGC, "Tiger Game.com 4-bit ADPCM"}, {coding_NDS_PROCYON, "Procyon Studio Digital Sound Elements NDS 4-bit APDCM"}, {coding_L5_555, "Level-5 0x555 4-bit ADPCM"}, - {coding_LSF, "lsf 4-bit ADPCM"}, + {coding_LSF, "Gizmondo Studios Helsingborg LSF 4-bit ADPCM"}, {coding_MTAF, "Konami MTAF 4-bit ADPCM"}, {coding_MTA2, "Konami MTA2 4-bit ADPCM"}, {coding_MC3, "Paradigm MC3 3-bit ADPCM"}, @@ -1174,7 +1174,7 @@ static const meta_info meta_info_list[] = { {meta_SSS, "Namco .SSS raw header"}, {meta_PS2_GCM, "Namco GCM header"}, {meta_SMPL, "Skonec SMPL header"}, - {meta_PS2_MSA, "Success .MSA header"}, + {meta_MSA, "Success .MSA header"}, {meta_VOI, "Irem .VOI header"}, {meta_NGC_PDT, "Hudson .PDT header"}, {meta_NGC_RKV, "Legacy of Kain - Blood Omen 2 RKV GC header"}, @@ -1208,7 +1208,7 @@ static const meta_info meta_info_list[] = { {meta_VGS_PS, "Princess Soft VGS header"}, {meta_PS2_IAB, "Runtime .IAB header"}, {meta_VS_STR, "Square .VS STRx header"}, - {meta_LSF_N1NJ4N, ".lsf !n1nj4n header"}, + {meta_LSF_N1NJ4N, "Gizmondo Studios Helsingborg LSF header"}, {meta_XWAV, "feelplus XWAV header"}, {meta_RAW_SNDS, "PC .snds raw header"}, {meta_PS2_WMUS, "assumed The Warriors Sony ADPCM by .wmus extension"}, diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index c4513674..8411cadd 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -484,6 +484,7 @@ + @@ -562,7 +563,6 @@ - @@ -599,9 +599,9 @@ + - diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 202b8f69..f774e7d4 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1273,6 +1273,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files @@ -1507,9 +1510,6 @@ meta\Source Files - - meta\Source Files - meta\Source Files @@ -1618,15 +1618,15 @@ meta\Source Files + + meta\Source Files + meta\Source Files meta\Source Files - - meta\Source Files - meta\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index a6a9fd93..cd4e0c19 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -443,7 +443,7 @@ VGMSTREAM * init_vgmstream_ps2_gcm(STREAMFILE* streamFile); VGMSTREAM* init_vgmstream_smpl(STREAMFILE* sf); -VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE* streamFile); +VGMSTREAM* init_vgmstream_msa(STREAMFILE* sf); VGMSTREAM* init_vgmstream_voi(STREAMFILE* sf); diff --git a/src/meta/msa.c b/src/meta/msa.c new file mode 100644 index 00000000..2c8683d9 --- /dev/null +++ b/src/meta/msa.c @@ -0,0 +1,62 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* MSA - from Sucess games [Psyvariar -Complete Edition- (PS2), Konohana Pack: 3tsu no Jikenbo (PS2)]*/ +VGMSTREAM* init_vgmstream_msa(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + uint32_t start_offset, data_size, channel_size, file_size; + int loop_flag, channels; + + + /* checks */ + if (read_u32be(0x00,sf) != 0x00000000 || read_u32be(0x08,sf) != 0x00000000) + return NULL; + if (!check_extensions(sf, "msa")) + return NULL; + + loop_flag = 0; + channels = 2; + start_offset = 0x14; + + file_size = get_streamfile_size(sf); + data_size = read_u32le(0x04,sf); /* wrong, see below */ + channel_size = read_u32le(0x0c,sf); /* also wrong like data_size */ + + if (!ps_check_format(sf, start_offset, 0x100)) + return NULL; + + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channels, loop_flag); + if (!vgmstream) goto fail; + + vgmstream->meta_type = meta_MSA; + vgmstream->sample_rate = read_s32le(0x10,sf); + if (vgmstream->sample_rate == 0) /* ex. Psyvariar's AME.MSA */ + vgmstream->sample_rate = 44100; + vgmstream->num_samples = ps_bytes_to_samples(data_size, channels); + + vgmstream->coding_type = coding_PSX; + vgmstream->layout_type = layout_interleave; + + if (channel_size) /* Konohana Pack */ + vgmstream->interleave_block_size = 0x6000; + else /* Psyvariar */ + vgmstream->interleave_block_size = 0x4000; + + /* MSAs are strangely truncated, so manually calculate samples. + * Data after last usable block is always silence or garbage. */ + if (data_size > file_size) { + uint32_t usable_size = file_size - start_offset; + usable_size -= usable_size % (vgmstream->interleave_block_size * channels); /* block-aligned */ + vgmstream->num_samples = ps_bytes_to_samples(usable_size, channels); + } + + if (!vgmstream_open_stream(vgmstream, sf, start_offset)) + goto fail; + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/ps2_msa.c b/src/meta/ps2_msa.c deleted file mode 100644 index c54146b5..00000000 --- a/src/meta/ps2_msa.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "meta.h" -#include "../coding/coding.h" - -/* MSA - from Sucess games [Psyvariar -Complete Edition- (PS2), Konohana Pack: 3tsu no Jikenbo (PS2)]*/ -VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE *streamFile) { - VGMSTREAM * vgmstream = NULL; - off_t start_offset; - int loop_flag, channel_count; - size_t data_size, channel_size, file_size; - - - /* checks */ - if (!check_extensions(streamFile, "msa")) - goto fail; - if (read_32bitBE(0x00,streamFile) != 0x00000000) - goto fail; - if (read_32bitBE(0x08,streamFile) != 0x00000000) - goto fail; - - loop_flag = 0; - channel_count = 2; - start_offset = 0x14; - - file_size = get_streamfile_size(streamFile); - data_size = read_32bitLE(0x04,streamFile); /* wrong, see below */ - channel_size = read_32bitLE(0x0c,streamFile); /* also wrong like data_size */ - - - /* build the VGMSTREAM */ - vgmstream = allocate_vgmstream(channel_count,loop_flag); - if (!vgmstream) goto fail; - - vgmstream->meta_type = meta_PS2_MSA; - vgmstream->sample_rate = read_32bitLE(0x10,streamFile); - if (vgmstream->sample_rate == 0) /* ex. Psyvariar's AME.MSA */ - vgmstream->sample_rate = 44100; - vgmstream->num_samples = ps_bytes_to_samples(data_size, channel_count); - - vgmstream->coding_type = coding_PSX; - vgmstream->layout_type = layout_interleave; - - if (channel_size) /* Konohana Pack */ - vgmstream->interleave_block_size = 0x6000; - else /* Psyvariar */ - vgmstream->interleave_block_size = 0x4000; - /* (could also test first frame in various interleaves, as it's always 0'ed) */ - - /* MSAs are strangely truncated, so manually calculate samples. - * Data after last usable block is always silence or garbage. */ - if (data_size > file_size) { - off_t usable_size = file_size - start_offset; - usable_size -= usable_size % (vgmstream->interleave_block_size*channel_count);/* block-aligned */ - vgmstream->num_samples = ps_bytes_to_samples(usable_size, channel_count);//usable_size * 28 / (16*channel_count); - } - - if (!vgmstream_open_stream(vgmstream, streamFile, start_offset)) - goto fail; - return vgmstream; - -fail: - close_vgmstream(vgmstream); - return NULL; -} diff --git a/src/vgmstream.c b/src/vgmstream.c index 958120af..a7261338 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -206,7 +206,7 @@ init_vgmstream_t init_vgmstream_functions[] = { init_vgmstream_bnsf, init_vgmstream_ps2_gcm, init_vgmstream_smpl, - init_vgmstream_ps2_msa, + init_vgmstream_msa, init_vgmstream_voi, init_vgmstream_ngc_rkv, init_vgmstream_dsp_ddsp, diff --git a/src/vgmstream_types.h b/src/vgmstream_types.h index 37d1a786..2e75428c 100644 --- a/src/vgmstream_types.h +++ b/src/vgmstream_types.h @@ -461,7 +461,7 @@ typedef enum { meta_SSS, /* raw Siren 14, 48kbit stereo */ meta_PS2_GCM, /* NamCollection */ meta_SMPL, - meta_PS2_MSA, /* Psyvariar -Complete Edition- */ + meta_MSA, meta_VOI, meta_P3D, /* Prototype P3D */ meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */