Skip to content

feat(systemgesture): implement the recognizer and no-touch event exports - #572

Closed
Phi1ow wants to merge 2 commits into
boykopovar:mainfrom
Phi1ow:implement-system-gesture-recognizers
Closed

Phi1ow wants to merge 2 commits into
boykopovar:mainfrom
Phi1ow:implement-system-gesture-recognizers

Conversation

@Phi1ow

@Phi1ow Phi1ow commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What

Ten libSceSystemGesture exports were throwing stubs. No touch input is fed to the recognizers,
so they report no gestures, following the functions already implemented in this file:

  • sceSystemGestureAppendTouchRecognizer / RemoveTouchRecognizer / ResetTouchRecognizer /
    UpdateTouchRecognizerRectangle -> check the handle and recognizer like
    sceSystemGestureCreateTouchRecognizer.
  • sceSystemGestureResetPrimitiveTouchRecognizer / UpdateAllTouchRecognizer -> check the handle
    like sceSystemGestureUpdateTouchRecognizer.
  • sceSystemGestureGetPrimitiveTouchEventsCount -> 0, like sceSystemGestureGetTouchEventsCount.
  • sceSystemGestureGetPrimitiveTouchEventByIndex -> INDEX_OUT_OF_ARRAY, like
    sceSystemGestureGetTouchEventByIndex.
  • sceSystemGestureGetTouchEvents / GetPrimitiveTouchEvents -> report zero events.

Adds a CMakeLists.txt so the library can carry its guest test.

The three lookup/info exports (GetTouchEventByEventID, GetPrimitiveTouchEventByPrimitiveID,
GetTouchRecognizerInformation) stay stubs: the not-found error for an id that never existed and
the recognizer-information layout aren't known, so I left them throwing rather than guess.

Tested

New test core/libs/tests/GuestSystemGesture.cpp (registered as guest_system_gesture) opens a
gesture context and checks the returns, the zero event counts and the handle/argument errors.

Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11; ctest -R guest_system_gesture
passes. On main the ten functions throw not implemented, so the test aborts without the change.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Progress report (5fc8755 → 633b8f3)

📈 System libraries: 87.43% (+0.35%, +10 implemented functions)

✅ 10 implemented
Library Name
libSceSystemGesture sceSystemGestureAppendTouchRecognizer
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventByIndex
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEvents
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventsCount
libSceSystemGesture sceSystemGestureGetTouchEvents
libSceSystemGesture sceSystemGestureRemoveTouchRecognizer
libSceSystemGesture sceSystemGestureResetPrimitiveTouchRecognizer
libSceSystemGesture sceSystemGestureResetTouchRecognizer
libSceSystemGesture sceSystemGestureUpdateAllTouchRecognizer
libSceSystemGesture sceSystemGestureUpdateTouchRecognizerRectangle

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks. All ten names recompute to their NIDs, and the bodies follow the functions already in the file: the handle and recognizer checks of sceSystemGestureCreateTouchRecognizer, the zero count of sceSystemGestureGetTouchEventsCount and the INDEX_OUT_OF_ARRAY of sceSystemGestureGetTouchEventByIndex. Leaving the three lookup and information exports throwing is the right call.

One thing before it goes in. The "no touch input is emulated" premise (it's also the code comment at the top of the file) isn't true on main any more: PadState.cpp reports touchpad contacts from the controller and from the keyboard bindings (touch_data_touch_num and the two touch points). So with this PR a title that builds its touch UI on SystemGesture recognizers gets a recognizer that never reports a tap or a drag while the pad shows a finger on it. That changes input, not only UI, so CONTRIBUTING's silent-stub exception doesn't cover it on its own (the same point I made on #565).

Recognizing gestures from the pad data would be a much bigger change, so I'm not asking for it here. Could you add libSceSystemGesture to the "Silent stubs" list in docs/dev/TechnicalDebt.md, saying that recognizers accept every call but never report touch or primitive events, although libScePad reports touchpad contacts? That covers the existing update and count functions too.

Optional: sceSystemGestureGetTouchEvents and sceSystemGestureGetPrimitiveTouchEvents return OK for a null number_of_event, and sceSystemGestureGetPrimitiveTouchEventByIndex doesn't check the handle (the same as sceSystemGestureGetTouchEventByIndex on main). Neither is wrong as far as I know, just noting it in case you have the real error order.

guest_system_gesture passes here and throws on main. PPSA21564 doesn't import any SystemGesture function.

Phi1ow added 2 commits October 6, 2026 23:51
Ten libSceSystemGesture exports were throwing stubs. No touch input is fed to the recognizers,
so they report no gestures, following the functions already implemented in this file:

- sceSystemGestureAppendTouchRecognizer / RemoveTouchRecognizer / ResetTouchRecognizer /
  UpdateTouchRecognizerRectangle -> check the handle and recognizer like
  sceSystemGestureCreateTouchRecognizer
- sceSystemGestureResetPrimitiveTouchRecognizer / UpdateAllTouchRecognizer -> check the handle
  like sceSystemGestureUpdateTouchRecognizer
- sceSystemGestureGetPrimitiveTouchEventsCount -> 0, like sceSystemGestureGetTouchEventsCount
- sceSystemGestureGetPrimitiveTouchEventByIndex -> INDEX_OUT_OF_ARRAY, like
  sceSystemGestureGetTouchEventByIndex
- sceSystemGestureGetTouchEvents / GetPrimitiveTouchEvents -> report zero events

Adds a CMakeLists.txt so the library can carry its guest test. New test
core/libs/tests/GuestSystemGesture.cpp opens a gesture context and checks the returns and the
handle errors.

The three lookup/info exports (GetTouchEventByEventID, GetPrimitiveTouchEventByPrimitiveID,
GetTouchRecognizerInformation) stay stubs: the not-found error for an id that never existed and
the recognizer-information layout aren't known, so I left them throwing rather than guess.
Per review: libScePad now reports touchpad contacts, so the recognizers accepting every call
while never reporting a touch or primitive event is a silent stub. Adds a "Silent stubs" line
for libSceSystemGesture to docs/dev/TechnicalDebt.md and removes the file's "no touch input is
emulated" comment, which is no longer true.
@Phi1ow
Phi1ow force-pushed the implement-system-gesture-recognizers branch from 015bd8b to 633b8f3 Compare October 6, 2026 21:51
@Phi1ow

Phi1ow commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Done. Added a libSceSystemGesture "Silent stubs" line saying the recognizers accept every call but never report a touch or primitive event although libScePad reports touchpad contacts, and removed the file's outdated "no touch input is emulated" comment. On the optional points: the null number_of_event and the missing handle check match sceSystemGestureGetTouchEventByIndex / GetTouchEvents already on main, so I kept them the same; happy to tighten if you have the real error order. guest_system_gesture passes here.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for adding the silent-stubs line and removing the outdated comment. Keeping the number_of_event and handle checks the same as the functions already on main is fine.

One question remains, which the owner has since asked us to check on every PR: which title calls these? A silent stub is allowed only when it unblocks a title, and if a title needs only some of the ten, the PR should keep just those. If you know one, please name it with the log line where it stops on main.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Following up on the question above: do you know which title calls these SystemGesture exports? The code itself looks fine now; the title (with the log line where it stops on main), and which of the ten it needs, is the last thing needed before it can be merged.

If no title needs them yet, we'd rather close it for now and reopen it once one does.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on oneandonlydean's open question (asked twice, still unanswered):

  • Which title calls these SystemGesture exports, and at which log line does it stop on main? Without one this is a silent stub that unblocks nothing (CONTRIBUTING). I also checked a first-party title dump: it doesn't import libSceSystemGesture, so there's no static evidence either. If a title needs only some of the ten, keep just those.
  • docs/dev/TechnicalDebt.md:31: the new line is the last one in "Silent stubs", where every PR appends and #910 already touches the same spot. Move it a few lines away from the end of the section.

If no title needs them yet, we'll close this for now; it can be reopened once one does.

@gjonn

gjonn commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

A title that needs this: PPSA06320 (Ape Escape, PS1HD emulator 1.7.17772), relinked for Windows.

It imports 10 libSceSystemGesture functions. Three of them are in this PR: sceSystemGestureAppendTouchRecognizer, sceSystemGestureRemoveTouchRecognizer and sceSystemGestureUpdateAllTouchRecognizer. The other seven (Open, Close, CreateTouchRecognizer, GetTouchEventByIndex, GetTouchEventsCount, InitializePrimitiveTouchRecognizer, UpdatePrimitiveTouchRecognizer) are already on main.

Without this PR it stops right after save data init (with #1247 and #1188 merged locally to get that far):

[SAVEDATA:native] mount3 user=268435456 dir=AppSmall mode=0x1 blocks=49 -> 0x809f0008 point= status=0
[libc] unhandled exception 'St13runtime_error' thrown from 00007ffbfd650576
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceSystemGestureAppendTouchRecognizer not implemented

With this PR merged locally, it gets past that, sets up the pad and submits its first GPU frame. The next stop is an unrelated AGC WRITE_DATA packet. AppendTouchRecognizer is the one confirmed called. RemoveTouchRecognizer and UpdateAllTouchRecognizer are imported, but the title doesn't get far enough yet to confirm it calls them.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing for now: the points from 2026-10-07 are still open. If you pick it back up, please comment here and it can be reopened.

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

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants