Merge pull request #624 from NicknineTheEagle/ubi

Ubi
This commit is contained in:
NicknineTheEagle 2020-05-17 23:35:24 +03:00 committed by GitHub
commit f5e43e42cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1473,19 +1473,26 @@ static STREAMFILE * setup_bao_streamfile(ubi_bao_header *bao, STREAMFILE *stream
if (!new_streamFile) goto fail;
stream_segments[0] = new_streamFile;
new_streamFile = open_atomic_bao(bao->cfg.file_type, bao->stream_id, 1, streamFile);
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
if (bao->stream_size - bao->prefetch_size != 0) {
new_streamFile = open_atomic_bao(bao->cfg.file_type, bao->stream_id, 1, streamFile);
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
new_streamFile = open_clamp_streamfile(stream_segments[1], bao->stream_offset, (bao->stream_size - bao->prefetch_size));
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
new_streamFile = open_clamp_streamfile(stream_segments[1], bao->stream_offset, (bao->stream_size - bao->prefetch_size));
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
new_streamFile = open_multifile_streamfile(stream_segments, 2);
if (!new_streamFile) goto fail;
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
stream_segments[1] = NULL;
new_streamFile = open_multifile_streamfile(stream_segments, 2);
if (!new_streamFile) goto fail;
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
stream_segments[1] = NULL;
}
else {
/* weird but happens, streamed chunk is empty in this case */
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
}
}
else {
new_streamFile = open_atomic_bao(bao->cfg.file_type, bao->stream_id, bao->is_external, streamFile);
@ -1507,20 +1514,27 @@ static STREAMFILE * setup_bao_streamfile(ubi_bao_header *bao, STREAMFILE *stream
if (!new_streamFile) goto fail;
stream_segments[0] = new_streamFile;
new_streamFile = open_streamfile_by_filename(streamFile, bao->resource_name);
if (!new_streamFile) { VGM_LOG("UBI BAO: external stream '%s' not found\n", bao->resource_name); goto fail; }
stream_segments[1] = new_streamFile;
if (bao->stream_size - bao->prefetch_size != 0) {
new_streamFile = open_streamfile_by_filename(streamFile, bao->resource_name);
if (!new_streamFile) { VGM_LOG("UBI BAO: external stream '%s' not found\n", bao->resource_name); goto fail; }
stream_segments[1] = new_streamFile;
new_streamFile = open_clamp_streamfile(stream_segments[1], bao->stream_offset, (bao->stream_size - bao->prefetch_size));
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
temp_streamFile = NULL;
new_streamFile = open_clamp_streamfile(stream_segments[1], bao->stream_offset, (bao->stream_size - bao->prefetch_size));
if (!new_streamFile) goto fail;
stream_segments[1] = new_streamFile;
temp_streamFile = NULL;
new_streamFile = open_multifile_streamfile(stream_segments, 2);
if (!new_streamFile) goto fail;
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
stream_segments[1] = NULL;
new_streamFile = open_multifile_streamfile(stream_segments, 2);
if (!new_streamFile) goto fail;
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
stream_segments[1] = NULL;
}
else {
/* weird but happens, streamed chunk is empty in this case */
temp_streamFile = new_streamFile;
stream_segments[0] = NULL;
}
}
else if (bao->is_external) {
new_streamFile = open_streamfile_by_filename(streamFile, bao->resource_name);
@ -1721,6 +1735,7 @@ static int config_bao_version(ubi_bao_header * bao, STREAMFILE *streamFile) {
case 0x001F0008: /* Rayman Raving Rabbids: TV Party (Wii)-package */
case 0x001F0010: /* Prince of Persia 2008 (PC/PS3/X360)-atomic-forge, Far Cry 2 (PS3)-atomic-dunia? */
case 0x001F0011: /* Naruto: The Broken Bond (X360)-package */
case 0x0021000C: /* Splinter Cell: Conviction (X360)(E3 2009 Demo)-package */
case 0x0022000D: /* Just Dance (Wii)-package */
case 0x0022001B: /* Prince of Persia: The Forgotten Sands (Wii)-package */
config_bao_entry(bao, 0xA4, 0x28); /* PC/Wii: 0xA8 */