Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer sanitization: Android, overlay, and other enhancements #17308

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

zoltanvb
Copy link
Contributor

Description

Adapt the sanitized pointer handling, discussed at #17196 :

Overlay "driver" specific changes:

  • make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
  • enable pointer offscreen query
  • report -0x8000 for lightgun if pointer is at the edge
  • align lightgun offscreen reporting and button ID conversion with other drivers

Android driver specific changes:

  • make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
  • remove extra "inside" checks, general simplification
  • enable pointer offscreen query
  • report same value for all ports when querying mouse and lightgun
  • fill missing lightgun support, with fixed button map

Udev and X11 driver specific changes:

  • simulate max. 3 touches instead of 1 using different mouse buttons

Wayland driver specific changes:

  • integrate touch input better to the overall handling (enabling overlay usage with mouse)
  • simulate max. 3 touches instead of 1 using different mouse buttons

Tested on Android and the changed Linux desktop environments. The mouse-simulates-multitouch gimmick is probably not very useful for cores, but it does enable easier testing of related functions.

There is one significant difference between mobile platforms (Android and iOS) and other platforms: touches outside the core viewport are:

  • reported on desktop platforms
  • not reported on Android/iOS
  • but are again reported if there is an overlay (which is probably almost always there).
    I did not align this now, as it may be an intentional function.

Also, in libretro.h there is RETRO_DEVICE_ID_POINTER_COUNT since 2019 but support for that is not present everywhere, and it is also not documented (though it should be quite clear). It may be aligned later.

Related Pull Requests

#16343 - in my opinion, the "enable offscreen reporting" lightgun config setting can go away now, since other input drivers will do report -0x8000 anyway. I will send a different PR for that eventually. Even if it needs to stay, menu text should probably be re-worded, since the option does not control whether "offscreen" touches are reported or not, but instead the value that is reported.

Adapt the sanitized pointer handling, discussed at libretro#17196 :

Overlay "driver" specific changes:

- make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
- enable pointer offscreen query
- report -0x8000 for lightgun if pointer is at the edge
- align lightgun offscreen reporting and button ID conversion with other drivers

Android driver specific changes:

- make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
- remove extra "inside" checks, general simplification
- enable pointer offscreen reporting
- report same value for all ports when querying mouse and lightgun
- fill missing lightgun support, with fixed button map

Udev and X11 driver specific changes:

- simulate max. 3 touches instead of 1 using different mouse buttons

Wayland driver specific changes:

- integrate touch input better to the overall handling (enabling overlay usage with mouse)
- simulate max. 3 touches instead of 1 using different mouse buttons
@LibretroAdmin LibretroAdmin merged commit fe1575b into libretro:master Dec 29, 2024
27 checks passed
neil4 added a commit to neil4/RetroArch-Lite that referenced this pull request Jan 3, 2025
- Fix the "Allow Off-Screen" setting not working since libretro#17308
- Prevent offscreen shot from disabling the lightgun with some cores
- Fullscreen pointer coordinates no longer needed
@neil4 neil4 mentioned this pull request Jan 3, 2025
LibretroAdmin pushed a commit that referenced this pull request Jan 4, 2025
- Fix the "Allow Off-Screen" setting not working since #17308
- Prevent offscreen shot from disabling the lightgun with some cores
- Fullscreen pointer coordinates no longer needed
cmitu pushed a commit to cmitu/RetroArch that referenced this pull request Jan 7, 2025
- Fix the "Allow Off-Screen" setting not working since libretro#17308
- Prevent offscreen shot from disabling the lightgun with some cores
- Fullscreen pointer coordinates no longer needed
@zoltanvb zoltanvb deleted the pointer_sanitize_overlay branch January 9, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants