aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-19 12:39:08 +0200
committerEugene Sandulenko2016-08-19 12:39:08 +0200
commit21d4d0aeb20b19f17784338fbf663774b2728562 (patch)
tree70fc6bd0158199ef3f04b7ea924e302fd84288d6 /engines/director
parent1abbe6bcf0b203725ae5c519a9a4502be89fa949 (diff)
downloadscummvm-rg350-21d4d0aeb20b19f17784338fbf663774b2728562.tar.gz
scummvm-rg350-21d4d0aeb20b19f17784338fbf663774b2728562.tar.bz2
scummvm-rg350-21d4d0aeb20b19f17784338fbf663774b2728562.zip
DIRECTOR: Lingo: Added generated script decompilation
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/lingo/lingo-codegen.cpp5
-rw-r--r--engines/director/lingo/lingo.cpp14
-rw-r--r--engines/director/lingo/lingo.h2
3 files changed, 19 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 3b7278488f..6584a92855 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -71,7 +71,7 @@ void Lingo::execute(int pc) {
}
}
-Common::String Lingo::decodeInstruction(int pc) {
+Common::String Lingo::decodeInstruction(int pc, int *newPc) {
Symbol sym;
Common::String res;
@@ -118,6 +118,9 @@ Common::String Lingo::decodeInstruction(int pc) {
res = "<unknown>";
}
+ if (newPc)
+ *newPc = pc;
+
return res;
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 412b817892..5728a2980f 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -181,6 +181,14 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
parse(chunk.c_str());
+ if (debugChannelSet(3, kDebugLingoCompile)) {
+ int pc = 0;
+ while (pc < _currentScript->size()) {
+ Common::String instr = decodeInstruction(pc, &pc);
+ debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str());
+ }
+ }
+
_currentScript->clear();
begin = end;
@@ -201,6 +209,12 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
if (debugChannelSet(3, kDebugLingoCompile)) {
if (_currentScript->size() && !_hadError)
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+
+ int pc = 0;
+ while (pc < _currentScript->size()) {
+ Common::String instr = decodeInstruction(pc, &pc);
+ debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str());
+ }
}
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index e674b22265..71708cf910 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -180,7 +180,7 @@ public:
void addCode(const char *code, ScriptType type, uint16 id);
void executeScript(ScriptType type, uint16 id);
- Common::String decodeInstruction(int pc);
+ Common::String decodeInstruction(int pc, int *newPC = NULL);
void processEvent(LEvent event, int entityId);