Fix some EA SCHl [Need for Speed 3 (PC)]

This commit is contained in:
bnnm 2018-04-29 19:41:38 +02:00
parent d5fc1159c5
commit 59ac455447
2 changed files with 16 additions and 5 deletions

View File

@ -93,6 +93,14 @@ void block_update_ea_schl(off_t block_offset, VGMSTREAM * vgmstream) {
break;
/* id, size, samples */
case coding_PCM16_int:
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + 0x0c + (i*0x02);
}
break;
/* id, size, samples, hists-per-channel, stereo/interleaved data */
case coding_EA_XA:
//case coding_EA_XA_V2: /* handled in default */

View File

@ -82,7 +82,7 @@ static VGMSTREAM * init_vgmstream_ea_variable_header(STREAMFILE *streamFile, ea_
VGMSTREAM * init_vgmstream_ea_schl(STREAMFILE *streamFile) {
off_t start_offset, header_offset;
size_t header_size;
ea_header ea;
ea_header ea = {0};
/* check extension; exts don't seem enforced by EA's tools, but usually:
@ -121,7 +121,7 @@ fail:
VGMSTREAM * init_vgmstream_ea_bnk(STREAMFILE *streamFile) {
off_t start_offset, header_offset, offset, table_offset;
size_t header_size;
ea_header ea;
ea_header ea = {0};
int32_t (*read_32bit)(off_t,STREAMFILE*) = NULL;
int16_t (*read_16bit)(off_t,STREAMFILE*) = NULL;
int i, bnk_version;
@ -285,7 +285,11 @@ static VGMSTREAM * init_vgmstream_ea_variable_header(STREAMFILE *streamFile, ea_
break;
case EA_CODEC2_S16LE: /* PCM16LE */
vgmstream->coding_type = coding_PCM16LE;
if (ea->version > 0) {
vgmstream->coding_type = coding_PCM16LE;
} else { /* Need for Speed III: Hot Pursuit (PC) */
vgmstream->coding_type = coding_PCM16_int;
}
break;
case EA_CODEC2_VAG: /* PS-ADPCM */
@ -450,7 +454,6 @@ static int parse_variable_header(STREAMFILE* streamFile, ea_header* ea, off_t be
uint32_t platform_id;
int is_header_end = 0;
memset(ea,0,sizeof(ea_header));
/* null defaults as 0 can be valid */
ea->version = EA_VERSION_NONE;
@ -468,7 +471,7 @@ static int parse_variable_header(STREAMFILE* streamFile, ea_header* ea, off_t be
offset += 4 + 4; /* GSTRs have an extra field (config?): ex. 0x01000000, 0x010000D8 BE */
}
else if ((platform_id & 0xFFFF0000) == 0x50540000) { /* "PT" = PlaTform */
ea->platform = (uint8_t)read_16bitLE(offset + 2,streamFile);
ea->platform = (uint16_t)read_16bitLE(offset + 2,streamFile);
offset += 4;
}
else {