diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3f4ad0fa8..56b81b950a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,15 +42,17 @@ include(FetchContent)
if((WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4)
include(cmake/miles.cmake)
include(cmake/bink.cmake)
- if (IS_VS6_BUILD)
- include(cmake/stlport.cmake)
- else()
- add_library(stlport INTERFACE) # Do not use stlport
- endif()
include(cmake/dx8.cmake)
include(cmake/dbghelp.cmake)
endif()
+# Define a dummy stlport target when not on VC6.
+if (IS_VS6_BUILD)
+ include(cmake/stlport.cmake)
+else()
+ add_library(stlport INTERFACE)
+endif()
+
include(cmake/config.cmake)
include(cmake/gamespy.cmake)
include(cmake/lzhl.cmake)
diff --git a/Dependencies/Utility/Utility/CppMacros.h b/Dependencies/Utility/Utility/CppMacros.h
index 680aeda5d6..7a6c1be907 100644
--- a/Dependencies/Utility/Utility/CppMacros.h
+++ b/Dependencies/Utility/Utility/CppMacros.h
@@ -1,6 +1,22 @@
-// TheSuperHackers
-// This file contains macros to help upgrade the code for newer cpp standards.
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+// This file contains macros to help upgrade the code for newer cpp standards.
#pragma once
#if __cplusplus >= 201703L
diff --git a/Dependencies/Utility/Utility/compat.h b/Dependencies/Utility/Utility/compat.h
new file mode 100644
index 0000000000..7af2c302c2
--- /dev/null
+++ b/Dependencies/Utility/Utility/compat.h
@@ -0,0 +1,74 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains macros to help compiling on non-windows platforms.
+#pragma once
+
+#ifndef _WIN32
+// For size_t
+#include
+// For isdigit
+#include
+
+// __forceinline
+#ifndef __forceinline
+#if defined __has_attribute && __has_attribute(always_inline)
+#define __forceinline __attribute__((always_inline)) inline
+#else
+#define __forceinline inline
+#endif
+#endif
+
+// _cdecl / __cdecl
+#ifndef _cdecl
+#define _cdecl
+#endif
+#ifndef __cdecl
+#define __cdecl
+#endif
+
+// OutputDebugString
+#ifndef OutputDebugString
+#define OutputDebugString(str) printf("%s\n", str)
+#endif
+
+// _MAX_DRIVE, _MAX_DIR, _MAX_FNAME, _MAX_EXT, _MAX_PATH
+#ifndef _MAX_DRIVE
+#define _MAX_DRIVE 3
+#endif
+#ifndef _MAX_DIR
+#define _MAX_DIR 256
+#endif
+#ifndef _MAX_FNAME
+#define _MAX_FNAME 256
+#endif
+#ifndef _MAX_EXT
+#define _MAX_EXT 256
+#endif
+#ifndef _MAX_PATH
+#define _MAX_PATH 260
+#endif
+
+#include "mem_compat.h"
+#include "string_compat.h"
+#include "tchar_compat.h"
+#include "wchar_compat.h"
+#include "time_compat.h"
+#include "thread_compat.h"
+
+#endif
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/fstream_adapter.h b/Dependencies/Utility/Utility/fstream_adapter.h
index 9857571356..ed4f1dce80 100644
--- a/Dependencies/Utility/Utility/fstream_adapter.h
+++ b/Dependencies/Utility/Utility/fstream_adapter.h
@@ -1,4 +1,21 @@
-// TheSuperHackers
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
// This file includes the fstream that is compatible with vs6, STLPort and modern c++.
#pragma once
diff --git a/Dependencies/Utility/Utility/hash_map_adapter.h b/Dependencies/Utility/Utility/hash_map_adapter.h
index 254c61e671..698ef80435 100644
--- a/Dependencies/Utility/Utility/hash_map_adapter.h
+++ b/Dependencies/Utility/Utility/hash_map_adapter.h
@@ -1,4 +1,21 @@
-// TheSuperHackers
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
// This file includes a hash map that is compatible with vs6, STLPort and modern c++ for the most part.
// There are differences, for example std::hash_map::resize is the equivalent to std::unordered_map::reserve.
diff --git a/Dependencies/Utility/Utility/intrin_compat.h b/Dependencies/Utility/Utility/intrin_compat.h
index c0e2ffa9e7..d17dc12d28 100644
--- a/Dependencies/Utility/Utility/intrin_compat.h
+++ b/Dependencies/Utility/Utility/intrin_compat.h
@@ -1,3 +1,22 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains macros to help compiling on non-windows platforms and VC6 compatibility macros.
#pragma once
// VC6 macros
diff --git a/Dependencies/Utility/Utility/iostream_adapter.h b/Dependencies/Utility/Utility/iostream_adapter.h
index 11e6086fcb..65ad38b6a1 100644
--- a/Dependencies/Utility/Utility/iostream_adapter.h
+++ b/Dependencies/Utility/Utility/iostream_adapter.h
@@ -1,4 +1,21 @@
-// TheSuperHackers
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
// This file helps adapting modern iostream to legacy vs6 iostream,
// where symbols are not contained in the std namespace.
diff --git a/Dependencies/Utility/Utility/mem_compat.h b/Dependencies/Utility/Utility/mem_compat.h
new file mode 100644
index 0000000000..189e1d058f
--- /dev/null
+++ b/Dependencies/Utility/Utility/mem_compat.h
@@ -0,0 +1,23 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// Thhis file contains the _alloca macro for alloca, which is used in the codebase.
+#pragma once
+
+#include
+#define _alloca alloca
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/sstream_adapter.h b/Dependencies/Utility/Utility/sstream_adapter.h
index 5c10328319..b486274335 100644
--- a/Dependencies/Utility/Utility/sstream_adapter.h
+++ b/Dependencies/Utility/Utility/sstream_adapter.h
@@ -1,7 +1,23 @@
-// TheSuperHackers
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
// This file helps adapting modern sstream to legacy vs6 strstrea,
// where symbols are not contained in the std namespace.
-
#pragma once
#if defined(USING_STLPORT) || (defined(_MSC_VER) && _MSC_VER < 1300)
diff --git a/Dependencies/Utility/Utility/string_compat.h b/Dependencies/Utility/Utility/string_compat.h
new file mode 100644
index 0000000000..1ae24864be
--- /dev/null
+++ b/Dependencies/Utility/Utility/string_compat.h
@@ -0,0 +1,39 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains string macros and alias functions to help compiling on non-windows platforms
+#pragma once
+#include
+
+typedef const char* LPCSTR;
+typedef char* LPSTR;
+
+// String functions
+inline char *_strlwr(char *str) {
+ for (int i = 0; str[i] != '\0'; i++) {
+ str[i] = tolower(str[i]);
+ }
+ return str;
+}
+
+#define strlwr _strlwr
+#define _vsnprintf vsnprintf
+#define _snprintf snprintf
+#define stricmp strcasecmp
+#define strnicmp strncasecmp
+#define strcmpi strcasecmp
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/tchar_compat.h b/Dependencies/Utility/Utility/tchar_compat.h
new file mode 100644
index 0000000000..f5a470fbef
--- /dev/null
+++ b/Dependencies/Utility/Utility/tchar_compat.h
@@ -0,0 +1,30 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file defines TCHAR and related macros for compatibility with non-windows platforms.
+#pragma once
+
+// TCHAR
+typedef char TCHAR;
+typedef const TCHAR* LPCTSTR;
+typedef TCHAR* LPTSTR;
+#define _tcslen strlen
+#define _tcscmp strcmp
+#define _tcsicmp strcasecmp
+#define _tcsclen strlen
+#define _tcscpy strcpy
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/thread_compat.h b/Dependencies/Utility/Utility/thread_compat.h
new file mode 100644
index 0000000000..9345944e7f
--- /dev/null
+++ b/Dependencies/Utility/Utility/thread_compat.h
@@ -0,0 +1,32 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains thread related functions for compatibility with non-windows platforms.
+#pragma once
+#include
+#include
+
+inline int GetCurrentThreadId()
+{
+ return pthread_self();
+}
+
+inline void Sleep(int ms)
+{
+ usleep(ms * 1000);
+}
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/time_compat.h b/Dependencies/Utility/Utility/time_compat.h
new file mode 100644
index 0000000000..1dd9582079
--- /dev/null
+++ b/Dependencies/Utility/Utility/time_compat.h
@@ -0,0 +1,40 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains the time functions for compatibility with non-windows platforms.
+#pragma once
+#include
+
+#define TIMERR_NOERROR 0
+typedef int MMRESULT;
+static inline MMRESULT timeBeginPeriod(int) { return TIMERR_NOERROR; }
+static inline MMRESULT timeEndPeriod(int) { return TIMERR_NOERROR; }
+
+inline unsigned int timeGetTime()
+{
+ struct timespec ts;
+ clock_gettime(CLOCK_BOOTTIME, &ts);
+ return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+}
+inline unsigned int GetTickCount()
+{
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ // Return ms since boot
+ return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+}
\ No newline at end of file
diff --git a/Dependencies/Utility/Utility/wchar_compat.h b/Dependencies/Utility/Utility/wchar_compat.h
new file mode 100644
index 0000000000..ad38df5164
--- /dev/null
+++ b/Dependencies/Utility/Utility/wchar_compat.h
@@ -0,0 +1,34 @@
+/*
+** Command & Conquer Generals Zero Hour(tm)
+** Copyright 2025 TheSuperHackers
+**
+** 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 .
+*/
+
+// This file contains WCHAR and related macros for compatibility with non-windows platforms.
+#pragma once
+
+// WCHAR
+typedef wchar_t WCHAR;
+typedef const WCHAR* LPCWSTR;
+typedef WCHAR* LPWSTR;
+
+#define _wcsicmp wcscasecmp
+#define wcsicmp wcscasecmp
+#define _vsnwprintf vswprintf
+
+// MultiByteToWideChar
+#define CP_ACP 0
+#define MultiByteToWideChar(cp, flags, mbstr, cb, wcstr, cch) mbstowcs(wcstr, mbstr, cch)
+#define WideCharToMultiByte(cp, flags, wcstr, cch, mbstr, cb, defchar, used) wcstombs(mbstr, wcstr, cb)
\ No newline at end of file
diff --git a/Generals/Code/CMakeLists.txt b/Generals/Code/CMakeLists.txt
index 5dfd35fbe9..05e4b7273a 100644
--- a/Generals/Code/CMakeLists.txt
+++ b/Generals/Code/CMakeLists.txt
@@ -10,6 +10,7 @@ add_library(gi_libraries_source_wwvegas_wwlib INTERFACE)
add_library(gi_libraries_source_wwvegas_wwmath INTERFACE)
add_library(gi_libraries_source_wwvegas_wwsaveload INTERFACE)
add_library(gi_main INTERFACE)
+add_library(gi_always INTERFACE)
target_include_directories(gi_gameengine INTERFACE "GameEngine")
target_include_directories(gi_gameengine_include INTERFACE "GameEngine/Include")
@@ -22,6 +23,10 @@ target_include_directories(gi_libraries_source_wwvegas_wwlib INTERFACE "Librarie
target_include_directories(gi_libraries_source_wwvegas_wwmath INTERFACE "Libraries/Source/WWVegas/WWMath")
target_include_directories(gi_libraries_source_wwvegas_wwsaveload INTERFACE "Libraries/Source/WWVegas/WWSaveLoad")
target_include_directories(gi_main INTERFACE "Main")
+target_link_libraries(gi_always INTERFACE
+ gi_libraries_include
+ gz_utility
+)
# Contains internal libraries
add_subdirectory(Libraries)
diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt
index fe21dd9020..f054aa9ce1 100644
--- a/Generals/Code/GameEngineDevice/CMakeLists.txt
+++ b/Generals/Code/GameEngineDevice/CMakeLists.txt
@@ -194,6 +194,7 @@ target_include_directories(g_gameenginedevice PUBLIC
target_link_libraries(g_gameenginedevice PRIVATE
gi_libraries_include
gi_main
+ gi_always
)
target_link_libraries(g_gameenginedevice PUBLIC
diff --git a/Generals/Code/Libraries/Include/Lib/BaseType.h b/Generals/Code/Libraries/Include/Lib/BaseType.h
index a7efb1bc71..0eab909847 100644
--- a/Generals/Code/Libraries/Include/Lib/BaseType.h
+++ b/Generals/Code/Libraries/Include/Lib/BaseType.h
@@ -34,6 +34,8 @@
#include
#include
+// TheSuperHackers @compile feliwir 07/04/2025 Adds utility macros for cross-platform compatibility
+#include
/*
** Turn off some unneeded warnings.
@@ -126,8 +128,13 @@ typedef char Byte; // 1 byte USED TO BE "SignedByte"
typedef char Char; // 1 byte of text
typedef bool Bool; //
// note, the types below should use "long long", but MSVC doesn't support it yet
+#ifdef _MSC_VER
typedef __int64 Int64; // 8 bytes
typedef unsigned __int64 UnsignedInt64; // 8 bytes
+#else
+typedef long long Int64; // 8 bytes
+typedef unsigned long long UnsignedInt64; // 8 bytes
+#endif
#include "Lib/trig.h"
diff --git a/Generals/Code/Libraries/Source/Compression/CMakeLists.txt b/Generals/Code/Libraries/Source/Compression/CMakeLists.txt
index 3c0ad78c75..7a5ae821f7 100644
--- a/Generals/Code/Libraries/Source/Compression/CMakeLists.txt
+++ b/Generals/Code/Libraries/Source/Compression/CMakeLists.txt
@@ -29,7 +29,7 @@ target_include_directories(g_compression INTERFACE
)
target_link_libraries(g_compression PRIVATE
- gi_libraries_include
+ gi_always
gz_config
)
diff --git a/Generals/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
index 63694ac24b..45b23fbe03 100644
--- a/Generals/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
+++ b/Generals/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
@@ -17,5 +17,5 @@ target_sources(g_wwdebug PRIVATE ${WWDEBUG_SRC})
target_link_libraries(g_wwdebug PRIVATE
g_wwcommon
- gi_libraries_include
+ gi_always
)
diff --git a/Generals/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/Generals/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
index c48737c85e..ba54364116 100644
--- a/Generals/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
+++ b/Generals/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
@@ -124,5 +124,5 @@ target_sources(g_wwlib PRIVATE ${WWLIB_SRC})
target_link_libraries(g_wwlib PRIVATE
g_wwcommon
- gi_libraries_include
+ gi_always
)
diff --git a/Generals/Code/Tools/Autorun/CMakeLists.txt b/Generals/Code/Tools/Autorun/CMakeLists.txt
index 4fed2854d6..f4157f1181 100644
--- a/Generals/Code/Tools/Autorun/CMakeLists.txt
+++ b/Generals/Code/Tools/Autorun/CMakeLists.txt
@@ -54,9 +54,8 @@ macro(setup_autorun appname)
target_sources(${appname} PRIVATE ${AUTORUN_SRC})
target_link_libraries(${appname} PRIVATE
- gi_libraries_include
+ gi_always
gz_config
- gz_utility
winmm
)
diff --git a/Generals/Code/Tools/Compress/CMakeLists.txt b/Generals/Code/Tools/Compress/CMakeLists.txt
index fa9bb1f38e..c6381c60a3 100644
--- a/Generals/Code/Tools/Compress/CMakeLists.txt
+++ b/Generals/Code/Tools/Compress/CMakeLists.txt
@@ -11,7 +11,7 @@ target_sources(g_compress PRIVATE ${COMRPESS_SRC})
target_link_libraries(g_compress PRIVATE
g_compression
- gi_libraries_include
+ gi_always
gz_config
)
diff --git a/Generals/Code/Tools/GUIEdit/CMakeLists.txt b/Generals/Code/Tools/GUIEdit/CMakeLists.txt
index b4248af364..5a7b0eb877 100644
--- a/Generals/Code/Tools/GUIEdit/CMakeLists.txt
+++ b/Generals/Code/Tools/GUIEdit/CMakeLists.txt
@@ -53,7 +53,7 @@ target_link_libraries(g_guiedit PRIVATE
g_gameengine
g_gameenginedevice
g_wwvegas
- gi_libraries_include
+ gi_always
imm32
stlport
vfw32
diff --git a/Generals/Code/Tools/ImagePacker/CMakeLists.txt b/Generals/Code/Tools/ImagePacker/CMakeLists.txt
index 79d9f13e55..a1fb500469 100644
--- a/Generals/Code/Tools/ImagePacker/CMakeLists.txt
+++ b/Generals/Code/Tools/ImagePacker/CMakeLists.txt
@@ -32,7 +32,7 @@ target_link_libraries(g_imagepacker PRIVATE
dbghelplib
g_gameengine
g_gameenginedevice
- gi_libraries_include
+ gi_always
imm32
vfw32
winmm
diff --git a/Generals/Code/Tools/MapCacheBuilder/CMakeLists.txt b/Generals/Code/Tools/MapCacheBuilder/CMakeLists.txt
index 94e5333338..4bf0c95ca9 100644
--- a/Generals/Code/Tools/MapCacheBuilder/CMakeLists.txt
+++ b/Generals/Code/Tools/MapCacheBuilder/CMakeLists.txt
@@ -19,7 +19,7 @@ target_link_libraries(g_mapcachebuilder PRIVATE
dbghelplib
g_gameengine
g_gameenginedevice
- gi_libraries_include
+ gi_always
imm32
vfw32
winmm
diff --git a/Generals/Code/Tools/PATCHGET/CMakeLists.txt b/Generals/Code/Tools/PATCHGET/CMakeLists.txt
index c49c6800a6..645d5ad246 100644
--- a/Generals/Code/Tools/PATCHGET/CMakeLists.txt
+++ b/Generals/Code/Tools/PATCHGET/CMakeLists.txt
@@ -27,7 +27,7 @@ macro(setup_patchgrabber appname)
g_gameenginedevice
g_wwvegas
gamespy::gamespy
- gi_libraries_include
+ gi_always
imm32
vfw32
winmm
diff --git a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt
index ba8fd219b6..7822bbd8ca 100644
--- a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt
+++ b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt
@@ -44,11 +44,10 @@ target_link_libraries(g_particleeditor PRIVATE
d3d8lib
dbghelplib
gi_gameengine_include
- gi_libraries_include
+ gi_always
gi_libraries_source_wwvegas
gi_libraries_source_wwvegas_wwlib
gz_config
- gz_utility
imm32
stlport
vfw32
diff --git a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt
index 30bb89d87e..c08233f081 100644
--- a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt
+++ b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt
@@ -214,7 +214,7 @@ target_link_libraries(g_worldbuilder PRIVATE
g_gameenginedevice
gi_gameengine_include
gi_gameenginedevice_include
- gi_libraries_include
+ gi_always
imm32
vfw32
winmm
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index 589f534b18..814ff45a81 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -10,6 +10,7 @@ add_library(zi_libraries_source_wwvegas_wwlib INTERFACE)
add_library(zi_libraries_source_wwvegas_wwmath INTERFACE)
add_library(zi_libraries_source_wwvegas_wwsaveload INTERFACE)
add_library(zi_main INTERFACE)
+add_library(zi_always INTERFACE)
target_include_directories(zi_gameengine INTERFACE "GameEngine")
target_include_directories(zi_gameengine_include INTERFACE "GameEngine/Include")
@@ -22,6 +23,10 @@ target_include_directories(zi_libraries_source_wwvegas_wwlib INTERFACE "Librarie
target_include_directories(zi_libraries_source_wwvegas_wwmath INTERFACE "Libraries/Source/WWVegas/WWMath")
target_include_directories(zi_libraries_source_wwvegas_wwsaveload INTERFACE "Libraries/Source/WWVegas/WWSaveLoad")
target_include_directories(zi_main INTERFACE "Main")
+target_link_libraries(zi_always INTERFACE
+ zi_libraries_include
+ gz_utility
+)
# Contains internal libraries
add_subdirectory(Libraries)
diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt
index 41bf376983..ef32a23380 100644
--- a/GeneralsMD/Code/GameEngine/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt
@@ -1166,7 +1166,7 @@ target_include_directories(z_gameengine PRIVATE
)
target_link_libraries(z_gameengine PRIVATE
- zi_libraries_include
+ zi_always
)
target_link_libraries(z_gameengine PUBLIC
diff --git a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
index 6e2342d91f..b8693d33cf 100644
--- a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
@@ -205,7 +205,7 @@ target_include_directories(z_gameenginedevice PUBLIC
)
target_link_libraries(z_gameenginedevice PRIVATE
- zi_libraries_include
+ zi_always
zi_main
)
diff --git a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h
index a77c757e84..f982c71eba 100644
--- a/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h
+++ b/GeneralsMD/Code/Libraries/Include/Lib/BaseType.h
@@ -34,6 +34,8 @@
#include
#include
+// TheSuperHackers @compile feliwir 07/04/2025 Adds utility macros for cross-platform compatibility
+#include
/*
** Turn off some unneeded warnings.
@@ -131,8 +133,13 @@ typedef char Byte; // 1 byte USED TO BE "SignedByte"
typedef char Char; // 1 byte of text
typedef bool Bool; //
// note, the types below should use "long long", but MSVC doesn't support it yet
+#ifdef _MSC_VER
typedef __int64 Int64; // 8 bytes
typedef unsigned __int64 UnsignedInt64; // 8 bytes
+#else
+typedef long long Int64; // 8 bytes
+typedef unsigned long long UnsignedInt64; // 8 bytes
+#endif
#include "Lib/trig.h"
diff --git a/GeneralsMD/Code/Libraries/Source/Compression/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/Compression/CMakeLists.txt
index cd14c5a5e8..9c9a2545b2 100644
--- a/GeneralsMD/Code/Libraries/Source/Compression/CMakeLists.txt
+++ b/GeneralsMD/Code/Libraries/Source/Compression/CMakeLists.txt
@@ -30,7 +30,7 @@ target_include_directories(z_compression INTERFACE
target_link_libraries(z_compression PRIVATE
gz_config
- zi_libraries_include
+ zi_always
)
target_link_libraries(z_compression PUBLIC
diff --git a/GeneralsMD/Code/Libraries/Source/Compression/EAC/huffencode.cpp b/GeneralsMD/Code/Libraries/Source/Compression/EAC/huffencode.cpp
index 77ba72df50..a2707b21b6 100644
--- a/GeneralsMD/Code/Libraries/Source/Compression/EAC/huffencode.cpp
+++ b/GeneralsMD/Code/Libraries/Source/Compression/EAC/huffencode.cpp
@@ -1050,8 +1050,8 @@ static void HUFF_pack(struct HuffEncodeContext *EC,
if (!i3)
HUFF_writecode(EC,dest,i);
- if (((int) bptr1- (int) EC->buffer) >= (int)(EC->plen+curpc))
- curpc = (int) bptr1 - (int) EC->buffer - EC->plen;
+ if (((long) bptr1- (long) EC->buffer) >= (long)(EC->plen+curpc))
+ curpc = (long) bptr1 - (long) EC->buffer - EC->plen;
}
/* write EOF ([clue] 0gn [10]) */
diff --git a/GeneralsMD/Code/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp b/GeneralsMD/Code/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp
index 7d006c6841..05f8ae05c3 100644
--- a/GeneralsMD/Code/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp
+++ b/GeneralsMD/Code/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp
@@ -47,7 +47,7 @@ Bool DecompressFile (char *infile, char *outfile)
char *outBlock = NULL;
LZHL_DHANDLE decompress;
Int ok = 0;
- UnsignedInt srcSz, dstSz;
+ size_t srcSz, dstSz;
// Parameter checking
@@ -224,7 +224,7 @@ Bool DecompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int
UnsignedInt rawSize = 0, compressedSize = 0;
LZHL_DHANDLE decompress;
Int ok = 0;
- UnsignedInt srcSz, dstSz;
+ size_t srcSz, dstSz;
// Parameter checking
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
index 1ffd2e269a..f2bd2a4533 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWDebug/CMakeLists.txt
@@ -17,5 +17,5 @@ target_sources(z_wwdebug PRIVATE ${WWDEBUG_SRC})
target_link_libraries(z_wwdebug PRIVATE
z_wwcommon
- zi_libraries_include
+ zi_always
)
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
index 73c28c725b..d96551141a 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/CMakeLists.txt
@@ -130,5 +130,5 @@ target_sources(z_wwlib PRIVATE ${WWLIB_SRC})
target_link_libraries(z_wwlib PRIVATE
z_wwcommon
- zi_libraries_include
+ zi_always
)
diff --git a/GeneralsMD/Code/Libraries/Source/debug/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/debug/CMakeLists.txt
index 7d2bb88c4f..860c13977e 100644
--- a/GeneralsMD/Code/Libraries/Source/debug/CMakeLists.txt
+++ b/GeneralsMD/Code/Libraries/Source/debug/CMakeLists.txt
@@ -34,5 +34,5 @@ target_include_directories(z_debug INTERFACE
target_link_libraries(z_debug PRIVATE
gz_config
- zi_libraries_include
+ zi_always
)
diff --git a/GeneralsMD/Code/Libraries/Source/profile/CMakeLists.txt b/GeneralsMD/Code/Libraries/Source/profile/CMakeLists.txt
index e1f6bf375f..52d5995a48 100644
--- a/GeneralsMD/Code/Libraries/Source/profile/CMakeLists.txt
+++ b/GeneralsMD/Code/Libraries/Source/profile/CMakeLists.txt
@@ -28,6 +28,5 @@ target_include_directories(z_profile INTERFACE
target_link_libraries(z_profile PRIVATE
gz_config
- gz_utility
- zi_libraries_include
+ zi_always
)
diff --git a/GeneralsMD/Code/Libraries/Source/profile/profile_funclevel.cpp b/GeneralsMD/Code/Libraries/Source/profile/profile_funclevel.cpp
index 493917f36f..070de422a5 100644
--- a/GeneralsMD/Code/Libraries/Source/profile/profile_funclevel.cpp
+++ b/GeneralsMD/Code/Libraries/Source/profile/profile_funclevel.cpp
@@ -549,8 +549,8 @@ bool ProfileFuncLevel::IdList::Enum(unsigned index, Id &id, unsigned *countPtr)
ProfileFuncLevelTracer::Profile &prof=*(ProfileFuncLevelTracer::Profile *)m_ptr;
- unsigned addr;
- if ((addr=prof.caller.Enumerate(index)))
+ unsigned addr = prof.caller.Enumerate(index);
+ if (addr!=0)
{
id.m_funcPtr=prof.tracer->FindFunction(addr);
if (countPtr)
diff --git a/GeneralsMD/Code/Main/CMakeLists.txt b/GeneralsMD/Code/Main/CMakeLists.txt
index f1a9f03c40..1fa597dc7e 100644
--- a/GeneralsMD/Code/Main/CMakeLists.txt
+++ b/GeneralsMD/Code/Main/CMakeLists.txt
@@ -24,7 +24,7 @@ target_link_libraries(z_generals PRIVATE
z_gameengine
z_gameenginedevice
z_profile
- zi_libraries_include
+ zi_always
)
# TODO Originally referred to build host and user, replace with git info perhaps?
diff --git a/GeneralsMD/Code/Tools/Autorun/CMakeLists.txt b/GeneralsMD/Code/Tools/Autorun/CMakeLists.txt
index 6a0adbaac5..06b57fadee 100644
--- a/GeneralsMD/Code/Tools/Autorun/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/Autorun/CMakeLists.txt
@@ -55,9 +55,8 @@ macro(setup_autorun appname)
target_link_libraries(${appname} PRIVATE
gz_config
- gz_utility
winmm
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
diff --git a/GeneralsMD/Code/Tools/CRCDiff/CRCDiff.cpp b/GeneralsMD/Code/Tools/CRCDiff/CRCDiff.cpp
index 02f74b5521..8a569012be 100644
--- a/GeneralsMD/Code/Tools/CRCDiff/CRCDiff.cpp
+++ b/GeneralsMD/Code/Tools/CRCDiff/CRCDiff.cpp
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
//=============================================================================
diff --git a/GeneralsMD/Code/Tools/CRCDiff/KVPair.cpp b/GeneralsMD/Code/Tools/CRCDiff/KVPair.cpp
index 486b85584c..4aa7c4a968 100644
--- a/GeneralsMD/Code/Tools/CRCDiff/KVPair.cpp
+++ b/GeneralsMD/Code/Tools/CRCDiff/KVPair.cpp
@@ -27,6 +27,7 @@
#include "KVPair.h"
#include "debug.h"
#include
+#include
std::string intToString(int val)
{
diff --git a/GeneralsMD/Code/Tools/CRCDiff/debug.cpp b/GeneralsMD/Code/Tools/CRCDiff/debug.cpp
index 7b828e0408..397085a5c2 100644
--- a/GeneralsMD/Code/Tools/CRCDiff/debug.cpp
+++ b/GeneralsMD/Code/Tools/CRCDiff/debug.cpp
@@ -20,9 +20,11 @@
// Minmal debug info
// Author: Matthew D. Campbell, Sept 2002
-#include
#include "debug.h"
#include
+#ifdef _WIN32
+#include
+#endif
#ifdef DEBUG
diff --git a/GeneralsMD/Code/Tools/Compress/CMakeLists.txt b/GeneralsMD/Code/Tools/Compress/CMakeLists.txt
index a6d1528300..1e241491a6 100644
--- a/GeneralsMD/Code/Tools/Compress/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/Compress/CMakeLists.txt
@@ -12,7 +12,7 @@ target_sources(z_compress PRIVATE ${COMRPESS_SRC})
target_link_libraries(z_compress PRIVATE
gz_config
z_compression
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
diff --git a/GeneralsMD/Code/Tools/Compress/Compress.cpp b/GeneralsMD/Code/Tools/Compress/Compress.cpp
index 6b12e69038..89777988ec 100644
--- a/GeneralsMD/Code/Tools/Compress/Compress.cpp
+++ b/GeneralsMD/Code/Tools/Compress/Compress.cpp
@@ -54,7 +54,7 @@ void dumpHelp(const char *exe)
}
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
std::string inFile = "";
std::string outFile = "";
@@ -65,7 +65,7 @@ void main(int argc, char **argv)
if ( !stricmp(argv[i], "-help") )
{
dumpHelp(argv[0]);
- exit(0);
+ return EXIT_SUCCESS;
}
if ( !strcmp(argv[i], "-in") )
@@ -106,7 +106,7 @@ void main(int argc, char **argv)
if (inFile.empty())
{
dumpHelp(argv[0]);
- exit(0);
+ return EXIT_SUCCESS;
}
DEBUG_LOG(("IN:'%s' OUT:'%s' Compression:'%s'\n",
@@ -119,7 +119,7 @@ void main(int argc, char **argv)
if (!fp)
{
DEBUG_LOG(("Cannot open '%s'\n", inFile.c_str()));
- return;
+ return EXIT_FAILURE;
}
fseek(fp, 0, SEEK_END);
int size = ftell(fp);
@@ -131,14 +131,14 @@ void main(int argc, char **argv)
if (numRead != 8)
{
DEBUG_LOG(("Cannot read header from '%s'\n", inFile.c_str()));
- return;
+ return EXIT_FAILURE;
}
CompressionType usedType = CompressionManager::getCompressionType(data, 8);
if (usedType == COMPRESSION_NONE)
{
DEBUG_LOG(("No compression on '%s'\n", inFile.c_str()));
- return;
+ return EXIT_FAILURE;
}
int uncompressedSize = CompressionManager::getUncompressedSize(data, 8);
@@ -147,8 +147,9 @@ void main(int argc, char **argv)
inFile.c_str(), CompressionManager::getCompressionNameByType(usedType),
uncompressedSize, size, size/(double)(uncompressedSize+0.1)*100.0));
- return;
+ return EXIT_SUCCESS;
}
// compress file
+ return EXIT_FAILURE;
}
diff --git a/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt b/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt
index 4d403462e8..fcf9a75cc0 100644
--- a/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt
@@ -59,7 +59,7 @@ target_link_libraries(z_guiedit PRIVATE
z_gameenginedevice
z_profile
z_wwvegas
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
diff --git a/GeneralsMD/Code/Tools/ImagePacker/CMakeLists.txt b/GeneralsMD/Code/Tools/ImagePacker/CMakeLists.txt
index c0b5f56f0a..c7affb096a 100644
--- a/GeneralsMD/Code/Tools/ImagePacker/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/ImagePacker/CMakeLists.txt
@@ -37,7 +37,7 @@ target_link_libraries(z_imagepacker PRIVATE
z_gameengine
z_gameenginedevice
z_profile
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
diff --git a/GeneralsMD/Code/Tools/MapCacheBuilder/CMakeLists.txt b/GeneralsMD/Code/Tools/MapCacheBuilder/CMakeLists.txt
index 9f606aea66..9cc87d6c99 100644
--- a/GeneralsMD/Code/Tools/MapCacheBuilder/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/MapCacheBuilder/CMakeLists.txt
@@ -24,7 +24,7 @@ target_link_libraries(z_mapcachebuilder PRIVATE
z_gameengine
z_gameenginedevice
z_profile
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
diff --git a/GeneralsMD/Code/Tools/PATCHGET/CMakeLists.txt b/GeneralsMD/Code/Tools/PATCHGET/CMakeLists.txt
index 9207a7058b..9d4f2dde50 100644
--- a/GeneralsMD/Code/Tools/PATCHGET/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/PATCHGET/CMakeLists.txt
@@ -32,7 +32,7 @@ macro(setup_patchgrabber appname)
z_gameenginedevice
z_profile
z_wwvegas
- zi_libraries_include
+ zi_always
)
target_compile_definitions(${appname} PRIVATE
diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt
index ea36aa485d..6550c65a59 100644
--- a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt
@@ -41,14 +41,13 @@ target_link_libraries(z_particleeditor PRIVATE
dbghelplib
imm32
gz_config
- gz_utility
stlport
vfw32
winmm
z_debug
z_profile
zi_gameengine_include
- zi_libraries_include
+ zi_always
zi_libraries_source_wwvegas
zi_libraries_source_wwvegas_wwlib
)
diff --git a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt
index 870d40a409..d92e9b19df 100644
--- a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt
+++ b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt
@@ -222,7 +222,7 @@ target_link_libraries(z_worldbuilder PRIVATE
z_profile
zi_gameengine_include
zi_gameenginedevice_include
- zi_libraries_include
+ zi_always
)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")