[Scummvm-git-logs] scummvm master -> b9f8c358d5e981682971d84f7e5911b0c46a09f4

lephilousophe noreply at scummvm.org
Tue Sep 23 18:38:22 UTC 2025


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

Summary:
9f6e7620f6 COMMON: Fix collisions between prefixed and one-shot GUIO options
b9f8c358d5 COMMON: Migrate MIDI, game options and render modes to 2 bytes GUIO


Commit: 9f6e7620f62d7323c2b4e86f2e9e97ae410c3289
    https://github.com/scummvm/scummvm/commit/9f6e7620f62d7323c2b4e86f2e9e97ae410c3289
Author: Łukasz Lenkiewicz (lukasz at lenkiewicz.xyz)
Date: 2025-09-23T20:38:18+02:00

Commit Message:
COMMON: Fix collisions between prefixed and one-shot GUIO options

Reserve range "\x80" - "\xdf" for prefixed options.

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 9ef73b1061c..b1f4af2b296 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -83,13 +83,15 @@
 
 #define GUIO_NOLANG          "\x33"
 
+// GUIO flags in range "\x80" - "\xbf" are reserved for prefixed lists of options
+
 // Helper macros to get string for the platform
 // 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))
 
-#define GUIO_PLATFORM_PREFIX "\x40"
+#define GUIO_PLATFORM_PREFIX "\xc0"
 
 // Get hex string literal for the given platform
 #define GUIO_PLATFORM(p) GUIO_PLATFORM_PREFIX GET_PLAT_STR(p##_VAL)
diff --git a/common/platform.cpp b/common/platform.cpp
index a680a06af64..0651f393ca8 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 += GUIO_PLATFORM_PREFIX + String(g_platforms[i].id);
+			res += GUIO_PLATFORM_PREFIX + String(g_platforms[i].id + 0x80);
 
 	return res;
 }
@@ -147,7 +147,7 @@ const String getGameGUIOptionsDescriptionPlatforms(const String &str) {
 	String res;
 
 	for (int i = 0; g_platforms[i].id != kPlatformUnknown; i++)
-		if (str.contains(GUIO_PLATFORM_PREFIX + String(g_platforms[i].id)))
+		if (str.contains(GUIO_PLATFORM_PREFIX + String(g_platforms[i].id + 0x80)))
 			res += "plat_" + String(g_platforms[i].code) + " ";
 
 	res.trim();
diff --git a/common/platform.h b/common/platform.h
index d07440e7e7a..d4efaa85c9d 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -43,46 +43,46 @@ class String;
 #define GET_ENUM_VAL(name) GET_ENUM_VAL_EXPAND((name))
 
 // List of platforms values as int and string literals, to be used in platform enum and gui options
-// 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"
+// Starting from 0x80 to avoid collision with existing GUIO options
+#define kPlatformApple2GS_VAL          0x00, "\x80"
+#define kPlatformApple2_VAL            0x01, "\x81"
+#define kPlatform3DO_VAL               0x02, "\x82"
+#define kPlatformAcorn_VAL             0x03, "\x83"
+#define kPlatformAmiga_VAL             0x04, "\x84"
+#define kPlatformAtari8Bit_VAL         0x05, "\x85"
+#define kPlatformAtariST_VAL           0x06, "\x86"
+#define kPlatformC64_VAL               0x07, "\x87"
+#define kPlatformAmstradCPC_VAL        0x08, "\x88"
+#define kPlatformDOS_VAL               0x09, "\x89"
+#define kPlatformPC98_VAL              0x0A, "\x8A"
+#define kPlatformWii_VAL               0x0B, "\x8B"
+#define kPlatformCoCo_VAL              0x0C, "\x8C"
+#define kPlatformCoCo3_VAL             0x0D, "\x8D"
+#define kPlatformFMTowns_VAL           0x0E, "\x8E"
+#define kPlatformLinux_VAL             0x0F, "\x8F"
+#define kPlatformMacintosh_VAL         0x10, "\x90"
+#define kPlatformPCEngine_VAL          0x11, "\x91"
+#define kPlatformNES_VAL               0x12, "\x92"
+#define kPlatformSegaCD_VAL            0x13, "\x93"
+#define kPlatformWindows_VAL           0x14, "\x94"
+#define kPlatformPSX_VAL               0x15, "\x95"
+#define kPlatformPS2_VAL               0x16, "\x96"
+#define kPlatformPS3_VAL               0x17, "\x97"
+#define kPlatformXbox_VAL              0x18, "\x98"
+#define kPlatformCDi_VAL               0x19, "\x99"
+#define kPlatformIOS_VAL               0x1A, "\x9A"
+#define kPlatformAndroid_VAL           0x1B, "\x9B"
+#define kPlatformOS2_VAL               0x1C, "\x9C"
+#define kPlatformBeOS_VAL              0x1D, "\x9D"
+#define kPlatformPocketPC_VAL          0x1E, "\x9E"
+#define kPlatformMegaDrive_VAL         0x1F, "\x9F"
+#define kPlatformSaturn_VAL            0x20, "\xA0"
+#define kPlatformPippin_VAL            0x21, "\xA1"
+#define kPlatformMacintoshII_VAL       0x22, "\xA2"
+#define kPlatformShockwave_VAL         0x23, "\xA3"
+#define kPlatformZX_VAL                0x24, "\xA4"
+#define kPlatformTI994_VAL             0x25, "\xA5"
+#define kPlatformNintendoSwitch_VAL    0x26, "\xA6"
 
 /**
  * List of game platforms. Specifying a platform for a target can be used to
@@ -91,48 +91,48 @@ class String;
  * game in question.
  */
 enum Platform : int8 {
-    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
+	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


Commit: b9f8c358d5e981682971d84f7e5911b0c46a09f4
    https://github.com/scummvm/scummvm/commit/b9f8c358d5e981682971d84f7e5911b0c46a09f4
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-09-23T20:38:18+02:00

Commit Message:
COMMON: Migrate MIDI, game options and render modes to 2 bytes GUIO

Changed paths:
    common/gui_options.cpp
    common/gui_options.h
    common/platform.h
    engines/sci/detection_internal.cpp
    engines/scumm/detection_internal.h
    gui/options.cpp


diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index 05b8fb7d7ec..40426e89500 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -185,6 +185,17 @@ const String getGameGUIOptionsDescription(const String &options) {
 
 		for (int j = 0; g_gameOptions[j].desc; j++) {
 			if (options[i] == g_gameOptions[j].option[0]) {
+				if (options[i] & 0x80) {
+					// 2-bytes option
+					// Make sure this is a leading option byte
+					assert((options[i] & 0xe0) == 0xc0);
+					if (options[i+1] != g_gameOptions[j].option[1]) {
+						continue;
+					}
+					// Skip the byte now we found our option
+					// The 2nd byte will be skipped at the end of loop
+					i++;
+				}
 				res += String(g_gameOptions[j].desc) + " ";
 				break;
 			}
diff --git a/common/gui_options.h b/common/gui_options.h
index b1f4af2b296..9d8ecd4f1c7 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -28,6 +28,13 @@
 // They are used only internally for making lookups cheaper and for
 // possibility to concatenate them as codes to the detection tables
 // See the GUIOnn() macros below
+// This is encoded like UTF-8 does with either 1 byte or 2 bytes codepoints
+// 3 and 4 bytes one may be added later
+
+// All simple options are expected to lie in the 0x01-0x7f range
+// The prefixed values lie in the 0x80-0xbf range
+// The options using a 2nd byte suffix lie in the 0xc0-0xdf range
+// The range 0xe0-0xff is reserved for future use
 
 #define GUIO_NONE            "\x00"
 #define GUIO_NOSUBTITLES     "\x01"
@@ -38,50 +45,13 @@
 #define GUIO_NOMIDI          "\x05"
 #define GUIO_NOLAUNCHLOAD    "\x06"
 
-#define GUIO_MIDIPCSPK       "\x07"
-#define GUIO_MIDICMS         "\x08"
-#define GUIO_MIDIPCJR        "\x09"
-#define GUIO_MIDIADLIB       "\x0a"
-#define GUIO_MIDIC64         "\x0b"
-#define GUIO_MIDIAMIGA       "\x0c"
-#define GUIO_MIDIAPPLEIIGS   "\x0d"
-#define GUIO_MIDITOWNS       "\x0e"
-#define GUIO_MIDIPC98        "\x0f"
-#define GUIO_MIDISEGACD      "\x10"
-#define GUIO_MIDIMT32        "\x11"
-#define GUIO_MIDIGM          "\x12"
-#define GUIO_MIDIMAC		 "\x17"
-
-#define GUIO_NOASPECT        "\x13"
-
-#define GUIO_RENDERHERCGREEN	"\x18"
-#define GUIO_RENDERHERCAMBER	"\x19"
-#define GUIO_RENDERCGA			"\x1a"
-#define GUIO_RENDEREGA			"\x1b"
-#define GUIO_RENDERVGA			"\x1c"
-#define GUIO_RENDERAMIGA		"\x1d"
-#define GUIO_RENDERFMTOWNS		"\x1e"
-#define GUIO_RENDERPC98_256C	"\x1f"
-#define GUIO_RENDERPC98_16C		"\x20"
-#define GUIO_RENDERAPPLE2GS		"\x21"
-#define GUIO_RENDERATARIST		"\x22"
-#define GUIO_RENDERMACINTOSH	"\x23"
-#define GUIO_RENDERMACINTOSHBW	"\x24"
-#define GUIO_RENDERCGACOMP		"\x25"
-#define GUIO_RENDERCGABW		"\x26"
-#define GUIO_RENDERCPC      	"\x27"
-#define GUIO_RENDERZX	    	"\x28"
-#define GUIO_RENDERC64	    	"\x29"
-#define GUIO_RENDERVGAGREY    	"\x2A"
-#define GUIO_RENDERPC98_8C   	"\x2B"
-#define GUIO_RENDERWIN_256C   	"\x2C"
-#define GUIO_RENDERWIN_16C   	"\x2D"
-
-#define GUIO_LINKSPEECHTOSFX "\x30"
-#define GUIO_LINKMUSICTOSFX  "\x31"
-#define GUIO_NOSPEECHVOLUME  "\x32"
-
-#define GUIO_NOLANG          "\x33"
+#define GUIO_NOASPECT        "\x07"
+
+#define GUIO_LINKSPEECHTOSFX "\x08"
+#define GUIO_LINKMUSICTOSFX  "\x09"
+#define GUIO_NOSPEECHVOLUME  "\x0a"
+
+#define GUIO_NOLANG          "\x0b"
 
 // GUIO flags in range "\x80" - "\xbf" are reserved for prefixed lists of options
 
@@ -91,46 +61,89 @@
 #define GET_PLAT_STR_EXPAND(x) GET_PLAT_STR_IMPL x
 #define GET_PLAT_STR(name) GET_PLAT_STR_EXPAND((name))
 
+// Here starts 2 bytes GUIO flags
+// They are made of a category specific prefix in the range 0xc0-0xdf followed by a byte between 0x80-0xbf
+
 #define GUIO_PLATFORM_PREFIX "\xc0"
 
 // Get hex string literal for the given platform
 #define GUIO_PLATFORM(p) GUIO_PLATFORM_PREFIX GET_PLAT_STR(p##_VAL)
 
+#define GUIO_RENDER_PREFIX       "\xc1"
+#define GUIO_RENDERHERCGREEN     "\xc1\x80"
+#define GUIO_RENDERHERCAMBER     "\xc1\x81"
+#define GUIO_RENDERCGA           "\xc1\x82"
+#define GUIO_RENDEREGA           "\xc1\x83"
+#define GUIO_RENDERVGA           "\xc1\x84"
+#define GUIO_RENDERAMIGA         "\xc1\x85"
+#define GUIO_RENDERFMTOWNS       "\xc1\x86"
+#define GUIO_RENDERPC98_256C     "\xc1\x87"
+#define GUIO_RENDERPC98_16C      "\xc1\x88"
+#define GUIO_RENDERAPPLE2GS      "\xc1\x89"
+#define GUIO_RENDERATARIST       "\xc1\x8a"
+#define GUIO_RENDERMACINTOSH     "\xc1\x8b"
+#define GUIO_RENDERMACINTOSHBW   "\xc1\x8c"
+#define GUIO_RENDERCGACOMP       "\xc1\x8d"
+#define GUIO_RENDERCGABW         "\xc1\x8e"
+#define GUIO_RENDERCPC           "\xc1\x8f"
+#define GUIO_RENDERZX            "\xc1\x90"
+#define GUIO_RENDERC64           "\xc1\x91"
+#define GUIO_RENDERVGAGREY       "\xc1\x92"
+#define GUIO_RENDERPC98_8C       "\xc1\x93"
+#define GUIO_RENDERWIN_256C      "\xc1\x94"
+#define GUIO_RENDERWIN_16C       "\xc1\x95"
+
+#define GUIO_MIDI_PREFIX     "\xc2"
+#define GUIO_MIDIPCSPK       "\xc2\x80"
+#define GUIO_MIDICMS         "\xc2\x81"
+#define GUIO_MIDIPCJR        "\xc2\x82"
+#define GUIO_MIDIADLIB       "\xc2\x83"
+#define GUIO_MIDIC64         "\xc2\x84"
+#define GUIO_MIDIAMIGA       "\xc2\x85"
+#define GUIO_MIDIAPPLEIIGS   "\xc2\x86"
+#define GUIO_MIDITOWNS       "\xc2\x87"
+#define GUIO_MIDIPC98        "\xc2\x88"
+#define GUIO_MIDISEGACD      "\xc2\x89"
+#define GUIO_MIDIMT32        "\xc2\x8a"
+#define GUIO_MIDIGM          "\xc2\x8b"
+#define GUIO_MIDIMAC         "\xc2\x8c"
+
 // Special GUIO flags for the AdvancedDetector's caching of game specific
 // options.
 // Putting them to the end of the range so less renumerations required
-#define GUIO_GAMEOPTIONS1    "\xe0"
-#define GUIO_GAMEOPTIONS2    "\xe1"
-#define GUIO_GAMEOPTIONS3    "\xe2"
-#define GUIO_GAMEOPTIONS4    "\xe3"
-#define GUIO_GAMEOPTIONS5    "\xe4"
-#define GUIO_GAMEOPTIONS6    "\xe5"
-#define GUIO_GAMEOPTIONS7    "\xe6"
-#define GUIO_GAMEOPTIONS8    "\xe7"
-#define GUIO_GAMEOPTIONS9    "\xe8"
-#define GUIO_GAMEOPTIONS10   "\xe9"
-#define GUIO_GAMEOPTIONS11   "\xea"
-#define GUIO_GAMEOPTIONS12   "\xeb"
-#define GUIO_GAMEOPTIONS13   "\xec"
-#define GUIO_GAMEOPTIONS14   "\xed"
-#define GUIO_GAMEOPTIONS15   "\xee"
-#define GUIO_GAMEOPTIONS16   "\xef"
-#define GUIO_GAMEOPTIONS17   "\xf0"
-#define GUIO_GAMEOPTIONS18   "\xf1"
-#define GUIO_GAMEOPTIONS19   "\xf2"
-#define GUIO_GAMEOPTIONS20   "\xf3"
-#define GUIO_GAMEOPTIONS21   "\xf4"
-#define GUIO_GAMEOPTIONS22   "\xf5"
-#define GUIO_GAMEOPTIONS23   "\xf6"
-#define GUIO_GAMEOPTIONS24   "\xf7"
-#define GUIO_GAMEOPTIONS25   "\xf8"
-#define GUIO_GAMEOPTIONS26   "\xf9"
-#define GUIO_GAMEOPTIONS27   "\xfa"
-#define GUIO_GAMEOPTIONS28   "\xfb"
-#define GUIO_GAMEOPTIONS29   "\xfc"
-#define GUIO_GAMEOPTIONS30   "\xfd"
-#define GUIO_GAMEOPTIONS31   "\xfe"
-#define GUIO_GAMEOPTIONS32   "\xff"
+#define GUIO_GAME_PREFIX     "\xdf"
+#define GUIO_GAMEOPTIONS1    "\xdf\x80"
+#define GUIO_GAMEOPTIONS2    "\xdf\x81"
+#define GUIO_GAMEOPTIONS3    "\xdf\x82"
+#define GUIO_GAMEOPTIONS4    "\xdf\x83"
+#define GUIO_GAMEOPTIONS5    "\xdf\x84"
+#define GUIO_GAMEOPTIONS6    "\xdf\x85"
+#define GUIO_GAMEOPTIONS7    "\xdf\x86"
+#define GUIO_GAMEOPTIONS8    "\xdf\x87"
+#define GUIO_GAMEOPTIONS9    "\xdf\x88"
+#define GUIO_GAMEOPTIONS10   "\xdf\x89"
+#define GUIO_GAMEOPTIONS11   "\xdf\x8a"
+#define GUIO_GAMEOPTIONS12   "\xdf\x8b"
+#define GUIO_GAMEOPTIONS13   "\xdf\x8c"
+#define GUIO_GAMEOPTIONS14   "\xdf\x8d"
+#define GUIO_GAMEOPTIONS15   "\xdf\x8e"
+#define GUIO_GAMEOPTIONS16   "\xdf\x8f"
+#define GUIO_GAMEOPTIONS17   "\xdf\x90"
+#define GUIO_GAMEOPTIONS18   "\xdf\x91"
+#define GUIO_GAMEOPTIONS19   "\xdf\x92"
+#define GUIO_GAMEOPTIONS20   "\xdf\x93"
+#define GUIO_GAMEOPTIONS21   "\xdf\x94"
+#define GUIO_GAMEOPTIONS22   "\xdf\x95"
+#define GUIO_GAMEOPTIONS23   "\xdf\x96"
+#define GUIO_GAMEOPTIONS24   "\xdf\x97"
+#define GUIO_GAMEOPTIONS25   "\xdf\x98"
+#define GUIO_GAMEOPTIONS26   "\xdf\x99"
+#define GUIO_GAMEOPTIONS27   "\xdf\x9a"
+#define GUIO_GAMEOPTIONS28   "\xdf\x9b"
+#define GUIO_GAMEOPTIONS29   "\xdf\x9c"
+#define GUIO_GAMEOPTIONS30   "\xdf\x9d"
+#define GUIO_GAMEOPTIONS31   "\xdf\x9e"
+#define GUIO_GAMEOPTIONS32   "\xdf\x9f"
 
 #define GUIO0() (GUIO_NONE)
 #define GUIO1(a) (a)
diff --git a/common/platform.h b/common/platform.h
index d4efaa85c9d..b0340cf6cf4 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -43,7 +43,7 @@ class String;
 #define GET_ENUM_VAL(name) GET_ENUM_VAL_EXPAND((name))
 
 // List of platforms values as int and string literals, to be used in platform enum and gui options
-// Starting from 0x80 to avoid collision with existing GUIO options
+// Starting GUI options at 0x80 to fit the numbering plan
 #define kPlatformApple2GS_VAL          0x00, "\x80"
 #define kPlatformApple2_VAL            0x01, "\x81"
 #define kPlatform3DO_VAL               0x02, "\x82"
diff --git a/engines/sci/detection_internal.cpp b/engines/sci/detection_internal.cpp
index 2ac90f10af6..851faf0f1a1 100644
--- a/engines/sci/detection_internal.cpp
+++ b/engines/sci/detection_internal.cpp
@@ -166,7 +166,7 @@ Common::String customizeGuiOptions(Common::Path gamePath, Common::String guiOpti
 				if (i->getFileName().equalsIgnoreCase(rmodes[ii].gfxDriverName)) {
 					// Make sure that the Windows 16 colors mode is only ever added to the above mentioned
 					// windows versions and the other modes only get added to the other versions.
-					if (isWindows != (strncmp(rmodes[ii].guio, GUIO_RENDERWIN_16C, 1) != 0))
+					if (isWindows != (strncmp(rmodes[ii].guio, GUIO_RENDERWIN_16C, sizeof(GUIO_RENDERWIN_16C) - 1) != 0))
 						guiOptions += rmodes[ii].guio;
 				}
 			}
diff --git a/engines/scumm/detection_internal.h b/engines/scumm/detection_internal.h
index c4aa0ba344d..8b97e75a642 100644
--- a/engines/scumm/detection_internal.h
+++ b/engines/scumm/detection_internal.h
@@ -624,7 +624,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
 
 			// Detect if there are speech files in this unknown game.
 			if (detectSpeech(fslist, g)) {
-				if (strchr(dr.game.guioptions, GUIO_NOSPEECH[0]) != NULL) {
+				if (strstr(dr.game.guioptions, GUIO_NOSPEECH) != NULL) {
 					if (g->id == GID_MONKEY || g->id == GID_MONKEY2)
 						// TODO: This may need to be updated if something important gets added
 						// in the top detection table for these game ids.
diff --git a/gui/options.cpp b/gui/options.cpp
index 091fa973038..3c9cb49b83b 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1333,11 +1333,10 @@ void OptionsDialog::setAudioSettingsState(bool enabled) {
 	_midiPopUpDesc->setEnabled(enabled);
 	_midiPopUp->setEnabled(enabled);
 
-	const Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
-	bool hasMidiDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != nullptr);
+	bool hasMidiDefined = _guioptions.contains(GUIO_MIDI_PREFIX);
 
 	if (_domain != Common::ConfigManager::kApplicationDomain && // global dialog
-		hasMidiDefined && // No flags are specified
+		hasMidiDefined && // No Adlib is specified but others are
 		!(_guioptions.contains(GUIO_MIDIADLIB))) {
 		_oplPopUpDesc->setEnabled(false);
 		_oplPopUp->setEnabled(false);
@@ -1619,8 +1618,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
 	}
 
 	// RenderMode popup
-	const Common::String allFlags = Common::allRenderModesGUIOs();
-	bool renderingTypeDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != nullptr);
+	bool renderingTypeDefined = _guioptions.contains(GUIO_RENDER_PREFIX);
 
 	_renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"), _("Special dithering modes supported by some games"));
 	if (ConfMan.isKeyTemporary("render_mode"))
@@ -1763,8 +1761,7 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
 	_midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup", _("Specifies output sound device or sound card emulator"));
 
 	// Populate it
-	const Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
-	bool hasMidiDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != nullptr);
+	bool hasMidiDefined = _guioptions.contains(GUIO_MIDI_PREFIX);
 
 	const PluginList p = MusicMan.getPlugins();
 	for (const auto &m : p) {




More information about the Scummvm-git-logs mailing list