From 7670d61aaccadbde5cde2b2b3ecbebbc38fd7d19 Mon Sep 17 00:00:00 2001 From: NicknineTheEagle Date: Thu, 28 Oct 2021 13:01:06 +0300 Subject: [PATCH] Ubi SB: Play silence for missing external files instead of failing Fixes Splinter Cell (Prototype) (Xbox) --- src/meta/ubi_sb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/meta/ubi_sb.c b/src/meta/ubi_sb.c index 4820f028..b9782771 100644 --- a/src/meta/ubi_sb.c +++ b/src/meta/ubi_sb.c @@ -645,7 +645,7 @@ static VGMSTREAM *init_vgmstream_ubi_dat_main(ubi_sb_header *sb, STREAMFILE *sf_ if (!sf_data) { /* play silence if external file is not found since Rayman 2 seems to rely on this behavior */ vgm_logi("UBI DAT: external file '%s' not found (put together)\n", sb->resource_name); - strncat(sb->readable_name, " (missing)", sizeof(sb->readable_name)); + concatn(sizeof(sb->readable_name), sb->readable_name, " (missing)"); sb->duration = (float)pcm_bytes_to_samples(sb->stream_size, sb->channels, 16) / (float)sb->sample_rate; return init_vgmstream_ubi_sb_silence(sb); } @@ -1301,8 +1301,11 @@ static VGMSTREAM* init_vgmstream_ubi_sb_audio(ubi_sb_header* sb, STREAMFILE* sf_ if (sb->is_external) { sf_data = open_streamfile_by_filename(sf, sb->resource_name); if (sf_data == NULL) { + /* play silence if external file is not found */ vgm_logi("UBI SB: external file '%s' not found (put together)\n", sb->resource_name); - goto fail; + concatn(sizeof(sb->readable_name), sb->readable_name, " (missing)"); + sb->duration = 1.0f; + return init_vgmstream_ubi_sb_silence(sb); } } else { @@ -1342,8 +1345,11 @@ static VGMSTREAM* init_vgmstream_ubi_sb_layer(ubi_sb_header* sb, STREAMFILE* sf_ if (sb->is_external) { sf_data = open_streamfile_by_filename(sf,sb->resource_name); if (sf_data == NULL) { + /* play silence if external file is not found */ vgm_logi("UBI SB: external file '%s' not found (put together)\n", sb->resource_name); - goto fail; + concatn(sizeof(sb->readable_name), sb->readable_name, " (missing)"); + sb->duration = 1.0f; + return init_vgmstream_ubi_sb_silence(sb); } } else {