window: reset held input instead of aborting on a gamepad remap (GTA V) #2396

Open
github-bot wants to merge 2 commits from github-bot/gh-2396 into main AGit
Owner

@⁠oguzhanozfe on GitHub · 2026-11-18 22:39 UTC · original
oguzhanozfe:fix/gamepad-remap-no-abort → main · +27 −1 · 3 files · 2 commits · open

Summary

Fixes the emulator exiting while playing Grand Theft Auto V (PPSA04263) when SDL reports that a connected gamepad was remapped.

Problem

SDL_EVENT_GAMEPAD_REMAPPED reaches GameEventController with remapped set. The handler starts with EXIT_NOT_IMPLEMENTED(f.remapped), so the event terminates the emulator. It still does on current main (window.cpp:320).

Change

The remap event no longer aborts. A new mapping only changes how SDL translates the device's raw inputs; the buttons and axes the emulator reads stay logical. SDL sends no button-up or neutral-axis events for the old mapping, so Controller::ResetInputState() clears the held input of every player, and no button or axis stays stuck.

This is based on TheCruZ's closed #1227. That PR reset only player 1's active controller (GetActiveControllerId() reads g_players[0]). main now supports up to four players, so the reset covers all of them. A remap is rare, so resetting every player costs nothing noticeable.

Testing

Windows 11, Ryzen 9 5950X, RTX 3090, clang-cl (LLVM 23), Release.

  • kyty_emulator builds.
  • controller_settings_tests and host_input_tests pass.
  • No unit test covers this. GameEventController is a static handler inside the SDL window loop.
  • TheCruZ played GTA V with the original change in his fork (#1227): the gamepad kept working and the emulator no longer exited on the remap.

AI usage

AI (Claude Opus 5.5) was used to port the change, check it against the multi-player controller code on main, and draft this description. The original fix is TheCruZ's (#1227), credited with Co-authored-by.

🤖 Generated with Claude Code

**@⁠oguzhanozfe** on GitHub · 2026-11-18 22:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2396) `oguzhanozfe:fix/gamepad-remap-no-abort` → `main` · +27 −1 · 3 files · 2 commits · open ## Summary Fixes the emulator exiting while playing **Grand Theft Auto V** (PPSA04263) when SDL reports that a connected gamepad was remapped. ## Problem `SDL_EVENT_GAMEPAD_REMAPPED` reaches `GameEventController` with `remapped` set. The handler starts with `EXIT_NOT_IMPLEMENTED(f.remapped)`, so the event terminates the emulator. It still does on current `main` (`window.cpp:320`). ## Change The remap event no longer aborts. A new mapping only changes how SDL translates the device's raw inputs; the buttons and axes the emulator reads stay logical. SDL sends no button-up or neutral-axis events for the old mapping, so `Controller::ResetInputState()` clears the held input of every player, and no button or axis stays stuck. This is based on TheCruZ's closed #1227. That PR reset only player 1's active controller (`GetActiveControllerId()` reads `g_players[0]`). `main` now supports up to four players, so the reset covers all of them. A remap is rare, so resetting every player costs nothing noticeable. ## Testing Windows 11, Ryzen 9 5950X, RTX 3090, clang-cl (LLVM 23), Release. - `kyty_emulator` builds. - `controller_settings_tests` and `host_input_tests` pass. - No unit test covers this. `GameEventController` is a static handler inside the SDL window loop. - TheCruZ played GTA V with the original change in his fork (#1227): the gamepad kept working and the emulator no longer exited on the remap. ## AI usage AI (Claude Opus 5.5) was used to port the change, check it against the multi-player controller code on `main`, and draft this description. The original fix is TheCruZ's (#1227), credited with `Co-authored-by`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Grand Theft Auto V (PPSA04263) exits when SDL reports that a connected
gamepad was remapped: SDL_EVENT_GAMEPAD_REMAPPED reaches
GameEventController with `remapped` set, and the handler began with
EXIT_NOT_IMPLEMENTED(f.remapped).

A new mapping only changes how SDL translates the device's raw inputs;
the buttons and axes the emulator reads stay logical. SDL sends no
release or neutral-axis events for the old mapping, so reset the input
state of every player and keep running.

Based on TheCruZ's closed #1227, which reset only player 1's active
controller; main now supports up to four players.

Co-authored-by: TheCruZ <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review on #2396: Controller::ResetInputState() cannot reach the
gamepad touchpad state in hostInput.cpp. If Cross was held for drawing
when the remap arrived, `drawing` stayed true and PollGamepadTouchPad
kept sending a touch-down every poll; cached stick values could also
keep the cursor drifting.

HostInputResetGamepadTouchPad releases the contact at its position and
re-centres the cached stick values, keeping the touchpad mode and its
controller selected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:19:35 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-18 22:43 UTC · original · edited 2026-11-18 22:54 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When GameEventController receives a gamepad remapping event, it resets the remapped gamepad’s active touchpad input and controller input state for every player, then returns. The touchpad reset preserves touchpad mode, clears drawing, centers the stored stick axes, updates the visual-state revision, and releases the touch. This replaces the previous not-implemented failure for remapping events.

Suggested reviewers: nmzik, pipe530

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 9d1ff

A gamepad remap during GTA V no longer exits the emulator. It now clears held input, including a held touchpad contact. No concrete merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a gamepad remap no longer aborts, and held input is reset instead. It matches the changeset, which replaces the EXIT_NOT_IMPLEMENTED path in GameEventController with a…
Description check Passed The description states the problem, the fix, the reasoning for resetting all players, and the testing done. It relates directly to the changeset, which resets controller input and touchpad state on ga…
Linked Issues check Passed The only linked issue, #1227 (window: tolerate remapped gamepads), is closed. Under the assessment rules it supplies background only, so no active directly linked coding requirements apply. For contex…
Out of Scope Changes check Passed The whole-PR changes are limited to the remap branch of GameEventController in window.cpp (+7/-1 per the raw summary), plus a new HostInputResetGamepadTouchPad(int id) in hostInput.cpp and hostInput.h…
Full details: Title check

Explanation

The title names the main change: a gamepad remap no longer aborts, and held input is reset instead. It matches the changeset, which replaces the EXIT_NOT_IMPLEMENTED path in GameEventController with a reset of controller input state. The title is specific, though the '(GTA V)' suffix names the trigger game rather than the code change.

Full details: Description check

Explanation

The description states the problem, the fix, the reasoning for resetting all players, and the testing done. It relates directly to the changeset, which resets controller input and touchpad state on gamepad remap events. It also links the prior closed PR #1227 for context.

Full details: Linked Issues check

Explanation

The only linked issue, #1227 (window: tolerate remapped gamepads), is closed. Under the assessment rules it supplies background only, so no active directly linked coding requirements apply. For context, the reviewed head in src/graphics/presentation/window/window.cpp no longer calls EXIT_NOT_IMPLEMENTED(f.remapped) in GameEventController. The remap branch calls HostInputResetGamepadTouchPad(f.id) and Controller::ResetInputState(), then returns. The body of Controller::ResetInputState() and HostInputResetGamepadTouchPad() were not read, so the all-player reset claim is not verified from source. This does not affect the verdict, because no coding requirements apply.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes are limited to the remap branch of GameEventController in window.cpp (+7/-1 per the raw summary), plus a new HostInputResetGamepadTouchPad(int id) in hostInput.cpp and hostInput.h (+20 lines total). All of these run only in the remap path, and their purpose is to clear held input after a remap, which the PR objective describes. The touchpad reset is not named in the PR description. It is described in the commit message and is a held-input reset of the same kind, so it is connected to the stated purpose and not unrelated. No unrelated change was identified. Limitation: the text diff could not be read because changed blobs are missing from the checkout, so the hostInput.cpp body was not verified directly.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f1a32a4737 and 9d1ff799ad.

Files selected for processing: 3

  • src/graphics/presentation/window/hostInput.cpp
  • src/graphics/presentation/window/hostInput.h
  • src/graphics/presentation/window/window.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-18 22:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2396#issuecomment-6993822085) · edited 2026-11-18 22:54 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2396?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> When `GameEventController` receives a gamepad remapping event, it resets the remapped gamepad’s active touchpad input and controller input state for every player, then returns. The touchpad reset preserves touchpad mode, clears drawing, centers the stored stick axes, updates the visual-state revision, and releases the touch. This replaces the previous not-implemented failure for remapping events. **Suggested reviewers:** `nmzik`, `pipe530` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"9d1ff799adec0968d1be3a586530a19479a90466" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>9d1ff</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `9d1ff` --> <!-- final_review_risk_coverage:{"sourceCommitId":"9d1ff799adec0968d1be3a586530a19479a90466","coveredCommitId":"9d1ff799adec0968d1be3a586530a19479a90466","kind":"reviewed"} --> A gamepad remap during GTA V no longer exits the emulator. It now clears held input, including a held touchpad contact. No concrete merge-blocking risk remains in the reviewed changes. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: a gamepad remap no longer aborts, and held input is reset instead. It matches the changeset, which replaces the EXIT_NOT_IMPLEMENTED path in GameEventController with a… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description states the problem, the fix, the reasoning for resetting all players, and the testing done. It relates directly to the changeset, which resets controller input and touchpad state on ga… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The only linked issue, `#1227` (window: tolerate remapped gamepads), is closed. Under the assessment rules it supplies background only, so no active directly linked coding requirements apply. For contex… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The whole-PR changes are limited to the remap branch of GameEventController in window.cpp (+7/-1 per the raw summary), plus a new HostInputResetGamepadTouchPad(int id) in hostInput.cpp and hostInput.h… | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: a gamepad remap no longer aborts, and held input is reset instead. It matches the changeset, which replaces the EXIT_NOT_IMPLEMENTED path in GameEventController with a reset of controller input state. The title is specific, though the '(GTA V)' suffix names the trigger game rather than the code change. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description states the problem, the fix, the reasoning for resetting all players, and the testing done. It relates directly to the changeset, which resets controller input and touchpad state on gamepad remap events. It also links the prior closed PR `#1227` for context. </dd> </dl> </details> <details> <summary><strong>Full details: Linked Issues check</strong></summary> <dl> <dd> <br> **Explanation** The only linked issue, `#1227` (window: tolerate remapped gamepads), is closed. Under the assessment rules it supplies background only, so no active directly linked coding requirements apply. For context, the reviewed head in src/graphics/presentation/window/window.cpp no longer calls EXIT_NOT_IMPLEMENTED(f.remapped) in GameEventController. The remap branch calls HostInputResetGamepadTouchPad(f.id) and Controller::ResetInputState(), then returns. The body of Controller::ResetInputState() and HostInputResetGamepadTouchPad() were not read, so the all-player reset claim is not verified from source. This does not affect the verdict, because no coding requirements apply. </dd> </dl> </details> <details> <summary><strong>Full details: Out of Scope Changes check</strong></summary> <dl> <dd> <br> **Explanation** The whole-PR changes are limited to the remap branch of GameEventController in window.cpp (+7/-1 per the raw summary), plus a new HostInputResetGamepadTouchPad(int id) in hostInput.cpp and hostInput.h (+20 lines total). All of these run only in the remap path, and their purpose is to clear held input after a remap, which the PR objective describes. The touchpad reset is not named in the PR description. It is described in the commit message and is a held-input reset of the same kind, so it is connected to the stated purpose and not unrelated. No unrelated change was identified. Limitation: the text diff could not be read because changed blobs are missing from the checkout, so the hostInput.cpp body was not verified directly. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2396)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/a90be8dd7304640cf4176a975871d51443710292/.coderabbit.yaml>) - **Commit**: [a90be8d](<https://github.com/KytyPS5/KytyPS5/commit/a90be8dd7304640cf4176a975871d51443710292>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `26e4dd15-bb51-41d1-bb10-c64cf1c6fbfc` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between f1a32a4737e98c40c84a238f5bded2ed767e928b and 9d1ff799adec0968d1be3a586530a19479a90466. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary> <dl> <dd> <br> * `src/graphics/presentation/window/hostInput.cpp` * `src/graphics/presentation/window/hostInput.h` * `src/graphics/presentation/window/window.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-18 22:43 UTC · original · reviewed

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a90be8dd73 and f1a32a4737.

Files selected for processing: 1

  • src/graphics/presentation/window/window.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-18 22:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2396#pullrequestreview-5966392859) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/a90be8dd7304640cf4176a975871d51443710292/.coderabbit.yaml>) - **Commit**: [a90be8d](<https://github.com/KytyPS5/KytyPS5/commit/a90be8dd7304640cf4176a975871d51443710292>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `a507c927-3508-4edd-bcb7-61e73b706764` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between a90be8dd7304640cf4176a975871d51443710292 and f1a32a4737e98c40c84a238f5bded2ed767e928b. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 1</summary> <dl> <dd> <br> * `src/graphics/presentation/window/window.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=0cc2e6b4-89f0-4082-8398-2d062ca1d609 attempt=36ff4513-8448-48a0-b903-6b1b78027edb batch=1/1 -->
@ -321,0 +321,4 @@
// events for the old mapping, so held input would stay stuck: reset it on every player.
if (f.remapped) {
HostInputResetGamepadTouchPad(f.id);
Controller::ResetInputState();
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-18 22:43 UTC · original · edited 2026-11-18 22:59 UTC

Minor · Functional Correctness · Quick win

Clear held gamepad touchpad state during the remap reset.

Controller::ResetInputState() cannot reach g_gamepad_touchpad, which is private to hostInput.cpp. If drawing is true when the remap arrives, it stays true. PollGamepadTouchPad then sends a touch-down on every poll cycle, so the contact returns without a new Cross press. Holding the left stick does not cause this, because stick input changes only the cached axis values. The contact stays down until a Cross release reaches HostInputGamepadDrawButton, or until touchpad mode is toggled off.

The cached stick values can also persist after a lost neutral event, so the touchpad position keeps drifting.

Clear this state in hostInput.cpp through a function exposed from its header. When touchpad mode is enabled, the function must:

  • Set drawing to false.
  • Release the contact at its current position with Controller::SetTouchPad(id, 1, false, x, y).
  • Reset x_axis and y_axis to 128.
  • Keep enabled and id so the selected touchpad mode stays active.

Call this function from the remap block in window.cpp before Controller::ResetInputState().

✅ Confirmed as addressed by @⁠oguzhanozfe

**@⁠coderabbitai[bot]** on GitHub · 2026-11-18 22:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2396#discussion_r4621883319) · edited 2026-11-18 22:59 UTC <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/amber-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minor** · **Functional Correctness** · **Quick win** **Clear held gamepad touchpad state during the remap reset.** `Controller::ResetInputState()` cannot reach `g_gamepad_touchpad`, which is private to `hostInput.cpp`. If `drawing` is true when the remap arrives, it stays true. `PollGamepadTouchPad` then sends a touch-down on every poll cycle, so the contact returns without a new Cross press. Holding the left stick does not cause this, because stick input changes only the cached axis values. The contact stays down until a Cross release reaches `HostInputGamepadDrawButton`, or until touchpad mode is toggled off. The cached stick values can also persist after a lost neutral event, so the touchpad position keeps drifting. Clear this state in `hostInput.cpp` through a function exposed from its header. When touchpad mode is enabled, the function must: - Set `drawing` to false. - Release the contact at its current position with `Controller::SetTouchPad(id, 1, false, x, y)`. - Reset `x_axis` and `y_axis` to 128. - Keep `enabled` and `id` so the selected touchpad mode stays active. Call this function from the remap block in `window.cpp` before `Controller::ResetInputState()`. <!-- fingerprinting:phantom:medusa:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:45f48a601ccf4033a1e1692b --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠oguzhanozfe <!-- This is an auto-generated comment by CodeRabbit -->
@ -321,0 +321,4 @@
// events for the old mapping, so held input would stay stuck: reset it on every player.
if (f.remapped) {
HostInputResetGamepadTouchPad(f.id);
Controller::ResetInputState();
Author
Owner

@⁠oguzhanozfe on GitHub · 2026-11-18 22:50 UTC · original

Fixed in 9d1ff799. The new HostInputResetGamepadTouchPad(id) releases the held contact at its position, sets drawing to false, and re-centres x_axis/y_axis to 128. It keeps enabled and id. The remap handler calls it before Controller::ResetInputState().

**@⁠oguzhanozfe** on GitHub · 2026-11-18 22:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2396#discussion_r4621943538) Fixed in 9d1ff799. The new `HostInputResetGamepadTouchPad(id)` releases the held contact at its position, sets `drawing` to false, and re-centres `x_axis`/`y_axis` to 128. It keeps `enabled` and `id`. The remap handler calls it before `Controller::ResetInputState()`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2396/head:github-bot/gh-2396'
git switch 'github-bot/gh-2396'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2396'
git switch 'github-bot/gh-2396'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2396'
git switch 'github-bot/gh-2396'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2396'
git switch 'main'
git merge --squash 'github-bot/gh-2396'
git switch 'main'
git merge --ff-only 'github-bot/gh-2396'
git switch 'main'
git merge 'github-bot/gh-2396'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.