From cdc5483cf9683fabf0a897954a510574e61af418 Mon Sep 17 00:00:00 2001
From: ROllerozxa <[EMAIL REDACTED]>
Date: Thu, 16 Jan 2025 20:18:11 +0100
Subject: [PATCH] Vita: Fix off-by-one error for synthetic mouse events
---
src/events/SDL_mouse.c | 6 +++---
src/events/SDL_touch.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 5e72a1cc0dc2a..df89271531ce9 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -143,13 +143,13 @@ static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *
switch (*hint) {
default:
case '0':
- mouse->vita_touch_mouse_device = 0;
+ mouse->vita_touch_mouse_device = 1;
break;
case '1':
- mouse->vita_touch_mouse_device = 1;
+ mouse->vita_touch_mouse_device = 2;
break;
case '2':
- mouse->vita_touch_mouse_device = 2;
+ mouse->vita_touch_mouse_device = 3;
break;
}
}
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index 3a4f54bd070c1..ec4acb14b62ae 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -267,7 +267,7 @@ void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_
// FIXME: maybe we should only restrict to a few SDL_TouchDeviceType
if ((id != SDL_MOUSE_TOUCHID) && (id != SDL_PEN_TOUCHID)) {
#ifdef SDL_PLATFORM_VITA
- if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) {
+ if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 3))) {
#else
if (mouse->touch_mouse_events) {
#endif