This commit is contained in:
Christoph Oelckers 2023-09-20 19:49:43 +02:00
parent 69e67037f8
commit b3cb2fafc7
4 changed files with 19 additions and 35 deletions

View file

@ -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);
}

View file

@ -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)

View file

@ -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;
}
//==========================================================================

View file

@ -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 <windows.h>
#include <winsock2.h>
extern int sys_ostype;
extern const char* sys_ostype;
#else
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
extern FString sys_ostype;
#else // !__APPLE__
#include <SDL.h>
#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