From f73ca8318657c11c66a04b34324c396c798b195f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 2 Feb 2025 08:53:03 -0800
Subject: [PATCH] Fixed the mouse wheel in Torchlight
---
src/sdl2_compat.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index f132e6c..69df06a 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -1440,8 +1440,10 @@ Event3to2(const SDL_Event *event3, SDL2_Event *event2)
}
if (UseSDL2PrereleaseEvents) {
SDL2PRERELEASE_MouseWheelEvent *wheel = (SDL2PRERELEASE_MouseWheelEvent *)&event2->wheel;
- wheel->x = (Sint32)event3->wheel.x;
- wheel->y = (Sint32)event3->wheel.y;
+ // Torchlight appears to use the wrong axis and expect the values in Windows units
+ // This is certainly a bug in the game, but we're just trying to make it work, so give it what it expects.
+ wheel->x = (Sint32)(event3->wheel.y * 120);
+ wheel->y = (Sint32)(event3->wheel.x * 120);
} else {
SDL2_MouseWheelEvent *wheel = &event2->wheel;
wheel->x = (Sint32)event3->wheel.x;