Fix Vorbis .wem with metadata [Gears of War 4 (PC)]

This commit is contained in:
bnnm 2020-11-24 18:46:57 +01:00
parent c4c083dfea
commit 53cd56ab35

View File

@ -30,7 +30,8 @@ typedef struct {
size_t smpl_size;
off_t seek_offset;
size_t seek_size;
off_t meta_offset;
size_t meta_size;
/* standard fmt stuff */
wwise_codec codec;
@ -255,6 +256,12 @@ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) {
cfg.blocksize_0_exp = read_u8(extra_offset + block_offsets + 0x01, sf); /* big */
ww.data_size -= audio_offset;
/* mutant .wem with metadata (voice strings/etc) between seek table and vorbis setup [Gears of War 4 (PC)] */
if (ww.meta_offset) {
/* 0x00: original setup_offset */
setup_offset += read_u32(ww.meta_offset + 0x04, sf); /* metadata size */
}
/* detect normal packets */
if (ww.extra_size == 0x30) {
/* almost all blocksizes are 0x08+0x0B except some with 0x09+0x09 [Oddworld New 'n' Tasty! (PSV)] */
@ -737,6 +744,10 @@ static int parse_wwise(STREAMFILE* sf, wwise_header* ww) {
ww->smpl_offset = offset;
ww->smpl_size = size;
break;
case 0x6D657461: /* "meta" */
ww->meta_offset = offset;
ww->meta_size = size;
break;
case 0x66616374: /* "fact" */
/* Wwise shouldn't use fact, but if somehow some file does uncomment the following: */