Commit 347659e8cf23648d0103a6e08343c12a41b46831

Cameron Cawley 2022-05-25T22:07:12

riscos: Ensure that last_mouse_buttons is initialised correctly

diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c
index b0a0d75..56fe398 100644
--- a/src/video/riscos/SDL_riscosevents.c
+++ b/src/video/riscos/SDL_riscosevents.c
@@ -143,6 +143,7 @@ int
 RISCOS_InitEvents(_THIS)
 {
     SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
+    _kernel_swi_regs regs;
     int i, status;
 
     for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++)
@@ -153,6 +154,9 @@ RISCOS_InitEvents(_THIS)
     SDL_ToggleModState(KMOD_CAPS,   (status & (1 << 4)) == 0);
     SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) != 0);
 
+    _kernel_swi(OS_Mouse, &regs, &regs);
+    driverdata->last_mouse_buttons = regs.r[2];
+
     /* Disable escape. */
     _kernel_osbyte(229, 1, 0);