mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 16:30:54 +01:00
Fix some BKHD .wem detection
This commit is contained in:
parent
b4edce5d4f
commit
1faeba40d2
@ -126,25 +126,14 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
|
|||||||
|
|
||||||
/* detect format */
|
/* detect format */
|
||||||
if (subfile_offset <= 0 || subfile_size <= 0) {
|
if (subfile_offset <= 0 || subfile_size <= 0) {
|
||||||
/* some indexes don't have data */
|
|
||||||
is_dummy = 1;
|
is_dummy = 1;
|
||||||
}
|
/* rarely some indexes don't have data (early bnk)
|
||||||
else if (read_f32(subfile_offset + 0x02, sf) >= 30.0 &&
|
* for now leave a dummy song for easier .bnk index-to-subsong mapping */
|
||||||
read_f32(subfile_offset + 0x02, sf) <= 250.0) {
|
|
||||||
/* ignore Wwise's custom .wmid (similar to a regular midi but with simplified
|
|
||||||
* chunks and custom fields: 0x00=MThd's division, 0x02: bpm (new), etc) */
|
|
||||||
is_wmid = 1;
|
|
||||||
}
|
|
||||||
/* default is riff/sfx */
|
|
||||||
|
|
||||||
|
|
||||||
if (is_dummy || is_wmid) {
|
|
||||||
/* for now leave a dummy song for easier .bnk index-to-subsong mapping */
|
|
||||||
vgmstream = init_vgmstream_silence(0, 0, 0);
|
vgmstream = init_vgmstream_silence(0, 0, 0);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* could pass .wem but few files need memory .wem detection */
|
/* could pass .wem extension but few files need memory .wem detection */
|
||||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, NULL);
|
temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, NULL);
|
||||||
if (!temp_sf) goto fail;
|
if (!temp_sf) goto fail;
|
||||||
|
|
||||||
@ -153,13 +142,21 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
|
|||||||
vgmstream = init_vgmstream_wwise_bnk(temp_sf, &prefetch);
|
vgmstream = init_vgmstream_wwise_bnk(temp_sf, &prefetch);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
}
|
}
|
||||||
|
else if (read_f32(subfile_offset + 0x02, temp_sf) >= 30.0 &&
|
||||||
|
read_f32(subfile_offset + 0x02, temp_sf) <= 250.0) {
|
||||||
|
is_wmid = 1;
|
||||||
|
/* ignore Wwise's custom .wmid (similar to a regular midi but with simplified
|
||||||
|
* chunks and custom fields: 0x00=MThd's division, 0x02: bpm (new), etc) */
|
||||||
|
vgmstream = init_vgmstream_silence(0, 0, 0);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
/* may fail if not an actual wfx */
|
||||||
vgmstream = init_vgmstream_bkhd_fx(temp_sf);
|
vgmstream = init_vgmstream_bkhd_fx(temp_sf);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vgmstream->num_streams = total_subsongs;
|
vgmstream->num_streams = total_subsongs;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user