UWP: Move some functions to a more sensible place

This commit is contained in:
Henrik Rydgård
2026-03-11 11:03:41 +01:00
parent 99094a9c69
commit b435ab2dac
2 changed files with 45 additions and 45 deletions
+45
View File
@@ -12,6 +12,7 @@
#include "Common/GPU/thin3d_create.h"
#include "Common/Common.h"
#include "Common/OSVersion.h"
#include "Common/Audio/AudioBackend.h"
#include "Common/Input/InputState.h"
#include "Common/File/VFS/VFS.h"
@@ -316,6 +317,50 @@ void UWPGraphicsContext::Shutdown() {
delete draw_;
}
bool IsXBox() {
auto deviceInfo = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo();
return deviceInfo.DeviceFamily() == L"Windows.Xbox";
}
bool IsMobile() {
auto deviceInfo = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo();
return deviceInfo.DeviceFamily() == L"Windows.Mobile";
}
void GetVersionInfo(uint32_t& major, uint32_t& minor, uint32_t& build, uint32_t& revision) {
winrt::hstring deviceFamilyVersion = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo().DeviceFamilyVersion();
uint64_t version = std::stoull(std::wstring(deviceFamilyVersion));
major = static_cast<uint32_t>((version & 0xFFFF000000000000L) >> 48);
minor = static_cast<uint32_t>((version & 0x0000FFFF00000000L) >> 32);
build = static_cast<uint32_t>((version & 0x00000000FFFF0000L) >> 16);
revision = static_cast<uint32_t>(version & 0x000000000000FFFFL);
}
std::string GetSystemName() {
std::string osName = "Microsoft Windows 10";
if (IsXBox()) {
osName = "Xbox OS";
} else {
uint32_t major = 0, minor = 0, build = 0, revision = 0;
GetVersionInfo(major, minor, build, revision);
if (build >= 22000) {
osName = "Microsoft Windows 11";
}
}
return osName + " " + GetWindowsSystemArchitecture();
}
std::string GetWindowsBuild() {
uint32_t major = 0, minor = 0, build = 0, revision = 0;
GetVersionInfo(major, minor, build, revision);
char buffer[50];
sprintf_s(buffer, sizeof(buffer), "%u.%u.%u (rev. %u)", major, minor, build, revision);
return std::string(buffer);
}
std::string System_GetProperty(SystemProperty prop) {
static bool hasCheckedGPUDriverVersion = false;
switch (prop) {
-45
View File
@@ -239,49 +239,4 @@ std::string GetLangRegion() {
return langRegion;
}
bool IsXBox() {
auto deviceInfo = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo();
return deviceInfo.DeviceFamily() == L"Windows.Xbox";
}
bool IsMobile() {
auto deviceInfo = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo();
return deviceInfo.DeviceFamily() == L"Windows.Mobile";
}
void GetVersionInfo(uint32_t& major, uint32_t& minor, uint32_t& build, uint32_t& revision) {
winrt::hstring deviceFamilyVersion = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo().DeviceFamilyVersion();
uint64_t version = std::stoull(std::wstring(deviceFamilyVersion));
major = static_cast<uint32_t>((version & 0xFFFF000000000000L) >> 48);
minor = static_cast<uint32_t>((version & 0x0000FFFF00000000L) >> 32);
build = static_cast<uint32_t>((version & 0x00000000FFFF0000L) >> 16);
revision = static_cast<uint32_t>(version & 0x000000000000FFFFL);
}
std::string GetSystemName() {
std::string osName = "Microsoft Windows 10";
if (IsXBox()) {
osName = "Xbox OS";
}
else {
uint32_t major = 0, minor = 0, build = 0, revision = 0;
GetVersionInfo(major, minor, build, revision);
if (build >= 22000) {
osName = "Microsoft Windows 11";
}
}
return osName + " " + GetWindowsSystemArchitecture();
}
std::string GetWindowsBuild() {
uint32_t major = 0, minor = 0, build = 0, revision = 0;
GetVersionInfo(major, minor, build, revision);
char buffer[50];
sprintf_s(buffer, sizeof(buffer), "%u.%u.%u (rev. %u)", major, minor, build, revision);
return std::string(buffer);
}
#pragma endregion