mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
UWP: Fix DPI calculations for touch. Implement back button support.
This commit is contained in:
parent
429f1227a8
commit
22782b6439
17 changed files with 111 additions and 58 deletions
|
@ -15,6 +15,8 @@
|
||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "ppsspp_config.h"
|
||||||
|
|
||||||
#if !defined(ANDROID)
|
#if !defined(ANDROID)
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -55,13 +57,13 @@ static EShLanguage GetLanguage(const Draw::ShaderStage stage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderTranslationInit() {
|
void ShaderTranslationInit() {
|
||||||
// TODO: We have TLS issues on mobile
|
// TODO: We have TLS issues on UWP
|
||||||
#ifndef _M_ARM
|
#if !PPSSPP_PLATFORM(UWP)
|
||||||
glslang::InitializeProcess();
|
glslang::InitializeProcess();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void ShaderTranslationShutdown() {
|
void ShaderTranslationShutdown() {
|
||||||
#ifndef _M_ARM
|
#if !PPSSPP_PLATFORM(UWP)
|
||||||
glslang::FinalizeProcess();
|
glslang::FinalizeProcess();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -172,7 +174,7 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, TranslatedShade
|
||||||
if (srcLang != GLSL_300 && srcLang != GLSL_140)
|
if (srcLang != GLSL_300 && srcLang != GLSL_140)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef _M_ARM
|
#if PPSSPP_PLATFORM(UWP)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -620,11 +620,6 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause) {
|
||||||
|
|
||||||
const int roundImage = g_Config.iTouchButtonStyle ? I_ROUND_LINE : I_ROUND;
|
const int roundImage = g_Config.iTouchButtonStyle ? I_ROUND_LINE : I_ROUND;
|
||||||
|
|
||||||
// These platforms always need the pause menu button to be shown.
|
|
||||||
#if defined(IOS)
|
|
||||||
root->Add(new BoolButton(pause, roundImage, I_ARROW, 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (g_Config.bShowTouchControls) {
|
if (g_Config.bShowTouchControls) {
|
||||||
const int rectImage = g_Config.iTouchButtonStyle ? I_RECT_LINE : I_RECT;
|
const int rectImage = g_Config.iTouchButtonStyle ? I_RECT_LINE : I_RECT;
|
||||||
const int shoulderImage = g_Config.iTouchButtonStyle ? I_SHOULDER_LINE : I_SHOULDER;
|
const int shoulderImage = g_Config.iTouchButtonStyle ? I_SHOULDER_LINE : I_SHOULDER;
|
||||||
|
@ -633,10 +628,10 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause) {
|
||||||
const int stickBg = g_Config.iTouchButtonStyle ? I_STICK_BG_LINE : I_STICK_BG;
|
const int stickBg = g_Config.iTouchButtonStyle ? I_STICK_BG_LINE : I_STICK_BG;
|
||||||
static const int comboKeyImages[5] = { I_1, I_2, I_3, I_4, I_5 };
|
static const int comboKeyImages[5] = { I_1, I_2, I_3, I_4, I_5 };
|
||||||
|
|
||||||
#if !defined(IOS)
|
if (!System_GetPropertyInt(SYSPROP_HAS_BACK_BUTTON)) {
|
||||||
if (g_Config.bShowTouchPause)
|
|
||||||
root->Add(new BoolButton(pause, roundImage, I_ARROW, 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90);
|
root->Add(new BoolButton(pause, roundImage, I_ARROW, 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (g_Config.bShowTouchCircle)
|
if (g_Config.bShowTouchCircle)
|
||||||
root->Add(new PSPButton(CTRL_CIRCLE, roundImage, I_CIRCLE, Action_button_scale, new AnchorLayoutParams(Action_circle_button_X, Action_circle_button_Y, NONE, NONE, true)));
|
root->Add(new PSPButton(CTRL_CIRCLE, roundImage, I_CIRCLE, Action_button_scale, new AnchorLayoutParams(Action_circle_button_X, Action_circle_button_Y, NONE, NONE, true)));
|
||||||
|
|
||||||
|
@ -685,6 +680,12 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause) {
|
||||||
if (g_Config.bShowComboKey4)
|
if (g_Config.bShowComboKey4)
|
||||||
root->Add(new ComboKey(g_Config.iCombokey4, roundImage, comboKeyImages[4], combo4_key_scale, new AnchorLayoutParams(combo4_key_X, combo4_key_Y, NONE, NONE, true)));
|
root->Add(new ComboKey(g_Config.iCombokey4, roundImage, comboKeyImages[4], combo4_key_scale, new AnchorLayoutParams(combo4_key_X, combo4_key_Y, NONE, NONE, true)));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// If there's no hardware back button (or ESC key), add a soft button.
|
||||||
|
if (!System_GetPropertyInt(SYSPROP_HAS_BACK_BUTTON)) {
|
||||||
|
root->Add(new BoolButton(pause, roundImage, I_ARROW, 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
21
UWP/App.cpp
21
UWP/App.cpp
|
@ -90,9 +90,26 @@ void App::SetWindow(CoreWindow^ window) {
|
||||||
window->PointerCaptureLost += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerCaptureLost);
|
window->PointerCaptureLost += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerCaptureLost);
|
||||||
window->PointerWheelChanged += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged);
|
window->PointerWheelChanged += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged);
|
||||||
|
|
||||||
|
if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) {
|
||||||
|
m_hardwareButtons.insert(HardwareButton::BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->
|
||||||
|
BackRequested += ref new Windows::Foundation::EventHandler<
|
||||||
|
Windows::UI::Core::BackRequestedEventArgs^>(
|
||||||
|
this, &App::App_BackRequested);
|
||||||
|
|
||||||
m_deviceResources->SetWindow(window);
|
m_deviceResources->SetWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool App::HasBackButton() {
|
||||||
|
return m_hardwareButtons.find(HardwareButton::BACK) != m_hardwareButtons.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::App_BackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ e) {
|
||||||
|
e->Handled = m_main->OnHardwareButton(HardwareButton::BACK);
|
||||||
|
}
|
||||||
|
|
||||||
void App::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args) {
|
void App::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args) {
|
||||||
m_main->OnKeyDown(args->KeyStatus.ScanCode, args->VirtualKey, args->KeyStatus.RepeatCount);
|
m_main->OnKeyDown(args->KeyStatus.ScanCode, args->VirtualKey, args->KeyStatus.RepeatCount);
|
||||||
}
|
}
|
||||||
|
@ -185,6 +202,10 @@ void App::Uninitialize() {
|
||||||
void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) {
|
void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) {
|
||||||
// Run() won't start until the CoreWindow is activated.
|
// Run() won't start until the CoreWindow is activated.
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
// On mobile, we force-enter fullscreen mode.
|
||||||
|
#ifdef _ARM
|
||||||
|
Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryEnterFullScreenMode();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) {
|
void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) {
|
||||||
|
|
11
UWP/App.h
11
UWP/App.h
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "Common/DeviceResources.h"
|
#include "Common/DeviceResources.h"
|
||||||
#include "PPSSPP_UWPMain.h"
|
#include "PPSSPP_UWPMain.h"
|
||||||
|
@ -45,6 +47,10 @@ namespace UWP {
|
||||||
Touch touches[maxTouches]{};
|
Touch touches[maxTouches]{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class HardwareButton {
|
||||||
|
BACK,
|
||||||
|
};
|
||||||
|
|
||||||
// Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
|
// Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
|
||||||
ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView {
|
ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView {
|
||||||
public:
|
public:
|
||||||
|
@ -57,6 +63,8 @@ namespace UWP {
|
||||||
virtual void Run();
|
virtual void Run();
|
||||||
virtual void Uninitialize();
|
virtual void Uninitialize();
|
||||||
|
|
||||||
|
bool HasBackButton();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Application lifecycle event handlers.
|
// Application lifecycle event handlers.
|
||||||
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
|
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
|
||||||
|
@ -85,8 +93,11 @@ namespace UWP {
|
||||||
void OnPointerCaptureLost(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
void OnPointerCaptureLost(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
||||||
void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
||||||
|
|
||||||
|
void App_BackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
||||||
|
std::set<HardwareButton> m_hardwareButtons;
|
||||||
std::unique_ptr<PPSSPP_UWPMain> m_main;
|
std::unique_ptr<PPSSPP_UWPMain> m_main;
|
||||||
bool m_windowClosed;
|
bool m_windowClosed;
|
||||||
bool m_windowVisible;
|
bool m_windowVisible;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace DisplayMetrics
|
||||||
// games attempt to render at 60 frames per second at full fidelity.
|
// games attempt to render at 60 frames per second at full fidelity.
|
||||||
// The decision to render at full fidelity across all platforms and form factors
|
// The decision to render at full fidelity across all platforms and form factors
|
||||||
// should be deliberate.
|
// should be deliberate.
|
||||||
static const bool SupportHighResolutions = false;
|
static const bool SupportHighResolutions = true;
|
||||||
|
|
||||||
// The default thresholds that define a "high resolution" display. If the thresholds
|
// The default thresholds that define a "high resolution" display. If the thresholds
|
||||||
// are exceeded and SupportHighResolutions is false, the dimensions will be scaled
|
// are exceeded and SupportHighResolutions is false, the dimensions will be scaled
|
||||||
|
@ -441,7 +441,6 @@ void DX::DeviceResources::UpdateRenderTargetSize()
|
||||||
m_effectiveDpi /= 2.0f;
|
m_effectiveDpi /= 2.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the necessary render target size in pixels.
|
// Calculate the necessary render target size in pixels.
|
||||||
m_outputSize.Width = DX::ConvertDipsToPixels(m_logicalSize.Width, m_effectiveDpi);
|
m_outputSize.Width = DX::ConvertDipsToPixels(m_logicalSize.Width, m_effectiveDpi);
|
||||||
m_outputSize.Height = DX::ConvertDipsToPixels(m_logicalSize.Height, m_effectiveDpi);
|
m_outputSize.Height = DX::ConvertDipsToPixels(m_logicalSize.Height, m_effectiveDpi);
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace DX
|
||||||
// The size of the render target, in dips.
|
// The size of the render target, in dips.
|
||||||
Windows::Foundation::Size GetLogicalSize() const { return m_logicalSize; }
|
Windows::Foundation::Size GetLogicalSize() const { return m_logicalSize; }
|
||||||
float GetDpi() const { return m_effectiveDpi; }
|
float GetDpi() const { return m_effectiveDpi; }
|
||||||
|
float GetActualDpi() const { return m_dpi; }
|
||||||
|
|
||||||
// D3D Accessors.
|
// D3D Accessors.
|
||||||
ID3D11Device3* GetD3DDevice() const { return m_d3dDevice.Get(); }
|
ID3D11Device3* GetD3DDevice() const { return m_d3dDevice.Get(); }
|
||||||
|
|
|
@ -1163,7 +1163,6 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\ext\native\ext\vjson\block_allocator.cpp" />
|
<ClCompile Include="..\..\ext\native\ext\vjson\block_allocator.cpp" />
|
||||||
<ClCompile Include="..\..\ext\native\ext\vjson\json.cpp" />
|
<ClCompile Include="..\..\ext\native\ext\vjson\json.cpp" />
|
||||||
<ClCompile Include="..\..\ext\native\ext\vjson\main.cpp" />
|
|
||||||
<ClCompile Include="..\..\ext\native\file\chunk_file.cpp" />
|
<ClCompile Include="..\..\ext\native\file\chunk_file.cpp" />
|
||||||
<ClCompile Include="..\..\ext\native\file\fd_util.cpp" />
|
<ClCompile Include="..\..\ext\native\file\fd_util.cpp" />
|
||||||
<ClCompile Include="..\..\ext\native\file\file_util.cpp" />
|
<ClCompile Include="..\..\ext\native\file\file_util.cpp" />
|
||||||
|
|
|
@ -220,9 +220,6 @@
|
||||||
<ClCompile Include="..\..\ext\native\ext\vjson\json.cpp">
|
<ClCompile Include="..\..\ext\native\ext\vjson\json.cpp">
|
||||||
<Filter>ext\vjson</Filter>
|
<Filter>ext\vjson</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\ext\native\ext\vjson\main.cpp">
|
|
||||||
<Filter>ext\vjson</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\ext\native\ext\libzip\mkstemp.c">
|
<ClCompile Include="..\..\ext\native\ext\libzip\mkstemp.c">
|
||||||
<Filter>ext\libzip</Filter>
|
<Filter>ext\libzip</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "UWPHost.h"
|
#include "UWPHost.h"
|
||||||
#include "UWPUtil.h"
|
#include "UWPUtil.h"
|
||||||
#include "StorageFileLoader.h"
|
#include "StorageFileLoader.h"
|
||||||
|
#include "App.h"
|
||||||
|
|
||||||
using namespace UWP;
|
using namespace UWP;
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
|
@ -145,10 +146,10 @@ PPSSPP_UWPMain::~PPSSPP_UWPMain() {
|
||||||
|
|
||||||
// Updates application state when the window size changes (e.g. device orientation change)
|
// Updates application state when the window size changes (e.g. device orientation change)
|
||||||
void PPSSPP_UWPMain::CreateWindowSizeDependentResources() {
|
void PPSSPP_UWPMain::CreateWindowSizeDependentResources() {
|
||||||
// TODO: Replace this with the size-dependent initialization of your app's content.
|
|
||||||
ctx_->GetDrawContext()->HandleEvent(Draw::Event::LOST_BACKBUFFER, 0, 0, nullptr);
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::LOST_BACKBUFFER, 0, 0, nullptr);
|
||||||
|
|
||||||
NativeResized();
|
NativeResized();
|
||||||
|
|
||||||
int width = m_deviceResources->GetScreenViewport().Width;
|
int width = m_deviceResources->GetScreenViewport().Width;
|
||||||
int height = m_deviceResources->GetScreenViewport().Height;
|
int height = m_deviceResources->GetScreenViewport().Height;
|
||||||
ctx_->GetDrawContext()->HandleEvent(Draw::Event::GOT_BACKBUFFER, width, height, m_deviceResources->GetBackBufferRenderTargetView());
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::GOT_BACKBUFFER, width, height, m_deviceResources->GetBackBufferRenderTargetView());
|
||||||
|
@ -169,8 +170,12 @@ bool PPSSPP_UWPMain::Render() {
|
||||||
time_update();
|
time_update();
|
||||||
auto context = m_deviceResources->GetD3DDeviceContext();
|
auto context = m_deviceResources->GetD3DDeviceContext();
|
||||||
|
|
||||||
// Reset the viewport to target the whole screen.
|
auto bounds = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->VisibleBounds;
|
||||||
auto viewport = m_deviceResources->GetScreenViewport();
|
|
||||||
|
int boundTop = bounds.Top;
|
||||||
|
int boundLeft = bounds.Left;
|
||||||
|
int boundedWidth = bounds.Width;
|
||||||
|
int boundedHeight = bounds.Height;
|
||||||
|
|
||||||
switch (m_deviceResources->ComputeDisplayRotation()) {
|
switch (m_deviceResources->ComputeDisplayRotation()) {
|
||||||
case DXGI_MODE_ROTATION_IDENTITY: g_display_rotation = DisplayRotation::ROTATE_0; break;
|
case DXGI_MODE_ROTATION_IDENTITY: g_display_rotation = DisplayRotation::ROTATE_0; break;
|
||||||
|
@ -181,6 +186,9 @@ bool PPSSPP_UWPMain::Render() {
|
||||||
// Not super elegant but hey.
|
// Not super elegant but hey.
|
||||||
memcpy(&g_display_rot_matrix, &m_deviceResources->GetOrientationTransform3D(), sizeof(float) * 16);
|
memcpy(&g_display_rot_matrix, &m_deviceResources->GetOrientationTransform3D(), sizeof(float) * 16);
|
||||||
|
|
||||||
|
// Reset the viewport to target the whole screen.
|
||||||
|
auto viewport = m_deviceResources->GetScreenViewport();
|
||||||
|
|
||||||
pixel_xres = viewport.Width;
|
pixel_xres = viewport.Width;
|
||||||
pixel_yres = viewport.Height;
|
pixel_yres = viewport.Height;
|
||||||
|
|
||||||
|
@ -189,14 +197,15 @@ bool PPSSPP_UWPMain::Render() {
|
||||||
std::swap(pixel_xres, pixel_yres);
|
std::swap(pixel_xres, pixel_yres);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_dpi = m_deviceResources->GetDpi();
|
g_dpi = m_deviceResources->GetActualDpi();
|
||||||
|
pixel_xres = (g_dpi / 96.0f) * boundedWidth;
|
||||||
|
pixel_yres = (g_dpi / 96.0f) * boundedHeight;
|
||||||
|
|
||||||
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) {
|
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) {
|
||||||
// Boost DPI a bit to look better.
|
// Boost DPI a bit to look better.
|
||||||
g_dpi_scale = 120.0f / g_dpi;
|
g_dpi *= 96.0f / 136.0f;
|
||||||
} else {
|
|
||||||
g_dpi_scale = 96.0f / g_dpi;
|
|
||||||
}
|
}
|
||||||
|
g_dpi_scale = 96.0f / g_dpi;
|
||||||
|
|
||||||
pixel_in_dps = 1.0f / g_dpi_scale;
|
pixel_in_dps = 1.0f / g_dpi_scale;
|
||||||
|
|
||||||
|
@ -260,30 +269,29 @@ void PPSSPP_UWPMain::OnMouseWheel(float delta) {
|
||||||
NativeKey(keyInput);
|
NativeKey(keyInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPSSPP_UWPMain::RotateXYToDisplay(float &x, float &y) {
|
bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) {
|
||||||
switch (m_deviceResources->ComputeDisplayRotation()) {
|
KeyInput keyInput{};
|
||||||
case DXGI_MODE_ROTATION_IDENTITY:
|
keyInput.deviceId = DEVICE_ID_KEYBOARD;
|
||||||
// Nothing to do here.
|
keyInput.flags = KEY_DOWN | KEY_UP;
|
||||||
break;
|
switch (button) {
|
||||||
case DXGI_MODE_ROTATION_ROTATE90:
|
case HardwareButton::BACK:
|
||||||
// TODO
|
keyInput.keyCode = NKCODE_BACK;
|
||||||
break;
|
return NativeKey(keyInput);
|
||||||
case DXGI_MODE_ROTATION_ROTATE180:
|
default:
|
||||||
x = m_deviceResources->GetScreenViewport().Width - x;
|
return false;
|
||||||
y = m_deviceResources->GetScreenViewport().Height - y;
|
|
||||||
break;
|
|
||||||
case DXGI_MODE_ROTATION_ROTATE270:
|
|
||||||
// TODO
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
|
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
|
||||||
|
// We get the coordinate in Windows' device independent pixels already. So let's undo that,
|
||||||
|
// and then apply our own "dpi".
|
||||||
|
float dpiFactor = m_deviceResources->GetActualDpi() / 96.0f;
|
||||||
|
dpiFactor /= pixel_in_dps;
|
||||||
|
|
||||||
TouchInput input{};
|
TouchInput input{};
|
||||||
input.id = touchId;
|
input.id = touchId;
|
||||||
RotateXYToDisplay(x, y);
|
input.x = x * dpiFactor;
|
||||||
input.x = x * pixel_in_dps;
|
input.y = y * dpiFactor;
|
||||||
input.y = y * pixel_in_dps;
|
|
||||||
input.flags = touchEvent;
|
input.flags = touchEvent;
|
||||||
input.timestamp = timestamp;
|
input.timestamp = timestamp;
|
||||||
NativeTouch(input);
|
NativeTouch(input);
|
||||||
|
@ -360,8 +368,10 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
#else
|
#else
|
||||||
return DEVICE_TYPE_DESKTOP;
|
return DEVICE_TYPE_DESKTOP;
|
||||||
#endif
|
#endif
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 1;
|
||||||
case SYSPROP_HAS_FILE_BROWSER:
|
case SYSPROP_HAS_FILE_BROWSER:
|
||||||
return true;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -389,16 +399,6 @@ void System_SendMessage(const char *command, const char *parameter) {
|
||||||
if (file) {
|
if (file) {
|
||||||
g_main->LoadStorageFile(file);
|
g_main->LoadStorageFile(file);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
std::thread([file] {
|
|
||||||
create_task(file->OpenReadAsync()).then([](IRandomAccessStreamWithContentType^ imgStream) {
|
|
||||||
imgStream->Seek(0);
|
|
||||||
IBuffer ^buffer = ref new Streams::Buffer(2048);
|
|
||||||
auto readTask = create_task(imgStream->ReadAsync(buffer, 2048, InputStreamOptions::None));
|
|
||||||
readTask.wait();
|
|
||||||
});
|
|
||||||
}).detach();
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &default
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emulation of TlsAlloc for Windows 10. Used by glslang.
|
// Emulation of TlsAlloc for Windows 10. Used by glslang. Doesn't actually seem to work, other than fixing the linking errors?
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
DWORD WINAPI __imp_TlsAlloc() {
|
DWORD WINAPI __imp_TlsAlloc() {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
namespace UWP {
|
namespace UWP {
|
||||||
|
|
||||||
ref class App;
|
ref class App;
|
||||||
|
enum class HardwareButton;
|
||||||
|
|
||||||
class UWPGraphicsContext : public GraphicsContext {
|
class UWPGraphicsContext : public GraphicsContext {
|
||||||
public:
|
public:
|
||||||
|
@ -50,6 +51,7 @@ public:
|
||||||
|
|
||||||
void OnMouseWheel(float delta);
|
void OnMouseWheel(float delta);
|
||||||
|
|
||||||
|
bool OnHardwareButton(HardwareButton button);
|
||||||
|
|
||||||
void RotateXYToDisplay(float &x, float &y);
|
void RotateXYToDisplay(float &x, float &y);
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,11 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
@ -127,9 +129,11 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|ARM'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|ARM'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
@ -137,9 +141,11 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsMobile, Version=10.0.10586.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsMobile.props')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='UWP Gold|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
@ -470,6 +476,9 @@ copy AssetsGold\*.* Assets /Y</Command>
|
||||||
<DeploymentContent>true</DeploymentContent>
|
<DeploymentContent>true</DeploymentContent>
|
||||||
</Text>
|
</Text>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<SDKReference Include="WindowsMobile, Version=10.0.10586.0" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
|
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />
|
||||||
|
|
|
@ -214,6 +214,8 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
return ScreenDPI();
|
return ScreenDPI();
|
||||||
case SYSPROP_HAS_FILE_BROWSER:
|
case SYSPROP_HAS_FILE_BROWSER:
|
||||||
return true;
|
return true;
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,6 +443,8 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
return (int)(display_hz * 1000.0);
|
return (int)(display_hz * 1000.0);
|
||||||
case SYSPROP_SUPPORTS_PERMISSIONS:
|
case SYSPROP_SUPPORTS_PERMISSIONS:
|
||||||
return androidVersion >= 23; // 6.0 Marshmallow introduced run time permissions.
|
return androidVersion >= 23; // 6.0 Marshmallow introduced run time permissions.
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,7 @@ enum SystemProperty {
|
||||||
SYSPROP_GPUDRIVER_VERSION,
|
SYSPROP_GPUDRIVER_VERSION,
|
||||||
|
|
||||||
SYSPROP_HAS_FILE_BROWSER,
|
SYSPROP_HAS_FILE_BROWSER,
|
||||||
|
SYSPROP_HAS_BACK_BUTTON,
|
||||||
|
|
||||||
// Available as Int:
|
// Available as Int:
|
||||||
SYSPROP_SYSTEMVERSION,
|
SYSPROP_SYSTEMVERSION,
|
||||||
|
|
|
@ -339,6 +339,8 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
#else
|
#else
|
||||||
return DEVICE_TYPE_DESKTOP;
|
return DEVICE_TYPE_DESKTOP;
|
||||||
#endif
|
#endif
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,8 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
#else
|
#else
|
||||||
return DEVICE_TYPE_DESKTOP;
|
return DEVICE_TYPE_DESKTOP;
|
||||||
#endif
|
#endif
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ int System_GetPropertyInt(SystemProperty prop) {
|
||||||
return 60000;
|
return 60000;
|
||||||
case SYSPROP_DEVICE_TYPE:
|
case SYSPROP_DEVICE_TYPE:
|
||||||
return DEVICE_TYPE_MOBILE;
|
return DEVICE_TYPE_MOBILE;
|
||||||
|
case SYSPROP_HAS_BACK_BUTTON:
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue