[Scummvm-git-logs] scummvm master -> 3ab147259bd7549297a9a726af4300c0fb4bf828

mikrosk noreply at scummvm.org
Sat Jun 10 21:36:57 UTC 2023


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

Summary:
62d3a3c16e BACKENDS: ATARI: work around engines with unaligned pitch
650ccb6ded GUI: Don't assume ManagedSurface's pitch
3294b20653 GRAPHICS: Support Floyd dithering for RGB121
09a5e47636 GUI: Add debug outputs for easier profiling
e4dcd46b43 GUI: Don't parse all available engines and games on startup
3ab147259b GRAPHICS: Add support for dithering from 3bpp into 1bpp


Commit: 62d3a3c16e704de4d34bf79541f6abe94f9c3d34
    https://github.com/scummvm/scummvm/commit/62d3a3c16e704de4d34bf79541f6abe94f9c3d34
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
BACKENDS: ATARI: work around engines with unaligned pitch

Too complex to investigate so don't align every 8-bit surface on a
16-byte boundary there.

Changed paths:
    backends/graphics/atari/atari-graphics.cpp


diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp
index be38c21b06f..e013bcbbaec 100644
--- a/backends/graphics/atari/atari-graphics.cpp
+++ b/backends/graphics/atari/atari-graphics.cpp
@@ -262,7 +262,10 @@ void AtariGraphicsManager::updateScreen() {
 			// hard to repair them. So instead of polluting the engine with
 			// Surface::init() & delete[] Surface::getPixels() just use this hack.
 			Common::String engineId = activeDomain->getValOrDefault("engineid");
-			if (engineId == "parallaction") {
+			if (engineId == "parallaction"
+				|| engineId == "mohawk"
+				|| engineId == "sherlock"
+				|| engineId == "tsage") {
 				g_unalignedPitch = true;
 			}
 		}


Commit: 650ccb6deddbdec408a1e1d685a5af428e9eac21
    https://github.com/scummvm/scummvm/commit/650ccb6deddbdec408a1e1d685a5af428e9eac21
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
GUI: Don't assume ManagedSurface's pitch

This caused corruption with small scale's cursor (18px) if
ManagedSurface's inner surface used a different pitch than w *
format.bytesPerPixel.

Changed paths:
    gui/ThemeEngine.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 3bcb6dc15c7..dda69215ae1 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1639,6 +1639,8 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
 			const int index = colorToIndex[col];
 			_cursor[y * _cursorWidth + x] = index;
 		}
+
+		src += cursor->pitch - cursor->w * cursor->format.bytesPerPixel;
 	}
 
 	_useCursor = true;


Commit: 3294b206534c46bf6efcdcaa886cbbf5f7a05e2f
    https://github.com/scummvm/scummvm/commit/3294b206534c46bf6efcdcaa886cbbf5f7a05e2f
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
GRAPHICS: Support Floyd dithering for RGB121

RGB121 is a special case of CLUT8 similar to RGB332 but with pixels
taking only the low nibble of a byte.

Changed paths:
    graphics/surface.cpp


diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 0464a31be3a..fb7fe573161 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -937,20 +937,31 @@ void Surface::ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *
 				dst++;
 			}
 		}
-	} else if (dstFormat == PixelFormat(1, 3, 3, 2, 0, 5, 2, 0, 0)) {
+	} else if (dstFormat == PixelFormat(1, 3, 3, 2, 0, 5, 2, 0, 0) || dstFormat == PixelFormat(1, 1, 2, 1, 0, 3, 1, 0, 0)) {
+		const int rShift = dstFormat.rLoss - dstFormat.rShift;
+		const int gShift = dstFormat.gLoss - dstFormat.gShift;
+		const int bShift = dstFormat.bLoss - dstFormat.bShift;
+
+		const int rMask = dstFormat.rMax() << dstFormat.rShift;
+		const int gMask = dstFormat.gMax() << dstFormat.gShift;
+		const int bMask = dstFormat.bMax() << dstFormat.bShift;
+
+		const int rLossMask = (1 << dstFormat.rLoss) - 1;
+		const int gLossMask = (1 << dstFormat.gLoss) - 1;
+		const int bLossMask = (1 << dstFormat.bLoss) - 1;
+
 		for (int y = 0; y < h; y++) {
 			const byte *src = &tmpSurf[y * w * 3];
 			byte *dst = (byte *)dstSurf->getBasePtr(0, y);
 
 			for (int x = 0; x < w; x++) {
 				byte r = src[0], g = src[1], b = src[2];
-				byte col = (r & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) & 3);
 
-				*dst = col;
+				*dst = ((r >> rShift) & rMask) | ((g >> gShift) & gMask) | ((b >> bShift) & bMask);
 
-				int qr = r & 0x1f;
-				int qg = g & 0x1f;
-				int qb = b & 0x3f;
+				int qr = r & rLossMask;
+				int qg = g & gLossMask;
+				int qb = b & bLossMask;
 
 				const DitherParams *params = algos[method].params;
 


Commit: 09a5e47636f8283e0beadd019b0500874bbbdcc5
    https://github.com/scummvm/scummvm/commit/09a5e47636f8283e0beadd019b0500874bbbdcc5
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
GUI: Add debug outputs for easier profiling

Changed paths:
    gui/ThemeEngine.cpp
    gui/launcher.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index dda69215ae1..7443f802c37 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -780,6 +780,8 @@ void ThemeEngine::loadTheme(const Common::String &themeId) {
 			_widgets[i]->calcBackgroundOffset();
 		}
 	}
+
+	debug(6, "Finished loading theme %s", themeId.c_str());
 }
 
 void ThemeEngine::unloadTheme() {
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index c0fc0f19a45..5a0fb620652 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -880,6 +880,8 @@ static Common::String buildQualifiedGameName(const Common::String &engineId, con
 }
 
 void LauncherChooser::genGameList() {
+	debug(6, "Generating game list");
+
 	const PluginList &plugins = EngineMan.getPlugins();
 	for (auto iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
@@ -889,6 +891,8 @@ void LauncherChooser::genGameList() {
 			_games[buildQualifiedGameName(metaEngine.getName(), v->gameId)] = v->description;
 		}
 	}
+
+	debug(6, "Finished generating game list: %d", _games.size());
 }
 
 static Common::Array<LauncherEntry> generateEntries(const Common::ConfigManager::DomainMap &domains, const Common::StringMap &games) {


Commit: e4dcd46b43fce606808758697416808c79b45153
    https://github.com/scummvm/scummvm/commit/e4dcd46b43fce606808758697416808c79b45153
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
GUI: Don't parse all available engines and games on startup

When statically linked, this makes about 8000 variants.

This change takes only engines and games present in a domain into
account. This speeds up loading time on slower backends quite
noticeably.

Changed paths:
    gui/launcher.cpp
    gui/launcher.h


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 5a0fb620652..4c85215d05b 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -114,6 +114,10 @@ const GroupingMode groupingModes[] = {
 
 #pragma mark -
 
+static Common::String buildQualifiedGameName(const Common::String &engineId, const Common::String &gameId) {
+	return Common::String::format("%s:%s", engineId.c_str(), gameId.c_str());
+}
+
 bool LauncherFilterMatcher(void *boss, int idx, const Common::U32String &item, const Common::U32String &token_) {
 	bool invert = false;
 	Common::U32String token(token_);
@@ -164,11 +168,10 @@ bool LauncherFilterMatcher(void *boss, int idx, const Common::U32String &item, c
 	return invert ? !result : result;
 }
 
-LauncherDialog::LauncherDialog(const Common::String &dialogName, LauncherChooser *chooser)
+LauncherDialog::LauncherDialog(const Common::String &dialogName)
 	: Dialog(dialogName), _title(dialogName), _browser(nullptr),
 	_loadDialog(nullptr), _searchClearButton(nullptr), _searchDesc(nullptr),
-	_grpChooserDesc(nullptr), _grpChooserPopup(nullptr), _groupBy(kGroupByNone),
-	_launcherChooser(chooser)
+	_grpChooserDesc(nullptr), _grpChooserPopup(nullptr), _groupBy(kGroupByNone)
 #ifndef DISABLE_FANCY_THEMES
 	, _logo(nullptr), _searchPic(nullptr), _groupPic(nullptr)
 #endif // !DISABLE_FANCY_THEMES
@@ -345,19 +348,6 @@ void LauncherDialog::close() {
 	ConfMan.flushToDisk();
 	Dialog::close();
 }
-struct LauncherEntry {
-	Common::String key;
-	Common::String engineid;
-	Common::String gameid;
-	Common::String description;
-	Common::String title;
-	const Common::ConfigManager::Domain *domain;
-
-	LauncherEntry(const Common::String &k, const Common::String &e, const Common::String &g,
-	              const Common::String &d, const Common::String &t, const Common::ConfigManager::Domain *v) :
-		key(k), engineid(e), gameid(g), description(d), title(t), domain(v) {
-	}
-};
 
 struct LauncherEntryComparator {
 	bool operator()(const LauncherEntry &x, const LauncherEntry &y) const {
@@ -549,6 +539,62 @@ void LauncherDialog::loadGame(int item) {
 	}
 }
 
+Common::Array<LauncherEntry> LauncherDialog::generateEntries(const Common::ConfigManager::DomainMap &domains) {
+	Common::Array<LauncherEntry> domainList;
+	for (Common::ConfigManager::DomainMap::const_iterator iter = domains.begin(); iter != domains.end(); ++iter) {
+		// Do not list temporary targets added when starting a game from the command line
+		if (iter->_value.contains("id_came_from_command_line"))
+			continue;
+
+		Common::String description;
+		Common::String title;
+
+		if (!iter->_value.tryGetVal("description", description)) {
+			QualifiedGameDescriptor g = EngineMan.findTarget(iter->_key);
+			if (!g.description.empty())
+				description = g.description;
+		}
+
+		Common::String engineid = iter->_value.getValOrDefault("engineid");
+
+		Common::String gameid;
+		if (!iter->_value.tryGetVal("gameid", gameid)) {
+			gameid = iter->_key;
+		}
+
+		Common::StringMap &engineMap = _engines[engineid];
+		if (!engineMap.contains(gameid)) {
+			const Plugin *plugin = EngineMan.findPlugin(engineid);
+			if (plugin) {
+				PlainGameDescriptor gd = plugin->get<MetaEngineDetection>().findGame(gameid.c_str());
+				if (gd.description)
+					engineMap[gameid] = gd.description;
+			}
+		}
+
+		// Either game description or empty (default) string
+		title = engineMap[gameid];
+
+		// This is not reliable
+		if (!title.empty() && gameid.contains("-demo"))
+			title += " (Demo)";
+
+		if (description.empty()) {
+			description = Common::String::format("Unknown (target %s, gameid %s)", iter->_key.c_str(), gameid.c_str());
+		}
+
+		if (title.empty())
+			title = description;
+		if (!description.empty())
+			domainList.push_back(LauncherEntry(iter->_key, engineid, gameid, description, title, &iter->_value));
+	}
+
+	// Now sort the list in dictionary order
+	Common::sort(domainList.begin(), domainList.end(), LauncherEntryComparator());
+
+	return domainList;
+}
+
 void LauncherDialog::handleKeyDown(Common::KeyState state) {
 	Dialog::handleKeyDown(state);
 }
@@ -867,7 +913,6 @@ bool LauncherDialog::checkModifier(int checkedModifier) {
 #pragma mark -
 
 LauncherChooser::LauncherChooser() : _impl(nullptr) {
-	genGameList();
 }
 
 LauncherChooser::~LauncherChooser() {
@@ -875,76 +920,6 @@ LauncherChooser::~LauncherChooser() {
 	_impl = nullptr;
 }
 
-static Common::String buildQualifiedGameName(const Common::String &engineId, const Common::String &gameId) {
-	return Common::String::format("%s:%s", engineId.c_str(), gameId.c_str());
-}
-
-void LauncherChooser::genGameList() {
-	debug(6, "Generating game list");
-
-	const PluginList &plugins = EngineMan.getPlugins();
-	for (auto iter = plugins.begin(); iter != plugins.end(); ++iter) {
-		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
-
-		PlainGameList list = metaEngine.getSupportedGames();
-		for (auto v = list.begin(); v != list.end(); ++v) {
-			_games[buildQualifiedGameName(metaEngine.getName(), v->gameId)] = v->description;
-		}
-	}
-
-	debug(6, "Finished generating game list: %d", _games.size());
-}
-
-static Common::Array<LauncherEntry> generateEntries(const Common::ConfigManager::DomainMap &domains, const Common::StringMap &games) {
-	Common::Array<LauncherEntry> domainList;
-	for (Common::ConfigManager::DomainMap::const_iterator iter = domains.begin(); iter != domains.end(); ++iter) {
-		// Do not list temporary targets added when starting a game from the command line
-		if (iter->_value.contains("id_came_from_command_line"))
-			continue;
-
-		Common::String description;
-		Common::String title;
-
-		if (!iter->_value.tryGetVal("description", description)) {
-			QualifiedGameDescriptor g = EngineMan.findTarget(iter->_key);
-			if (!g.description.empty())
-				description = g.description;
-		}
-
-		Common::String engineid = iter->_value.getValOrDefault("engineid");
-
-		Common::String gameid;
-		if (!iter->_value.tryGetVal("gameid", gameid)) {
-			gameid = iter->_key;
-		}
-
-		// Strip platform language from the title.
-		Common::String key = buildQualifiedGameName(engineid, gameid);
-
-		if (games.contains(key)) {
-			title = games.getVal(key);
-
-			// This is not reliable
-			if (gameid.contains("-demo"))
-				title += " (Demo)";
-		}
-
-		if (description.empty()) {
-			description = Common::String::format("Unknown (target %s, gameid %s)", iter->_key.c_str(), gameid.c_str());
-		}
-
-		if (title.empty())
-			title = description;
-		if (!description.empty())
-			domainList.push_back(LauncherEntry(iter->_key, engineid, gameid, description, title, &iter->_value));
-	}
-
-	// Now sort the list in dictionary order
-	Common::sort(domainList.begin(), domainList.end(), LauncherEntryComparator());
-
-	return domainList;
-}
-
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
 LauncherDisplayType getRequestedLauncherType() {
 	const Common::String &userConfig = ConfMan.get("gui_launcher_chooser", Common::ConfigManager::kApplicationDomain);
@@ -960,7 +935,7 @@ LauncherDisplayType getRequestedLauncherType() {
 
 class LauncherSimple : public LauncherDialog {
 public:
-	LauncherSimple(const Common::String &title, LauncherChooser *chooser);
+	LauncherSimple(const Common::String &title);
 	~LauncherSimple() override;
 
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
@@ -982,7 +957,7 @@ private:
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
 class LauncherGrid : public LauncherDialog {
 public:
-	LauncherGrid(const Common::String &title, LauncherChooser *chooser);
+	LauncherGrid(const Common::String &title);
 	~LauncherGrid() override;
 
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
@@ -1014,14 +989,14 @@ void LauncherChooser::selectLauncher() {
 
 		switch (requestedType) {
 		case kLauncherDisplayGrid:
-			_impl = new LauncherGrid("LauncherGrid", this);
+			_impl = new LauncherGrid("LauncherGrid");
 			break;
 
 		default:
 			// fallthrough intended
 		case kLauncherDisplayList:
 #endif // !DISABLE_LAUNCHERDISPLAY_GRID
-			_impl = new LauncherSimple("Launcher", this);
+			_impl = new LauncherSimple("Launcher");
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
 			break;
 		}
@@ -1045,8 +1020,8 @@ int LauncherChooser::runModal() {
 
 #pragma mark -
 
-LauncherSimple::LauncherSimple(const Common::String &title, LauncherChooser *chooser)
-	: LauncherDialog(title, chooser),
+LauncherSimple::LauncherSimple(const Common::String &title)
+	: LauncherDialog(title),
 	_list(nullptr) {
 	build();
 }
@@ -1116,7 +1091,7 @@ void LauncherSimple::updateListing() {
 	bool scanEntries = numEntries == -1 ? true : ((int)domains.size() <= numEntries);
 
 	// Turn it into a sorted list of entries
-	Common::Array<LauncherEntry> domainList = generateEntries(domains, _launcherChooser->getGameList());
+	Common::Array<LauncherEntry> domainList = generateEntries(domains);
 
 	// And fill out our structures
 	for (Common::Array<LauncherEntry>::const_iterator iter = domainList.begin(); iter != domainList.end(); ++iter) {
@@ -1333,8 +1308,8 @@ void LauncherSimple::updateButtons() {
 #pragma mark -
 
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
-LauncherGrid::LauncherGrid(const Common::String &title, LauncherChooser *chooser)
-	: LauncherDialog(title, chooser),
+LauncherGrid::LauncherGrid(const Common::String &title)
+	: LauncherDialog(title),
 	_grid(nullptr), _gridItemSizeSlider(nullptr), _gridItemSizeLabel(nullptr) {
 	build();
 }
@@ -1521,7 +1496,7 @@ void LauncherGrid::updateListing() {
 	const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
 
 	// Turn it into a sorted list of entries
-	Common::Array<LauncherEntry> domainList = generateEntries(domains, _launcherChooser->getGameList());
+	Common::Array<LauncherEntry> domainList = generateEntries(domains);
 
 	Common::Array<GridItemInfo> gridList;
 
diff --git a/gui/launcher.h b/gui/launcher.h
index 6fdc45fa241..82b112508ac 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -28,6 +28,8 @@
 #endif
 #define kSwitchLauncherDialog -2
 
+#include "common/hashmap.h"
+
 #include "gui/dialog.h"
 #include "gui/widgets/popup.h"
 #include "gui/MetadataParser.h"
@@ -86,11 +88,24 @@ class StaticTextWidget;
 class EditTextWidget;
 class SaveLoadChooser;
 class PopUpWidget;
-class LauncherChooser;
+
+struct LauncherEntry {
+	Common::String key;
+	Common::String engineid;
+	Common::String gameid;
+	Common::String description;
+	Common::String title;
+	const Common::ConfigManager::Domain *domain;
+
+	LauncherEntry(const Common::String &k, const Common::String &e, const Common::String &g,
+				  const Common::String &d, const Common::String &t, const Common::ConfigManager::Domain *v) :
+		key(k), engineid(e), gameid(g), description(d), title(t), domain(v) {
+	}
+};
 
 class LauncherDialog : public Dialog {
 public:
-	LauncherDialog(const Common::String &dialogName, LauncherChooser *chooser);
+	LauncherDialog(const Common::String &dialogName);
 	~LauncherDialog() override;
 
 	void rebuild();
@@ -129,7 +144,6 @@ protected:
 	Common::String	_title;
 	Common::String	_search;
 	MetadataParser	_metadataParser;
-	LauncherChooser *_launcherChooser = nullptr;
 
 #ifndef DISABLE_LAUNCHERDISPLAY_GRID
 	ButtonWidget		*_listButton;
@@ -185,6 +199,8 @@ protected:
 	 */
 	void loadGame(int item);
 
+	Common::Array<LauncherEntry> generateEntries(const Common::ConfigManager::DomainMap &domains);
+
 	/**
 	 * Select the target with the given name in the launcher game list.
 	 * Also scrolls the list so that the newly selected item is visible.
@@ -194,13 +210,14 @@ protected:
 	virtual void selectTarget(const Common::String &target) = 0;
 	virtual int getSelected() = 0;
 private:
+	Common::HashMap<Common::String, Common::StringMap, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _engines;
+
 	bool checkModifier(int modifier);
 };
 
 class LauncherChooser {
 protected:
 	LauncherDialog *_impl;
-	Common::StringMap _games;
 
 public:
 	LauncherChooser();
@@ -208,11 +225,6 @@ public:
 
 	int runModal();
 	void selectLauncher();
-
-	const Common::StringMap &getGameList() { return _games; }
-
-private:
-	void genGameList();
 };
 
 } // End of namespace GUI


Commit: 3ab147259bd7549297a9a726af4300c0fb4bf828
    https://github.com/scummvm/scummvm/commit/3ab147259bd7549297a9a726af4300c0fb4bf828
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2023-06-10T23:27:57+02:00

Commit Message:
GRAPHICS: Add support for dithering from 3bpp into 1bpp

This allows using "ScummVM Modern" theme in 8-bit resolutions.

Changed paths:
    graphics/surface.cpp


diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index fb7fe573161..42da07d0372 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -769,6 +769,12 @@ void Surface::ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *
 				src += 2;
 				format.colorToRGB(color, r, g, b);
 				break;
+			case 3:
+				color = *((const uint32 *)src);
+				color >>= 8;
+				src += 3;
+				format.colorToRGB(color, r, g, b);
+				break;
 			case 4:
 				color = *((const uint32 *)src);
 				src += 4;




More information about the Scummvm-git-logs mailing list