[Scummvm-git-logs] scummvm master -> 281cca1e538a58636e0c2cacce73c4783c7770cf
dreammaster
noreply at scummvm.org
Thu Jun 23 04:45:02 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
281cca1e53 CHEWY: Fix speech crashes later in the game
Commit: 281cca1e538a58636e0c2cacce73c4783c7770cf
https://github.com/scummvm/scummvm/commit/281cca1e538a58636e0c2cacce73c4783c7770cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-06-22T21:44:31-07:00
Commit Message:
CHEWY: Fix speech crashes later in the game
Changed paths:
engines/chewy/resource.cpp
diff --git a/engines/chewy/resource.cpp b/engines/chewy/resource.cpp
index 7998b18da09..aea96b44309 100644
--- a/engines/chewy/resource.cpp
+++ b/engines/chewy/resource.cpp
@@ -68,10 +68,22 @@ Resource::Resource(Common::String filename) {
_encrypted = true;
_chunkCount = _stream.readUint16LE();
- _chunkList.reserve(_chunkCount);
+ _chunkList.resize(_chunkCount);
+
+ if (header == headerGeneric) {
+ // NGS files have an index at the end
+ _stream.seek(-(int)(_chunkCount * sizeof(uint32)), SEEK_END);
+ for (uint i = 0; i < _chunkCount; i++) {
+ Chunk &cur = _chunkList[i];
+ cur.pos = _stream.readUint32LE();
+ }
+ }
for (uint i = 0; i < _chunkCount; i++) {
- Chunk cur;
+ Chunk &cur = _chunkList[i];
+ if (header == headerGeneric)
+ _stream.seek(cur.pos - 6);
+
cur.size = _stream.readUint32LE();
if (isText) {
@@ -88,6 +100,9 @@ Resource::Resource(Common::String filename) {
cur.pos = _stream.pos();
+ // TODO: Is this workaround necessary anymore
+ // with the stream offset fixes
+#if 0
// WORKAROUND: Patch invalid speech sample
if (isSpeech && i == 2277 && cur.size == 57028) {
cur.size = 152057;
@@ -96,9 +111,10 @@ Resource::Resource(Common::String filename) {
_chunkList.push_back(cur);
continue;
}
+#endif
- _stream.skip(cur.size);
- _chunkList.push_back(cur);
+ if (header != headerGeneric)
+ _stream.skip(cur.size);
}
_spriteCorrectionsCount = 0;
More information about the Scummvm-git-logs
mailing list