[Scummvm-git-logs] scummvm master -> e3c3556b570ed716e6499901228f9156687241b0
sev-
noreply at scummvm.org
Sat Sep 6 12:11:05 UTC 2025
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
868a582fcf GUI: Restrict platform selection based on detection tables
aa9973aa98 GUI: Add gui options for additional platform detection
999d251866 SCI: Add additional platforms (as gui options) for Gabriel Knight 1
104a2c81fe GUI: JANITORIAL: Add comments for gui options and platform functions
47b4ea44f4 GUI: Rework adding additional platforms for gui options
06200f79ab GUI: Fix platform related macro expansion on MSVC compiler
e3c3556b57 GUI: Renumerate Platform enum with the help of GUIO_PLATFORM_PREFIX
Commit: 868a582fcf12686d56c4e233335f9dc0a83a95fd
https://github.com/scummvm/scummvm/commit/868a582fcf12686d56c4e233335f9dc0a83a95fd
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: Restrict platform selection based on detection tables
Restrict platform selection if platform defined in detection tables is different
than kPlatformUnknown, otherwise allow all platforms to be selected.
Changed paths:
common/platform.cpp
common/platform.h
engines/advancedDetector.cpp
engines/sci/detection.cpp
engines/scumm/detection.cpp
gui/editgamedialog.cpp
diff --git a/common/platform.cpp b/common/platform.cpp
index 1741dfba8b0..539f4b35327 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -124,6 +124,23 @@ const char *getPlatformDescription(Platform id) {
return l->description;
}
+bool checkGameGUIOptionPlatform(Platform plat, const String &str) {
+ if (!str.contains("plat_")) // If no platforms are specified
+ return true;
+
+ if (str.contains(getGameGUIOptionsDescriptionPlatform(plat)))
+ return true;
+
+ return false;
+}
+
+const String getGameGUIOptionsDescriptionPlatform(Platform plat) {
+ if (plat == kPlatformUnknown)
+ return "";
+
+ return String("plat_") + getPlatformDescription(plat);
+}
+
List<String> getPlatformList() {
List<String> list;
diff --git a/common/platform.h b/common/platform.h
index 7b2b07b2016..efbcadf5dbd 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -102,6 +102,8 @@ extern Platform parsePlatform(const String &str);
extern const char *getPlatformCode(Platform id);
extern const char *getPlatformAbbrev(Platform id);
extern const char *getPlatformDescription(Platform id);
+extern const String getGameGUIOptionsDescriptionPlatform(Platform plat);
+extern bool checkGameGUIOptionPlatform(Platform plat, const String &str);
List<String> getPlatformList();
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index dd5f410c5d7..bcf34dc44a9 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -217,6 +217,7 @@ DetectedGame AdvancedMetaEngineDetectionBase::toDetectedGame(const ADDetectedGam
game.setGUIOptions(desc->guiOptions + _guiOptions);
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(desc->language));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionPlatform(desc->platform));
if (desc->flags & ADGF_ADDENGLISH)
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index a88a5570cac..2cd01911695 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -235,6 +235,8 @@ DetectedGames SciMetaEngineDetection::detectGames(const Common::FSList &fslist,
}
game.setGUIOptions(customizeGuiOptions(fslist.begin()->getParent().getPath(), parseGameGUIOptions(game.getGUIOptions()), game.platform, g->gameidStr, g->version));
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(game.language));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionPlatform(game.platform));
+
}
return games;
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index d508efc5067..f8f7175e5e4 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -239,6 +239,8 @@ DetectedGames ScummMetaEngineDetection::detectGames(const Common::FSList &fslist
game.setGUIOptions(customizeGuiOptions(*x));
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionPlatform(x->game.platform));
+
detectedGames.push_back(game);
}
diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp
index 502a1b79735..79bb1d30a35 100644
--- a/gui/editgamedialog.cpp
+++ b/gui/editgamedialog.cpp
@@ -381,7 +381,8 @@ void EditGameDialog::addGameControls(GuiObject *boss, const Common::String &pref
_platformPopUp->appendEntry("");
const Common::PlatformDescription *p = Common::g_platforms;
for (; p->code; ++p) {
- _platformPopUp->appendEntry(p->description, p->id);
+ if (checkGameGUIOptionPlatform(p->id, _guioptionsString))
+ _platformPopUp->appendEntry(p->description, p->id);
}
}
@@ -393,7 +394,6 @@ void EditGameDialog::setupGraphicsTab() {
void EditGameDialog::open() {
OptionsDialog::open();
- int sel, i;
bool e;
// En-/disable dialog items depending on whether overrides are active or not.
@@ -462,14 +462,21 @@ void EditGameDialog::open() {
_engineOptions->load();
}
- const Common::PlatformDescription *p = Common::g_platforms;
const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", _domain));
- sel = 0;
- for (i = 0; p->code; ++p, ++i) {
- if (platform == p->id)
- sel = i + 2;
+
+ if (ConfMan.hasKey("platform", _domain)) {
+ _platformPopUp->setSelectedTag(platform);
+ } else {
+ _platformPopUp->setSelectedTag((uint32)Common::kPlatformUnknown);
+ }
+
+ // First entry is <default>
+ // Second entry is ""
+ // So from third entry onwards are actual platforms - same logic as for language
+ if (_platformPopUp->numEntries() <= 3) {
+ _platformPopUpDesc->setEnabled(false);
+ _platformPopUp->setEnabled(false);
}
- _platformPopUp->setSelected(sel);
}
void EditGameDialog::close() {
Commit: aa9973aa98a97c3168c4c19b97a451011840ce1d
https://github.com/scummvm/scummvm/commit/aa9973aa98a97c3168c4c19b97a451011840ce1d
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: Add gui options for additional platform detection
Changed paths:
common/gui_options.cpp
common/gui_options.h
common/platform.cpp
common/platform.h
engines/advancedDetector.cpp
engines/sci/detection.cpp
engines/sci/metaengine.cpp
engines/scumm/metaengine.cpp
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index a4f5ff3ee09..a061a3f9e7e 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -22,6 +22,7 @@
#include "common/gui_options.h"
#include "common/config-manager.h"
+#include "common/platform.h"
#include "common/str.h"
namespace Common {
@@ -167,6 +168,8 @@ String parseGameGUIOptions(const String &str) {
}
}
+ res += parseGameGUIOptionsPlatforms(str);
+
return res;
}
@@ -177,13 +180,15 @@ const String getGameGUIOptionsDescription(const String &options) {
if (options.contains(g_gameOptions[i].option[0]))
res += String(g_gameOptions[i].desc) + " ";
+ res += getGameGUIOptionsDescriptionPlatforms(options);
res.trim();
return res;
}
-void updateGameGUIOptions(const String &options, const String &langOption) {
- const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption;
+void updateGameGUIOptions(const String &options, const String &langOption, const String &platOption) {
+ const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption + " " + platOption;
+
ConfMan.setAndFlush("guioptions", newOptionString);
}
diff --git a/common/gui_options.h b/common/gui_options.h
index 12301b65bf4..363772b426f 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -81,6 +81,47 @@
#define GUIO_NOLANG "\x33"
+// Defines to be used for additional platforms
+#define GUIO_PLAT_APPLE2GS "\x40"
+#define GUIO_PLAT_APPLE2 "\x41"
+#define GUIO_PLAT_3DO "\x42"
+#define GUIO_PLAT_ACORN "\x43"
+#define GUIO_PLAT_AMIGA "\x44"
+#define GUIO_PLAT_ATARI8BIT "\x45"
+#define GUIO_PLAT_ATARIST "\x46"
+#define GUIO_PLAT_C64 "\x47"
+#define GUIO_PLAT_AMSTRADCPC "\x48"
+#define GUIO_PLAT_DOS "\x49"
+#define GUIO_PLAT_PC98 "\x4A"
+#define GUIO_PLAT_WII "\x4B"
+#define GUIO_PLAT_COCO "\x4C"
+#define GUIO_PLAT_COCO3 "\x4D"
+#define GUIO_PLAT_FMTOWNS "\x4E"
+#define GUIO_PLAT_LINUX "\x4F"
+#define GUIO_PLAT_MACINTOSH "\x50"
+#define GUIO_PLAT_PCENGINE "\x51"
+#define GUIO_PLAT_NES "\x52"
+#define GUIO_PLAT_SEGACD "\x53"
+#define GUIO_PLAT_WINDOWS "\x54"
+#define GUIO_PLAT_PSX "\x55"
+#define GUIO_PLAT_PS2 "\x56"
+#define GUIO_PLAT_PS3 "\x57"
+#define GUIO_PLAT_XBOX "\x58"
+#define GUIO_PLAT_CDI "\x59"
+#define GUIO_PLAT_IOS "\x5A"
+#define GUIO_PLAT_ANDROID "\x5B"
+#define GUIO_PLAT_OS2 "\x5C"
+#define GUIO_PLAT_BEOS "\x5D"
+#define GUIO_PLAT_POCKETPC "\x5E"
+#define GUIO_PLAT_MEGADRIVE "\x5F"
+#define GUIO_PLAT_SATURN "\x60"
+#define GUIO_PLAT_PIPPIN "\x61"
+#define GUIO_PLAT_MACINTOSHII "\x62"
+#define GUIO_PLAT_SHOCKWAVE "\x63"
+#define GUIO_PLAT_ZX "\x64"
+#define GUIO_PLAT_TI994 "\x65"
+#define GUIO_PLAT_NINTENDOSWITCH "\x66"
+
// Special GUIO flags for the AdvancedDetector's caching of game specific
// options.
// Putting them to the end of the range so less renumerations required
@@ -153,7 +194,7 @@ const String getGameGUIOptionsDescription(const String &options);
* domain when they differ to the ones passed as
* parameter.
*/
-void updateGameGUIOptions(const String &options, const String &langOption);
+void updateGameGUIOptions(const String &options, const String &langOption, const String &platOption);
/** @} */
diff --git a/common/platform.cpp b/common/platform.cpp
index 539f4b35327..cbaae607894 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -20,58 +20,58 @@
*/
#include "common/platform.h"
+#include "common/array.h"
+#include "common/gui_options.h"
#include "common/str.h"
#include "common/algorithm.h"
namespace Common {
const PlatformDescription g_platforms[] = {
- { "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
- { "apple2", "apple2", "apple2", "Apple II", kPlatformApple2 },
- { "3do", "3do", "3do", "3DO", kPlatform3DO },
- { "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn },
- { "amiga", "ami", "amiga", "Amiga", kPlatformAmiga },
- { "atari8", "atari8", "atari8", "Atari 8-bit", kPlatformAtari8Bit },
- { "atari", "atari-st", "st", "Atari ST", kPlatformAtariST },
- { "c64", "c64", "c64", "Commodore 64", kPlatformC64 },
- { "cpc", "cpc", "cpc", "Amstrad CPC", kPlatformAmstradCPC },
- { "pc", "dos", "ibm", "DOS", kPlatformDOS },
- { "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 },
- { "wii", "wii", "wii", "Nintendo Wii", kPlatformWii },
- { "coco", "coco", "coco", "CoCo", kPlatformCoCo }, // CoCo 1/2
- { "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, // CoCo 3 only
-
+ { GUIO_PLAT_APPLE2GS, "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
+ { GUIO_PLAT_APPLE2, "apple2", "apple2", "apple2", "Apple II", kPlatformApple2 },
+ { GUIO_PLAT_3DO, "3do", "3do", "3do", "3DO", kPlatform3DO },
+ { GUIO_PLAT_ACORN, "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn },
+ { GUIO_PLAT_AMIGA, "amiga", "ami", "amiga", "Amiga", kPlatformAmiga },
+ { GUIO_PLAT_ATARI8BIT, "atari8", "atari8", "atari8", "Atari 8-bit", kPlatformAtari8Bit },
+ { GUIO_PLAT_ATARIST, "atari", "atari-st", "st", "Atari ST", kPlatformAtariST },
+ { GUIO_PLAT_C64, "c64", "c64", "c64", "Commodore 64", kPlatformC64 },
+ { GUIO_PLAT_AMSTRADCPC, "cpc", "cpc", "cpc", "Amstrad CPC", kPlatformAmstradCPC },
+ { GUIO_PLAT_DOS, "pc", "dos", "ibm", "DOS", kPlatformDOS },
+ { GUIO_PLAT_PC98, "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 },
+ { GUIO_PLAT_WII, "wii", "wii", "wii", "Nintendo Wii", kPlatformWii },
+ { GUIO_PLAT_COCO, "coco", "coco", "coco", "CoCo", kPlatformCoCo }, // CoCo 1/2
+ { GUIO_PLAT_COCO3, "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, // CoCo 3 only
// The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo).
// However, on the net many variations can be seen, like "FMTOWNS",
// "FM TOWNS", "FmTowns", etc.
- { "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns },
-
- { "linux", "linux", "linux", "Linux", kPlatformLinux },
- { "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh },
- { "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
- { "nes", "nes", "nes", "NES", kPlatformNES },
- { "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
- { "windows", "win", "win", "Windows", kPlatformWindows },
- { "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
- { "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 },
- { "playstation3", "ps3", "ps3", "Sony PlayStation 3", kPlatformPS3 },
- { "xbox", "xbox", "xbox", "Microsoft Xbox", kPlatformXbox },
- { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
- { "ios", "ios", "ios", "Apple iOS", kPlatformIOS },
- { "android", "android", "android", "Android", kPlatformAndroid },
- { "os2", "os2", "os2", "OS/2", kPlatformOS2 },
- { "beos", "beos", "beos", "BeOS", kPlatformBeOS },
- { "ppc", "ppc", "ppc", "PocketPC", kPlatformPocketPC },
- { "megadrive", "genesis", "md", "Mega Drive/Genesis", kPlatformMegaDrive },
- { "saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn },
- { "pippin", "pippin", "pippin", "Pippin", kPlatformPippin },
- { "macintosh2", "macintosh2", "mac2", "Macintosh II", kPlatformMacintoshII },
- { "shockwave", "shockwave", "shock", "Shockwave", kPlatformShockwave },
- { "zx", "zx", "zx", "ZX Spectrum", kPlatformZX },
- { "ti994", "ti994", "ti994", "TI-99/4A", kPlatformTI994 },
- { "switch", "switch", "switch", "Nintendo Switch", kPlatformNintendoSwitch },
-
- { nullptr, nullptr, nullptr, "Default", kPlatformUnknown }
+ { GUIO_PLAT_FMTOWNS, "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns },
+ { GUIO_PLAT_LINUX, "linux", "linux", "linux", "Linux", kPlatformLinux },
+ { GUIO_PLAT_MACINTOSH, "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh },
+ { GUIO_PLAT_PCENGINE, "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
+ { GUIO_PLAT_NES, "nes", "nes", "nes", "NES", kPlatformNES },
+ { GUIO_PLAT_SEGACD, "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
+ { GUIO_PLAT_WINDOWS, "windows", "win", "win", "Windows", kPlatformWindows },
+ { GUIO_PLAT_PSX, "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
+ { GUIO_PLAT_PS2, "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 },
+ { GUIO_PLAT_PS3, "playstation3", "ps3", "ps3", "Sony PlayStation 3", kPlatformPS3 },
+ { GUIO_PLAT_XBOX, "xbox", "xbox", "xbox", "Microsoft Xbox", kPlatformXbox },
+ { GUIO_PLAT_CDI, "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
+ { GUIO_PLAT_IOS, "ios", "ios", "ios", "Apple iOS", kPlatformIOS },
+ { GUIO_PLAT_ANDROID, "android", "android", "android", "Android", kPlatformAndroid },
+ { GUIO_PLAT_OS2, "os2", "os2", "os2", "OS/2", kPlatformOS2 },
+ { GUIO_PLAT_BEOS, "beos", "beos", "beos", "BeOS", kPlatformBeOS },
+ { GUIO_PLAT_POCKETPC, "ppc", "ppc", "ppc", "PocketPC", kPlatformPocketPC },
+ { GUIO_PLAT_MEGADRIVE, "megadrive", "genesis", "md", "Mega Drive/Genesis", kPlatformMegaDrive },
+ { GUIO_PLAT_SATURN, "saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn },
+ { GUIO_PLAT_PIPPIN, "pippin", "pippin", "pippin", "Pippin", kPlatformPippin },
+ { GUIO_PLAT_MACINTOSHII, "macintosh2", "macintosh2", "mac2", "Macintosh II", kPlatformMacintoshII },
+ { GUIO_PLAT_SHOCKWAVE, "shockwave", "shockwave", "shock", "Shockwave", kPlatformShockwave },
+ { GUIO_PLAT_ZX, "zx", "zx", "zx", "ZX Spectrum", kPlatformZX },
+ { GUIO_PLAT_TI994, "ti994", "ti994", "ti994", "TI-99/4A", kPlatformTI994 },
+ { GUIO_PLAT_NINTENDOSWITCH, "switch", "switch", "switch", "Nintendo Switch", kPlatformNintendoSwitch },
+
+ { nullptr, nullptr, nullptr, nullptr, "Default", kPlatformUnknown }
};
Platform parsePlatform(const String &str) {
@@ -134,11 +134,34 @@ bool checkGameGUIOptionPlatform(Platform plat, const String &str) {
return false;
}
+const String parseGameGUIOptionsPlatforms(const String &str) {
+ String res;
+
+ for (int i = 0; g_platforms[i].code; i++)
+ if (str.contains("plat_" + String(g_platforms[i].code)))
+ res += String(g_platforms[i].GUIOption);
+
+ return res;
+}
+
+const String getGameGUIOptionsDescriptionPlatforms(const String &str) {
+ String res;
+
+ for (int i = 0; g_platforms[i].GUIOption; i++)
+ if (str.contains(g_platforms[i].GUIOption))
+ res += "plat_" + String(g_platforms[i].code) + " ";
+
+ res.trim();
+
+ return res;
+}
+
const String getGameGUIOptionsDescriptionPlatform(Platform plat) {
if (plat == kPlatformUnknown)
return "";
- return String("plat_") + getPlatformDescription(plat);
+ // Using platform code as description for GUI options to avoid spaces in the name
+ return String("plat_") + getPlatformCode(plat);
}
List<String> getPlatformList() {
diff --git a/common/platform.h b/common/platform.h
index efbcadf5dbd..8449749c4d3 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -88,6 +88,7 @@ enum Platform : int8 {
};
struct PlatformDescription {
+ const char *GUIOption;
const char *code;
const char *code2;
const char *abbrev;
@@ -102,8 +103,10 @@ extern Platform parsePlatform(const String &str);
extern const char *getPlatformCode(Platform id);
extern const char *getPlatformAbbrev(Platform id);
extern const char *getPlatformDescription(Platform id);
-extern const String getGameGUIOptionsDescriptionPlatform(Platform plat);
-extern bool checkGameGUIOptionPlatform(Platform plat, const String &str);
+const String getGameGUIOptionsDescriptionPlatform(Platform plat);
+bool checkGameGUIOptionPlatform(Platform plat, const String &str);
+const String parseGameGUIOptionsPlatforms(const String &str);
+const String getGameGUIOptionsDescriptionPlatforms(const String &str);
List<String> getPlatformList();
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index bcf34dc44a9..ab581219eb5 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -217,7 +217,7 @@ DetectedGame AdvancedMetaEngineDetectionBase::toDetectedGame(const ADDetectedGam
game.setGUIOptions(desc->guiOptions + _guiOptions);
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(desc->language));
- game.appendGUIOptions(getGameGUIOptionsDescriptionPlatform(desc->platform));
+ game.appendGUIOptions(Common::getGameGUIOptionsDescriptionPlatform(desc->platform));
if (desc->flags & ADGF_ADDENGLISH)
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 2cd01911695..64b6b47e6bd 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -233,10 +233,9 @@ DetectedGames SciMetaEngineDetection::detectGames(const Common::FSList &fslist,
if (game.gameId.equals(g->gameidStr))
break;
}
+
game.setGUIOptions(customizeGuiOptions(fslist.begin()->getParent().getPath(), parseGameGUIOptions(game.getGUIOptions()), game.platform, g->gameidStr, g->version));
game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(game.language));
- game.appendGUIOptions(getGameGUIOptionsDescriptionPlatform(game.platform));
-
}
return games;
diff --git a/engines/sci/metaengine.cpp b/engines/sci/metaengine.cpp
index ea232151792..6ae26445403 100644
--- a/engines/sci/metaengine.cpp
+++ b/engines/sci/metaengine.cpp
@@ -215,7 +215,9 @@ Common::Error SciMetaEngine::createInstance(OSystem *syst, Engine **engine, cons
*engine = new SciEngine(syst, desc, g->gameidEnum);
// If the GUI options were updated, we catch this here and update them in the users config file transparently.
- Common::updateGameGUIOptions(customizeGuiOptions(ConfMan.getPath("path"), desc->guiOptions, desc->platform, g->gameidStr, g->version), getGameGUIOptionsDescriptionLanguage(desc->language));
+ Common::updateGameGUIOptions(customizeGuiOptions(ConfMan.getPath("path"), desc->guiOptions, desc->platform, g->gameidStr, g->version),
+ getGameGUIOptionsDescriptionLanguage(desc->language),
+ getGameGUIOptionsDescriptionPlatform(desc->platform));
return Common::kNoError;
}
diff --git a/engines/scumm/metaengine.cpp b/engines/scumm/metaengine.cpp
index cdf47b14e43..2f3c9544802 100644
--- a/engines/scumm/metaengine.cpp
+++ b/engines/scumm/metaengine.cpp
@@ -420,7 +420,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine,
// If the GUI options were updated, we catch this here and update them in the users config
// file transparently.
- Common::updateGameGUIOptions(customizeGuiOptions(res), getGameGUIOptionsDescriptionLanguage(res.language));
+ Common::updateGameGUIOptions(customizeGuiOptions(res), getGameGUIOptionsDescriptionLanguage(res.language), getGameGUIOptionsDescriptionPlatform(res.game.platform));
// If the game was added really long ago, it may be missing its "extra"
// field. When adding game-specific options, it may be our only way of
Commit: 999d2518661db81a67c0c7aa0068b2713ad453aa
https://github.com/scummvm/scummvm/commit/999d2518661db81a67c0c7aa0068b2713ad453aa
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
SCI: Add additional platforms (as gui options) for Gabriel Knight 1
Changed paths:
engines/sci/detection_tables.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 03142bfd134..927bb9184be 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -19,6 +19,7 @@
*
*/
+#include "common/gui_options.h"
#include "common/translation.h"
namespace Sci {
@@ -907,17 +908,19 @@ static const struct ADGameDescription SciGameDescriptions[] = {
GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_TTS, \
GAMEOPTION_ENABLE_GMM_SAVE)
-#define GUIO_GK1_CD_DOS GUIO6(GUIO_LINKSPEECHTOSFX, \
+#define GUIO_GK1_CD_DOS GUIO7(GUIO_LINKSPEECHTOSFX, \
GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_HIGH_RESOLUTION_GRAPHICS, \
GAMEOPTION_HQ_VIDEO, \
GAMEOPTION_ENABLE_GMM_SAVE, \
- GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX)
-#define GUIO_GK1_CD_WIN GUIO5(GUIO_LINKSPEECHTOSFX, \
+ GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX, \
+ GUIO_PLAT_WINDOWS)
+#define GUIO_GK1_CD_WIN GUIO6(GUIO_LINKSPEECHTOSFX, \
GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_HQ_VIDEO, \
GAMEOPTION_ENABLE_GMM_SAVE, \
- GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX)
+ GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX, \
+ GUIO_PLAT_DOS)
#define GUIO_GK1_MAC GUIO3(GUIO_NOSPEECH, \
GAMEOPTION_TTS, \
GAMEOPTION_ENABLE_GMM_SAVE)
@@ -5902,7 +5905,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "0d8dfe42683b46f3131823233a91ce6a", 787066},
AD_LISTEND},
Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO_STD16_MAC_PALETTEMODS },
-
+
// Space Quest 3 - Hebrew DOS (from the Space Quest Collection)
// Executable scanning reports "0.000.685", VERSION file reports "1.018"
// This translation is still a work in progress
@@ -5914,7 +5917,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"PATCHES/font.000", 0, "6fab182f1c071d1ed47be27776964baf", 3334},
AD_LISTEND},
Common::HE_ISR, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO_STD16_PALETTEMODS },
-
+
// Space Quest 3 - Spanish fan translation. VERSION file reports "06/03/2002"
{ "sq3", "", {
{"resource.map", 0, "9ba042c797b62dd46d8979caeed61116", 3726},
Commit: 104a2c81fe1de1b41ef08986fe752b71219e0c1d
https://github.com/scummvm/scummvm/commit/104a2c81fe1de1b41ef08986fe752b71219e0c1d
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: JANITORIAL: Add comments for gui options and platform functions
Changed paths:
common/gui_options.h
common/platform.cpp
common/platform.h
diff --git a/common/gui_options.h b/common/gui_options.h
index 363772b426f..9c2d2ea790c 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -185,8 +185,19 @@ namespace Common {
class String;
+/**
+* Check if given option exists in a string
+*/
bool checkGameGUIOption(const String &option, const String &str);
+
+/**
+* Parse GUIOptions string to GUIO literals defined in this file
+*/
String parseGameGUIOptions(const String &str);
+
+/**
+* Return string containing gui options description based on GUIO literals
+*/
const String getGameGUIOptionsDescription(const String &options);
/**
diff --git a/common/platform.cpp b/common/platform.cpp
index cbaae607894..4e20407a1d2 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -20,7 +20,6 @@
*/
#include "common/platform.h"
-#include "common/array.h"
#include "common/gui_options.h"
#include "common/str.h"
#include "common/algorithm.h"
diff --git a/common/platform.h b/common/platform.h
index 8449749c4d3..a4d74348861 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -103,9 +103,25 @@ extern Platform parsePlatform(const String &str);
extern const char *getPlatformCode(Platform id);
extern const char *getPlatformAbbrev(Platform id);
extern const char *getPlatformDescription(Platform id);
+
+/**
+* Return string containing platform description based on platform enum
+*/
const String getGameGUIOptionsDescriptionPlatform(Platform plat);
+
+/**
+* Check if given platform option is present in a string
+*/
bool checkGameGUIOptionPlatform(Platform plat, const String &str);
+
+/**
+* Parse gui options string to GUIO platform literals
+*/
const String parseGameGUIOptionsPlatforms(const String &str);
+
+/**
+* Return string containing platform(s) description based on gui options string
+*/
const String getGameGUIOptionsDescriptionPlatforms(const String &str);
List<String> getPlatformList();
Commit: 47b4ea44f42e541dc473981a016fdb1f479aeef8
https://github.com/scummvm/scummvm/commit/47b4ea44f42e541dc473981a016fdb1f479aeef8
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: Rework adding additional platforms for gui options
Changed paths:
common/gui_options.h
common/platform.cpp
common/platform.h
engines/sci/detection_tables.h
diff --git a/common/gui_options.h b/common/gui_options.h
index 9c2d2ea790c..f8ff0517d0e 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -22,6 +22,8 @@
#ifndef COMMON_GUI_OPTIONS_H
#define COMMON_GUI_OPTIONS_H
+#include "platform.h"
+
// This is an equivalent of an enum. Feel free to renumerate them
// They are used only internally for making lookups cheaper and for
// possibility to concatenate them as codes to the detection tables
@@ -81,46 +83,12 @@
#define GUIO_NOLANG "\x33"
-// Defines to be used for additional platforms
-#define GUIO_PLAT_APPLE2GS "\x40"
-#define GUIO_PLAT_APPLE2 "\x41"
-#define GUIO_PLAT_3DO "\x42"
-#define GUIO_PLAT_ACORN "\x43"
-#define GUIO_PLAT_AMIGA "\x44"
-#define GUIO_PLAT_ATARI8BIT "\x45"
-#define GUIO_PLAT_ATARIST "\x46"
-#define GUIO_PLAT_C64 "\x47"
-#define GUIO_PLAT_AMSTRADCPC "\x48"
-#define GUIO_PLAT_DOS "\x49"
-#define GUIO_PLAT_PC98 "\x4A"
-#define GUIO_PLAT_WII "\x4B"
-#define GUIO_PLAT_COCO "\x4C"
-#define GUIO_PLAT_COCO3 "\x4D"
-#define GUIO_PLAT_FMTOWNS "\x4E"
-#define GUIO_PLAT_LINUX "\x4F"
-#define GUIO_PLAT_MACINTOSH "\x50"
-#define GUIO_PLAT_PCENGINE "\x51"
-#define GUIO_PLAT_NES "\x52"
-#define GUIO_PLAT_SEGACD "\x53"
-#define GUIO_PLAT_WINDOWS "\x54"
-#define GUIO_PLAT_PSX "\x55"
-#define GUIO_PLAT_PS2 "\x56"
-#define GUIO_PLAT_PS3 "\x57"
-#define GUIO_PLAT_XBOX "\x58"
-#define GUIO_PLAT_CDI "\x59"
-#define GUIO_PLAT_IOS "\x5A"
-#define GUIO_PLAT_ANDROID "\x5B"
-#define GUIO_PLAT_OS2 "\x5C"
-#define GUIO_PLAT_BEOS "\x5D"
-#define GUIO_PLAT_POCKETPC "\x5E"
-#define GUIO_PLAT_MEGADRIVE "\x5F"
-#define GUIO_PLAT_SATURN "\x60"
-#define GUIO_PLAT_PIPPIN "\x61"
-#define GUIO_PLAT_MACINTOSHII "\x62"
-#define GUIO_PLAT_SHOCKWAVE "\x63"
-#define GUIO_PLAT_ZX "\x64"
-#define GUIO_PLAT_TI994 "\x65"
-#define GUIO_PLAT_NINTENDOSWITCH "\x66"
+// Helper macros to get string for the platform
+#define GUIO_GET_PLAT_STR_IMPL(val, hex) hex
+#define GUIO_GET_PLAT_STR(name) GUIO_GET_PLAT_STR_IMPL(name)
+
+// Get hex string literal for the given platform
+#define GUIO_PLATFORM(p) GUIO_GET_PLAT_STR(p##_VAL)
// Special GUIO flags for the AdvancedDetector's caching of game specific
// options.
diff --git a/common/platform.cpp b/common/platform.cpp
index 4e20407a1d2..bc9f0c43407 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -27,50 +27,50 @@
namespace Common {
const PlatformDescription g_platforms[] = {
- { GUIO_PLAT_APPLE2GS, "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
- { GUIO_PLAT_APPLE2, "apple2", "apple2", "apple2", "Apple II", kPlatformApple2 },
- { GUIO_PLAT_3DO, "3do", "3do", "3do", "3DO", kPlatform3DO },
- { GUIO_PLAT_ACORN, "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn },
- { GUIO_PLAT_AMIGA, "amiga", "ami", "amiga", "Amiga", kPlatformAmiga },
- { GUIO_PLAT_ATARI8BIT, "atari8", "atari8", "atari8", "Atari 8-bit", kPlatformAtari8Bit },
- { GUIO_PLAT_ATARIST, "atari", "atari-st", "st", "Atari ST", kPlatformAtariST },
- { GUIO_PLAT_C64, "c64", "c64", "c64", "Commodore 64", kPlatformC64 },
- { GUIO_PLAT_AMSTRADCPC, "cpc", "cpc", "cpc", "Amstrad CPC", kPlatformAmstradCPC },
- { GUIO_PLAT_DOS, "pc", "dos", "ibm", "DOS", kPlatformDOS },
- { GUIO_PLAT_PC98, "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 },
- { GUIO_PLAT_WII, "wii", "wii", "wii", "Nintendo Wii", kPlatformWii },
- { GUIO_PLAT_COCO, "coco", "coco", "coco", "CoCo", kPlatformCoCo }, // CoCo 1/2
- { GUIO_PLAT_COCO3, "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, // CoCo 3 only
+ { "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
+ { "apple2", "apple2", "apple2", "Apple II", kPlatformApple2 },
+ { "3do", "3do", "3do", "3DO", kPlatform3DO },
+ { "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn },
+ { "amiga", "ami", "amiga", "Amiga", kPlatformAmiga },
+ { "atari8", "atari8", "atari8", "Atari 8-bit", kPlatformAtari8Bit },
+ { "atari", "atari-st", "st", "Atari ST", kPlatformAtariST },
+ { "c64", "c64", "c64", "Commodore 64", kPlatformC64 },
+ { "cpc", "cpc", "cpc", "Amstrad CPC", kPlatformAmstradCPC },
+ { "pc", "dos", "ibm", "DOS", kPlatformDOS },
+ { "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 },
+ { "wii", "wii", "wii", "Nintendo Wii", kPlatformWii },
+ { "coco", "coco", "coco", "CoCo", kPlatformCoCo }, // CoCo 1/2
+ { "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, // CoCo 3 only
// The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo).
// However, on the net many variations can be seen, like "FMTOWNS",
// "FM TOWNS", "FmTowns", etc.
- { GUIO_PLAT_FMTOWNS, "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns },
- { GUIO_PLAT_LINUX, "linux", "linux", "linux", "Linux", kPlatformLinux },
- { GUIO_PLAT_MACINTOSH, "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh },
- { GUIO_PLAT_PCENGINE, "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
- { GUIO_PLAT_NES, "nes", "nes", "nes", "NES", kPlatformNES },
- { GUIO_PLAT_SEGACD, "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
- { GUIO_PLAT_WINDOWS, "windows", "win", "win", "Windows", kPlatformWindows },
- { GUIO_PLAT_PSX, "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
- { GUIO_PLAT_PS2, "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 },
- { GUIO_PLAT_PS3, "playstation3", "ps3", "ps3", "Sony PlayStation 3", kPlatformPS3 },
- { GUIO_PLAT_XBOX, "xbox", "xbox", "xbox", "Microsoft Xbox", kPlatformXbox },
- { GUIO_PLAT_CDI, "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
- { GUIO_PLAT_IOS, "ios", "ios", "ios", "Apple iOS", kPlatformIOS },
- { GUIO_PLAT_ANDROID, "android", "android", "android", "Android", kPlatformAndroid },
- { GUIO_PLAT_OS2, "os2", "os2", "os2", "OS/2", kPlatformOS2 },
- { GUIO_PLAT_BEOS, "beos", "beos", "beos", "BeOS", kPlatformBeOS },
- { GUIO_PLAT_POCKETPC, "ppc", "ppc", "ppc", "PocketPC", kPlatformPocketPC },
- { GUIO_PLAT_MEGADRIVE, "megadrive", "genesis", "md", "Mega Drive/Genesis", kPlatformMegaDrive },
- { GUIO_PLAT_SATURN, "saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn },
- { GUIO_PLAT_PIPPIN, "pippin", "pippin", "pippin", "Pippin", kPlatformPippin },
- { GUIO_PLAT_MACINTOSHII, "macintosh2", "macintosh2", "mac2", "Macintosh II", kPlatformMacintoshII },
- { GUIO_PLAT_SHOCKWAVE, "shockwave", "shockwave", "shock", "Shockwave", kPlatformShockwave },
- { GUIO_PLAT_ZX, "zx", "zx", "zx", "ZX Spectrum", kPlatformZX },
- { GUIO_PLAT_TI994, "ti994", "ti994", "ti994", "TI-99/4A", kPlatformTI994 },
- { GUIO_PLAT_NINTENDOSWITCH, "switch", "switch", "switch", "Nintendo Switch", kPlatformNintendoSwitch },
-
- { nullptr, nullptr, nullptr, nullptr, "Default", kPlatformUnknown }
+ { "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns },
+ { "linux", "linux", "linux", "Linux", kPlatformLinux },
+ { "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh },
+ { "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
+ { "nes", "nes", "nes", "NES", kPlatformNES },
+ { "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD },
+ { "windows", "win", "win", "Windows", kPlatformWindows },
+ { "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX },
+ { "playstation2", "ps2", "ps2", "Sony PlayStation 2", kPlatformPS2 },
+ { "playstation3", "ps3", "ps3", "Sony PlayStation 3", kPlatformPS3 },
+ { "xbox", "xbox", "xbox", "Microsoft Xbox", kPlatformXbox },
+ { "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi },
+ { "ios", "ios", "ios", "Apple iOS", kPlatformIOS },
+ { "android", "android", "android", "Android", kPlatformAndroid },
+ { "os2", "os2", "os2", "OS/2", kPlatformOS2 },
+ { "beos", "beos", "beos", "BeOS", kPlatformBeOS },
+ { "ppc", "ppc", "ppc", "PocketPC", kPlatformPocketPC },
+ { "megadrive", "genesis", "md", "Mega Drive/Genesis", kPlatformMegaDrive },
+ { "saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn },
+ { "pippin", "pippin", "pippin", "Pippin", kPlatformPippin },
+ { "macintosh2", "macintosh2", "mac2", "Macintosh II", kPlatformMacintoshII },
+ { "shockwave", "shockwave", "shock", "Shockwave", kPlatformShockwave },
+ { "zx", "zx", "zx", "ZX Spectrum", kPlatformZX },
+ { "ti994", "ti994", "ti994", "TI-99/4A", kPlatformTI994 },
+ { "switch", "switch", "switch", "Nintendo Switch", kPlatformNintendoSwitch },
+
+ { nullptr, nullptr, nullptr, "Default", kPlatformUnknown }
};
Platform parsePlatform(const String &str) {
@@ -138,7 +138,7 @@ const String parseGameGUIOptionsPlatforms(const String &str) {
for (int i = 0; g_platforms[i].code; i++)
if (str.contains("plat_" + String(g_platforms[i].code)))
- res += String(g_platforms[i].GUIOption);
+ res += String(g_platforms[i].id);
return res;
}
@@ -146,8 +146,8 @@ const String parseGameGUIOptionsPlatforms(const String &str) {
const String getGameGUIOptionsDescriptionPlatforms(const String &str) {
String res;
- for (int i = 0; g_platforms[i].GUIOption; i++)
- if (str.contains(g_platforms[i].GUIOption))
+ for (int i = 0; g_platforms[i].id; i++)
+ if (str.contains(g_platforms[i].id))
res += "plat_" + String(g_platforms[i].code) + " ";
res.trim();
diff --git a/common/platform.h b/common/platform.h
index a4d74348861..b5d81e9fd03 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -37,6 +37,51 @@ namespace Common {
class String;
+// Helper macros to get enum value for the platform
+#define GET_ENUM_VAL_IMPL(val, hex) val
+#define GET_ENUM_VAL(name) GET_ENUM_VAL_IMPL(name)
+
+// List of platforms values as int and string literals, to be used in platform enum and gui options
+#define kPlatformApple2GS_VAL 0x40, "\x40"
+#define kPlatformApple2_VAL 0x41, "\x41"
+#define kPlatform3DO_VAL 0x42, "\x42"
+#define kPlatformAcorn_VAL 0x43, "\x43"
+#define kPlatformAmiga_VAL 0x44, "\x44"
+#define kPlatformAtari8Bit_VAL 0x45, "\x45"
+#define kPlatformAtariST_VAL 0x46, "\x46"
+#define kPlatformC64_VAL 0x47, "\x47"
+#define kPlatformAmstradCPC_VAL 0x48, "\x48"
+#define kPlatformDOS_VAL 0x49, "\x49"
+#define kPlatformPC98_VAL 0x4A, "\x4A"
+#define kPlatformWii_VAL 0x4B, "\x4B"
+#define kPlatformCoCo_VAL 0x4C, "\x4C"
+#define kPlatformCoCo3_VAL 0x4D, "\x4D"
+#define kPlatformFMTowns_VAL 0x4E, "\x4E"
+#define kPlatformLinux_VAL 0x4F, "\x4F"
+#define kPlatformMacintosh_VAL 0x50, "\x50"
+#define kPlatformPCEngine_VAL 0x51, "\x51"
+#define kPlatformNES_VAL 0x52, "\x52"
+#define kPlatformSegaCD_VAL 0x53, "\x53"
+#define kPlatformWindows_VAL 0x54, "\x54"
+#define kPlatformPSX_VAL 0x55, "\x55"
+#define kPlatformPS2_VAL 0x56, "\x56"
+#define kPlatformPS3_VAL 0x57, "\x57"
+#define kPlatformXbox_VAL 0x58, "\x58"
+#define kPlatformCDi_VAL 0x59, "\x59"
+#define kPlatformIOS_VAL 0x5A, "\x5A"
+#define kPlatformAndroid_VAL 0x5B, "\x5B"
+#define kPlatformOS2_VAL 0x5C, "\x5C"
+#define kPlatformBeOS_VAL 0x5D, "\x5D"
+#define kPlatformPocketPC_VAL 0x5E, "\x5E"
+#define kPlatformMegaDrive_VAL 0x5F, "\x5F"
+#define kPlatformSaturn_VAL 0x60, "\x60"
+#define kPlatformPippin_VAL 0x61, "\x61"
+#define kPlatformMacintoshII_VAL 0x62, "\x62"
+#define kPlatformShockwave_VAL 0x63, "\x63"
+#define kPlatformZX_VAL 0x64, "\x64"
+#define kPlatformTI994_VAL 0x65, "\x65"
+#define kPlatformNintendoSwitch_VAL 0x66, "\x66"
+
/**
* List of game platforms. Specifying a platform for a target can be used to
* give the game engines a hint for which platform the game data file are.
@@ -44,51 +89,55 @@ class String;
* game in question.
*/
enum Platform : int8 {
- kPlatformDOS,
- kPlatformAmiga,
- kPlatformAmstradCPC,
- kPlatformAtari8Bit,
- kPlatformAtariST,
- kPlatformMacintosh,
- kPlatformFMTowns,
- kPlatformWindows,
- kPlatformNES,
- kPlatformC64,
- kPlatformCoCo,
- kPlatformCoCo3,
- kPlatformLinux,
- kPlatformAcorn,
- kPlatformSegaCD,
- kPlatform3DO,
- kPlatformPCEngine,
- kPlatformApple2,
- kPlatformApple2GS,
- kPlatformPC98,
- kPlatformWii,
- kPlatformPSX,
- kPlatformPS2,
- kPlatformPS3,
- kPlatformXbox,
- kPlatformCDi,
- kPlatformIOS,
- kPlatformAndroid,
- kPlatformOS2,
- kPlatformBeOS,
- kPlatformPocketPC,
- kPlatformMegaDrive,
- kPlatformSaturn,
- kPlatformPippin,
- kPlatformMacintoshII,
- kPlatformShockwave,
- kPlatformZX,
- kPlatformTI994,
- kPlatformNintendoSwitch,
-
- kPlatformUnknown = -1
+ kPlatformDOS = GET_ENUM_VAL(kPlatformDOS_VAL),
+ kPlatformAmiga = GET_ENUM_VAL(kPlatformAmiga_VAL),
+ kPlatformAmstradCPC = GET_ENUM_VAL(kPlatformAmstradCPC_VAL),
+ kPlatformAtari8Bit = GET_ENUM_VAL(kPlatformAtari8Bit_VAL),
+ kPlatformAtariST = GET_ENUM_VAL(kPlatformAtariST_VAL),
+ kPlatformMacintosh = GET_ENUM_VAL(kPlatformMacintosh_VAL),
+ kPlatformFMTowns = GET_ENUM_VAL(kPlatformFMTowns_VAL),
+ kPlatformWindows = GET_ENUM_VAL(kPlatformWindows_VAL),
+ kPlatformNES = GET_ENUM_VAL(kPlatformNES_VAL),
+ kPlatformC64 = GET_ENUM_VAL(kPlatformC64_VAL),
+ kPlatformCoCo = GET_ENUM_VAL(kPlatformCoCo_VAL),
+ kPlatformCoCo3 = GET_ENUM_VAL(kPlatformCoCo3_VAL),
+ kPlatformLinux = GET_ENUM_VAL(kPlatformLinux_VAL),
+ kPlatformAcorn = GET_ENUM_VAL(kPlatformAcorn_VAL),
+ kPlatformSegaCD = GET_ENUM_VAL(kPlatformSegaCD_VAL),
+ kPlatform3DO = GET_ENUM_VAL(kPlatform3DO_VAL),
+ kPlatformPCEngine = GET_ENUM_VAL(kPlatformPCEngine_VAL),
+ kPlatformApple2 = GET_ENUM_VAL(kPlatformApple2_VAL),
+ kPlatformApple2GS = GET_ENUM_VAL(kPlatformApple2GS_VAL),
+ kPlatformPC98 = GET_ENUM_VAL(kPlatformPC98_VAL),
+ kPlatformWii = GET_ENUM_VAL(kPlatformWii_VAL),
+ kPlatformPSX = GET_ENUM_VAL(kPlatformPSX_VAL),
+ kPlatformPS2 = GET_ENUM_VAL(kPlatformPS2_VAL),
+ kPlatformPS3 = GET_ENUM_VAL(kPlatformPS3_VAL),
+ kPlatformXbox = GET_ENUM_VAL(kPlatformXbox_VAL),
+ kPlatformCDi = GET_ENUM_VAL(kPlatformCDi_VAL),
+ kPlatformIOS = GET_ENUM_VAL(kPlatformIOS_VAL),
+ kPlatformAndroid = GET_ENUM_VAL(kPlatformAndroid_VAL),
+ kPlatformOS2 = GET_ENUM_VAL(kPlatformOS2_VAL),
+ kPlatformBeOS = GET_ENUM_VAL(kPlatformBeOS_VAL),
+ kPlatformPocketPC = GET_ENUM_VAL(kPlatformPocketPC_VAL),
+ kPlatformMegaDrive = GET_ENUM_VAL(kPlatformMegaDrive_VAL),
+ kPlatformSaturn = GET_ENUM_VAL(kPlatformSaturn_VAL),
+ kPlatformPippin = GET_ENUM_VAL(kPlatformPippin_VAL),
+ kPlatformMacintoshII = GET_ENUM_VAL(kPlatformMacintoshII_VAL),
+ kPlatformShockwave = GET_ENUM_VAL(kPlatformShockwave_VAL),
+ kPlatformZX = GET_ENUM_VAL(kPlatformZX_VAL),
+ kPlatformTI994 = GET_ENUM_VAL(kPlatformTI994_VAL),
+ kPlatformNintendoSwitch = GET_ENUM_VAL(kPlatformNintendoSwitch_VAL),
+
+ // This is a special case, unknown platform won't be added to gui options string
+ kPlatformUnknown = -1
};
+// Do not pollute namespace
+#undef GET_ENUM_VAL_IMPL
+#undef GET_ENUM_VAL
+
struct PlatformDescription {
- const char *GUIOption;
const char *code;
const char *code2;
const char *abbrev;
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 927bb9184be..ebc609997d2 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -914,13 +914,13 @@ static const struct ADGameDescription SciGameDescriptions[] = {
GAMEOPTION_HQ_VIDEO, \
GAMEOPTION_ENABLE_GMM_SAVE, \
GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX, \
- GUIO_PLAT_WINDOWS)
+ GUIO_PLATFORM(kPlatformWindows))
#define GUIO_GK1_CD_WIN GUIO6(GUIO_LINKSPEECHTOSFX, \
GAMEOPTION_ORIGINAL_SAVELOAD, \
GAMEOPTION_HQ_VIDEO, \
GAMEOPTION_ENABLE_GMM_SAVE, \
GAMEOPTION_GK1_ENABLE_AUDIO_POPFIX, \
- GUIO_PLAT_DOS)
+ GUIO_PLATFORM(kPlatformDOS))
#define GUIO_GK1_MAC GUIO3(GUIO_NOSPEECH, \
GAMEOPTION_TTS, \
GAMEOPTION_ENABLE_GMM_SAVE)
Commit: 06200f79ab86b70736362f0cf2c229300307ab60
https://github.com/scummvm/scummvm/commit/06200f79ab86b70736362f0cf2c229300307ab60
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: Fix platform related macro expansion on MSVC compiler
Changed paths:
common/gui_options.h
common/platform.h
diff --git a/common/gui_options.h b/common/gui_options.h
index f8ff0517d0e..841031bbe5a 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -84,11 +84,18 @@
#define GUIO_NOLANG "\x33"
// Helper macros to get string for the platform
-#define GUIO_GET_PLAT_STR_IMPL(val, hex) hex
-#define GUIO_GET_PLAT_STR(name) GUIO_GET_PLAT_STR_IMPL(name)
+#ifdef _MSC_VER
+// Extra level of indirection required to force macro expansion
+#define GET_PLAT_STR_IMPL(val, hex) hex
+#define GET_PLAT_STR_EXPAND(x) GET_PLAT_STR_IMPL x
+#define GET_PLAT_STR(name) GET_PLAT_STR_EXPAND((name))
+#else
+#define GET_PLAT_STR_IMPL(val, hex) hex
+#define GET_PLAT_STR(name) GET_PLAT_STR_IMPL(name)
+#endif
// Get hex string literal for the given platform
-#define GUIO_PLATFORM(p) GUIO_GET_PLAT_STR(p##_VAL)
+#define GUIO_PLATFORM(p) GET_PLAT_STR(p##_VAL)
// Special GUIO flags for the AdvancedDetector's caching of game specific
// options.
diff --git a/common/platform.h b/common/platform.h
index b5d81e9fd03..c8e08ece167 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -38,8 +38,15 @@ namespace Common {
class String;
// Helper macros to get enum value for the platform
+#ifdef _MSC_VER
+// Extra level of indirection required to force macro expansion
+#define GET_ENUM_VAL_IMPL(val, hex) val
+#define GET_ENUM_VAL_EXPAND(x) GET_ENUM_VAL_IMPL x
+#define GET_ENUM_VAL(name) GET_ENUM_VAL_EXPAND((name))
+#else
#define GET_ENUM_VAL_IMPL(val, hex) val
#define GET_ENUM_VAL(name) GET_ENUM_VAL_IMPL(name)
+#endif
// List of platforms values as int and string literals, to be used in platform enum and gui options
#define kPlatformApple2GS_VAL 0x40, "\x40"
@@ -136,6 +143,9 @@ enum Platform : int8 {
// Do not pollute namespace
#undef GET_ENUM_VAL_IMPL
#undef GET_ENUM_VAL
+#ifdef _MSC_VER
+#undef GET_ENUM_VAL_EXPAND
+#endif
struct PlatformDescription {
const char *code;
Commit: e3c3556b570ed716e6499901228f9156687241b0
https://github.com/scummvm/scummvm/commit/e3c3556b570ed716e6499901228f9156687241b0
Author: Åukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-06T14:10:59+02:00
Commit Message:
GUI: Renumerate Platform enum with the help of GUIO_PLATFORM_PREFIX
Additional minor macro and include cleanups.
Changed paths:
common/gui_options.cpp
common/gui_options.h
common/platform.cpp
common/platform.h
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index a061a3f9e7e..582b2c5f653 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -176,9 +176,20 @@ String parseGameGUIOptions(const String &str) {
const String getGameGUIOptionsDescription(const String &options) {
String res;
- for (int i = 0; g_gameOptions[i].desc; i++)
- if (options.contains(g_gameOptions[i].option[0]))
- res += String(g_gameOptions[i].desc) + " ";
+ for (int i = 0; i < options.size(); i++) {
+ // Skip the next byte after platform prefix as it will contain platform info
+ if (options[i] == GUIO_PLATFORM_PREFIX[0]) {
+ i++;
+ continue;
+ }
+
+ for (int j = 0; g_gameOptions[j].desc; j++) {
+ if (options[i] == g_gameOptions[j].option[0]) {
+ res += String(g_gameOptions[j].desc) + " ";
+ break;
+ }
+ }
+ }
res += getGameGUIOptionsDescriptionPlatforms(options);
res.trim();
diff --git a/common/gui_options.h b/common/gui_options.h
index 841031bbe5a..9ef73b1061c 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -22,7 +22,7 @@
#ifndef COMMON_GUI_OPTIONS_H
#define COMMON_GUI_OPTIONS_H
-#include "platform.h"
+#include "common/platform.h"
// This is an equivalent of an enum. Feel free to renumerate them
// They are used only internally for making lookups cheaper and for
@@ -84,18 +84,15 @@
#define GUIO_NOLANG "\x33"
// Helper macros to get string for the platform
-#ifdef _MSC_VER
-// Extra level of indirection required to force macro expansion
+// Extra level of indirection required to force macro expansion on some compilers
#define GET_PLAT_STR_IMPL(val, hex) hex
#define GET_PLAT_STR_EXPAND(x) GET_PLAT_STR_IMPL x
#define GET_PLAT_STR(name) GET_PLAT_STR_EXPAND((name))
-#else
-#define GET_PLAT_STR_IMPL(val, hex) hex
-#define GET_PLAT_STR(name) GET_PLAT_STR_IMPL(name)
-#endif
+
+#define GUIO_PLATFORM_PREFIX "\x40"
// Get hex string literal for the given platform
-#define GUIO_PLATFORM(p) GET_PLAT_STR(p##_VAL)
+#define GUIO_PLATFORM(p) GUIO_PLATFORM_PREFIX GET_PLAT_STR(p##_VAL)
// Special GUIO flags for the AdvancedDetector's caching of game specific
// options.
diff --git a/common/platform.cpp b/common/platform.cpp
index bc9f0c43407..a680a06af64 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -138,7 +138,7 @@ const String parseGameGUIOptionsPlatforms(const String &str) {
for (int i = 0; g_platforms[i].code; i++)
if (str.contains("plat_" + String(g_platforms[i].code)))
- res += String(g_platforms[i].id);
+ res += GUIO_PLATFORM_PREFIX + String(g_platforms[i].id);
return res;
}
@@ -146,8 +146,8 @@ const String parseGameGUIOptionsPlatforms(const String &str) {
const String getGameGUIOptionsDescriptionPlatforms(const String &str) {
String res;
- for (int i = 0; g_platforms[i].id; i++)
- if (str.contains(g_platforms[i].id))
+ for (int i = 0; g_platforms[i].id != kPlatformUnknown; i++)
+ if (str.contains(GUIO_PLATFORM_PREFIX + String(g_platforms[i].id)))
res += "plat_" + String(g_platforms[i].code) + " ";
res.trim();
diff --git a/common/platform.h b/common/platform.h
index c8e08ece167..d07440e7e7a 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -37,57 +37,52 @@ namespace Common {
class String;
-// Helper macros to get enum value for the platform
-#ifdef _MSC_VER
-// Extra level of indirection required to force macro expansion
+// Extra level of indirection required to force macro expansion on some compilers
#define GET_ENUM_VAL_IMPL(val, hex) val
#define GET_ENUM_VAL_EXPAND(x) GET_ENUM_VAL_IMPL x
#define GET_ENUM_VAL(name) GET_ENUM_VAL_EXPAND((name))
-#else
-#define GET_ENUM_VAL_IMPL(val, hex) val
-#define GET_ENUM_VAL(name) GET_ENUM_VAL_IMPL(name)
-#endif
// List of platforms values as int and string literals, to be used in platform enum and gui options
-#define kPlatformApple2GS_VAL 0x40, "\x40"
-#define kPlatformApple2_VAL 0x41, "\x41"
-#define kPlatform3DO_VAL 0x42, "\x42"
-#define kPlatformAcorn_VAL 0x43, "\x43"
-#define kPlatformAmiga_VAL 0x44, "\x44"
-#define kPlatformAtari8Bit_VAL 0x45, "\x45"
-#define kPlatformAtariST_VAL 0x46, "\x46"
-#define kPlatformC64_VAL 0x47, "\x47"
-#define kPlatformAmstradCPC_VAL 0x48, "\x48"
-#define kPlatformDOS_VAL 0x49, "\x49"
-#define kPlatformPC98_VAL 0x4A, "\x4A"
-#define kPlatformWii_VAL 0x4B, "\x4B"
-#define kPlatformCoCo_VAL 0x4C, "\x4C"
-#define kPlatformCoCo3_VAL 0x4D, "\x4D"
-#define kPlatformFMTowns_VAL 0x4E, "\x4E"
-#define kPlatformLinux_VAL 0x4F, "\x4F"
-#define kPlatformMacintosh_VAL 0x50, "\x50"
-#define kPlatformPCEngine_VAL 0x51, "\x51"
-#define kPlatformNES_VAL 0x52, "\x52"
-#define kPlatformSegaCD_VAL 0x53, "\x53"
-#define kPlatformWindows_VAL 0x54, "\x54"
-#define kPlatformPSX_VAL 0x55, "\x55"
-#define kPlatformPS2_VAL 0x56, "\x56"
-#define kPlatformPS3_VAL 0x57, "\x57"
-#define kPlatformXbox_VAL 0x58, "\x58"
-#define kPlatformCDi_VAL 0x59, "\x59"
-#define kPlatformIOS_VAL 0x5A, "\x5A"
-#define kPlatformAndroid_VAL 0x5B, "\x5B"
-#define kPlatformOS2_VAL 0x5C, "\x5C"
-#define kPlatformBeOS_VAL 0x5D, "\x5D"
-#define kPlatformPocketPC_VAL 0x5E, "\x5E"
-#define kPlatformMegaDrive_VAL 0x5F, "\x5F"
-#define kPlatformSaturn_VAL 0x60, "\x60"
-#define kPlatformPippin_VAL 0x61, "\x61"
-#define kPlatformMacintoshII_VAL 0x62, "\x62"
-#define kPlatformShockwave_VAL 0x63, "\x63"
-#define kPlatformZX_VAL 0x64, "\x64"
-#define kPlatformTI994_VAL 0x65, "\x65"
-#define kPlatformNintendoSwitch_VAL 0x66, "\x66"
+// Starting from 1 to avoid dealing with "\x00" in the middle of the string
+#define kPlatformApple2GS_VAL 0x01, "\x01"
+#define kPlatformApple2_VAL 0x02, "\x02"
+#define kPlatform3DO_VAL 0x03, "\x03"
+#define kPlatformAcorn_VAL 0x04, "\x04"
+#define kPlatformAmiga_VAL 0x05, "\x05"
+#define kPlatformAtari8Bit_VAL 0x06, "\x06"
+#define kPlatformAtariST_VAL 0x07, "\x07"
+#define kPlatformC64_VAL 0x08, "\x08"
+#define kPlatformAmstradCPC_VAL 0x09, "\x09"
+#define kPlatformDOS_VAL 0x0A, "\x0A"
+#define kPlatformPC98_VAL 0x0B, "\x0B"
+#define kPlatformWii_VAL 0x0C, "\x0C"
+#define kPlatformCoCo_VAL 0x0D, "\x0D"
+#define kPlatformCoCo3_VAL 0x0E, "\x0E"
+#define kPlatformFMTowns_VAL 0x0F, "\x0F"
+#define kPlatformLinux_VAL 0x10, "\x10"
+#define kPlatformMacintosh_VAL 0x11, "\x11"
+#define kPlatformPCEngine_VAL 0x12, "\x12"
+#define kPlatformNES_VAL 0x13, "\x13"
+#define kPlatformSegaCD_VAL 0x14, "\x14"
+#define kPlatformWindows_VAL 0x15, "\x15"
+#define kPlatformPSX_VAL 0x16, "\x16"
+#define kPlatformPS2_VAL 0x17, "\x17"
+#define kPlatformPS3_VAL 0x18, "\x18"
+#define kPlatformXbox_VAL 0x19, "\x19"
+#define kPlatformCDi_VAL 0x1A, "\x1A"
+#define kPlatformIOS_VAL 0x1B, "\x1B"
+#define kPlatformAndroid_VAL 0x1C, "\x1C"
+#define kPlatformOS2_VAL 0x1D, "\x1D"
+#define kPlatformBeOS_VAL 0x1E, "\x1E"
+#define kPlatformPocketPC_VAL 0x1F, "\x1F"
+#define kPlatformMegaDrive_VAL 0x20, "\x20"
+#define kPlatformSaturn_VAL 0x21, "\x21"
+#define kPlatformPippin_VAL 0x22, "\x22"
+#define kPlatformMacintoshII_VAL 0x23, "\x23"
+#define kPlatformShockwave_VAL 0x24, "\x24"
+#define kPlatformZX_VAL 0x25, "\x25"
+#define kPlatformTI994_VAL 0x26, "\x26"
+#define kPlatformNintendoSwitch_VAL 0x27, "\x27"
/**
* List of game platforms. Specifying a platform for a target can be used to
@@ -143,9 +138,7 @@ enum Platform : int8 {
// Do not pollute namespace
#undef GET_ENUM_VAL_IMPL
#undef GET_ENUM_VAL
-#ifdef _MSC_VER
#undef GET_ENUM_VAL_EXPAND
-#endif
struct PlatformDescription {
const char *code;
More information about the Scummvm-git-logs
mailing list