[Scummvm-git-logs] scummvm master -> 80ee9303ac7e0958ff80e05096ec6543c17bd883
djsrv
noreply at scummvm.org
Mon Jan 30 03:10:55 UTC 2023
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:
80ee9303ac DIRECTOR: LINGO: Ignore bad scriptId field in Lscr
Commit: 80ee9303ac7e0958ff80e05096ec6543c17bd883
https://github.com/scummvm/scummvm/commit/80ee9303ac7e0958ff80e05096ec6543c17bd883
Author: djsrv (dservilla at gmail.com)
Date: 2023-01-29T21:09:01-06:00
Commit Message:
DIRECTOR: LINGO: Ignore bad scriptId field in Lscr
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo-codegen.h
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 6bfebac8493..d96f02bf436 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -947,7 +947,7 @@ void LC::cb_zeropush() {
g_lingo->push(d);
}
-ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName, uint16 version) {
+ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, LingoArchive *archive, const Common::String &archName, uint16 version) {
if (stream.size() < 0x5c) {
warning("Lscr header too small");
return nullptr;
@@ -974,7 +974,14 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
/* uint32 length = */ stream.readUint32();
/* uint32 length2 = */ stream.readUint32();
uint16 codeStoreOffset = stream.readUint16();
- uint16 scriptId = stream.readUint16() + 1;
+
+ /* uint16 scriptId = */ stream.readUint16() /* + 1 */;
+ // This field *should* match the script's index in Lctx, but this
+ // is unreliable. (e.g. script 261 in DATA/LEVEL1.DIR in betterd-win
+ // has this field incorrectly set to 263 instead of 261.)
+ // Thus, ignore it and simply use the script's index in Lctx.
+ uint16 scriptId = lctxIndex;
+
// unk2
for (uint32 i = 0; i < 0x10; i++) {
stream.readByte();
@@ -1605,7 +1612,7 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
}
void LingoArchive::addCodeV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, const Common::String &archName, uint16 version) {
- ScriptContext *ctx = g_lingo->_compiler->compileLingoV4(stream, this, archName, version);
+ ScriptContext *ctx = g_lingo->_compiler->compileLingoV4(stream, lctxIndex, this, archName, version);
if (ctx) {
lctxContexts[lctxIndex] = ctx;
*ctx->_refCount += 1;
diff --git a/engines/director/lingo/lingo-codegen.h b/engines/director/lingo/lingo-codegen.h
index 14caa53f45d..b821006abf0 100644
--- a/engines/director/lingo/lingo-codegen.h
+++ b/engines/director/lingo/lingo-codegen.h
@@ -35,7 +35,7 @@ public:
ScriptContext *compileAnonymous(const Common::U32String &code);
ScriptContext *compileLingo(const Common::U32String &code, LingoArchive *archive, ScriptType type, CastMemberID id, const Common::String &scriptName, bool anonyomous = false);
- ScriptContext *compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName, uint16 version);
+ ScriptContext *compileLingoV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, LingoArchive *archive, const Common::String &archName, uint16 version);
int code1(inst code) { _currentAssembly->push_back(code); return _currentAssembly->size() - 1; }
int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; }
More information about the Scummvm-git-logs
mailing list