Fix ds2 samples

This commit is contained in:
bnnm 2019-02-18 00:53:59 +01:00
parent ac4aae7fce
commit ce07e6af9e

View File

@ -223,7 +223,7 @@ static VGMSTREAM * init_vgmstream_dsp_common(STREAMFILE *streamFile, dsp_meta *d
if (dspm->fix_looping && vgmstream->loop_end_sample > vgmstream->num_samples)
vgmstream->loop_end_sample = vgmstream->num_samples;
if (dspm->single_header) {
if (dspm->single_header == 2) { /* double the samples */
vgmstream->num_samples /= dspm->channel_count;
vgmstream->loop_start_sample /= dspm->channel_count;
vgmstream->loop_end_sample /= dspm->channel_count;
@ -517,14 +517,13 @@ VGMSTREAM * init_vgmstream_ngc_mpdsp(STREAMFILE *streamFile) {
if (!check_extensions(streamFile, "mpdsp"))
goto fail;
/* at 0x48 is extra data that could help differenciating these DSPs, but other games
* put similar stuff there, needs more checks (ex. Battallion Wars, Army Men) */
//0x00005300 60A94000 64FF1200 00000000 00000000 00000000
/* at 0x48 is extra data that could help differenciating these DSPs, but seems like
* memory garbage created by the encoder that other games also have */
/* 0x02(2): sample rate, 0x08+: channel sizes/loop offsets? */
dspm.channel_count = 2;
dspm.max_channels = 2;
dspm.single_header = 1;
dspm.single_header = 2;
dspm.header_offset = 0x00;
dspm.header_spacing = 0x00; /* same header for both channels */
@ -1204,7 +1203,7 @@ VGMSTREAM * init_vgmstream_dsp_ds2(STREAMFILE *streamFile) {
/* checks */
/* .ds2: real extension, dsp: fake/renamed */
if (!check_extensions(streamFile, "ds2"))
if (!check_extensions(streamFile, "ds2,dsp"))
goto fail;
if (!(read_32bitBE(0x50,streamFile) == 0 &&
read_32bitBE(0x54,streamFile) == 0 &&
@ -1213,8 +1212,7 @@ VGMSTREAM * init_vgmstream_dsp_ds2(STREAMFILE *streamFile) {
goto fail;
file_size = get_streamfile_size(streamFile);
channel_offset = read_32bitBE(0x5c,streamFile); /* absolute offset to 2nd channel */
/* just to make sure */
if (channel_offset < file_size / 2 || channel_offset > file_size)
if (channel_offset < file_size / 2 || channel_offset > file_size) /* just to make sure */
goto fail;
dspm.channel_count = 2;