Skip to content

feat(libSceSystemGesture): report primitive touch events from the pad reports - #7574

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
bl4nkTHEBUNKER:feat/system-gesture-primitive-touch
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
bl4nkTHEBUNKER:feat/system-gesture-primitive-touch

Conversation

@bl4nkTHEBUNKER

Copy link
Copy Markdown

What

sceSystemGestureUpdatePrimitiveTouchRecognizer now reads the pad reports the title passes in and tracks every touch as a primitive, so the primitive event queries report real events instead of reporting that no touch input exists.

  • The second argument is SceSystemGestureTouchPadData, {int32 padHandle, int32 reportNumber, const ScePadData* padDataBuffer, 8 reserved bytes}, as fpPS4 records it; its SceSystemGestureTouchRecognizer (361 qwords) and SceSystemGestureRectangle (4 floats and 8 reserved bytes) are the layouts main already uses.
  • The touch states 0 inactive, 1 begin, 2 active, 3 end come from the Vita header in RPCS3, whose primitive event layout is the same shape as the one in SceTypes.hpp. No public source states the PS5 values.
  • A primitive keeps the touch id the pad reports; positions are the pad's touchpad coordinates unscaled; delta_time and elapsed_time come from the reports' own timestamp, so a title that replays its own reports gets the same events. An ended touch stays readable as one end event until the next sampled report drops it.
  • GetPrimitiveTouchEvents, GetPrimitiveTouchEventsCount and GetPrimitiveTouchEventByIndex report the tracked events, and GetPrimitiveTouchEventByPrimitiveID no longer throws for a tracked touch. It still throws for an id no touch has, because the console's error there is not known.
  • The recognizer side (tap, drag, hold, pinch, rotation, flick) is unchanged and still reports no gesture event; that is a separate topic, not folded in here.

Everything unverified against console behaviour is in docs/dev/debt/libSceSystemGesture.md: the unchecked padHandle, the coordinate units, the is_updated rule, the result for a null pInputData or padDataBuffer, a too small event buffer, and the unknown id.

Tested

Windows 11, GCC 16.2 (MSYS2 UCRT64), core/libs/tests/GuestSystemGesture.cpp extended and run against the library sources with -Wall -Wextra (clean, test passes). The new assertions cover: begin on a first report; active with the delta vector, delta time and elapsed time on a move; is_updated 0 when a held touch does not move; one end event after the release and its drop on the next report; two touches at once; lookup by primitive id, including the throw for an unknown id; an event buffer shorter than the event count; several reports in one update; and reset and finalize clearing the events. The existing no-input assertions still hold. No title tested: no touch-driven title was run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

… reports

sceSystemGestureUpdatePrimitiveTouchRecognizer reads the pad reports the title
passes in and tracks every touch as a primitive, so the primitive event queries
report begin, active and end events with their pressed and current positions,
delta vector, delta time and elapsed time instead of reporting that no touch
input exists. sceSystemGestureGetPrimitiveTouchEventByPrimitiveID no longer
throws for a tracked touch.
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5965 core/libs/SceTypes.hpp
PR 6044 core/libs/tests/GuestSystemGesture.cpp
PR 6977 core/libs/SceTypes.hpp
PR 7081 core/libs/SceTypes.hpp
PR 7412 core/libs/SceTypes.hpp
PR 8106 core/libs/prx/libSceSystemGesture/Export.cpp
docs/dev/debt/libSceSystemGesture.md

@bl4nkTHEBUNKER

Copy link
Copy Markdown
Author

Overlap checked, including the three shared files the bot could not compare.

#6447 is the one real overlap, on sceSystemGestureGetPrimitiveTouchEventByPrimitiveID. It turns the throw into a blanket INDEX_OUT_OF_ARRAY; this pull request answers the export from the primitive events it tracks and keeps a throw only for an id that no tracked touch has, so the two cannot both apply as written. Neither needs the other, so Depends on stays none. I am happy either way: if #6447 goes first I rebase this one onto it, and the hunk disappears since this pull request rewrites the same function. Its second gesture hunk, sceSystemGestureGetTouchEventByEventID, does not overlap, because this pull request leaves that export untouched.

The other three do not overlap:

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@github-actions

Copy link
Copy Markdown

Progress report (e5f18ea → 15af4e3)

📈 System libraries: 90.26% (+0.02%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventByPrimitiveID

@adriadam10
adriadam10 merged commit 8038a42 into boykopovar:main Oct 19, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the PadData fields used, the new test cases (each fails on main, where the events were never reported), locking and the TechnicalDebt entry; the console-side unknowns are listed there. #6447 is closed, so the overlap is gone; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants