[Scummvm-git-logs] scummvm master -> e0b18bf957d3fd068061d2494cc497a7dfffaa30
dreammaster
noreply at scummvm.org
Fri Jul 31 06:59:43 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
e0b18bf957 MADS: PHANTOM: Fix regression in LoaderReadStream reading multi-part loaders
Commit: e0b18bf957d3fd068061d2494cc497a7dfffaa30
https://github.com/scummvm/scummvm/commit/e0b18bf957d3fd068061d2494cc497a7dfffaa30
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-07-31T16:58:58+10:00
Commit Message:
MADS: PHANTOM: Fix regression in LoaderReadStream reading multi-part loaders
This was causing a crash at the start of the first conversation, because
everything beyond the initial part containing the conversation
data header wasn't being properly read.
Changed paths:
engines/mads/core/loader.cpp
diff --git a/engines/mads/core/loader.cpp b/engines/mads/core/loader.cpp
index 17202bea0f7..56a5eff353f 100644
--- a/engines/mads/core/loader.cpp
+++ b/engines/mads/core/loader.cpp
@@ -57,11 +57,28 @@ char loader_last[14] = "";
LoaderReadStream::LoaderReadStream(LoadHandle load, long size) {
- if (size < 0)
+ byte *data;
+
+ if (size < 0) {
+ // No explicit size was given, so the caller wants the whole file. The
+ // pack list may hold multiple index entries (e.g. header/data split into
+ // separate compressed sections), and loader_read() only ever decompresses
+ // one entry per call. Read each remaining entry in turn using its own
+ // declared uncompressed size, advancing the destination pointer, instead
+ // of asking for the full decompressed size in a single call.
size = load->decompress_size;
+ data = (byte *)malloc(size);
+ byte *dest = data;
- byte *data = (byte *)malloc(size);
- (void)loader_read(data, 1, size, load);
+ while (load->pack_list_marker < (int)load->pack.num_records) {
+ long entrySize = load->pack.strategy[load->pack_list_marker].size;
+ (void)loader_read(dest, 1, entrySize, load);
+ dest += entrySize;
+ }
+ } else {
+ data = (byte *)malloc(size);
+ (void)loader_read(data, 1, size, load);
+ }
_data = new Common::MemoryReadStream(data, size, DisposeAfterUse::YES);
}
More information about the Scummvm-git-logs
mailing list