fixed ps3_past.c

fixed musx v10

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@866 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-10-12 22:22:44 +00:00
parent bbb6d6fc3c
commit f4217ef4e6
3 changed files with 23 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="libvgmstream" Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}" ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream" RootNamespace="libvgmstream"

View File

@ -282,10 +282,13 @@ VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE *streamFile) {
/* check header */ /* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */ if (read_32bitBE(0x00,streamFile) != 0x4D555358) /* "MUSX" */
goto fail; goto fail;
if (read_32bitBE(0x800,streamFile) == 0x53424E4B) /* "SBNK", */ // SoundBank, refuse
goto fail;
if (read_32bitBE(0x08,streamFile) != 0x0A000000) /* "0x0A000000" */ if (read_32bitBE(0x08,streamFile) != 0x0A000000) /* "0x0A000000" */
goto fail; goto fail;
loop_flag = (read_32bitLE(0x34,streamFile)!=0x00000000); loop_flag = ((read_32bitLE(0x34,streamFile)!=0x00000000) &&
(read_32bitLE(0x34,streamFile)!=0xABABABAB));
channel_count = 2; channel_count = 2;
musx_type=(read_32bitBE(0x10,streamFile)); musx_type=(read_32bitBE(0x10,streamFile));
@ -327,7 +330,7 @@ VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE *streamFile) {
vgmstream->channels = channel_count; vgmstream->channels = channel_count;
vgmstream->sample_rate = 32000; vgmstream->sample_rate = 32000;
vgmstream->coding_type = coding_DAT4_IMA; vgmstream->coding_type = coding_DAT4_IMA;
vgmstream->num_samples = read_32bitLE(0x40,streamFile); vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)/2/(0x20)*((0x20-4)*2);
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x20; vgmstream->interleave_block_size = 0x20;
vgmstream->meta_type = meta_MUSX_V010; vgmstream->meta_type = meta_MUSX_V010;

View File

@ -18,9 +18,8 @@ VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE *streamFile) {
if (read_32bitBE(0x0,streamFile) != 0x534E4450) /* SNDP */ if (read_32bitBE(0x0,streamFile) != 0x534E4450) /* SNDP */
goto fail; goto fail;
loop_flag = read_32bitLE(0x1C,streamFile); loop_flag = (read_32bitBE(0x1C,streamFile)!=0);
channel_count = (uint16_t)read_16bitBE(0xC,streamFile);
channel_count = 2;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
@ -34,11 +33,19 @@ VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE *streamFile) {
vgmstream->num_samples = (read_32bitBE(0x14,streamFile))/2/channel_count; vgmstream->num_samples = (read_32bitBE(0x14,streamFile))/2/channel_count;
if (loop_flag) { if (loop_flag) {
vgmstream->loop_start_sample = read_32bitBE(0x18,streamFile)/2/channel_count; vgmstream->loop_start_sample = read_32bitBE(0x18,streamFile)/2/channel_count;
vgmstream->loop_end_sample = vgmstream->num_samples; vgmstream->loop_end_sample = read_32bitBE(0x1C,streamFile)/2/channel_count;
} }
if (channel_count == 1)
{
vgmstream->layout_type = layout_none;
}
else
{
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2; vgmstream->interleave_block_size = 0x2;
}
vgmstream->meta_type = meta_PS3_PAST; vgmstream->meta_type = meta_PS3_PAST;
/* open the file for reading */ /* open the file for reading */