SDL: Vita: implement mousewheel and buttons 4/5 (2e43a)

From 2e43a69a5c11b2b71cf713d930ff276cba9ebbd8 Mon Sep 17 00:00:00 2001
From: Ivan Epifanov <[EMAIL REDACTED]>
Date: Tue, 26 Nov 2024 22:24:09 +0300
Subject: [PATCH] Vita: implement mousewheel and buttons 4/5

(cherry picked from commit 6428cee8925a6fe33946c5aa5f75443ae9320eff)
---
 src/video/vita/SDL_vitamouse.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/video/vita/SDL_vitamouse.c b/src/video/vita/SDL_vitamouse.c
index 47fa095bbfed5..76867c6645b94 100644
--- a/src/video/vita/SDL_vitamouse.c
+++ b/src/video/vita/SDL_vitamouse.c
@@ -73,12 +73,28 @@ void VITA_PollMouse(void)
                     else
                         SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_MIDDLE);
                 }
+                if (changed_buttons & 0x8) {
+                    if (prev_buttons & 0x8)
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_X1);
+                    else
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_X1);
+                }
+                if (changed_buttons & 0x10) {
+                    if (prev_buttons & 0x10)
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_RELEASED, SDL_BUTTON_X2);
+                    else
+                        SDL_SendMouseButton(Vita_Window, 0, SDL_PRESSED, SDL_BUTTON_X2);
+                }
 
                 prev_buttons = m_reports[i].buttons;
 
                 if (m_reports[i].rel_x || m_reports[i].rel_y) {
                     SDL_SendMouseMotion(Vita_Window, 0, 1, m_reports[i].rel_x, m_reports[i].rel_y);
                 }
+
+                if (m_reports[i].tilt != 0 || m_reports[i].wheel != 0) {
+                    SDL_SendMouseWheel(Vita_Window, 0, m_reports[i].tilt, m_reports[i].wheel, SDL_MOUSEWHEEL_NORMAL);
+                }
             }
         }
     }