From 77ec5c7c501fb181649ac6f6f4c5e702ee594698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 19 Dec 2025 13:48:55 +0100 Subject: [PATCH] Buildfixes --- Common/Input/InputState.h | 1 + UWP/App.cpp | 4 ++-- UWP/PPSSPP_UWPMain.cpp | 12 +++++++----- UWP/PPSSPP_UWPMain.h | 2 +- android/jni/app-android.cpp | 2 +- ios/Controls.mm | 20 ++++++++++---------- ios/ViewControllerCommon.mm | 4 ++-- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Common/Input/InputState.h b/Common/Input/InputState.h index b41a28d0ea..bdbec037d7 100644 --- a/Common/Input/InputState.h +++ b/Common/Input/InputState.h @@ -129,6 +129,7 @@ public: void FormatDebug(char *buffer, size_t bufSize) const; }; +// Be careful about changing these values as some are set on the Android java side! enum class TouchInputFlags { MOVE = 1 << 0, DOWN = 1 << 1, diff --git a/UWP/App.cpp b/UWP/App.cpp index b6cb56ff45..bc5909207d 100644 --- a/UWP/App.cpp +++ b/UWP/App.cpp @@ -220,7 +220,7 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C float X = args->CurrentPoint->Position.X; float Y = args->CurrentPoint->Position.Y; int64_t timestamp = args->CurrentPoint->Timestamp; - m_main->OnTouchEvent(TouchInputFlags::DOWN|TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp); + m_main->OnTouchEvent(TouchInputFlags::DOWN | TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp); if (!m_isPhone) { sender->SetPointerCapture(); } @@ -233,7 +233,7 @@ void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI:: float X = args->CurrentPoint->Position.X; float Y = args->CurrentPoint->Position.Y; int64_t timestamp = args->CurrentPoint->Timestamp; - m_main->OnTouchEvent(TouchInputFlags::UP|TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp); + m_main->OnTouchEvent(TouchInputFlags::UP | TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp); if (!m_isPhone) { sender->ReleasePointerCapture(); } diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 5621a6c51b..edcf1433ad 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -204,7 +204,9 @@ void PPSSPP_UWPMain::OnKeyDown(int scanCode, Windows::System::VirtualKey virtual KeyInput key{}; key.deviceId = DEVICE_ID_KEYBOARD; key.keyCode = iter->second; - key.flags = KeyInputFlags::DOWN | (repeatCount > 1 ? KeyInputFlags::IS_REPEAT : 0); + key.flags = KeyInputFlags::DOWN; + if (repeatCount > 1) + key.flags |= KeyInputFlags::IS_REPEAT; NativeKey(key); } } @@ -264,7 +266,7 @@ bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) { } } -void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) { +void PPSSPP_UWPMain::OnTouchEvent(TouchInputFlags flags, 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_x = m_deviceResources->GetActualDpi() / 96.0f; @@ -276,18 +278,18 @@ void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, input.id = touchId; input.x = x * dpiFactor_x; input.y = y * dpiFactor_y; - input.flags = touchEvent; + input.flags = flags; input.timestamp = timestamp; NativeTouch(input); KeyInput key{}; key.deviceId = DEVICE_ID_MOUSE; - if (touchEvent & TouchInputFlags::DOWN) { + if (flags & TouchInputFlags::DOWN) { key.keyCode = NKCODE_EXT_MOUSEBUTTON_1; key.flags = KeyInputFlags::DOWN; NativeKey(key); } - if (touchEvent & TouchInputFlags::UP) { + if (flags & TouchInputFlags::UP) { key.keyCode = NKCODE_EXT_MOUSEBUTTON_1; key.flags = KeyInputFlags::UP; NativeKey(key); diff --git a/UWP/PPSSPP_UWPMain.h b/UWP/PPSSPP_UWPMain.h index 96d1a015ea..3a6d832b36 100644 --- a/UWP/PPSSPP_UWPMain.h +++ b/UWP/PPSSPP_UWPMain.h @@ -48,7 +48,7 @@ public: void OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKey); void OnCharacterReceived(int scanCode,unsigned int keyCode); - void OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp); + void OnTouchEvent(TouchInputFlags flags, int touchId, float x, float y, double timestamp); void OnMouseWheel(float delta); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 89c9a6fb39..1b151a44a7 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -1232,7 +1232,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch touch.id = pointerId; touch.x = x * display_scale_x * g_display.dpi_scale_x; touch.y = y * display_scale_y * g_display.dpi_scale_y; - touch.flags = code; + touch.flags = (TouchInputFlags)code; NativeTouch(touch); } diff --git a/ios/Controls.mm b/ios/Controls.mm index e71215a870..daf133e22d 100644 --- a/ios/Controls.mm +++ b/ios/Controls.mm @@ -11,7 +11,7 @@ static void controllerButtonPressed(BOOL pressed, InputKeyCode keyCode) { KeyInput key; key.deviceId = DEVICE_ID_PAD_0; - key.flags = pressed ? KEY_DOWN : KEY_UP; + key.flags = pressed ? KeyInputFlags::DOWN : KeyInputFlags::UP; key.keyCode = keyCode; NativeKey(key); } @@ -177,9 +177,9 @@ void TouchTracker::SendTouchEvent(float x, float y, int code, int pointerId) { input.x = scaledX; input.y = scaledY; switch (code) { - case 1: input.flags = TOUCH_DOWN; break; - case 2: input.flags = TOUCH_UP; break; - default: input.flags = TOUCH_MOVE; break; + case 1: input.flags = TouchInputFlags::DOWN; break; + case 2: input.flags = TouchInputFlags::UP; break; + default: input.flags = TouchInputFlags::MOVE; break; } input.id = pointerId; NativeTouch(input); @@ -297,7 +297,7 @@ void ICadeTracker::ButtonDown(iCadeState button) { NativeAxis(&axis, 1); } else { KeyInput key; - key.flags = KEY_DOWN; + key.flags = KeyInputFlags::DOWN; key.keyCode = iCadeToKeyMap[button]; key.deviceId = DEVICE_ID_PAD_0; NativeKey(key); @@ -322,7 +322,7 @@ void ICadeTracker::ButtonUp(iCadeState button) { // Pressing Start twice within 1 second will take to the Emu menu if ((lastStartPress + 1.0f) > time_now_d()) { KeyInput key; - key.flags = KEY_DOWN; + key.flags = KeyInputFlags::DOWN; key.keyCode = NKCODE_ESCAPE; key.deviceId = DEVICE_ID_KEYBOARD; NativeKey(key); @@ -365,7 +365,7 @@ void ICadeTracker::ButtonUp(iCadeState button) { NativeAxis(&axis, 1); } else { KeyInput key; - key.flags = KEY_UP; + key.flags = KeyInputFlags::UP; key.keyCode = iCadeToKeyMap[button]; key.deviceId = DEVICE_ID_PAD_0; NativeKey(key); @@ -386,7 +386,7 @@ void SendKeyboardChars(std::string_view str) { uint32_t codePoint = chars.next(); KeyInput input{}; input.deviceId = DEVICE_ID_KEYBOARD; - input.flags = KEY_CHAR; + input.flags = KeyInputFlags::CHAR; input.unicodeChar = codePoint; NativeKey(input); } @@ -404,7 +404,7 @@ void KeyboardPressesBegan(NSSet *presses, UIPressesEvent *event) { KeyInput input{}; input.deviceId = DEVICE_ID_KEYBOARD; input.keyCode = code; - input.flags = KEY_DOWN; + input.flags = KeyInputFlags::DOWN; NativeKey(input); INFO_LOG(Log::System, "pressesBegan %d", code); } @@ -428,7 +428,7 @@ void KeyboardPressesEnded(NSSet *presses, UIPressesEvent *event) { KeyInput input{}; input.deviceId = DEVICE_ID_KEYBOARD; input.keyCode = code; - input.flags = KEY_UP; + input.flags = KeyInputFlags::UP; NativeKey(input); INFO_LOG(Log::System, "pressesEnded %d", code); } diff --git a/ios/ViewControllerCommon.mm b/ios/ViewControllerCommon.mm index 386fb7a8e4..2ee1c29b4b 100644 --- a/ios/ViewControllerCommon.mm +++ b/ios/ViewControllerCommon.mm @@ -223,7 +223,7 @@ - (void)handleSwipeFrom:(UIScreenEdgePanGestureRecognizer *)recognizer { if (recognizer.state == UIGestureRecognizerStateEnded) { KeyInput key; - key.flags = KEY_DOWN | KEY_UP; + key.flags = KeyInputFlags::DOWN | KeyInputFlags::UP; key.keyCode = NKCODE_BACK; key.deviceId = DEVICE_ID_TOUCH; NativeKey(key); @@ -346,7 +346,7 @@ extern float g_safeInsetBottom; - (void)deleteBackward { KeyInput input{}; input.deviceId = DEVICE_ID_KEYBOARD; - input.flags = KEY_DOWN | KEY_UP; + input.flags = KeyInputFlags::DOWN | KeyInputFlags::UP; input.keyCode = NKCODE_DEL; NativeKey(input); INFO_LOG(Log::System, "Backspace");