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..c190c308dda8 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 @@ -92,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; } @@ -104,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) { @@ -148,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) - sender->SetPointerCapture(); -#endif + if (!m_isPhone) { + sender->SetPointerCapture(); + } } void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) { @@ -161,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) { @@ -208,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) { @@ -237,8 +246,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) { 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/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; } 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 +