From a7d26910d7798d1c4816a6c763271cac31dbd1f0 Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Fri, 16 Mar 2018 13:15:10 -0500 Subject: [PATCH] Vita: decrease default joystick sensitivity (was too fast) --- src/psp2/psp2_input.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/psp2/psp2_input.c b/src/psp2/psp2_input.c index ac149a64f..fe7bc125a 100644 --- a/src/psp2/psp2_input.c +++ b/src/psp2/psp2_input.c @@ -116,26 +116,33 @@ void PSP2_HandleJoysticks() { int analogX = SDL_JoystickGetAxis(vitaJoy0, 0); int analogY = SDL_JoystickGetAxis(vitaJoy0, 1); - rescaleAnalog( &analogX, &analogY, 1000); + rescaleAnalog( &analogX, &analogY, 3000); hiresDX += analogX; hiresDY += analogY; - if (insideMenu) { - SDL_WarpMouse(lastmx + hiresDX / 2048, lastmy + hiresDY / 2048); - } - else - { - SDL_Event event; - event.type = SDL_MOUSEMOTION; - event.motion.x = lastmx + hiresDX / 2048; - event.motion.y = lastmy + hiresDY / 2048; - event.motion.xrel = hiresDX / 2048; - event.motion.yrel = hiresDY / 2048; - SDL_PushEvent(&event); - } + const int slowdown = 4096; + + if (hiresDX != 0 || hiresDY != 0) { + int xrel = hiresDX / slowdown; + int yrel = hiresDY / slowdown; - hiresDX = hiresDX - ((hiresDX / 2048) * 2048); - hiresDY = hiresDY - ((hiresDY / 2048) * 2048); + if (insideMenu) { + SDL_WarpMouse(lastmx + xrel, lastmy + yrel); + } + else + { + SDL_Event event; + event.type = SDL_MOUSEMOTION; + event.motion.x = lastmx + xrel; + event.motion.y = lastmy + yrel; + event.motion.xrel = xrel; + event.motion.yrel = yrel; + SDL_PushEvent(&event); + } + + hiresDX %= slowdown; + hiresDY %= slowdown; + } }