Add blocked VS [Final Fantasy X (PS2)]

This commit is contained in:
bnnm 2018-10-20 15:30:46 +02:00
parent 17d2a096b8
commit 33aa532c34
11 changed files with 112 additions and 6 deletions

View File

@ -686,6 +686,7 @@ static const layout_info layout_info_list[] = {
{layout_blocked_sthd, "blocked (STHD)"},
{layout_blocked_h4m, "blocked (H4M)"},
{layout_blocked_xa_aiff, "blocked (XA AIFF)"},
{layout_blocked_vs_ffx, "blocked (Final Fantasy X VS)"},
};
static const meta_info meta_info_list[] = {
@ -1104,8 +1105,9 @@ static const meta_info meta_info_list[] = {
{meta_ADPCM_CAPCOM, "Capcom .ADPCM header"},
{meta_UE4OPUS, "Epic Games UE4OPUS header"},
{meta_XWMA, "Microsoft XWMA RIFF header"},
{meta_VA3, "Konami / Sony ATRAC3 Header" },
{meta_VA3, "Konami VA3 header" },
{meta_XOPUS, "Exient XOPUS header"},
{meta_VS_FFX, "Final Fantasy X VS header"},
};

View File

@ -205,6 +205,9 @@ void block_update(off_t block_offset, VGMSTREAM * vgmstream) {
case layout_blocked_xa_aiff:
block_update_xa_aiff(block_offset,vgmstream);
break;
case layout_blocked_vs_ffx:
block_update_vs_ffx(block_offset,vgmstream);
break;
default: /* not a blocked layout */
break;
}

View File

@ -0,0 +1,26 @@
#include "layout.h"
#include "../vgmstream.h"
/* Final Fantasy X VS headered blocks */
void block_update_vs_ffx(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
size_t block_size = 0x800;
/* 0x00: header id
* 0x04: null
* 0x08: block number
* 0x0c: blocks left in the subfile
* 0x10: always 0x1000
* 0x14: always 0x64
* 0x18: null
* 0x1c: null */
vgmstream->current_block_offset = block_offset;
vgmstream->current_block_size = block_size - 0x20;
vgmstream->next_block_offset = block_offset + block_size;
/* 0x08: number of remaning blocks, 0x10: some id/size? (shared in all blocks) */
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + 0x20 + 0x800*i;
}
}

View File

@ -46,6 +46,7 @@ void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_sthd(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_h4m(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_xa_aiff(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_vs_ffx(off_t block_offset, VGMSTREAM * vgmstream);
/* other layouts */
void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);

View File

@ -1190,10 +1190,14 @@
RelativePath=".\meta\ps2_voi.c"
>
</File>
<File
RelativePath=".\meta\vpk.c"
>
</File>
<File
RelativePath=".\meta\vpk.c"
>
</File>
<File
RelativePath=".\meta\vs_ffx.c"
>
</File>
<File
RelativePath=".\meta\ps2_wad.c"
>
@ -1946,6 +1950,10 @@
RelativePath=".\layout\blocked_vgs.c"
>
</File>
<File
RelativePath=".\layout\blocked_vs_ffx.c"
>
</File>
<File
RelativePath=".\layout\blocked_xvag.c"
>

View File

@ -391,6 +391,7 @@
<ClCompile Include="meta\ps2_vms.c" />
<ClCompile Include="meta\ps2_voi.c" />
<ClCompile Include="meta\vpk.c" />
<ClCompile Include="meta\vs_ffx.c" />
<ClCompile Include="meta\ps2_wad.c" />
<ClCompile Include="meta\ps2_wb.c" />
<ClCompile Include="meta\ps2_xa2.c" />
@ -534,6 +535,7 @@
<ClCompile Include="layout\blocked_awc.c" />
<ClCompile Include="layout\blocked_ea_1snh.c" />
<ClCompile Include="layout\blocked_vgs.c" />
<ClCompile Include="layout\blocked_vs_ffx.c" />
<ClCompile Include="layout\blocked_vawx.c" />
<ClCompile Include="layout\blocked_xvag.c" />
<ClCompile Include="layout\blocked_caf.c" />

View File

@ -742,6 +742,9 @@
<ClCompile Include="meta\vpk.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\vs_ffx.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_wad.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
@ -1165,6 +1168,9 @@
<ClCompile Include="layout\blocked_vgs.c">
<Filter>layout\Source Files</Filter>
</ClCompile>
<ClCompile Include="layout\blocked_vs_ffx.c">
<Filter>layout\Source Files</Filter>
</ClCompile>
<ClCompile Include="layout\blocked_vawx.c">
<Filter>layout\Source Files</Filter>
</ClCompile>

View File

@ -799,4 +799,6 @@ VGMSTREAM * init_vgmstream_xwma(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_xopus(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE * streamFile);
#endif /*_META_H*/

53
src/meta/vs_ffx.c Normal file
View File

@ -0,0 +1,53 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
/* .vs/VS - from Final Fantasy X voices (PS2) */
VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int channel_count, loop_flag;
off_t start_offset;
/* checks */
/* .vs: header id (probably ok like The Bouncer's .vs, very similar) */
if (!check_extensions(streamFile, "vs"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x56530000) /* "VS\0\0" */
goto fail;
loop_flag = 0;
channel_count = 1;
start_offset = 0x00;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_VS_FFX;
vgmstream->sample_rate = 48000;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_blocked_vs_ffx;
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
/* calc num_samples */
{
vgmstream->next_block_offset = start_offset;
do {
block_update(vgmstream->next_block_offset,vgmstream);
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
}
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
block_update(start_offset, vgmstream);
}
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -444,7 +444,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_ue4opus,
init_vgmstream_xwma,
init_vgmstream_xopus,
init_vgmstream_vs_ffx,
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
@ -1018,6 +1018,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_blocked_sthd:
case layout_blocked_h4m:
case layout_blocked_xa_aiff:
case layout_blocked_vs_ffx:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_aix:

View File

@ -253,6 +253,7 @@ typedef enum {
layout_blocked_sthd, /* Dream Factory STHD */
layout_blocked_h4m, /* H4M video */
layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */
layout_blocked_vs_ffx,
/* otherwise odd */
layout_aix, /* CRI AIX's wheels within wheels */
@ -701,6 +702,7 @@ typedef enum {
meta_XWMA,
meta_VA3, /* DDR Supernova 2 AC */
meta_XOPUS,
meta_VS_FFX,
} meta_t;