[*] unfuck VersionHelpers.cpp
This commit is contained in:
parent
0d388dc4e2
commit
fe424115f4
@ -15,9 +15,25 @@ namespace Aurora::Locale::Encoding
|
||||
static void SanitizeIConvCharset(AuString &str)
|
||||
{
|
||||
if (AuStartsWith(str, "MS-"))
|
||||
{
|
||||
str = "WINDOWS-" + str.substr(3);
|
||||
else if (AuToUpper(str) == AuToUpper("Latin-1"))
|
||||
str = "LATIN1";
|
||||
else str = AuToUpper(str);
|
||||
return;
|
||||
}
|
||||
|
||||
str = AuToUpper(str);
|
||||
|
||||
if (AuStartsWith(str, "LATIN"))
|
||||
{
|
||||
// Maybe a BST could do this faster. Dont want hashstring jump table. Meh, it'll do.
|
||||
if (str == "LATIN-1") str = "LATIN1";
|
||||
else if (str == "LATIN-9") str = "LATIN9";
|
||||
else if (str == "LATIN-2") str = "LATIN2";
|
||||
else if (str == "LATIN-3") str = "LATIN3";
|
||||
else if (str == "LATIN-4") str = "LATIN4";
|
||||
else if (str == "LATIN-5") str = "LATIN5";
|
||||
else if (str == "LATIN-6") str = "LATIN6";
|
||||
else if (str == "LATIN-7") str = "LATIN7";
|
||||
else if (str == "LATIN-8") str = "LATIN8";
|
||||
}
|
||||
}
|
||||
}
|
@ -15,20 +15,6 @@
|
||||
|
||||
namespace Aurora::SWInfo
|
||||
{
|
||||
static AuUInt8 kWinVerNT4 = 0x0400;
|
||||
static AuUInt8 kWinVerWIN2K = 0x0500;
|
||||
static AuUInt8 kWinVerWINXP = 0x0501;
|
||||
static AuUInt8 kWinVerWS03 = 0x0502;
|
||||
static AuUInt8 kWinVerWIN6 = 0x0600;
|
||||
static AuUInt8 kWinVerVISTA = 0x0600;
|
||||
static AuUInt8 kWinVerWS08 = 0x0600;
|
||||
static AuUInt8 kWinVerLONGHORN = 0x0600;
|
||||
static AuUInt8 kWinVerWIN7 = 0x0601;
|
||||
static AuUInt8 kWinVerWIN8 = 0x0602;
|
||||
static AuUInt8 kWinVerWINBLUE = 0x0603;
|
||||
static AuUInt8 kWinVerWIN10 = 0x0A00;
|
||||
|
||||
static AuUInt8 kWinVerWIN10 = 0x0A00;
|
||||
static const AuString kDefaultStr;
|
||||
static const OSInformation kDefaultInfo;
|
||||
static OSInformation const *gInfo = &kDefaultInfo;
|
||||
@ -168,74 +154,4 @@ namespace Aurora::SWInfo
|
||||
|
||||
gInfo = &gTempInfo;
|
||||
}
|
||||
|
||||
static bool IsWindowsVersionOrGreater(AuUInt8 major, AuUInt8 ignored, AuUInt8 sp)
|
||||
{
|
||||
return gInfo->ePlatform == Build::EPlatform::ePlatformWin32 && gInfo->uKernelMajor >= major && gInfo->uUserlandMinor >= sp;
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPOrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWINXP, kWinVerWINXP, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWINXP, kWinVerWINXP, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP2OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWINXP, kWinVerWINXP, 2);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP3OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWINXP, kWinVerWINXP, 3);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaOrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVISTA, kWinVerVISTA, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaSP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVISTA, kWinVerVISTA, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaSP2OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVISTA, kWinVerVISTA, 2);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows7OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWIN7, kWinVerWIN7, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows7SP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWIN7, kWinVerWIN7, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows8OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWIN8, kWinVerWIN8, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows8Point1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWINBLUE, kWinVerWINBLUE, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows10OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWIN10, kWinVerWIN10, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows11OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWIN10, kWinVerWIN10, 0) && gInfo->uKernelPatch >= 22000;
|
||||
}
|
||||
}
|
96
Source/SWInfo/VersionHelpers.cpp
Normal file
96
Source/SWInfo/VersionHelpers.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/***
|
||||
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: VersionHelpers.cpp
|
||||
Date: 2022-1-25
|
||||
Author: Reece
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "SWInfo.hpp"
|
||||
// NO HEADER (note -> .hpp wouldn't clash with windows' sdk)
|
||||
|
||||
namespace Aurora::SWInfo
|
||||
{
|
||||
static AuUInt16 kWinVerNT4 = 0x0400;
|
||||
static AuUInt16 kWinVerWin2K = 0x0500;
|
||||
static AuUInt16 kWinVerWinXP = 0x0501;
|
||||
static AuUInt16 kWinVerWS03 = 0x0502;
|
||||
static AuUInt16 kWinVerWin6 = 0x0600;
|
||||
static AuUInt16 kWinVerVista = 0x0600;
|
||||
static AuUInt16 kWinVerWS08 = 0x0600;
|
||||
static AuUInt16 kWinVerWin7 = 0x0601;
|
||||
static AuUInt16 kWinVerWin8 = 0x0602;
|
||||
static AuUInt16 kWinVerWinBlue = 0x0603;
|
||||
static AuUInt16 kWinVerWin10 = 0x0A00;
|
||||
|
||||
static bool IsWindowsVersionOrGreater(AuUInt16 major, AuUInt16 ignored, AuUInt16 sp)
|
||||
{
|
||||
auto &info = GetPlatformInfo();
|
||||
return info.ePlatform == Build::EPlatform::ePlatformWin32 && info.uKernelMajor >= major && info.uUserlandMinor >= sp;
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPOrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWinXP, kWinVerWinXP, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWinXP, kWinVerWinXP, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP2OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWinXP, kWinVerWinXP, 2);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsXPSP3OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWinXP, kWinVerWinXP, 3);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaOrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVista, kWinVerVista, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaSP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVista, kWinVerVista, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindowsVistaSP2OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerVista, kWinVerVista, 2);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows7OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWin7, kWinVerWin7, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows7SP1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWin7, kWinVerWin7, 1);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows8OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWin8, kWinVerWin8, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows8Point1OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWinBlue, kWinVerWinBlue, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows10OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWin10, kWinVerWin10, 0);
|
||||
}
|
||||
|
||||
AUKN_SYM bool IsWindows11OrGreater()
|
||||
{
|
||||
return IsWindowsVersionOrGreater(kWinVerWin10, kWinVerWin10, 0) && GetPlatformInfo().uKernelPatch >= 22000;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user