Fix some VAWX multichannel files

This commit is contained in:
bnnm 2017-12-09 19:01:36 +01:00
parent cb646cfbde
commit cc8256d178
7 changed files with 37 additions and 2 deletions

View File

@ -564,6 +564,7 @@ static const layout_info layout_info_list[] = {
{layout_blocked_ea_sns, "blocked (EA SNS)"},
{layout_blocked_awc, "blocked (AWC)"},
{layout_blocked_vgs, "blocked (VGS)"},
{layout_blocked_vawx, "blocked (VAWX)"},
#ifdef VGM_USE_VORBIS
{layout_ogg_vorbis, "Ogg"},
#endif

View File

@ -161,6 +161,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_blocked_vgs:
block_update_vgs(vgmstream->next_block_offset,vgmstream);
break;
case layout_blocked_vawx:
block_update_vawx(vgmstream->next_block_offset,vgmstream);
break;
default:
break;
}

25
src/layout/blocked_vawx.c Normal file
View File

@ -0,0 +1,25 @@
#include "layout.h"
#include "../vgmstream.h"
/* pseudo-blocks that must skip last 0x20 every 0x8000 */
void block_update_vawx(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
size_t block_size;
/* no header */
block_size = vgmstream->channels * 0x10;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
vgmstream->current_block_size = block_size / vgmstream->channels;
if ((vgmstream->next_block_offset - 0x800) > 0
&& ((vgmstream->next_block_offset - 0x800 + 0x20) % 0x8000) == 0) {
vgmstream->next_block_offset += 0x20;
}
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + 0x10*i;
}
}

View File

@ -65,6 +65,7 @@ void hwas_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_ea_sns(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_awc(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_vgs(off_t block_offset, VGMSTREAM * vgmstream);
void block_update_vawx(off_t block_offset, VGMSTREAM * vgmstream);
/* other layouts */
void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);

View File

@ -1,4 +1,5 @@
#include "meta.h"
#include "../layout/layout.h"
#include "../coding/coding.h"
@ -37,12 +38,11 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
switch(type) {
case 2: /* VAG */
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->layout_type = channel_count == 6 ? layout_blocked_vawx : layout_interleave ;
vgmstream->interleave_block_size = 0x10;
vgmstream->loop_start_sample = read_32bitBE(0x44,streamFile);
vgmstream->loop_end_sample = read_32bitBE(0x48,streamFile);
/* todo 6ch has 0x8000 blocks and must skip last 0x20 each block (or, skip 0x20 every 0x1550*6 */
break;
@ -110,6 +110,9 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
if (vgmstream->layout_type == layout_blocked_vawx)
block_update_vawx(start_offset,vgmstream);
return vgmstream;
fail:

View File

@ -959,6 +959,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_blocked_ea_sns:
case layout_blocked_awc:
case layout_blocked_vgs:
case layout_blocked_vawx:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_acm:

View File

@ -242,6 +242,7 @@ typedef enum {
layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */
layout_blocked_awc, /* Rockstar AWC */
layout_blocked_vgs, /* Guitar Hero II (PS2) */
layout_blocked_vawx, /* No More Heroes 6ch (PS3) */
/* otherwise odd */
layout_acm, /* libacm layout */