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

Closed
Phi1ow wants to merge 2 commits from upstream-pr/572 into main
Phi1ow commented 2026-10-04 22:45:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T22:45:29Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4738193303 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-04T22:45:29Z. --- ### 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-04 22:46:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T22:46:58Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985286130 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-5985286130). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T22:46:58Z. --- <!-- progress-report --> ### Progress report (5fc8755 → 633b8f3) 📈 **System libraries**: 87.43% (+0.35%, +10 implemented functions) <details> <summary>✅ 10 implemented</summary> | Library | Name | | - | - | | libSceSystemGesture | `sceSystemGestureAppendTouchRecognizer` | | libSceSystemGesture | `sceSystemGestureGetPrimitiveTouchEventByIndex` | | libSceSystemGesture | `sceSystemGestureGetPrimitiveTouchEvents` | | libSceSystemGesture | `sceSystemGestureGetPrimitiveTouchEventsCount` | | libSceSystemGesture | `sceSystemGestureGetTouchEvents` | | libSceSystemGesture | `sceSystemGestureRemoveTouchRecognizer` | | libSceSystemGesture | `sceSystemGestureResetPrimitiveTouchRecognizer` | | libSceSystemGesture | `sceSystemGestureResetTouchRecognizer` | | libSceSystemGesture | `sceSystemGestureUpdateAllTouchRecognizer` | | libSceSystemGesture | `sceSystemGestureUpdateTouchRecognizerRectangle` | </details>
oneandonlydean commented 2026-10-04 23:44:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:44:01Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985702607 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-5985702607). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T23:44:01Z. --- 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 commented 2026-10-06 21:52:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-06T21:52:22Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6026127364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-6026127364). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-06T21:52:22Z. --- 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 commented 2026-10-06 22:40:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T22:40:46Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6026767588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-6026767588). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T22:40:46Z. --- 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 commented 2026-10-07 01:20:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-07T01:20:42Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6028820389 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-6028820389). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-07T01:20:42Z. --- 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 commented 2026-10-07 15:48:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T15:48:25Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5444784540 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#pullrequestreview-5444784540). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T15:48:25Z. **Review:** CHANGES_REQUESTED --- 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 commented 2026-10-07 19:40:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-07T19:40:45Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6045460525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-6045460525). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-07T19:40:45Z. --- 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 commented 2026-10-10 18:08:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T18:08:19Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100604146 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/572#issuecomment-6100604146). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T18:08:19Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!572
No description provided.