ubi_bao changes (4/?)

implement a hack for games with %08x.sbao naming nomenclature for streamed BAOs.
(present in Shaun White Snowboarding and Prince of Persia 2008)
This commit is contained in:
modusc896d352 2022-01-31 21:19:45 -03:00 committed by GitHub
parent 5f20e3344d
commit 211b2e7a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,7 @@ typedef struct {
size_t layer_entry_size;
int layer_external_and;
int layer_ignore_error;
int switch_to_sbao_if_bao_is_stream;
off_t silence_duration_float;
@ -1137,7 +1138,7 @@ static int parse_offsets(ubi_bao_header* bao, STREAMFILE* sf) {
/* rarely resource has more data than stream (sometimes a few bytes, others +0x100000)
* sometimes short song versions, but not accessed? no samples/sizes/cues/etc in header seem to refer to that [Just Dance (Wii)]
* Michael Jackson the experiende also uses prefetch size + bad size (ignored) */
* Michael Jackson The Experience also uses prefetch size + bad size (ignored) */
if (!bao->cfg.audio_ignore_resource_size && bao->prefetch_size)
goto fail;
}
@ -1363,16 +1364,17 @@ static STREAMFILE* open_atomic_bao(ubi_bao_file file_type, uint32_t file_id, int
/* If all else fails, try %08x.bao/%08x.sbao nomenclature.
* (id).bao is for mimicking engine loading files by internal ID,
* original names (like Common_BAO_0x5NNNNNNN, French_BAO_0x5NNNNNNN and the like) are OK too. */
/* %08x.bao nomenclature present in Assassin's Creed (Windows Vista) exe. */
snprintf(buf,buf_size, "%08x.bao", file_id);
sf_bao = open_streamfile_by_filename(sf, buf);
if (sf_bao) return sf_bao;
/* %08x.sbao nomenclature (in addition to %08x.bao) present in Shaun White Snowboarding (Windows Vista) exe. */
snprintf(buf,buf_size, "%08x.sbao", file_id);
sf_bao = open_streamfile_by_filename(sf, buf);
if (sf_bao) return sf_bao;
if (!bao->cfg.switch_to_sbao_if_bao_is_stream) {
/* %08x.bao nomenclature present in Assassin's Creed (Windows Vista) exe. */
snprintf(buf,buf_size, "%08x.bao", file_id);
sf_bao = open_streamfile_by_filename(sf, buf);
if (sf_bao) return sf_bao;
else {
/* %08x.sbao nomenclature (in addition to %08x.bao) present in Shaun White Snowboarding (Windows Vista) exe. */
snprintf(buf,buf_size, "%08x.sbao", file_id);
sf_bao = open_streamfile_by_filename(sf, buf);
if (sf_bao) return sf_bao;
}
}
else {
snprintf(buf,buf_size, "BAO_0x%08x", file_id);
@ -1812,6 +1814,8 @@ static int config_bao_version(ubi_bao_header* bao, STREAMFILE* sf) {
bao->cfg.audio_ignore_resource_size = 1;
if (version == 0x0022000D) /* We Dare (Wii) */
config_bao_audio_c(bao, 0x68, 0x78);
if (version == 0x001F0010) /* Shaun White Snowboarding (Vista/PS3/X360), Prince of Persia 2008 (Vista/PS3/X360) */
bao->cfg.switch_to_sbao_if_bao_is_stream = 1;
return 1;
@ -1881,9 +1885,10 @@ static int config_bao_version(ubi_bao_header* bao, STREAMFILE* sf) {
bao->cfg.codec_map[0x06] = RAW_AT3_105;
bao->cfg.file_type = UBI_FORGE_b;
return 1;
case 0x00260000: /* <michael Jackson: The Experience (X360)-package */
case 0x00260000: /* Michael Jackson: The Experience (X360)-package */
config_bao_entry(bao, 0xB8, 0x28);
config_bao_audio_b(bao, 0x08, 0x28, 0x30, 0x3c, 1, 1); //loop?