fix(libSceSystemGesture): report no touch events for the primitive and recognizer calls #3174

Merged
adriadam10 merged 3 commits from upstream-pr/3174 into main 2026-10-11 00:22:43 +00:00
adriadam10 commented 2026-10-11 00:04:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:04:38Z.


What

Carries @xXPBSXx's branch from #3144 (fix/systemgesture-no-touch-events, commits kept with their authorship). Intake is paused for new contributors, and the issue asks a maintainer to carry it.

Ten libSceSystemGesture exports threw on main. They now follow the no-touch model the file already uses: recognizers exist but never report an event, and handle and pointer arguments are checked.

  • GetPrimitiveTouchEvents and GetTouchEvents report 0 events and leave the buffer untouched.
  • GetPrimitiveTouchEventsCount returns 0.
  • GetPrimitiveTouchEventByIndex returns INDEX_OUT_OF_ARRAY, like GetTouchEventByIndex on main.
  • Append, Remove, Reset and UpdateAll succeed for a valid handle and recognizer, as do ResetPrimitiveTouchRecognizer and UpdateTouchRecognizerRectangle.
  • UpdateTouchRecognizer now returns INVALID_ARGUMENT for a null recognizer, as KytyPS5 does.
  • GetTouchEventByEventID, GetPrimitiveTouchEventByPrimitiveID and GetTouchRecognizerInformation keep throwing. Their not-found code and the information layout aren't settled.

Titles that stop on these on main:

  • PPSA06320 (Ape Escape, PS1HD emulator) stops on sceSystemGestureAppendTouchRecognizer not implemented right after save data init (log in #572, @gjonn). It also imports Remove and UpdateAll.
  • RE4 (PPSA07411) on Windows stops on these calls (#3144, @xXPBSXx).

Behaviour follows KytyPS5 (libSystemService.cpp, SystemGesture), except for the error codes. Those stay at the 0x80D1 values this file already uses on main, which @oneandonlydean OK'd on #572. KytyPS5 uses 0x8089 (INVALID_ARGUMENT 0x80890001, INVALID_HANDLE 0x80890006). TechnicalDebt now lists the disagreement, and the no-touch line moved from "Functional" to "Silent stubs".

My commit adds the handle and null checks of Remove/Reset/Update/UpdateTouchRecognizerRectangle to the test.

Tested

Linux (CachyOS), GCC 16, Release.

  • guest_system_gesture passes.
  • On main the first new call throws.
  • Negative checks: each of 21 mutations makes the test fail. Each one removes one handle check, null check or count write.
  • tools/check_conventions.py passes.

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:4815353856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3174). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:04:38Z. --- ### What Carries @xXPBSXx's branch from #3144 (`fix/systemgesture-no-touch-events`, commits kept with their authorship). Intake is paused for new contributors, and the issue asks a maintainer to carry it. Ten `libSceSystemGesture` exports threw on `main`. They now follow the no-touch model the file already uses: recognizers exist but never report an event, and handle and pointer arguments are checked. - `GetPrimitiveTouchEvents` and `GetTouchEvents` report 0 events and leave the buffer untouched. - `GetPrimitiveTouchEventsCount` returns 0. - `GetPrimitiveTouchEventByIndex` returns `INDEX_OUT_OF_ARRAY`, like `GetTouchEventByIndex` on `main`. - `Append`, `Remove`, `Reset` and `UpdateAll` succeed for a valid handle and recognizer, as do `ResetPrimitiveTouchRecognizer` and `UpdateTouchRecognizerRectangle`. - `UpdateTouchRecognizer` now returns `INVALID_ARGUMENT` for a null recognizer, as KytyPS5 does. - `GetTouchEventByEventID`, `GetPrimitiveTouchEventByPrimitiveID` and `GetTouchRecognizerInformation` keep throwing. Their not-found code and the information layout aren't settled. **Titles that stop on these on `main`:** - PPSA06320 (Ape Escape, PS1HD emulator) stops on `sceSystemGestureAppendTouchRecognizer not implemented` right after save data init (log in #572, @gjonn). It also imports `Remove` and `UpdateAll`. - RE4 (PPSA07411) on Windows stops on these calls (#3144, @xXPBSXx). Behaviour follows KytyPS5 (`libSystemService.cpp`, `SystemGesture`), except for the error codes. Those stay at the 0x80D1 values this file already uses on `main`, which @oneandonlydean OK'd on #572. KytyPS5 uses 0x8089 (`INVALID_ARGUMENT` 0x80890001, `INVALID_HANDLE` 0x80890006). TechnicalDebt now lists the disagreement, and the no-touch line moved from "Functional" to "Silent stubs". My commit adds the handle and null checks of `Remove`/`Reset`/`Update`/`UpdateTouchRecognizerRectangle` to the test. ### Tested Linux (CachyOS), GCC 16, Release. - `guest_system_gesture` passes. - On `main` the first new call throws. - Negative checks: each of 21 mutations makes the test fail. Each one removes one handle check, null check or count write. - `tools/check_conventions.py` passes. ### 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-11 00:05:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T00:05:02Z.


Progress report (942a174 → 894ef6d)

📈 System libraries: 85.93% (+0.31%, +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:6103579290 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3174#issuecomment-6103579290). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T00:05:02Z. --- <!-- progress-report --> ### Progress report (942a174 → 894ef6d) 📈 **System libraries**: 85.93% (+0.31%, +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>
Dextroid17 commented 2026-10-11 00:22:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T00:22:02Z.

Review: COMMENTED


The shape of this one is what makes it reviewable: ten exports, each given the answer the file's existing no-touch model gives, and the three that are not settled named as still throwing with the reason they are not. Leaving GetTouchEventByEventID, GetPrimitiveTouchEventByPrimitiveID and GetTouchRecognizerInformation on NotImplemented because their not-found code and information layout are not established is the right call, and saying so is what stops it reading as an oversight.

The negative test is the strongest part, and it is worth saying why. Every handle check, null check and count write in the test has a mutation that removes it and a run that then fails, which demonstrates that a case exists behind each one — the thing a test for a table of behaviours otherwise never establishes. Those runs and the Linux/GCC 16 pass are the author's measurements; what a reviewer can reproduce locally is that the first new call throws on main.

The INDEX_OUT_OF_ARRAY choice is the one worth naming. Having GetPrimitiveTouchEventByIndex return what GetTouchEventByIndex already returns on main, rather than something that seemed more correct, keeps the two recognizer kinds consistent — and INVALID_ARGUMENT for a null recognizer is what KytyPS5 returns for the same call, which is checkable rather than a matter of taste. Both are the right kind of default.

The three that still throw are left throwing deliberately. They keep NotImplemented because their not-found code and information layout are not settled, and throwing is the conventions-compliant state for an unimplemented path — so they belong with the throwing paths, not with the silent stubs that need a debt entry. Nothing further needed.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481317600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3174#pullrequestreview-5481317600). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T00:22:02Z. **Review:** COMMENTED --- The shape of this one is what makes it reviewable: ten exports, each given the answer the file's existing no-touch model gives, and the three that are *not* settled named as still throwing with the reason they are not. Leaving `GetTouchEventByEventID`, `GetPrimitiveTouchEventByPrimitiveID` and `GetTouchRecognizerInformation` on `NotImplemented` because their not-found code and information layout are not established is the right call, and saying so is what stops it reading as an oversight. **The negative test is the strongest part, and it is worth saying why.** Every handle check, null check and count write in the test has a mutation that removes it and a run that then fails, which demonstrates that a case exists behind each one — the thing a test for a table of behaviours otherwise never establishes. Those runs and the Linux/GCC 16 pass are the author's measurements; what a reviewer can reproduce locally is that the first new call throws on `main`. **The `INDEX_OUT_OF_ARRAY` choice is the one worth naming.** Having `GetPrimitiveTouchEventByIndex` return what `GetTouchEventByIndex` already returns on `main`, rather than something that seemed more correct, keeps the two recognizer kinds consistent — and `INVALID_ARGUMENT` for a null recognizer is what KytyPS5 returns for the same call, which is checkable rather than a matter of taste. Both are the right kind of default. **The three that still throw are left throwing deliberately.** They keep `NotImplemented` because their not-found code and information layout are not settled, and throwing is the conventions-compliant state for an unimplemented path — so they belong with the throwing paths, not with the silent stubs that need a debt entry. Nothing further needed. Written with AI assistance.
adriadam10 commented 2026-10-11 00:23:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:23:07Z.


Merged with Linux CI red on three AGC tests (agc_unit_shadow, agc_driver_flat_apertures, agc_driver_image_packed16_load). The main push build at 942a174e0 (run 38097151664) fails the same three, and nothing in this PR touches AGC. Windows passed, and so did guest_system_gesture on both.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103717318 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3174#issuecomment-6103717318). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:23:07Z. --- Merged with Linux CI red on three AGC tests (`agc_unit_shadow`, `agc_driver_flat_apertures`, `agc_driver_image_packed16_load`). The main push build at 942a174e0 (run 38097151664) fails the same three, and nothing in this PR touches AGC. Windows passed, and so did `guest_system_gesture` on both.
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!3174
No description provided.