SDL: Vita: implement mousewheel and buttons 4/5

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

---
 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 eedb90c0c6f98..facda1b5d8c0c 100644
--- a/src/video/vita/SDL_vitamouse.c
+++ b/src/video/vita/SDL_vitamouse.c
@@ -75,12 +75,28 @@ void VITA_PollMouse(void)
                     else
                         SDL_SendMouseButton(0, Vita_Window, mouseID, SDL_BUTTON_MIDDLE, true);
                 }
+                if (changed_buttons & 0x8) {
+                    if (prev_buttons & 0x8)
+                        SDL_SendMouseButton(0, Vita_Window, mouseID, SDL_BUTTON_X1, false);
+                    else
+                        SDL_SendMouseButton(0, Vita_Window, mouseID, SDL_BUTTON_X1, true);
+                }
+                if (changed_buttons & 0x10) {
+                    if (prev_buttons & 0x10)
+                        SDL_SendMouseButton(0, Vita_Window, mouseID, SDL_BUTTON_X2, false);
+                    else
+                        SDL_SendMouseButton(0, Vita_Window, mouseID, SDL_BUTTON_X2, true);
+                }
 
                 prev_buttons = m_reports[i].buttons;
 
                 if (m_reports[i].rel_x || m_reports[i].rel_y) {
                     SDL_SendMouseMotion(0, Vita_Window, mouseID, true, (float)m_reports[i].rel_x, (float)m_reports[i].rel_y);
                 }
+
+                if (m_reports[i].tilt != 0 || m_reports[i].wheel != 0) {
+                    SDL_SendMouseWheel(0, Vita_Window, mouseID, m_reports[i].tilt, m_reports[i].wheel, SDL_MOUSEWHEEL_NORMAL);
+                }
             }
         }
     }