From 28d9ee70d522cdd710cd05a5dedac690db97ea2e Mon Sep 17 00:00:00 2001 From: Helloyunho Date: Sat, 5 Jul 2025 20:54:57 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20fix:=20forgot=20to=20enable=20ga?= =?UTF-8?q?mepad,=20and=20ignore=20small=20axis=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ISLE/isleapp.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index aa13a56e..b81e9bba 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -276,7 +276,7 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv) SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0"); SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); - if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) { + if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD)) { char buffer[256]; SDL_snprintf( buffer, @@ -500,14 +500,19 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) break; } case SDL_EVENT_GAMEPAD_AXIS_MOTION: { + MxS16 axisValue = 0; + if (event->gaxis.value < -8000 || event->gaxis.value > 8000) { + // Ignore small axis values + axisValue = event->gaxis.value; + } if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHTX) { - g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity(); + g_lastJoystickMouseX = ((float) axisValue) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity(); } else if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHTY) { - g_lastJoystickMouseY = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity(); + g_lastJoystickMouseY = ((float) axisValue) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity(); } else if (event->gaxis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) { - if (event->gaxis.value != 0) { + if (axisValue != 0) { g_mousedown = TRUE; if (InputManager()) {