Random tweaks

This commit is contained in:
bnnm 2018-08-26 13:47:02 +02:00
parent 92f35029bb
commit c2a0311584
3 changed files with 19 additions and 17 deletions

View File

@ -13,6 +13,7 @@ static VGMSTREAM *parse_riff_ogg(STREAMFILE * streamFile, off_t start_offset, si
/* return milliseconds */
static long parse_adtl_marker(unsigned char * marker) {
long hh,mm,ss,ms;
if (memcmp("Marker ",marker,7)) return -1;
if (4 != sscanf((char*)marker+7,"%ld:%ld:%ld.%ld",&hh,&mm,&ss,&ms))
@ -25,31 +26,31 @@ static long parse_adtl_marker(unsigned char * marker) {
static void parse_adtl(off_t adtl_offset, off_t adtl_length, STREAMFILE *streamFile, long *loop_start, long *loop_end, int *loop_flag) {
int loop_start_found = 0;
int loop_end_found = 0;
off_t current_chunk = adtl_offset+4;
off_t current_chunk = adtl_offset+0x04;
while (current_chunk < adtl_offset+adtl_length) {
uint32_t chunk_type = read_32bitBE(current_chunk,streamFile);
off_t chunk_size = read_32bitLE(current_chunk+4,streamFile);
while (current_chunk < adtl_offset + adtl_length) {
uint32_t chunk_type = read_32bitBE(current_chunk+0x00,streamFile);
off_t chunk_size = read_32bitLE(current_chunk+0x04,streamFile);
if (current_chunk+8+chunk_size > adtl_offset+adtl_length) return;
if (current_chunk+0x08+chunk_size > adtl_offset+adtl_length)
return;
switch(chunk_type) {
case 0x6c61626c: { /* labl */
unsigned char *labelcontent;
labelcontent = malloc(chunk_size-4);
case 0x6c61626c: { /* "labl" */
unsigned char *labelcontent = malloc(chunk_size-0x04);
if (!labelcontent) return;
if (read_streamfile(labelcontent,current_chunk+0xc, chunk_size-4,streamFile)!=chunk_size-4) {
if (read_streamfile(labelcontent,current_chunk+0x0c, chunk_size-0x04,streamFile) != chunk_size-0x04) {
free(labelcontent);
return;
}
switch (read_32bitLE(current_chunk+8,streamFile)) {
case 1:
if (!loop_start_found && (*loop_start = parse_adtl_marker(labelcontent))>=0)
if (!loop_start_found && (*loop_start = parse_adtl_marker(labelcontent)) >= 0)
loop_start_found = 1;
break;
case 2:
if (!loop_end_found && (*loop_end = parse_adtl_marker(labelcontent))>=0)
if (!loop_end_found && (*loop_end = parse_adtl_marker(labelcontent)) >= 0)
loop_end_found = 1;
break;
default:

View File

@ -420,7 +420,7 @@ static int parse_bao(ubi_bao_header * bao, STREAMFILE *streamFile, off_t offset)
/* 0x18: null */
/* 0x1c: null */
descriptor_type = read_32bit(offset+0x20, streamFile);
descriptor_subtype = read_32bit(offset+header_size+0x04, streamFile); /* games may crash if changed */
descriptor_subtype = read_32bit(offset+header_size+0x04, streamFile);
/* for debugging purposes */
switch(descriptor_type) {
@ -457,7 +457,7 @@ static int parse_bao(ubi_bao_header * bao, STREAMFILE *streamFile, off_t offset)
//;VGM_ASSERT(descriptor_subtype != 0x01, "UBI BAO: subtype %x at %lx (%lx)\n", descriptor_subtype, offset, offset+header_size+0x04);
/* ignore unknown subtypes */
if (descriptor_subtype != 0x01)
if (descriptor_subtype != 0x00000001)
return 1;
bao->total_subsongs++;
@ -543,7 +543,7 @@ static int parse_bao(ubi_bao_header * bao, STREAMFILE *streamFile, off_t offset)
break;
case 0x00230008: /* Splinter Cell: Conviction (X360/PC) */
case 0x00230008: /* Splinter Cell: Conviction (X360/PC)-pk */
bao->stream_size = read_32bit(offset+header_size+0x08, streamFile);
bao->stream_id = read_32bit(offset+header_size+0x24, streamFile);
bao->is_external = read_32bit(offset+header_size+0x38, streamFile);
@ -612,7 +612,7 @@ static int parse_bao(ubi_bao_header * bao, STREAMFILE *streamFile, off_t offset)
case 0x001F0010: /* Prince of Persia 2008 (PS3/X360)-file, Far Cry 2 (PS3)-file */
case 0x00280306: /* Far Cry 3: Blood Dragon (X360)-file */
case 0x00290106: /* Splinter Cell Blacklist? */
default:
default: /* others possibly using BAO: Avatar X360/PS3/PC, Just Dance, Watch_Dogs, Far Cry Primal, Far Cry 4 */
VGM_LOG("UBI BAO: unknown BAO version at %lx\n", offset);
goto fail;
}

View File

@ -172,8 +172,9 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) {
else if (ww.format == 0x0002 && ww.block_align == 0x104 * ww.channels) {
//ww.codec = SWITCH_ADPCM;
/* unknown codec, found in Bayonetta 2 (Switch)
* frames of 0x104 per ch, possibly frame header is hist1(2)/hist2(2)/predictor(1)
* (may write 2 header samples + FF*2 nibbles = 0x200 samples per block?) */
* frames of 0x104 per ch, possibly frame header is hist1(2)/hist2(2)/index(1)
* (may write 2 header samples + FF*2 nibbles = 0x200 samples per block?)
* index only goes up to ~0xb, may be a shift/scale value */
goto fail;
}