Skip to content

Commit 4703eef

Browse files
f4mrfauxclaude
andcommitted
fix(android): Enable S-Pen hover cursor movement for RETRO_DEVICE_POINTER games
CRITICAL BUG FIX: S-Pen hover was only updating relative mouse coordinates but not absolute pointer coordinates, causing games like Clock Tower to not recognize hover cursor movement despite RetroArch setting being enabled. Problem Analysis: - Pure hover only called android_mouse_calculate_deltas() for mouse cursor - Barrel+hover worked because side button path updates pointer coordinates - Games using RETRO_DEVICE_POINTER need absolute coordinates, not just mouse deltas Solution: - Add missing video_driver_translate_coord_viewport_*() calls to hover path - Maintain pointer_count to ensure RETRO_DEVICE_POINTER reports valid coordinates - Now both RetroArch menu cursor AND libretro pointer games work with hover NOTE: Requires hardware testing to confirm fix on Galaxy Z Fold 5 with S-Pen 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent fbe7e12 commit 4703eef

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

input/drivers/android_input.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,9 +905,32 @@ static INLINE void android_input_poll_event_type_motion(
905905
/* Optional: Update cursor position for hover if settings allow */
906906
if (settings->bools.input_stylus_hover_moves_pointer && action == AMOTION_EVENT_ACTION_HOVER_MOVE)
907907
{
908+
struct video_viewport vp = {0};
909+
910+
/* Update mouse deltas for mouse-like cursor behavior */
908911
android_mouse_calculate_deltas(android, event, motion_ptr, source);
912+
913+
/* Also update absolute pointer coordinates for RETRO_DEVICE_POINTER */
914+
video_driver_translate_coord_viewport_confined_wrap(
915+
&vp, x, y,
916+
&android->pointer[motion_ptr].confined_x,
917+
&android->pointer[motion_ptr].confined_y,
918+
&android->pointer[motion_ptr].full_x,
919+
&android->pointer[motion_ptr].full_y);
920+
921+
video_driver_translate_coord_viewport_wrap(
922+
&vp, x, y,
923+
&android->pointer[motion_ptr].x,
924+
&android->pointer[motion_ptr].y,
925+
&android->pointer[motion_ptr].full_x,
926+
&android->pointer[motion_ptr].full_y);
927+
928+
/* Ensure pointer_count covers this motion_ptr */
929+
if (android->pointer_count < (int)motion_ptr + 1)
930+
android->pointer_count = (int)motion_ptr + 1;
931+
909932
#ifdef DEBUG_ANDROID_INPUT
910-
RARCH_LOG("[RA Input] Stylus hover cursor update (user enabled)\n");
933+
RARCH_LOG("[RA Input] Stylus hover cursor update (user enabled) - mouse + pointer coords\n");
911934
#endif
912935
}
913936

0 commit comments

Comments
 (0)