window: reset held input instead of aborting on a gamepad remap (GTA V) #2396
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2396
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2396"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@oguzhanozfe on GitHub · 2026-11-18 22:39 UTC · original
oguzhanozfe:fix/gamepad-remap-no-abort→main· +27 −1 · 3 files · 2 commits · openSummary
Fixes the emulator exiting while playing Grand Theft Auto V (PPSA04263) when SDL reports that a connected gamepad was remapped.
Problem
SDL_EVENT_GAMEPAD_REMAPPEDreachesGameEventControllerwithremappedset. The handler starts withEXIT_NOT_IMPLEMENTED(f.remapped), so the event terminates the emulator. It still does on currentmain(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()readsg_players[0]).mainnow 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_emulatorbuilds.controller_settings_testsandhost_input_testspass.GameEventControlleris a static handler inside the SDL window loop.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 withCo-authored-by.🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-11-18 22:43 UTC · original · edited 2026-11-18 22:54 UTC
No actionable comments were generated in the recent review.
Walkthrough
When
GameEventControllerreceives 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,pipe530Change: Bug fix · Severity of issue fixed: Medium
Merge Risk:
Minimal · up to
9d1ffA 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:
4
#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…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
#1227for 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
26e4dd15-bb51-41d1-bb10-c64cf1c6fbfcReviewing files that changed from the base of the PR and between
f1a32a4737and9d1ff799ad.src/graphics/presentation/window/hostInput.cppsrc/graphics/presentation/window/hostInput.hsrc/graphics/presentation/window/window.cppIncluded 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 · reviewed
Actionable comments posted: 1
a507c927-3508-4edd-bcb7-61e73b706764Reviewing files that changed from the base of the PR and between
a90be8dd73andf1a32a4737.src/graphics/presentation/window/window.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
@ -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();@coderabbitai[bot] on GitHub · 2026-11-18 22:43 UTC · original · edited 2026-11-18 22:59 UTC
Clear held gamepad touchpad state during the remap reset.
Controller::ResetInputState()cannot reachg_gamepad_touchpad, which is private tohostInput.cpp. Ifdrawingis true when the remap arrives, it stays true.PollGamepadTouchPadthen 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 reachesHostInputGamepadDrawButton, 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.cppthrough a function exposed from its header. When touchpad mode is enabled, the function must:drawingto false.Controller::SetTouchPad(id, 1, false, x, y).x_axisandy_axisto 128.enabledandidso the selected touchpad mode stays active.Call this function from the remap block in
window.cppbeforeController::ResetInputState().✅ Confirmed as addressed by @oguzhanozfe
@ -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();@oguzhanozfe on GitHub · 2026-11-18 22:50 UTC · original
Fixed in
9d1ff799. The newHostInputResetGamepadTouchPad(id)releases the held contact at its position, setsdrawingto false, and re-centresx_axis/y_axisto 128. It keepsenabledandid. The remap handler calls it beforeController::ResetInputState().View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.