Add XBOX mono/int to GENH/TXTH (as codec_mode 1) [Manhunt (Xbox)]

This commit is contained in:
bnnm 2018-03-03 01:09:44 +01:00
parent c3d3aaeeee
commit e9b2751064
3 changed files with 25 additions and 6 deletions

View File

@ -237,6 +237,7 @@ static const char* extension_list[] = {
"psnd",
"psw",
"rac", //txth/reserved [Manhunt (Xbox)]
"rak",
"ras",
"raw",

View File

@ -195,7 +195,15 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
break;
case coding_XBOX_IMA:
vgmstream->layout_type = layout_none;
if (genh.codec_mode == 1) {
if (!genh.interleave) goto fail; /* creates garbage */
coding = coding_XBOX_IMA_int;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = genh.interleave;
}
else {
vgmstream->layout_type = layout_none;
}
break;
case coding_NGC_DTK:
if (vgmstream->channels != 2) goto fail;
@ -367,14 +375,16 @@ static int parse_genh(STREAMFILE * streamFile, genh_header * genh) {
genh->num_samples = read_32bitLE(0x40,streamFile);
genh->skip_samples = read_32bitLE(0x44,streamFile); /* for FFmpeg based codecs */
genh->skip_samples_mode = read_8bit(0x48,streamFile); /* 0=autodetect, 1=force manual value @ 0x44 */
if (genh->codec == ATRAC3 || genh->codec == ATRAC3PLUS)
genh->codec_mode = read_8bit(0x49,streamFile); /* 0=autodetect, 1=force joint stereo, 2=force full stereo */
if (genh->codec == XMA1 || genh->codec == XMA2)
genh->codec_mode = read_8bit(0x4a,streamFile); /* 0=default (4ch = 2ch + 2ch), 1=single (4ch = 1ch + 1ch + 1ch + 1ch) */
genh->codec_mode = read_8bit(0x4b,streamFile);
if ((genh->codec == ATRAC3 || genh->codec == ATRAC3PLUS) && genh->codec_mode==0)
genh->codec_mode = read_8bit(0x49,streamFile);
if ((genh->codec == XMA1 || genh->codec == XMA2) && genh->codec_mode==0)
genh->codec_mode = read_8bit(0x4a,streamFile);
genh->data_size = read_32bitLE(0x50,streamFile);
if (genh->data_size == 0)
genh->data_size = get_streamfile_size(streamFile) - genh->start_offset;
genh->num_samples = genh->num_samples > 0 ? genh->num_samples : genh->loop_end_sample;
genh->loop_flag = genh->loop_start_sample != -1;

View File

@ -206,7 +206,15 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
break;
case coding_XBOX_IMA:
vgmstream->layout_type = layout_none;
if (txth.codec_mode == 1) {
if (!txth.interleave) goto fail; /* creates garbage */
coding = coding_XBOX_IMA_int;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = txth.interleave;
}
else {
vgmstream->layout_type = layout_none;
}
break;
case coding_NGC_DTK:
if (vgmstream->channels != 2) goto fail;