[Scummvm-git-logs] scummvm master -> 1809453de10c98553b2a4956ac261d4bac6d8e8e

scemino noreply at scummvm.org
Fri May 17 21:14:12 UTC 2024


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:
1809453de1 DIRECTOR: Add decompilation for sharedcast


Commit: 1809453de10c98553b2a4956ac261d4bac6d8e8e
    https://github.com/scummvm/scummvm/commit/1809453de10c98553b2a4956ac261d4bac6d8e8e
Author: scemino (scemino74 at gmail.com)
Date: 2024-05-17T23:13:54+02:00

Commit Message:
DIRECTOR: Add decompilation for sharedcast

Changed paths:
    engines/director/debugtools.cpp


diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index 8cf8fc042da..a7a62b6a9da 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -1201,13 +1201,6 @@ static void displayScripts() {
 	ImGui::End();
 }
 
-static void getScriptCode(ImGuiScript &script, Symbol &sym) {
-	uint pc = 0;
-	while (pc < sym.u.defn->size()) {
-		script.code.push_back({pc, g_lingo->decodeInstruction(sym.u.defn, pc, &pc)});
-	}
-}
-
 static Common::String getHandlerName(Symbol &sym) {
 	Common::String handlerName;
 
@@ -1257,7 +1250,14 @@ static void showFuncList() {
 						script.type = csc->_scriptType;
 						script.handlerId = functionHandler._key;
 						script.handlerName = getHandlerName(functionHandler._value);
-						getScriptCode(script, functionHandler._value);
+						uint32 scriptId = movie->getCast()->getCastMemberInfo(csc->_id)->scriptId;
+						const LingoDec::Script *s = movie->getCast()->_lingodec->scripts[scriptId];
+						ImGuiNodeVisitor visitor(script);
+						for (auto &h : s->handlers) {
+							if (h.name != functionHandler._key)
+								continue;
+							h.ast.root->accept(visitor);
+						}
 						setScriptToDisplay(script);
 					}
 					ImGui::TableNextColumn();
@@ -1299,6 +1299,8 @@ static void showFuncList() {
 								const LingoDec::Script *s = cast._value->_lingodec->scripts[scriptId];
 								ImGuiNodeVisitor visitor(script);
 								for (auto &h : s->handlers) {
+									if (h.name != functionHandler._key)
+										continue;
 									h.ast.root->accept(visitor);
 								}
 								setScriptToDisplay(script);
@@ -1341,7 +1343,14 @@ static void showFuncList() {
 								script.type = (ScriptType)i;
 								script.handlerId = functionHandler._key;
 								script.handlerName = getHandlerName(functionHandler._value);
-								getScriptCode(script, functionHandler._value);
+								uint32 scriptId = sharedCast->getCastMemberInfo(scriptContext._key)->scriptId;
+								const LingoDec::Script *s = sharedCast->_lingodec->scripts[scriptId];
+								ImGuiNodeVisitor visitor(script);
+								for (auto &h : s->handlers) {
+									if (h.name != functionHandler._key)
+										continue;
+									h.ast.root->accept(visitor);
+								}
 								setScriptToDisplay(script);
 							}
 							ImGui::TableNextColumn();




More information about the Scummvm-git-logs mailing list