From b435ab2dac642bccb81d404c93a8ed9ffb90bc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 11 Mar 2026 11:03:41 +0100 Subject: [PATCH] UWP: Move some functions to a more sensible place --- UWP/PPSSPP_UWPMain.cpp | 45 +++++++++++++++++++++++++++++++++ UWP/UWPHelpers/InputHelpers.cpp | 45 --------------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index b07e7af435..a89ee1f48c 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -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((version & 0xFFFF000000000000L) >> 48); + minor = static_cast((version & 0x0000FFFF00000000L) >> 32); + build = static_cast((version & 0x00000000FFFF0000L) >> 16); + revision = static_cast(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) { diff --git a/UWP/UWPHelpers/InputHelpers.cpp b/UWP/UWPHelpers/InputHelpers.cpp index c512a4d688..56138ca2dc 100644 --- a/UWP/UWPHelpers/InputHelpers.cpp +++ b/UWP/UWPHelpers/InputHelpers.cpp @@ -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((version & 0xFFFF000000000000L) >> 48); - minor = static_cast((version & 0x0000FFFF00000000L) >> 32); - build = static_cast((version & 0x00000000FFFF0000L) >> 16); - revision = static_cast(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