[Scummvm-git-logs] scummvm master -> 45db2389e37b83857032e623741b1da8d5dc7fb2

moralrecordings code at moral.net.au
Sat May 16 06:53:52 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f8c5893f28 DIRECTOR: LINGO: Fix updateStage to only re-render sprites
43465e349b DIRECTOR: LINGO: Add debug for printing the call stack
45db2389e3 DIRECTOR: Check for file paths with FAT-incompatible symbols stripped


Commit: f8c5893f2809f5df68ee94b17bbe8426249fe643
    https://github.com/scummvm/scummvm/commit/f8c5893f2809f5df68ee94b17bbe8426249fe643
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-16T14:52:06+08:00

Commit Message:
DIRECTOR: LINGO: Fix updateStage to only re-render sprites

Changed paths:
    engines/director/frame.cpp
    engines/director/frame.h
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index fe5e032efa..fd3a247705 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -526,25 +526,27 @@ void Frame::readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offse
 
 }
 
-void Frame::prepareFrame(Score *score) {
+void Frame::prepareFrame(Score *score, bool updateStageOnly) {
 	_drawRects.clear();
 	renderSprites(*score->_surface, false);
 	renderSprites(*score->_trailSurface, true);
 
-	score->renderZoomBox();
+	if (!updateStageOnly) {
+		score->renderZoomBox();
 
-	_vm->_wm->draw();
+		_vm->_wm->draw();
 
-	if (_transType != 0)
-		// TODO Handle changing area case
-		playTransition(score);
+		if (_transType != 0)
+			// TODO Handle changing area case
+			playTransition(score);
 
-	if (_sound1 != 0 || _sound2 != 0) {
-		playSoundChannel();
-	}
+		if (_sound1 != 0 || _sound2 != 0) {
+			playSoundChannel();
+		}
 
-	if (_vm->getCurrentScore()->haveZoomBox())
-		score->_backSurface->copyFrom(*score->_surface);
+		if (_vm->getCurrentScore()->haveZoomBox())
+			score->_backSurface->copyFrom(*score->_surface);
+	}
 
 	g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, score->_surface->getBounds().width(), score->_surface->getBounds().height());
 }
diff --git a/engines/director/frame.h b/engines/director/frame.h
index cd1f2c636e..6891f11290 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -72,7 +72,7 @@ public:
 	~Frame();
 	void readChannels(Common::ReadStreamEndian *stream);
 	void readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
-	void prepareFrame(Score *score);
+	void prepareFrame(Score *score, bool updateStageOnly = false);
 	uint16 getSpriteIDFromPos(Common::Point pos);
 	bool checkSpriteIntersection(uint16 spriteId, Common::Point pos);
 	Common::Rect *getSpriteRect(uint16 spriteId);
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 705ee944f9..0e6156f2ef 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1809,7 +1809,7 @@ void LB::b_updateStage(int nargs) {
 	uint16 curFrame = score->getCurrentFrame();
 	Frame *frame = score->_frames[curFrame];
 
-	frame->prepareFrame(score);
+	frame->prepareFrame(score, true);
 }
 
 


Commit: 43465e349be8147996a091e96e45628370bd1cc6
    https://github.com/scummvm/scummvm/commit/43465e349be8147996a091e96e45628370bd1cc6
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-16T14:52:06+08:00

Commit Message:
DIRECTOR: LINGO: Add debug for printing the call stack

Changed paths:
    engines/director/lingo/lingo-code.cpp
    engines/director/lingo/lingo-codegen.cpp
    engines/director/lingo/lingo.h


diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 083e95148c..9528c82680 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1525,6 +1525,10 @@ void LC::call(Symbol *sym, int nargs) {
 
 	g_lingo->_callstack.push_back(fp);
 
+	if (debugChannelSet(5, kDebugLingoExec)) {
+		g_lingo->printCallStack(0);
+	}
+
 	g_lingo->_currentScript = sym->u.defn;
 	if (sym->ctx) {
 		g_lingo->_currentScriptContext = sym->ctx;
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 8c6b4bc188..efa9de2594 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -97,6 +97,27 @@ void Lingo::printStack(const char *s, uint pc) {
 	debugC(5, kDebugLingoExec, "[%3d]: %s", pc, stack.c_str());
 }
 
+void Lingo::printCallStack(uint pc) {
+	debugC(5, kDebugLingoExec, "Call stack:");
+	for (int i = 0; i < (int)g_lingo->_callstack.size(); i++) {
+		CFrame *frame = g_lingo->_callstack[i];
+		uint framePc = pc;
+		if (i < (int)g_lingo->_callstack.size() - 1)
+			framePc = g_lingo->_callstack[i + 1]->retpc;
+
+		if (frame->sp) {
+			debugC(5, kDebugLingoExec, "#%d %s:%d", i + 1,
+				g_lingo->_callstack[i]->sp->name.c_str(),
+				framePc
+			);
+		} else {
+			debugC(5, kDebugLingoExec, "#%d [unknown]:%d", i + 1,
+				framePc
+			);
+		}
+	}
+}
+
 Common::String Lingo::decodeInstruction(ScriptData *sd, uint pc, uint *newPc) {
 	Symbol sym;
 	Common::String res;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 75389695a9..f6103e93ea 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -258,6 +258,7 @@ public:
 	void executeHandler(Common::String name);
 	void executeScript(ScriptType type, uint16 id, uint16 function);
 	void printStack(const char *s, uint pc);
+	void printCallStack(uint pc);
 	Common::String decodeInstruction(ScriptData *sd, uint pc, uint *newPC = NULL);
 
 	void initBuiltIns();


Commit: 45db2389e37b83857032e623741b1da8d5dc7fb2
    https://github.com/scummvm/scummvm/commit/45db2389e37b83857032e623741b1da8d5dc7fb2
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-16T14:52:06+08:00

Commit Message:
DIRECTOR: Check for file paths with FAT-incompatible symbols stripped

Changed paths:
    engines/director/util.cpp
    engines/director/util.h


diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 04755940ce..a2b0571d02 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -189,6 +189,33 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
 		break;
 	}
 
+	if (!opened) {
+		// Try stripping all of the characters not allowed in FAT
+		convPath = stripMacPath(initialPath.c_str());
+
+		debug(2, "pathMakeRelative(): s4 %s", convPath.c_str());
+
+		if (f.open(initialPath))
+			return initialPath;
+
+		// Now try to search the file
+		while (convPath.contains('/')) {
+			int pos = convPath.find('/');
+			convPath = Common::String(&convPath.c_str()[pos + 1]);
+
+			debug(2, "pathMakeRelative(): s5 try %s", convPath.c_str());
+
+			if (!f.open(convPath))
+				continue;
+
+			debug(2, "pathMakeRelative(): s5 converted %s -> %s", path.c_str(), convPath.c_str());
+
+			opened = true;
+
+			break;
+		}
+	}
+
 	if (!opened && recursive) {
 		// Hmmm. We couldn't find the path as is.
 		// Let's try to translate file path into 8.3 format
@@ -215,13 +242,13 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
 			}
 
 			Common::String convname = convertMacFilename(component.c_str());
-			debug(2, "pathMakeRelative(): s5 %s -> %s%s", initialPath.c_str(), convPath.c_str(), convname.c_str());
+			debug(2, "pathMakeRelative(): s6 %s -> %s%s", initialPath.c_str(), convPath.c_str(), convname.c_str());
 
 			const char *exts[] = { ".MMM", ".DIR", ".DXR", 0 };
 			for (int i = 0; exts[i] && addexts; ++i) {
 				Common::String newpath = convPath + convname + exts[i];
 
-				debug(2, "pathMakeRelative(): s5 try %s", newpath.c_str());
+				debug(2, "pathMakeRelative(): s6 try %s", newpath.c_str());
 
 				Common::String res = pathMakeRelative(newpath, false, false);
 
@@ -265,6 +292,32 @@ static bool myIsSpace(byte c) {
 	return c == ' ';
 }
 
+static bool myIsFATChar(byte c) {
+	return (c >= ' ' && c <= '!') || (c >= '#' && c == ')') || (c >= '-' && c <= '.') ||
+			(c >= '?' && c <= '@') || (c >= '^' && c <= '`') || c == '{' || (c >= '}' && c <= '~');
+}
+
+Common::String stripMacPath(const char *name) {
+	Common::String res;
+
+	int origlen = strlen(name);
+
+	// Remove trailing spaces
+	const char *end = &name[origlen - 1];
+	while (myIsSpace(*end))
+		end--;
+	const char *ptr = name;
+
+	while (ptr <= end) {
+		if (myIsAlnum(*ptr) || myIsFATChar(*ptr) || *ptr == '/') {
+			res += *ptr;
+		}
+		ptr++;
+	}
+
+	return res;
+}
+
 Common::String convertMacFilename(const char *name) {
 	Common::String res;
 
diff --git a/engines/director/util.h b/engines/director/util.h
index 23447da4bf..6b2ceb3ad1 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -40,6 +40,8 @@ Common::String getPath(Common::String path, Common::String cwd);
 
 Common::String pathMakeRelative(Common::String path, bool recursive = true, bool addexts = true);
 
+Common::String stripMacPath(const char *name);
+
 Common::String convertMacFilename(const char *name);
 
 bool processQuitEvent(bool click = false); // events.cpp




More information about the Scummvm-git-logs mailing list