Fix raw .xa validation [Toy Story 2 (PS1)]

This commit is contained in:
bnnm 2019-01-01 23:19:12 +01:00
parent 6ccceee033
commit 18fcb5fed7
2 changed files with 4 additions and 3 deletions

View File

@ -752,7 +752,7 @@ static const meta_info meta_info_list[] = {
{meta_RWAV, "Nintendo RWAV header"}, {meta_RWAV, "Nintendo RWAV header"},
{meta_CWAV, "Nintendo CWAV header"}, {meta_CWAV, "Nintendo CWAV header"},
{meta_FWAV, "Nintendo FWAV header"}, {meta_FWAV, "Nintendo FWAV header"},
{meta_XA, "Sony XA RIFF header"}, {meta_XA, "Sony XA header"},
{meta_PS2_RXWS, "Sony RXWS header"}, {meta_PS2_RXWS, "Sony RXWS header"},
{meta_PS2_RAW, ".int PCM raw header"}, {meta_PS2_RAW, ".int PCM raw header"},
{meta_PS2_OMU, "Alter Echo OMU Header"}, {meta_PS2_OMU, "Alter Echo OMU Header"},

View File

@ -2,7 +2,7 @@
#include "../layout/layout.h" #include "../layout/layout.h"
#include "../coding/coding.h" #include "../coding/coding.h"
/* CD-XA - from Sony PS1 CDs */ /* CD-XA - from Sony PS1 and Philips CD-i CD audio */
VGMSTREAM * init_vgmstream_xa(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_xa(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
off_t start_offset; off_t start_offset;
@ -10,6 +10,7 @@ VGMSTREAM * init_vgmstream_xa(STREAMFILE *streamFile) {
int is_blocked; int is_blocked;
size_t file_size = get_streamfile_size(streamFile); size_t file_size = get_streamfile_size(streamFile);
/* checks /* checks
* .xa: common, .str: sometimes (mainly videos) * .xa: common, .str: sometimes (mainly videos)
* .adp: Phantasy Star Collection (SAT) raw XA */ * .adp: Phantasy Star Collection (SAT) raw XA */
@ -53,7 +54,7 @@ VGMSTREAM * init_vgmstream_xa(STREAMFILE *streamFile) {
for (i = 0; i < (sector_size/block_size); i++) { for (i = 0; i < (sector_size/block_size); i++) {
/* XA headers checks: filter indexes should be 0..3, and shifts 0..C */ /* XA headers checks: filter indexes should be 0..3, and shifts 0..C */
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
uint8_t header = (uint8_t)read_8bit(test_offset + i, streamFile); uint8_t header = (uint8_t)read_8bit(test_offset + j, streamFile);
if (((header >> 4) & 0xF) > 0x03) if (((header >> 4) & 0xF) > 0x03)
goto fail; goto fail;
if (((header >> 0) & 0xF) > 0x0c) if (((header >> 0) & 0xF) > 0x0c)