Buildfixes

This commit is contained in:
Henrik Rydgård 2025-12-19 13:48:55 +01:00
parent 29d1331396
commit 77ec5c7c50
7 changed files with 24 additions and 21 deletions

View File

@ -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,

View File

@ -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();
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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<UIPress *> *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<UIPress *> *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);
}

View File

@ -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");