diff options
author | Scott Percival | 2019-11-17 18:08:18 +0800 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-17 22:31:54 +0100 |
commit | 397a29a5a26c9b3889fa7e47ecd4240d5488c2f9 (patch) | |
tree | 4b2351c5fe67c56bf5274fdc220c24be9cd0fbec /engines | |
parent | 25c8d3a57c6839f8a5bde2f9026d66331d19c7a6 (diff) | |
download | scummvm-rg350-397a29a5a26c9b3889fa7e47ecd4240d5488c2f9.tar.gz scummvm-rg350-397a29a5a26c9b3889fa7e47ecd4240d5488c2f9.tar.bz2 scummvm-rg350-397a29a5a26c9b3889fa7e47ecd4240d5488c2f9.zip |
DIRECTOR: Add more logging to Lingo script loader
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/lingo/lingo-bytecode.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp index 64fc354cb5..086f61de4f 100644 --- a/engines/director/lingo/lingo-bytecode.cpp +++ b/engines/director/lingo/lingo-bytecode.cpp @@ -83,6 +83,11 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty _currentEntityId = id; _scriptContexts[type][id] = _currentScriptContext; + if (debugChannelSet(5, kDebugLoading)) { + debugC(5, kDebugLoading, "Lscr header:"); + stream.hexdump(0x5c); + } + // read the Lscr header! // unk1 for (uint32 i = 0; i < 0x10; i++) { @@ -117,6 +122,12 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty uint32 constsStoreOffset = constsOffset + 6 * constsCount; uint32 constsStoreSize = stream.size() - constsStoreOffset; stream.seek(constsStoreOffset); + + if (debugChannelSet(5, kDebugLoading)) { + debugC(5, kDebugLoading, "Lscr consts store:"); + stream.hexdump(constsStoreSize); + } + byte *constsStore = (byte *)malloc(constsStoreSize); stream.read(constsStore, constsStoreSize); @@ -193,6 +204,11 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty // read each entry in the function table. stream.seek(functionsOffset); for (uint16 i = 0; i < functionsCount; i++) { + if (debugChannelSet(5, kDebugLoading)) { + debugC(5, kDebugLoading, "Function %d header:", i); + stream.hexdump(0x2a); + } + _currentScriptFunction = i; _currentScriptContext->functions.push_back(new ScriptData); _currentScript = _currentScriptContext->functions[_currentScriptFunction]; @@ -223,6 +239,11 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty continue; } + if (debugChannelSet(5, kDebugLoading)) { + debugC(5, kDebugLoading, "Function %d code:", i); + Common::hexdump(codeStore, length, 16, startOffset); + } + uint16 pointer = startOffset - codeStoreOffset; Common::Array<uint32> offsetList; while (pointer < startOffset + length - codeStoreOffset) { @@ -254,10 +275,12 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty } else { // unimplemented instruction if (opcode < 0x40) { // 1 byte instruction + debugC(5, kDebugLingoCompile, "Unimplemented opcode: 0x%02x", opcode); offsetList.push_back(_currentScript->size()); g_lingo->code1(Lingo::c_unk); g_lingo->codeInt(opcode); } else if (opcode < 0x80) { // 2 byte instruction + debugC(5, kDebugLingoCompile, "Unimplemented opcode: 0x%02x (%d)", opcode, (uint)codeStore[pointer]); offsetList.push_back(_currentScript->size()); g_lingo->code1(Lingo::c_unk1); g_lingo->codeInt(opcode); @@ -265,6 +288,7 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty g_lingo->codeInt((uint)codeStore[pointer]); pointer += 1; } else { // 3 byte instruction + debugC(5, kDebugLingoCompile, "Unimplemented opcode: 0x%02x (%d, %d)", opcode, (uint)codeStore[pointer], (uint)codeStore[pointer+1]); offsetList.push_back(_currentScript->size()); g_lingo->code1(Lingo::c_unk2); g_lingo->codeInt(opcode); @@ -286,6 +310,11 @@ void Lingo::addNamesV4(Common::SeekableSubReadStreamEndian &stream) { debugC(1, kDebugLingoCompile, "Add V4 script name index"); // read the Lnam header! + if (debugChannelSet(5, kDebugLoading)) { + debugC(5, kDebugLoading, "Lnam header:"); + stream.hexdump(0x14); + } + stream.readUint16(); stream.readUint16(); stream.readUint16(); |