mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
cleanup: ps2_msa to msa
This commit is contained in:
parent
e1c7c38093
commit
a4484b5082
@ -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"},
|
||||
|
@ -484,6 +484,7 @@
|
||||
<ClCompile Include="meta\mp4.c" />
|
||||
<ClCompile Include="meta\mp4_faac.c" />
|
||||
<ClCompile Include="meta\mpeg.c" />
|
||||
<ClCompile Include="meta\msa.c" />
|
||||
<ClCompile Include="meta\msb_msh.c" />
|
||||
<ClCompile Include="meta\msf.c" />
|
||||
<ClCompile Include="meta\msf_banpresto.c" />
|
||||
@ -562,7 +563,6 @@
|
||||
<ClCompile Include="meta\ps2_mcg.c" />
|
||||
<ClCompile Include="meta\ps2_mic.c" />
|
||||
<ClCompile Include="meta\ps2_mihb.c" />
|
||||
<ClCompile Include="meta\ps2_msa.c" />
|
||||
<ClCompile Include="meta\ps2_p2bt.c" />
|
||||
<ClCompile Include="meta\ps2_pcm.c" />
|
||||
<ClCompile Include="meta\ps2_rnd.c" />
|
||||
@ -599,9 +599,9 @@
|
||||
<ClCompile Include="meta\rsd.c" />
|
||||
<ClCompile Include="meta\rstm_rockstar.c" />
|
||||
<ClCompile Include="meta\rwax.c" />
|
||||
<ClCompile Include="meta\rwsd.c" />
|
||||
<ClCompile Include="meta\rws_809.c" />
|
||||
<ClCompile Include="meta\rws_80d.c" />
|
||||
<ClCompile Include="meta\rwsd.c" />
|
||||
<ClCompile Include="meta\rxws.c" />
|
||||
<ClCompile Include="meta\s3v.c" />
|
||||
<ClCompile Include="meta\sab.c" />
|
||||
|
@ -1273,6 +1273,9 @@
|
||||
<ClCompile Include="meta\mpeg.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\msa.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\msb_msh.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1507,9 +1510,6 @@
|
||||
<ClCompile Include="meta\ps2_mihb.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_msa.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\ps2_p2bt.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -1618,15 +1618,15 @@
|
||||
<ClCompile Include="meta\rwax.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rwsd.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rws_809.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rws_80d.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rwsd.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\rxws.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -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);
|
||||
|
||||
|
62
src/meta/msa.c
Normal file
62
src/meta/msa.c
Normal file
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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,
|
||||
|
@ -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) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user