[Scummvm-git-logs] scummvm master -> 93412a5babdc4e6175e4ef694b31582398de18f3

sev- noreply at scummvm.org
Fri Jun 3 12:04:44 UTC 2022


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:
93412a5bab DIRECTOR: Created file for hosting game-specific quirks and moved a few there


Commit: 93412a5babdc4e6175e4ef694b31582398de18f3
    https://github.com/scummvm/scummvm/commit/93412a5babdc4e6175e4ef694b31582398de18f3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-06-03T14:04:16+02:00

Commit Message:
DIRECTOR: Created file for hosting game-specific quirks and moved a few there

Changed paths:
  A engines/director/game-quirks.cpp
    engines/director/director.cpp
    engines/director/director.h
    engines/director/module.mk


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index da9a9691cdb..d6d7ebe1e21 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -60,7 +60,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
 	g_director = this;
 	g_debugger = new Debugger();
 	setDebugger(g_debugger);
-	
+
 	_dirSeparator = ':';
 
 	parseOptions();
@@ -92,16 +92,13 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
 
 	_gameDataDir = Common::FSNode(ConfMan.get("path"));
 
-	// Meet Mediaband could have up to 5 levels of directories
-	SearchMan.addDirectory(_gameDataDir.getPath(), _gameDataDir, 0, 5);
-
-	SearchMan.addSubDirectoryMatching(_gameDataDir, "win_data", 0, 2);
-
 	for (uint i = 0; Director::directoryGlobs[i]; i++) {
 		Common::String directoryGlob = directoryGlobs[i];
 		SearchMan.addSubDirectoryMatching(_gameDataDir, directoryGlob);
 	}
 
+	gameQuirks(_gameDescription->desc.gameId, _gameDescription->desc.platform);
+
 	if (debugChannelSet(-1, kDebug32bpp))
 		_colorDepth = 32;
 	else
diff --git a/engines/director/director.h b/engines/director/director.h
index 369015d3a79..a3f5de40a62 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -254,6 +254,9 @@ public:
 	void processEventQUIT();
 	uint32 getMacTicks();
 
+	// game-quirks.cpp
+	void gameQuirks(const char *target, Common::Platform platform);
+
 public:
 	RandomState _rnd;
 	Graphics::MacWindowManager *_wm;
@@ -274,10 +277,11 @@ public:
 protected:
 	Common::Error run() override;
 
-private:
+public:
 	const DirectorGameDescription *_gameDescription;
 	Common::FSNode _gameDataDir;
 
+private:
 	byte *_currentPalette;
 	uint16 _currentPaletteLength;
 	Lingo *_lingo;
diff --git a/engines/director/game-quirks.cpp b/engines/director/game-quirks.cpp
new file mode 100644
index 00000000000..597b60d6747
--- /dev/null
+++ b/engines/director/game-quirks.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "director/director.h"
+
+namespace Director {
+
+static void quirkLzone() {
+	SearchMan.addSubDirectoryMatching(g_director->_gameDataDir, "win_data", 0, 2);
+}
+
+static void quirkMediaband() {
+	// Meet Mediaband could have up to 5 levels of directories
+	SearchMan.addDirectory(g_director->_gameDataDir.getPath(), g_director->_gameDataDir, 0, 5);
+}
+
+struct Quirk {
+	const char *target;
+	Common::Platform platform;
+	void (*quirk)();
+} quirks[] = {
+	{ "lzone", Common::kPlatformWindows, &quirkLzone },
+	{ "mediaband", Common::kPlatformUnknown, &quirkMediaband },
+	{ nullptr, Common::kPlatformUnknown, nullptr }
+};
+
+void DirectorEngine::gameQuirks(const char *target, Common::Platform platform) {
+	for (auto q = quirks; q->target != nullptr; q++) {
+		if (q->platform == Common::kPlatformUnknown || q->platform == platform)
+			if (!strcmp(q->target, target)) {
+				q->quirk();
+				break;
+			}
+	}
+}
+
+} // End of namespace Director
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 8acbc926629..1413f2f09b8 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
 	events.o \
 	fonts.o \
 	frame.o \
+	game-quirks.o \
 	graphics.o \
 	images.o \
 	metaengine.o \




More information about the Scummvm-git-logs mailing list