window: tolerate remapped gamepads #1227

Closed
github-bot wants to merge 1 commit from gh-pr/1227/head into gh-pr/1227/base
Owner

@⁠TheCruZ on GitHub · 2026-10-08 19:04 UTC · original
pr/gamepad-remap → main · +8 −1 · 1 files · 1 commits · closed without merging

Summary

Fixes the emulator aborting 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, and the handler started with EXIT_NOT_IMPLEMENTED(f.remapped), so the event terminated the emulator.

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 does not send button-up or neutral-axis events for the old mapping, so when the remapped gamepad is the active controller its input state is reset (Controller::ResetInputState()) and no button or axis stays stuck.

Testing

  • Grand Theft Auto V (PPSA04263): played in my fork with this change, the gamepad keeps working and the emulator no longer exits on the remap event.
  • kyty_emulator builds (window.cpp rebuilt with the reset).
  • Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090.

AI usage

AI (Claude Opus 5.5) was used to investigate the issue and to implement the change. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my GTA V fork, i will be bringing PRs here after test them enough.

**@⁠TheCruZ** on GitHub · 2026-10-08 19:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1227) `pr/gamepad-remap` → `main` · +8 −1 · 1 files · 1 commits · closed without merging ## Summary Fixes the emulator aborting 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, and the handler started with `EXIT_NOT_IMPLEMENTED(f.remapped)`, so the event terminated the emulator. ## 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 does not send button-up or neutral-axis events for the old mapping, so when the remapped gamepad is the active controller its input state is reset (`Controller::ResetInputState()`) and no button or axis stays stuck. ## Testing - Grand Theft Auto V (PPSA04263): played in my fork with this change, the gamepad keeps working and the emulator no longer exits on the remap event. - `kyty_emulator` builds (`window.cpp` rebuilt with the reset). - Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090. ## AI usage AI (Claude Opus 5.5) was used to investigate the issue and to implement the change. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my [GTA V fork](https://github.com/TheCruZ/KytyPS5-GTA), i will be bringing PRs here after test them enough.
An SDL gamepad remap event aborted the emulator through
EXIT_NOT_IMPLEMENTED. Buttons and axes stay logical under a new mapping,
but SDL sends no button-up or neutral-axis events for the old one, so
the input state of the active controller is reset when it is remapped.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:48:57 +00:00
github-bot closed this pull request 2026-11-26 09:48:57 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 19:09 UTC · original · edited 2026-10-08 19:17 UTC

Review in Change Stack →

📝 Walkthrough

Walkthrough

GameEventController now returns early when it receives a remapping event. Controller button and axis events continue through the existing handling paths.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to 3370a

Remapping a controller while a control is held can leave that input stuck until another update changes it. The impact is localized to the affected controller, and clearing its cached state on remap is a bounded fix.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing the window handling code to tolerate remapped gamepads.
Description check ✅ Passed The description directly explains the remapped gamepad failure, the code change, and the reported testing.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 19:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1227#issuecomment-6067123161) · edited 2026-10-08 19:17 UTC <!-- 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/1227?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough GameEventController now returns early when it receives a remapping event. Controller button and axis events continue through the existing handling paths. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"3370a9f0572890be5ee5a82a43239b2cdd7dffef" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **🔵 Low** · up to `3370a` <!-- final_review_risk_coverage:{"sourceCommitId":"3370a9f0572890be5ee5a82a43239b2cdd7dffef","coveredCommitId":"3370a9f0572890be5ee5a82a43239b2cdd7dffef","kind":"reviewed"} --> Remapping a controller while a control is held can leave that input stuck until another update changes it. The impact is localized to the affected controller, and clearing its cached state on remap is a bounded fix. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------- | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Title check | ✅ Passed | The title clearly and concisely describes the main change: allowing the window handling code to tolerate remapped gamepads. | | Description check | ✅ Passed | The description directly explains the remapped gamepad failure, the code change, and the reported testing. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1227)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -291,0 +294,4 @@
Controller::ResetInputState();
}
return;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 19:09 UTC · original · edited 2026-10-08 19:17 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- diff ---'
git diff --unified=80 58978d154a57cb5f4d68867c8e966af42fc7770 3370a9f0572890be5ee5a82a43239b2cdd7dffef -- src/graphics/presentation/window/window.cpp
printf '%s\n' '--- current handler references ---'
rg -n -F -- 'SDL_EVENT_GAMEPAD_REMAPPED' src CMakeLists.txt cmake 2>/dev/null || true
printf '%s\n' '--- controller calls in handler file ---'
rg -n -F -- 'Controller::SetButton' src/graphics/presentation/window/window.cpp || true
rg -n -F -- 'Controller::SetAxis' src/graphics/presentation/window/window.cpp || true
printf '%s\n' '--- controller declarations/definitions ---'
rg -n -F -- 'SetButton(' src | head -80 || true
rg -n -F -- 'SetAxis(' src | head -80 || true
printf '%s\n' '--- SDL dependency declarations ---'
rg -n -i --glob '!build/**' --glob '!dist/**' -- 'sdl3|sdl2|SDL_VERSION|SDL_EVENT_GAMEPAD_REMAPPED' . | head -200 || true

Repository: KytyPS5/KytyPS5

Length of output: 10134


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- controller state update block ---'
sed -n '820,950p' src/libs/controller.cpp
printf '%s\n' '--- controller state declarations and reset-related symbols ---'
rg -n -F -- 'struct Controller' src/libs/controller.cpp src/libs/controller.h || true
rg -n -i -- 'reset|disconnect|SetButton|SetAxis|button_state|axis_state' src/libs/controller.cpp src/libs/controller.h | head -160 || true
printf '%s\n' '--- SDL subtree metadata ---'
git ls-tree 3370a9f0572890be5ee5a82a43239b2cdd7dffef 3rdparty/SDL3
git submodule status -- 3rdparty/SDL3 || true
find 3rdparty/SDL3 -maxdepth 2 -type f \\( -name 'VERSION.txt' -o -name 'README*' -o -name 'SDL_gamepad.c' -o -name 'SDL_gamepad.h' \\) -print 2>/dev/null | sort | head -80
printf '%s\n' '--- remap symbols in available SDL source ---'
rg -n -i --glob '*.{c,h,md,txt}' -- 'GAMEPAD_REMAPPED|gamepad.*remap|remap.*gamepad' 3rdparty/SDL3 2>/dev/null | head -160 || true

Repository: KytyPS5/KytyPS5

Length of output: 5549


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- controller state and update implementation ---'
sed -n '70,145p' src/libs/controller.cpp
sed -n '390,470p' src/libs/controller.cpp
sed -n '650,705p' src/libs/controller.cpp
printf '%s\n' '--- SDL submodule availability and pin context ---'
git -C 3rdparty/SDL3 rev-parse HEAD 2>&1 || true
git -C 3rdparty/SDL3 status --short 2>&1 || true
git show 3370a9f0572890be5ee5a82a43239b2cdd7dffef:.gitmodules 2>/dev/null || true

Repository: KytyPS5/KytyPS5

Length of output: 7775


🌐 Web query:

SDL3 commit fa2c02bb6e21974a89ea9824bc53c9932abe5f9c SDL_EVENT_GAMEPAD_REMAPPED source

💡 Result:

At commit `fa2c02bb6e21974a89ea9824bc53c9932abe5f9c` (SDL 3.4.16), `SDL_EVENT_GAMEPAD_REMAPPED` is defined as **“The gamepad mapping was updated.”** It’s a gamepad device event; its `event.gdevice.which` field identifies the joystick instance. ([github.com](https://github.com/libsdl-org/SDL/commit/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c))

In the source, SDL queues this event for that instance when a remap occurs, unless gamepads aren’t initialized or a joystick is currently being added. ([github.com](https://github.com/libsdl-org/SDL/blob/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c/src/joystick/SDL_gamepad.c))

Citations:

- 1: https://github.com/libsdl-org/SDL/commit/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c
- 2: https://github.com/libsdl-org/SDL/blob/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c/src/joystick/SDL_gamepad.c

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- GameController button and axis methods ---'
rg -n -F -- 'void GameController::Button' src/libs/controller.cpp
rg -n -F -- 'void GameController::Axis' src/libs/controller.cpp
sed -n '500,650p' src/libs/controller.cpp
printf '%s\n' '--- all reset-input call sites ---'
rg -n -F -- 'ResetInputState(' src --glob '!src/libs/controller.cpp' || true

Repository: KytyPS5/KytyPS5

Length of output: 6467


🌐 Web query:

SDL 3.4.16 SDL_gamepad.c SDL_EVENT_GAMEPAD_REMAPPED does remapping send button release axis neutral state

💡 Result:

**No—SDL 3.4.16’s remap path does not itself send gamepad button-up events or axis-motion events with neutral values.** It reloads the mapping, then queues `SDL_EVENT_GAMEPAD_REMAPPED`; that event only indicates the mapping changed. ([fossies.org](https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai))

So don’t rely on releases or neutral-axis events to clear your input state. Handle `SDL_EVENT_GAMEPAD_REMAPPED` explicitly—e.g., clear cached mapped input state and refresh it from SDL’s current gamepad state. **Inference:** the cited implementation shows the mapping reload and remap notification, but no synthesized release/neutral events in that path. ([fossies.org](https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai))

Citations:

- 1: https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai
- 2: https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- button method ---'
sed -n '480,515p' src/libs/controller.cpp
printf '%s\n' '--- controller event conversion ---'
sed -n '680,720p' src/graphics/presentation/window/window.cpp
printf '%s\n' '--- active-controller API ---'
rg -n -F -- 'GetActiveControllerId' src/libs/controller.h src/libs/controller.cpp
sed -n '60,82p' src/libs/controller.h
sed -n '760,790p' src/libs/controller.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4532


Reset the active controller state on remap.

SDL 3.4.16 does not synthesize button-up or neutral-axis events when it queues SDL_EVENT_GAMEPAD_REMAPPED. The early return can therefore leave the active controller's cached input stuck. Reset only the remapped active controller.

🐛 Suggested fix
--- "a/src/graphics/presentation/window/window.cpp"
+++ "b/src/graphics/presentation/window/window.cpp"
@@ -288,9 +288,12 @@
 
 static void GameEventController([[maybe_unused]] const EventController& f) {
 	// A new mapping changes how SDL translates the device; buttons and axes stay logical.
 	if (f.remapped) {
+		if (Controller::GetActiveControllerId() == f.id) {
+			Controller::ResetInputState();
+		}
 		return;
 	}
 
 #ifdef KYTY_DBG_INPUT
 	if (f.added || f.removed) {

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 19:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1227#discussion_r4223079638) · edited 2026-10-08 19:17 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- diff ---' git diff --unified=80 58978d154a57cb5f4d68867c8e966af42fc7770 3370a9f0572890be5ee5a82a43239b2cdd7dffef -- src/graphics/presentation/window/window.cpp printf '%s\n' '--- current handler references ---' rg -n -F -- 'SDL_EVENT_GAMEPAD_REMAPPED' src CMakeLists.txt cmake 2>/dev/null || true printf '%s\n' '--- controller calls in handler file ---' rg -n -F -- 'Controller::SetButton' src/graphics/presentation/window/window.cpp || true rg -n -F -- 'Controller::SetAxis' src/graphics/presentation/window/window.cpp || true printf '%s\n' '--- controller declarations/definitions ---' rg -n -F -- 'SetButton(' src | head -80 || true rg -n -F -- 'SetAxis(' src | head -80 || true printf '%s\n' '--- SDL dependency declarations ---' rg -n -i --glob '!build/**' --glob '!dist/**' -- 'sdl3|sdl2|SDL_VERSION|SDL_EVENT_GAMEPAD_REMAPPED' . | head -200 || true ``` Repository: KytyPS5/KytyPS5 Length of output: 10134 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- controller state update block ---' sed -n '820,950p' src/libs/controller.cpp printf '%s\n' '--- controller state declarations and reset-related symbols ---' rg -n -F -- 'struct Controller' src/libs/controller.cpp src/libs/controller.h || true rg -n -i -- 'reset|disconnect|SetButton|SetAxis|button_state|axis_state' src/libs/controller.cpp src/libs/controller.h | head -160 || true printf '%s\n' '--- SDL subtree metadata ---' git ls-tree 3370a9f0572890be5ee5a82a43239b2cdd7dffef 3rdparty/SDL3 git submodule status -- 3rdparty/SDL3 || true find 3rdparty/SDL3 -maxdepth 2 -type f \\( -name 'VERSION.txt' -o -name 'README*' -o -name 'SDL_gamepad.c' -o -name 'SDL_gamepad.h' \\) -print 2>/dev/null | sort | head -80 printf '%s\n' '--- remap symbols in available SDL source ---' rg -n -i --glob '*.{c,h,md,txt}' -- 'GAMEPAD_REMAPPED|gamepad.*remap|remap.*gamepad' 3rdparty/SDL3 2>/dev/null | head -160 || true ``` Repository: KytyPS5/KytyPS5 Length of output: 5549 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- controller state and update implementation ---' sed -n '70,145p' src/libs/controller.cpp sed -n '390,470p' src/libs/controller.cpp sed -n '650,705p' src/libs/controller.cpp printf '%s\n' '--- SDL submodule availability and pin context ---' git -C 3rdparty/SDL3 rev-parse HEAD 2>&1 || true git -C 3rdparty/SDL3 status --short 2>&1 || true git show 3370a9f0572890be5ee5a82a43239b2cdd7dffef:.gitmodules 2>/dev/null || true ``` Repository: KytyPS5/KytyPS5 Length of output: 7775 --- 🌐 Web query: `SDL3 commit fa2c02bb6e21974a89ea9824bc53c9932abe5f9c SDL_EVENT_GAMEPAD_REMAPPED source` 💡 Result: ``` At commit `fa2c02bb6e21974a89ea9824bc53c9932abe5f9c` (SDL 3.4.16), `SDL_EVENT_GAMEPAD_REMAPPED` is defined as **“The gamepad mapping was updated.”** It’s a gamepad device event; its `event.gdevice.which` field identifies the joystick instance. ([github.com](https://github.com/libsdl-org/SDL/commit/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c)) In the source, SDL queues this event for that instance when a remap occurs, unless gamepads aren’t initialized or a joystick is currently being added. ([github.com](https://github.com/libsdl-org/SDL/blob/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c/src/joystick/SDL_gamepad.c)) Citations: - 1: https://github.com/libsdl-org/SDL/commit/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c - 2: https://github.com/libsdl-org/SDL/blob/fa2c02bb6e21974a89ea9824bc53c9932abe5f9c/src/joystick/SDL_gamepad.c ``` --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- GameController button and axis methods ---' rg -n -F -- 'void GameController::Button' src/libs/controller.cpp rg -n -F -- 'void GameController::Axis' src/libs/controller.cpp sed -n '500,650p' src/libs/controller.cpp printf '%s\n' '--- all reset-input call sites ---' rg -n -F -- 'ResetInputState(' src --glob '!src/libs/controller.cpp' || true ``` Repository: KytyPS5/KytyPS5 Length of output: 6467 --- 🌐 Web query: `SDL 3.4.16 SDL_gamepad.c SDL_EVENT_GAMEPAD_REMAPPED does remapping send button release axis neutral state` 💡 Result: ``` **No—SDL 3.4.16’s remap path does not itself send gamepad button-up events or axis-motion events with neutral values.** It reloads the mapping, then queues `SDL_EVENT_GAMEPAD_REMAPPED`; that event only indicates the mapping changed. ([fossies.org](https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai)) So don’t rely on releases or neutral-axis events to clear your input state. Handle `SDL_EVENT_GAMEPAD_REMAPPED` explicitly—e.g., clear cached mapped input state and refresh it from SDL’s current gamepad state. **Inference:** the cited implementation shows the mapping reload and remap notification, but no synthesized release/neutral events in that path. ([fossies.org](https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai)) Citations: - 1: https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai - 2: https://fossies.org/dox/SDL3-3.4.16/SDL__gamepad_8c_source.html?utm_source=openai ``` --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- button method ---' sed -n '480,515p' src/libs/controller.cpp printf '%s\n' '--- controller event conversion ---' sed -n '680,720p' src/graphics/presentation/window/window.cpp printf '%s\n' '--- active-controller API ---' rg -n -F -- 'GetActiveControllerId' src/libs/controller.h src/libs/controller.cpp sed -n '60,82p' src/libs/controller.h sed -n '760,790p' src/libs/controller.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4532 --- </details> **Reset the active controller state on remap.** SDL 3.4.16 does not synthesize button-up or neutral-axis events when it queues `SDL_EVENT_GAMEPAD_REMAPPED`. The early return can therefore leave the active controller's cached input stuck. Reset only the remapped active controller. <details> <summary>🐛 Suggested fix</summary> ```diff --- "a/src/graphics/presentation/window/window.cpp" +++ "b/src/graphics/presentation/window/window.cpp" @@ -288,9 +288,12 @@ static void GameEventController([[maybe_unused]] const EventController& f) { // A new mapping changes how SDL translates the device; buttons and axes stay logical. if (f.remapped) { + if (Controller::GetActiveControllerId() == f.id) { + Controller::ResetInputState(); + } return; } #ifdef KYTY_DBG_INPUT if (f.added || f.removed) { ``` </details> <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:5b70ccb8cae95d55a33c8fb5 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 19:09 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f2a5facc-5d2c-45a4-b37c-52e5561936a2
📥 Commits

Reviewing files that changed from the base of the PR and between 2f4b8a335d and 3370a9f0572890be5ee5a82a43239b2cdd7dffef.

📒 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 8 included reviews per hour; 0 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 19:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1227#pullrequestreview-5461606514) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `f2a5facc-5d2c-45a4-b37c-52e5561936a2` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and 3370a9f0572890be5ee5a82a43239b2cdd7dffef. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/presentation/window/window.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=cc465a1f-40db-459a-bd42-425a9925cb85 attempt=0f055d3e-3175-4bdb-b4d5-ea95e582be3e batch=1/1 -->
@ -291,0 +294,4 @@
Controller::ResetInputState();
}
return;
}
Author
Owner

@⁠TheCruZ on GitHub · 2026-10-08 19:17 UTC · original

Fixed in 3269ab49: the active controller's input state is reset when it is remapped.

**@⁠TheCruZ** on GitHub · 2026-10-08 19:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1227#discussion_r4223163976) Fixed in 3269ab49: the active controller's input state is reset when it is remapped.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.