From 1fe4c7ea6a1bbe9301ece1ddc2de9be7d195ec47 Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Sun, 15 Jul 2018 00:58:20 -0500 Subject: [PATCH] Improve response to slow finger motion --- CMakeLists.txt | 1 + README.MD | 4 ++++ src/psp2/psp2_touch.c | 43 +++++++++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e3f664ad..21d19309f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,6 +382,7 @@ set(LDFLAGS freetype ssl crypto + mikmod ) if (BUILD_DEBUG) diff --git a/README.MD b/README.MD index 493480544..87048a809 100644 --- a/README.MD +++ b/README.MD @@ -95,6 +95,10 @@ make enigma.vpk -j10 Changelog ===== +1.10 + +- Improve response to slow finger motion + 1.09 - Improve controls with bluetooth mouse by re-compiling with latest SDL-Vita diff --git a/src/psp2/psp2_touch.c b/src/psp2/psp2_touch.c index 0aaf1ce25..9e1696321 100644 --- a/src/psp2/psp2_touch.c +++ b/src/psp2/psp2_touch.c @@ -26,6 +26,8 @@ int mainMenu_touchControls = 2; // always enable rear_touch for now extern int lastmx; extern int lastmy; extern int insideMenu; +static int hiresdx = 0; +static int hiresdy = 0; enum { MAX_NUM_FINGERS = 3, // number of fingers to track per panel @@ -346,14 +348,6 @@ void psp2ProcessFingerMotion(TouchEvent *event) { } if (numFingersDown >= 1) { - int x = lastmx; - int y = lastmy; - int xrel = (int)(event->tfinger.dx * 960.0); - int yrel = (int)(event->tfinger.dy * 544.0); - - x = lastmx + (int)(event->tfinger.dx * 960.0); - y = lastmy + (int)(event->tfinger.dy * 544.0); - // If we are starting a multi-finger drag, start holding down the mouse button if (numFingersDown >= 2) { if (!_multiFingerDragging[port]) { @@ -404,16 +398,29 @@ void psp2ProcessFingerMotion(TouchEvent *event) { } } if (updatePointer) { - if (insideMenu) { - SDL_WarpMouse(x, y); - } else { - SDL_Event ev0; - ev0.type = SDL_MOUSEMOTION; - ev0.motion.x = x; - ev0.motion.y = y; - ev0.motion.xrel = xrel; - ev0.motion.yrel = yrel; - SDL_PushEvent(&ev0); + const int slowdown = 16; + hiresdx += (int)(event->tfinger.dx * 960.0 * slowdown); + hiresdy += (int)(event->tfinger.dy * 544.0 * slowdown); + int xrel = hiresdx / slowdown; + int yrel = hiresdy / slowdown; + + if (xrel || yrel) { + int x = lastmx + xrel; + int y = lastmy + yrel; + if (insideMenu) { + SDL_WarpMouse(x, y); + } else { + SDL_Event ev0; + ev0.type = SDL_MOUSEMOTION; + ev0.motion.x = x; + ev0.motion.y = y; + ev0.motion.xrel = xrel; + ev0.motion.yrel = yrel; + SDL_PushEvent(&ev0); + } + + hiresdx %= slowdown; + hiresdy %= slowdown; } } }