diff --git a/src/common/platform/posix/cocoa/i_main.mm b/src/common/platform/posix/cocoa/i_main.mm index 8c58ca419..50353ba3d 100644 --- a/src/common/platform/posix/cocoa/i_main.mm +++ b/src/common/platform/posix/cocoa/i_main.mm @@ -47,6 +47,7 @@ #include "printf.h" #include "s_music.h" #include "engineerrors.h" +#include "zstring.h" #define ZD_UNUSED(VARIABLE) ((void)(VARIABLE)) @@ -130,6 +131,7 @@ static bool ReadSystemVersionFromPlist(NSOperatingSystemVersion& version) return false; } +FString sys_ostype; void I_DetectOS() { NSOperatingSystemVersion version = {}; @@ -192,6 +194,8 @@ void I_DetectOS() Printf("%s running macOS %s %d.%d.%d (%s) %s\n", model, name, int(version.majorVersion), int(version.minorVersion), int(version.patchVersion), release, architecture); + + sys_ostype.Format("macOS %d.%d %s", int(version.majorVersion), int(version.minorVersion), name); } diff --git a/src/common/platform/posix/sdl/i_main.cpp b/src/common/platform/posix/sdl/i_main.cpp index 196504b54..4f29bb76e 100644 --- a/src/common/platform/posix/sdl/i_main.cpp +++ b/src/common/platform/posix/sdl/i_main.cpp @@ -77,6 +77,7 @@ int GameMain(); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- // PUBLIC DATA DEFINITIONS ------------------------------------------------- +FString sys_ostype; // The command line arguments. FArgs *Args; @@ -136,6 +137,7 @@ void I_DetectOS() { const char* const separator = operatingSystem.Len() > 0 ? ", " : ""; operatingSystem.AppendFormat("%s%s %s on %s", separator, unameInfo.sysname, unameInfo.release, unameInfo.machine); + sys_ostype.Format("%s %s on %s", unameInfo.sysname, unameInfo.release, unameInfo.machine); } if (operatingSystem.Len() > 0) diff --git a/src/common/platform/win32/i_system.cpp b/src/common/platform/win32/i_system.cpp index 8b39061a6..0a9843e94 100644 --- a/src/common/platform/win32/i_system.cpp +++ b/src/common/platform/win32/i_system.cpp @@ -128,7 +128,7 @@ double PerfToSec, PerfToMillisec; UINT TimerPeriod; -int sys_ostype = 0; +const char* sys_ostype = ""; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -168,12 +168,10 @@ void I_DetectOS(void) if (info.dwMinorVersion == 0) { osname = (info.wProductType == VER_NT_WORKSTATION) ? "Vista" : "Server 2008"; - sys_ostype = 2; // legacy OS } else if (info.dwMinorVersion == 1) { osname = (info.wProductType == VER_NT_WORKSTATION) ? "7" : "Server 2008 R2"; - sys_ostype = 2; // supported OS } else if (info.dwMinorVersion == 2) { @@ -181,12 +179,10 @@ void I_DetectOS(void) // the highest version of Windows you support, which will also be the // highest version of Windows this function returns. osname = (info.wProductType == VER_NT_WORKSTATION) ? "8" : "Server 2012"; - sys_ostype = 2; // supported OS } else if (info.dwMinorVersion == 3) { osname = (info.wProductType == VER_NT_WORKSTATION) ? "8.1" : "Server 2012 R2"; - sys_ostype = 2; // supported OS } else if (info.dwMinorVersion == 4) { @@ -196,7 +192,6 @@ void I_DetectOS(void) else if (info.dwMajorVersion == 10) { osname = (info.wProductType == VER_NT_WORKSTATION) ? (info.dwBuildNumber >= 22000 ? "11 (or higher)" : "10") : "Server 2016 (or higher)"; - sys_ostype = 3; // modern OS } break; @@ -209,6 +204,8 @@ void I_DetectOS(void) osname, info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber, info.szCSDVersion); + + sys_ostype = osname; } //========================================================================== diff --git a/src/d_anonstats.cpp b/src/d_anonstats.cpp index 5c15d8cf0..fe42633cf 100644 --- a/src/d_anonstats.cpp +++ b/src/d_anonstats.cpp @@ -1,4 +1,4 @@ -#define NO_SEND_STATS +//#define NO_SEND_STATS #ifdef NO_SEND_STATS void D_DoAnonStats() @@ -16,10 +16,11 @@ void D_ConfirmSendStats() #define WIN32_LEAN_AND_MEAN #include #include -extern int sys_ostype; +extern const char* sys_ostype; #else #ifdef __APPLE__ #include +extern FString sys_ostype; #else // !__APPLE__ #include #endif // __APPLE__ @@ -168,48 +169,28 @@ bool I_HTTPRequest(const char* request) } #endif -static int GetOSVersion() +static FString GetOSVersion() { #ifdef _WIN32 #ifndef _M_ARM64 - if (sizeof(void*) == 4) // 32 bit - { - BOOL res; - if (IsWow64Process(GetCurrentProcess(), &res) && res) - { - return 1; - } - return 0; - } - else - { - if (sys_ostype == 2) return 2; - else return 3; - } + return FStringf("Windows %s", sys_ostype); #else - return 4; + return FStringf("Windows %s ARM", sys_ostype); #endif #elif defined __APPLE__ #if defined(__aarch64__) - return 6; + return sys_ostype + " ARM"; #else - return 5; + return sys_ostype + " x64"; #endif #else // fall-through linux stuff here #ifdef __arm__ - return 9; + return sys_ostype + " ARM"; #else - if (sizeof(void*) == 4) // 32 bit - { - return 7; - } - else - { - return 8; - } + return sys_ostype; #endif