From befd3edd3b68e5720fcc357cc55530c5b196252f Mon Sep 17 00:00:00 2001
From: Caball009 <82909616+Caball009@users.noreply.github.com>
Date: Thu, 2 Apr 2026 17:32:45 +0200
Subject: [PATCH 1/3] refactor: Change unicode check from run-time to
compile-time.
---
.../GameEngine/Source/Common/System/Debug.cpp | 28 +++++++----------
Generals/Code/GameEngine/CMakeLists.txt | 2 +-
.../GameEngine/Include/Common/SystemInfo.h | 31 -------------------
.../GameEngine/Source/Common/GameEngine.cpp | 8 -----
.../Win32Device/Common/Win32OSDisplay.cpp | 29 +++++++----------
GeneralsMD/Code/GameEngine/CMakeLists.txt | 2 +-
.../GameEngine/Include/Common/SystemInfo.h | 31 -------------------
.../GameEngine/Source/Common/GameEngine.cpp | 8 -----
.../Win32Device/Common/Win32OSDisplay.cpp | 29 +++++++----------
9 files changed, 38 insertions(+), 130 deletions(-)
delete mode 100644 Generals/Code/GameEngine/Include/Common/SystemInfo.h
delete mode 100644 GeneralsMD/Code/GameEngine/Include/Common/SystemInfo.h
diff --git a/Core/GameEngine/Source/Common/System/Debug.cpp b/Core/GameEngine/Source/Common/System/Debug.cpp
index cbabe05197a..27de42eacfe 100644
--- a/Core/GameEngine/Source/Common/System/Debug.cpp
+++ b/Core/GameEngine/Source/Common/System/Debug.cpp
@@ -61,7 +61,6 @@
#include "Common/CommandLine.h"
#include "Common/Debug.h"
#include "Common/CRCDebug.h"
-#include "Common/SystemInfo.h"
#include "Common/UnicodeString.h"
#include "GameClient/ClientInstance.h"
#include "GameClient/GameText.h"
@@ -848,21 +847,18 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m)
}
}
- if (TheSystemIsUnicode)
- {
- ::MessageBoxW(nullptr, mesg.str(), prompt.str(), MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
- }
- else
- {
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(prompt);
- mesgA.translate(mesg);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0,SWP_NOSIZE |SWP_NOMOVE);
- ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), MB_OK|MB_TASKMODAL|MB_ICONERROR);
- }
+#ifdef UNICODE
+ ::MessageBoxW(nullptr, mesg.str(), prompt.str(), MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
+#else
+ // However, if we're using the default version of the message box, we need to
+ // translate the string into an AsciiString
+ AsciiString promptA, mesgA;
+ promptA.translate(prompt);
+ mesgA.translate(mesg);
+ //Make sure main window is not TOP_MOST
+ ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0,SWP_NOSIZE |SWP_NOMOVE);
+ ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), MB_OK|MB_TASKMODAL|MB_ICONERROR);
+#endif
char prevbuf[ _MAX_PATH ];
char curbuf[ _MAX_PATH ];
diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt
index 124246f68f4..5c0a945490b 100644
--- a/Generals/Code/GameEngine/CMakeLists.txt
+++ b/Generals/Code/GameEngine/CMakeLists.txt
@@ -108,7 +108,7 @@ set(GAMEENGINE_SRC
# Include/Common/STLTypedefs.h
# Include/Common/StreamingArchiveFile.h
# Include/Common/SubsystemInterface.h
- Include/Common/SystemInfo.h
+# Include/Common/SystemInfo.h
Include/Common/Team.h
Include/Common/Terrain.h
Include/Common/TerrainTypes.h
diff --git a/Generals/Code/GameEngine/Include/Common/SystemInfo.h b/Generals/Code/GameEngine/Include/Common/SystemInfo.h
deleted file mode 100644
index 8b08868eabf..00000000000
--- a/Generals/Code/GameEngine/Include/Common/SystemInfo.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-** Command & Conquer Generals(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: SystemInfo.h /////////////////////////////////////////////////////////////////////////////
-// Booleans about the System
-// Author: John K. McDonald, December 2002
-
-#pragma once
-
-extern const Bool TheSystemIsUnicode;
diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp
index 9e40587138e..77860919063 100644
--- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1058,11 +1058,3 @@ void updateTGAtoDDS()
system(CONVERT_EXEC1);
}
-
-//-------------------------------------------------------------------------------------------------
-// System things
-
-// If we're using the Wide character version of MessageBox, then there's no additional
-// processing necessary. Please note that this is a sleazy way to get this information,
-// but pending a better one, this'll have to do.
-extern const Bool TheSystemIsUnicode = (((void*) (::MessageBox)) == ((void*) (::MessageBoxW)));
diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
index dd6baa139e2..b053dbc88c0 100644
--- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
+++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
@@ -33,7 +33,6 @@
#include "Common/SubsystemInterface.h"
#include "Common/STLTypedefs.h"
#include "Common/AsciiString.h"
-#include "Common/SystemInfo.h"
#include "Common/UnicodeString.h"
#include "GameClient/GameText.h"
@@ -100,22 +99,18 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn
// @todo Make this return more than just ok/cancel - jkmcd
// (we need a function to translate back the other way.)
- Int returnResult = 0;
- if (TheSystemIsUnicode)
- {
- returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
- }
- else
- {
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(promptStr);
- mesgA.translate(mesgStr);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
- }
+#ifdef UNICODE
+ const Int returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
+#else
+ // However, if we're using the default version of the message box, we need to
+ // translate the string into an AsciiString
+ AsciiString promptA, mesgA;
+ promptA.translate(promptStr);
+ mesgA.translate(mesgStr);
+ //Make sure main window is not TOP_MOST
+ ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ const Int returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
+#endif
if (returnResult == IDOK) {
return OSDBT_OK;
diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt
index e594d69ac80..8bddb136842 100644
--- a/GeneralsMD/Code/GameEngine/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt
@@ -113,7 +113,7 @@ set(GAMEENGINE_SRC
# Include/Common/STLTypedefs.h
# Include/Common/StreamingArchiveFile.h
# Include/Common/SubsystemInterface.h
- Include/Common/SystemInfo.h
+# Include/Common/SystemInfo.h
Include/Common/Team.h
Include/Common/Terrain.h
Include/Common/TerrainTypes.h
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SystemInfo.h b/GeneralsMD/Code/GameEngine/Include/Common/SystemInfo.h
deleted file mode 100644
index c2d1f06282e..00000000000
--- a/GeneralsMD/Code/GameEngine/Include/Common/SystemInfo.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(tm)
-** Copyright 2025 Electronic Arts Inc.
-**
-** This program is free software: you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program. If not, see .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: SystemInfo.h /////////////////////////////////////////////////////////////////////////////
-// Booleans about the System
-// Author: John K. McDonald, December 2002
-
-#pragma once
-
-extern const Bool TheSystemIsUnicode;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index f8743c30079..60a2beccb4b 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1109,11 +1109,3 @@ void updateTGAtoDDS()
system(CONVERT_EXEC1);
}
-
-//-------------------------------------------------------------------------------------------------
-// System things
-
-// If we're using the Wide character version of MessageBox, then there's no additional
-// processing necessary. Please note that this is a sleazy way to get this information,
-// but pending a better one, this'll have to do.
-extern const Bool TheSystemIsUnicode = (((void*) (::MessageBox)) == ((void*) (::MessageBoxW)));
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
index 4296ef53d1f..7aabdf06268 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
@@ -33,7 +33,6 @@
#include "Common/SubsystemInterface.h"
#include "Common/STLTypedefs.h"
#include "Common/AsciiString.h"
-#include "Common/SystemInfo.h"
#include "Common/UnicodeString.h"
#include "GameClient/GameText.h"
@@ -100,22 +99,18 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn
// @todo Make this return more than just ok/cancel - jkmcd
// (we need a function to translate back the other way.)
- Int returnResult = 0;
- if (TheSystemIsUnicode)
- {
- returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
- }
- else
- {
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(promptStr);
- mesgA.translate(mesgStr);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
- }
+#ifdef UNICODE
+ const Int returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
+#else
+ // However, if we're using the default version of the message box, we need to
+ // translate the string into an AsciiString
+ AsciiString promptA, mesgA;
+ promptA.translate(promptStr);
+ mesgA.translate(mesgStr);
+ //Make sure main window is not TOP_MOST
+ ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ const Int returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
+#endif
if (returnResult == IDOK) {
return OSDBT_OK;
From 2763ddb665fd51d42d8d9ce1ba2b20d8728169d3 Mon Sep 17 00:00:00 2001
From: Caball009 <82909616+Caball009@users.noreply.github.com>
Date: Thu, 2 Apr 2026 20:02:09 +0200
Subject: [PATCH 2/3] Removed MessageBoxA code.
---
Core/GameEngine/Source/Common/System/Debug.cpp | 13 +------------
.../Source/Win32Device/Common/Win32OSDisplay.cpp | 12 ------------
.../Source/Win32Device/Common/Win32OSDisplay.cpp | 12 ------------
3 files changed, 1 insertion(+), 36 deletions(-)
diff --git a/Core/GameEngine/Source/Common/System/Debug.cpp b/Core/GameEngine/Source/Common/System/Debug.cpp
index 27de42eacfe..10207ece344 100644
--- a/Core/GameEngine/Source/Common/System/Debug.cpp
+++ b/Core/GameEngine/Source/Common/System/Debug.cpp
@@ -847,18 +847,7 @@ void ReleaseCrashLocalized(const AsciiString& p, const AsciiString& m)
}
}
-#ifdef UNICODE
- ::MessageBoxW(nullptr, mesg.str(), prompt.str(), MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
-#else
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(prompt);
- mesgA.translate(mesg);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0,SWP_NOSIZE |SWP_NOMOVE);
- ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), MB_OK|MB_TASKMODAL|MB_ICONERROR);
-#endif
+ ::MessageBoxW(nullptr, mesg.str(), prompt.str(), MB_OK | MB_SYSTEMMODAL | MB_ICONERROR);
char prevbuf[ _MAX_PATH ];
char curbuf[ _MAX_PATH ];
diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
index b053dbc88c0..dbe3d3f18e4 100644
--- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
+++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
@@ -99,19 +99,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn
// @todo Make this return more than just ok/cancel - jkmcd
// (we need a function to translate back the other way.)
-#ifdef UNICODE
const Int returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
-#else
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(promptStr);
- mesgA.translate(mesgStr);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- const Int returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
-#endif
-
if (returnResult == IDOK) {
return OSDBT_OK;
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
index 7aabdf06268..7f96c30dc86 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
@@ -99,19 +99,7 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn
// @todo Make this return more than just ok/cancel - jkmcd
// (we need a function to translate back the other way.)
-#ifdef UNICODE
const Int returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags);
-#else
- // However, if we're using the default version of the message box, we need to
- // translate the string into an AsciiString
- AsciiString promptA, mesgA;
- promptA.translate(promptStr);
- mesgA.translate(mesgStr);
- //Make sure main window is not TOP_MOST
- ::SetWindowPos(ApplicationHWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- const Int returnResult = ::MessageBoxA(nullptr, mesgA.str(), promptA.str(), windowsOptionsFlags);
-#endif
-
if (returnResult == IDOK) {
return OSDBT_OK;
}
From db3085ae8ad00d72d017fb706e3408ecc6c1fbd5 Mon Sep 17 00:00:00 2001
From: Caball009 <82909616+Caball009@users.noreply.github.com>
Date: Thu, 2 Apr 2026 22:13:12 +0200
Subject: [PATCH 3/3] Removed 'SystemInfo' header from CMake lists.
---
Core/GameEngine/CMakeLists.txt | 1 -
Generals/Code/GameEngine/CMakeLists.txt | 1 -
GeneralsMD/Code/GameEngine/CMakeLists.txt | 1 -
3 files changed, 3 deletions(-)
diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt
index cba050dd079..0154ecbde98 100644
--- a/Core/GameEngine/CMakeLists.txt
+++ b/Core/GameEngine/CMakeLists.txt
@@ -120,7 +120,6 @@ set(GAMEENGINE_SRC
Include/Common/STLTypedefs.h
Include/Common/StreamingArchiveFile.h
Include/Common/SubsystemInterface.h
-# Include/Common/SystemInfo.h
# Include/Common/Team.h
# Include/Common/Terrain.h
# Include/Common/TerrainTypes.h
diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt
index 5c0a945490b..73b6cc223bf 100644
--- a/Generals/Code/GameEngine/CMakeLists.txt
+++ b/Generals/Code/GameEngine/CMakeLists.txt
@@ -108,7 +108,6 @@ set(GAMEENGINE_SRC
# Include/Common/STLTypedefs.h
# Include/Common/StreamingArchiveFile.h
# Include/Common/SubsystemInterface.h
-# Include/Common/SystemInfo.h
Include/Common/Team.h
Include/Common/Terrain.h
Include/Common/TerrainTypes.h
diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt
index 8bddb136842..3b6d674c2b4 100644
--- a/GeneralsMD/Code/GameEngine/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt
@@ -113,7 +113,6 @@ set(GAMEENGINE_SRC
# Include/Common/STLTypedefs.h
# Include/Common/StreamingArchiveFile.h
# Include/Common/SubsystemInterface.h
-# Include/Common/SystemInfo.h
Include/Common/Team.h
Include/Common/Terrain.h
Include/Common/TerrainTypes.h