fixed the "XIII" dsp meta

added PCM coding to NAOMI SPSD

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@794 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-05-10 08:02:22 +00:00
parent 87a52ca673
commit ad4276c7b7
9 changed files with 57 additions and 17 deletions

View File

@ -117,6 +117,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
break;
case layout_ps2_adm_blocked:
ps2_adm_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_dsp_bdsp_blocked:
dsp_bdsp_block_update(vgmstream->next_block_offset,vgmstream);
break;
default:
break;

View File

@ -62,4 +62,6 @@ void psx_mgav_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_adm_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
#endif

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream"
@ -196,6 +196,10 @@
<Filter
Name="Source Files"
>
<File
RelativePath=".\meta\#dsp_test.c"
>
</File>
<File
RelativePath=".\meta\2dx.c"
>
@ -1130,6 +1134,10 @@
RelativePath=".\layout\ast_blocked.c"
>
</File>
<File
RelativePath=".\layout\bdsp_blocked.c"
>
</File>
<File
RelativePath=".\layout\blocked.c"
>

View File

@ -503,4 +503,6 @@ VGMSTREAM * init_vgmstream_ps2_adm(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_lpcm(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_dsp_bdsp(STREAMFILE* streamFile);
#endif

View File

@ -6,6 +6,7 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int coding;
int loop_flag;
int channel_count;
@ -25,17 +26,32 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) {
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
start_offset = 0x40;
vgmstream->channels = channel_count;
vgmstream->sample_rate = (uint16_t)read_16bitLE(0x2A,streamFile);
vgmstream->coding_type = coding_AICA;
switch (read_8bit(0x8,streamFile))
{
case 0x01:
coding = coding_PCM8;
break;
case 0x03:
coding = coding_AICA;
break;
default:
goto fail;
}
vgmstream->coding_type = coding;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile);
if (loop_flag) {
#if 0
if (loop_flag)
{
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile);
}
#endif
vgmstream->interleave_block_size = 0x2000;
if (channel_count > 1) {

View File

@ -1786,8 +1786,9 @@ fail:
return NULL;
}
/* .dsp found in Ubisoft games, like "XIII", possibly more
always 2 channels and an interleave of 8 */
/* .dsp found in: Speed Challenge - Jacques Villeneuve's Racing Vision (NGC)
XIII (NGC)
always 2 channels, and an interleave of 0x8 */
VGMSTREAM * init_vgmstream_dsp_xiii(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
@ -1830,7 +1831,7 @@ VGMSTREAM * init_vgmstream_dsp_xiii(STREAMFILE *streamFile) {
ch0_header.nibble_count != ch1_header.nibble_count ||
ch0_header.sample_rate != ch1_header.sample_rate ||
ch0_header.loop_flag != ch1_header.loop_flag ||
ch0_header.loop_start_offset != ch1_header.loop_start_offset ||
//ch0_header.loop_start_offset != ch1_header.loop_start_offset ||
ch0_header.loop_end_offset != ch1_header.loop_end_offset
) goto fail;
@ -1838,7 +1839,7 @@ VGMSTREAM * init_vgmstream_dsp_xiii(STREAMFILE *streamFile) {
{
off_t loop_off;
/* check loop predictor/scale */
loop_off = ch0_header.loop_start_offset/16*8;
loop_off = 0x0; //ch0_header.loop_start_offset/16*8;
if (ch0_header.loop_ps != (uint8_t)read_8bit(ch1_start+loop_off,streamFile))
goto fail;
@ -1846,16 +1847,16 @@ VGMSTREAM * init_vgmstream_dsp_xiii(STREAMFILE *streamFile) {
goto fail;
}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(2,ch0_header.loop_flag);
vgmstream = allocate_vgmstream(2,ch1_header.loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->num_samples = ch0_header.sample_count;
vgmstream->sample_rate = ch0_header.sample_rate;
vgmstream->loop_start_sample = dsp_nibbles_to_samples(
ch0_header.loop_start_offset);
vgmstream->loop_start_sample = 0x0; //dsp_nibbles_to_samples(ch0_header.loop_start_offset);
vgmstream->loop_end_sample = dsp_nibbles_to_samples(
ch0_header.loop_end_offset)+1;

View File

@ -274,6 +274,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_dsp_cabelas,
init_vgmstream_ps2_adm,
init_vgmstream_ps2_lpcm,
init_vgmstream_dsp_bdsp,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -712,6 +713,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_ivaud_blocked:
case layout_psx_mgav_blocked:
case layout_ps2_adm_blocked:
case layout_dsp_bdsp_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_interleave_byte:
@ -1764,6 +1766,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case layout_ps2_adm_blocked:
snprintf(temp,TEMPSIZE,"ADM blocked");
break;
case layout_dsp_bdsp_blocked:
snprintf(temp,TEMPSIZE,"DSP blocked");
break;
#ifdef VGM_USE_MPEG
case layout_fake_mpeg:
snprintf(temp,TEMPSIZE,"MPEG Audio stream with incorrect frame headers");

View File

@ -150,6 +150,7 @@ typedef enum {
layout_mxch_blocked,
layout_psx_mgav_blocked,
layout_ps2_adm_blocked,
layout_dsp_bdsp_blocked,
#if 0
layout_strm_blocked, /* */
#endif
@ -469,6 +470,7 @@ typedef enum {
meta_DSP_CABELAS, /* Cabelas games */
meta_PS2_ADM, /* Dragon Quest 5 */
meta_PS2_LPCM, /* Ah! My Goddess */
meta_DSP_BDSP, /* Ah! My Goddess */
} meta_t;
typedef struct {

View File

@ -104,6 +104,7 @@ char * extension_list[] = {
"b1s\0B1S Audio File (*.B1S)\0",
"baka\0BAKA Audio File (*.BAKA)\0",
"bdsp\0BDSP Audio File (*.BDSP)\0",
"bg00\0BG00 Audio File (*.BG00)\0",
"bgw\0BGW Audio File (*.BGW)\0",
"bh2pcm\0BH2PCM Audio File (*.BH2PCM)\0",