From 0e9f53c8b42917603e433098e6d985644b9c2cf2 Mon Sep 17 00:00:00 2001 From: driver1998 Date: Mon, 13 May 2019 15:34:30 +0800 Subject: [PATCH 1/3] UWP Window resizing support this correctly resize the render view when the Window is resized --- Core/Core.cpp | 2 +- UWP/App.cpp | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Core/Core.cpp b/Core/Core.cpp index 32db6ab451ea..93c6eaf8d850 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -150,7 +150,7 @@ static bool IsWindowSmall(int pixelWidth, int pixelHeight) { // TODO: Feels like this belongs elsewhere. bool UpdateScreenScale(int width, int height) { bool smallWindow; -#ifdef _WIN32 +#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) g_dpi = (float)System_GetPropertyInt(SYSPROP_DISPLAY_DPI); g_dpi_scale_x = 96.0f / g_dpi; g_dpi_scale_y = 96.0f / g_dpi; diff --git a/UWP/App.cpp b/UWP/App.cpp index 124905478fec..794a949dd40f 100644 --- a/UWP/App.cpp +++ b/UWP/App.cpp @@ -6,6 +6,9 @@ #include #include "input/input_state.h" +#include "base/NativeApp.h" +#include "Core/System.h" +#include "Core/Core.h" #include @@ -149,7 +152,7 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C int64_t timestamp = args->CurrentPoint->Timestamp; m_main->OnTouchEvent(TOUCH_DOWN|TOUCH_MOVE, pointerId, X, Y, timestamp); #if !PPSSPP_ARCH(ARM) - sender->SetPointerCapture(); + sender->SetPointerCapture(); #endif } @@ -237,8 +240,20 @@ void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) { // Window event handlers. void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) { - m_deviceResources->SetLogicalSize(Size(sender->Bounds.Width, sender->Bounds.Height)); + int width = sender->Bounds.Width; + int height = sender->Bounds.Height; + float scale = m_deviceResources->GetDpi() / 96.0f; + + m_deviceResources->SetLogicalSize(Size(width, height)); m_main->CreateWindowSizeDependentResources(); + + PSP_CoreParameter().pixelWidth = width * scale; + PSP_CoreParameter().pixelHeight = height * scale; + + if (UpdateScreenScale(width, height)) { + NativeMessageReceived("gpu_resized", ""); + } + } void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) { From 1804b88454a5eaf096eab23bec9858bc8ebaa37d Mon Sep 17 00:00:00 2001 From: driver1998 Date: Mon, 13 May 2019 15:38:04 +0800 Subject: [PATCH 2/3] Proper device type detection for UWP implement proper device type detection instead of relying on architecture. --- UWP/App.cpp | 24 +++++++++++++++--------- UWP/PPSSPP_UWPMain.cpp | 16 ++++++++++------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/UWP/App.cpp b/UWP/App.cpp index 794a949dd40f..c190c308dda8 100644 --- a/UWP/App.cpp +++ b/UWP/App.cpp @@ -95,6 +95,9 @@ void App::SetWindow(CoreWindow^ window) { if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { m_hardwareButtons.insert(HardwareButton::BACK); + } + + if (Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily == "Windows.Mobile") { m_isPhone = true; } @@ -107,7 +110,10 @@ void App::SetWindow(CoreWindow^ window) { } bool App::HasBackButton() { - return m_isPhone; + if (m_hardwareButtons.count(HardwareButton::BACK) != 0) + return true; + else + return false; } void App::App_BackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ e) { @@ -151,9 +157,9 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C float Y = args->CurrentPoint->Position.Y; int64_t timestamp = args->CurrentPoint->Timestamp; m_main->OnTouchEvent(TOUCH_DOWN|TOUCH_MOVE, pointerId, X, Y, timestamp); -#if !PPSSPP_ARCH(ARM) + if (!m_isPhone) { sender->SetPointerCapture(); -#endif + } } void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { @@ -164,9 +170,9 @@ void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI:: float Y = args->CurrentPoint->Position.Y; int64_t timestamp = args->CurrentPoint->Timestamp; m_main->OnTouchEvent(TOUCH_UP|TOUCH_MOVE, pointerId, X, Y, timestamp); -#if !PPSSPP_ARCH(ARM) - sender->ReleasePointerCapture(); -#endif + if (!m_isPhone) { + sender->ReleasePointerCapture(); + } } void App::OnPointerCaptureLost(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { @@ -211,9 +217,9 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ // Run() won't start until the CoreWindow is activated. CoreWindow::GetForCurrentThread()->Activate(); // On mobile, we force-enter fullscreen mode. -#ifdef _ARM - Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryEnterFullScreenMode(); -#endif + if (m_isPhone) { + Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryEnterFullScreenMode(); + } } void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) { diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 214566a0f69e..4819f7953475 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -368,12 +368,16 @@ int System_GetPropertyInt(SystemProperty prop) { case SYSPROP_DISPLAY_REFRESH_RATE: return 60000; case SYSPROP_DEVICE_TYPE: - // TODO: Detect touch screen instead. -#ifdef _M_ARM - return DEVICE_TYPE_MOBILE; -#else - return DEVICE_TYPE_DESKTOP; -#endif + { + auto ver = Windows::System::Profile::AnalyticsInfo::VersionInfo; + if (ver->DeviceFamily == "Windows.Mobile") { + return DEVICE_TYPE_MOBILE; + } else if (ver->DeviceFamily == "Windows.Xbox") { + return DEVICE_TYPE_TV; + } else { + return DEVICE_TYPE_DESKTOP; + } + } default: return -1; } From 1a9a6173259c4c4fbd6eeef3bb5e7fa13ea0960f Mon Sep 17 00:00:00 2001 From: driver1998 Date: Mon, 13 May 2019 15:47:42 +0800 Subject: [PATCH 3/3] UWP: Use default (latest) toolset and remove dependency to 16299 SDK --- UWP/Armips_UWP/Armips_UWP.vcxproj | 8 ----- UWP/CommonUWP/CommonUWP.vcxproj | 16 ++------- UWP/CoreUWP/CoreUWP.vcxproj | 12 ------- UWP/GPU_UWP/GPU_UWP.vcxproj | 12 ------- UWP/NativeUWP/NativeUWP.vcxproj | 16 ++------- UWP/SPIRVCross_UWP/SPIRVCross_UWP.vcxproj | 16 ++------- UWP/UI_UWP/UI_UWP.vcxproj | 16 ++------- UWP/UWP.vcxproj | 42 ++++++++--------------- UWP/glslang_UWP/glslang_UWP.vcxproj | 16 ++------- UWP/libkirk_UWP/libkirk_UWP.vcxproj | 16 ++------- UWP/zlib_UWP/zlib_UWP.vcxproj | 16 ++------- 11 files changed, 29 insertions(+), 157 deletions(-) diff --git a/UWP/Armips_UWP/Armips_UWP.vcxproj b/UWP/Armips_UWP/Armips_UWP.vcxproj index 92f1ccf6bb42..4baa6e63623b 100644 --- a/UWP/Armips_UWP/Armips_UWP.vcxproj +++ b/UWP/Armips_UWP/Armips_UWP.vcxproj @@ -50,46 +50,38 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index c1470e6fed6c..a049b11dee95 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -488,4 +476,4 @@ - \ No newline at end of file + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 2eccd7d6212e..5cac0a005d3a 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 diff --git a/UWP/GPU_UWP/GPU_UWP.vcxproj b/UWP/GPU_UWP/GPU_UWP.vcxproj index 9211acc61807..9dd5a945de6c 100644 --- a/UWP/GPU_UWP/GPU_UWP.vcxproj +++ b/UWP/GPU_UWP/GPU_UWP.vcxproj @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 diff --git a/UWP/NativeUWP/NativeUWP.vcxproj b/UWP/NativeUWP/NativeUWP.vcxproj index 1b61ab00bfb8..ebb45d8febd1 100644 --- a/UWP/NativeUWP/NativeUWP.vcxproj +++ b/UWP/NativeUWP/NativeUWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -1655,4 +1643,4 @@ - \ No newline at end of file + diff --git a/UWP/SPIRVCross_UWP/SPIRVCross_UWP.vcxproj b/UWP/SPIRVCross_UWP/SPIRVCross_UWP.vcxproj index abb8c1dfef57..3ef93d6aa227 100644 --- a/UWP/SPIRVCross_UWP/SPIRVCross_UWP.vcxproj +++ b/UWP/SPIRVCross_UWP/SPIRVCross_UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -415,4 +403,4 @@ - \ No newline at end of file + diff --git a/UWP/UI_UWP/UI_UWP.vcxproj b/UWP/UI_UWP/UI_UWP.vcxproj index 0239f337b0fc..98c5b54a0b72 100644 --- a/UWP/UI_UWP/UI_UWP.vcxproj +++ b/UWP/UI_UWP/UI_UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -475,4 +463,4 @@ - \ No newline at end of file + diff --git a/UWP/UWP.vcxproj b/UWP/UWP.vcxproj index 6dd31abfefe0..32af70a24c1b 100644 --- a/UWP/UWP.vcxproj +++ b/UWP/UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -67,77 +67,65 @@ Application true - v141 Application true - v141 Application true - v141 Application true - v141 Application false true - v141 true Application false true - v141 true Application false false - v141 true Application false false - v141 true Application false false - v141 true Application false false - v141 true Application false true - v141 true Application false true - v141 true @@ -148,51 +136,51 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -613,7 +601,7 @@ copy AssetsGold\*.* Assets /Y - + @@ -621,4 +609,4 @@ copy AssetsGold\*.* Assets /Y - \ No newline at end of file + diff --git a/UWP/glslang_UWP/glslang_UWP.vcxproj b/UWP/glslang_UWP/glslang_UWP.vcxproj index e81a4749734a..e96343eca527 100644 --- a/UWP/glslang_UWP/glslang_UWP.vcxproj +++ b/UWP/glslang_UWP/glslang_UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -498,4 +486,4 @@ - \ No newline at end of file + diff --git a/UWP/libkirk_UWP/libkirk_UWP.vcxproj b/UWP/libkirk_UWP/libkirk_UWP.vcxproj index fa74dcec03fd..510ff0968176 100644 --- a/UWP/libkirk_UWP/libkirk_UWP.vcxproj +++ b/UWP/libkirk_UWP/libkirk_UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -408,4 +396,4 @@ - \ No newline at end of file + diff --git a/UWP/zlib_UWP/zlib_UWP.vcxproj b/UWP/zlib_UWP/zlib_UWP.vcxproj index f5bda9773b67..5ac9ab5c0898 100644 --- a/UWP/zlib_UWP/zlib_UWP.vcxproj +++ b/UWP/zlib_UWP/zlib_UWP.vcxproj @@ -1,4 +1,4 @@ - + @@ -66,70 +66,58 @@ StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary true - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false false - v141 StaticLibrary false true - v141 StaticLibrary false true - v141 @@ -408,4 +396,4 @@ - \ No newline at end of file +