Input mapping tabs UI, emulated touchpad, and rumble for non-PS5 controllers #1541

Manually merged
github merged 8 commits from gh-pr/1541/head into gh-pr/1541/base 2026-11-26 09:59:07 +00:00
Owner

@⁠Pipe530 on GitHub · 2026-10-15 22:42 UTC · original
Pipe530:pipe530-input-mapping-tabs-ui → main · +1908 −209 · 18 files · 8 commits · merged 2026-10-16 02:04 UTC

Summary

  • Input Mapping dialog revamp: tabbed UI ("Gamepad" and "Keyboard & Mouse"), wider window, clearer layout.
  • Gamepad remapping (Pad:<Control>=<Source>) and a mappable gyro-emulation toggle (default Back/View) for pads without a gyroscope.
  • Emulated touchpad for non-PS4/PS5 controllers and mouse: F6 (or a mapped button) toggles it, left mouse / Cross draws, hand cursor overlay with particle skins (Classic, Blue neon, Monochrome, Crimson, Red/Blue). Disabled when the mouse leaves the window.
  • Shared touchpad options in the dialog: particle skin and a "Show hand cursor and trail" toggle (touchpad input still works when hidden).
  • Rumble for non-PS5 controllers: haptic audio is converted to rumble motor output on non-DualSense pads. This feature comes from the Jetsku fork.
  • New assets/cursors (hand/drawing PNGs) with CMake copy/install rules.
**@⁠Pipe530** on GitHub · 2026-10-15 22:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541) `Pipe530:pipe530-input-mapping-tabs-ui` → `main` · +1908 −209 · 18 files · 8 commits · merged 2026-10-16 02:04 UTC ## Summary - **Input Mapping dialog revamp**: tabbed UI ("Gamepad" and "Keyboard & Mouse"), wider window, clearer layout. - **Gamepad remapping** (`Pad:<Control>=<Source>`) and a mappable gyro-emulation toggle (default Back/View) for pads without a gyroscope. - **Emulated touchpad** for non-PS4/PS5 controllers and mouse: F6 (or a mapped button) toggles it, left mouse / Cross draws, hand cursor overlay with particle skins (Classic, Blue neon, Monochrome, Crimson, Red/Blue). Disabled when the mouse leaves the window. - **Shared touchpad options** in the dialog: particle skin and a "Show hand cursor and trail" toggle (touchpad input still works when hidden). - **Rumble for non-PS5 controllers**: haptic audio is converted to rumble motor output on non-DualSense pads. This feature comes from the Jetsku fork. - New `assets/cursors` (hand/drawing PNGs) with CMake copy/install rules.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:59:05 +00:00
github manually merged commit 5689fd8c7f into gh-pr/1541/base 2026-11-26 09:59:07 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · edited 2026-10-16 01:24 UTC

Review in Change Stack →

📝 Walkthrough

The changes add separate keyboard and gamepad mappings, controller gyro emulation, and mouse and gamepad touchpad input. The overlay displays a touch cursor with optional cursor images, trails, and particles. CMake copies and installs cursor assets and adds host-input tests to the build and CI workflows. Non-speaker haptic streams for controllers other than PS5 gamepads now produce gamepad rumble.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Feature

Merge Risk: 🟡 Moderate · up to 5689f

Mouse drawing can trigger an unintended touchpad click or mapped game control, and the touch cursor can start at the wrong position. Correct these input behaviors before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 3.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 129 functions across 13 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the primary changes: input mapping tabs, emulated touchpad support, and rumble fallback for non-PS5 controllers.
Description check Passed The description accurately covers the input mapping UI, gamepad remapping, emulated touchpad, visual options, rumble fallback, and cursor assets included in the changeset.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 3.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 129 functions across 13 files. (3 skipped: 3 unsupported.)

  • Autofix · 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-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#issuecomment-6203873287) · edited 2026-10-16 01:24 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/1541?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-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The changes add separate keyboard and gamepad mappings, controller gyro emulation, and mouse and gamepad touchpad input. The overlay displays a touch cursor with optional cursor images, trails, and particles. CMake copies and installs cursor assets and adds host-input tests to the build and CI workflows. Non-speaker haptic streams for controllers other than PS5 gamepads now produce gamepad rumble. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"5689fd8c7fa7b31361441f5acedb661e57922145" --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🟡 Moderate</strong> · up to <code>5689f</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟡 Moderate** · up to `5689f` --> <!-- final_review_risk_coverage:{"sourceCommitId":"5689fd8c7fa7b31361441f5acedb661e57922145","coveredCommitId":"5689fd8c7fa7b31361441f5acedb661e57922145","kind":"reviewed"} --> Mouse drawing can trigger an unintended touchpad click or mapped game control, and the touch cursor can start at the wrong position. Correct these input behaviors before merging. <!-- 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 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 3.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 129 functions across 13 files. (3 skipped:… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><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> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly summarizes the primary changes: input mapping tabs, emulated touchpad support, and rumble fallback for non-PS5 controllers. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description accurately covers the input mapping UI, gamepad remapping, emulated touchpad, visual options, rumble fallback, and cursor assets included in the changeset. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 3.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 129 functions across 13 files. (3 skipped: 3 unsupported.) </dd> </dl> </details> </dd> </dl> </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">Autofix</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=1541)! 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> - [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> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -763,0 +772,4 @@
"$<TARGET_FILE_DIR:kyty_emulator>/assets/cursors"
VERBATIM)
add_dependencies(kyty_emulator kyty_touch_cursors)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets)
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -n -C2 'install\s*\(' CMakeLists.txt
rg -n -C2 'assets/sounds|trophy-unlock' --glob 'CMakeLists.txt' --glob '*.cmake'

Repository: KytyPS5/KytyPS5

Length of output: 2313


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- top-level CMake ---'
nl -ba CMakeLists.txt | sed -n '744,775p;820,842p'
printf '%s\n' '--- launcher CMake ---'
nl -ba src/launcher/CMakeLists.txt | sed -n '88,116p'
printf '%s\n' '--- cursor lookup ---'
rg -n -F --glob '*.{cpp,h,hpp,c,cc}' -e 'LoadTouchCursorImage' -e 'SDL_GetBasePath' .
printf '%s\n' '--- relevant source excerpts ---'
rg -l -F --glob '*.{cpp,h,hpp,c,cc}' 'LoadTouchCursorImage' . | while read -r f; do
  echo "FILE: $f"
  rg -n -C8 -F 'LoadTouchCursorImage' "$f"
done

Repository: KytyPS5/KytyPS5

Length of output: 6680


Install cursors inside the macOS application bundle.

The generic install path is correct for non-bundle builds. On macOS, kyty_emulator installs to KytyPS5.app/Contents/MacOS, but the cursor rule installs to the prefix-level assets/cursors. LoadTouchCursorImage therefore looks in KytyPS5.app/Contents/MacOS/assets/cursors and does not find the installed images.

--- "a/CMakeLists.txt"
+++ "b/CMakeLists.txt"
@@ -766,7 +766,12 @@
 		"$<TARGET_FILE_DIR:kyty_emulator>/assets/cursors"
 	VERBATIM)
 add_dependencies(kyty_emulator kyty_touch_cursors)
-install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets)
+if(APPLE AND KYTY_BUILD_LAUNCHER)
+	install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors"
+		DESTINATION "KytyPS5.app/Contents/MacOS/assets")
+else()
+	install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets)
+endif()
 
 target_link_libraries(kyty_emulator ${kyty_emulator_link_libraries})
 if (WIN32)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

if(APPLE AND KYTY_BUILD_LAUNCHER)
	install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors"
		DESTINATION "KytyPS5.app/Contents/MacOS/assets")
else()
	install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets)
endif()
**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047856) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash rg -n -C2 'install\s*\(' CMakeLists.txt rg -n -C2 'assets/sounds|trophy-unlock' --glob 'CMakeLists.txt' --glob '*.cmake' ``` Repository: KytyPS5/KytyPS5 Length of output: 2313 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- top-level CMake ---' nl -ba CMakeLists.txt | sed -n '744,775p;820,842p' printf '%s\n' '--- launcher CMake ---' nl -ba src/launcher/CMakeLists.txt | sed -n '88,116p' printf '%s\n' '--- cursor lookup ---' rg -n -F --glob '*.{cpp,h,hpp,c,cc}' -e 'LoadTouchCursorImage' -e 'SDL_GetBasePath' . printf '%s\n' '--- relevant source excerpts ---' rg -l -F --glob '*.{cpp,h,hpp,c,cc}' 'LoadTouchCursorImage' . | while read -r f; do echo "FILE: $f" rg -n -C8 -F 'LoadTouchCursorImage' "$f" done ``` Repository: KytyPS5/KytyPS5 Length of output: 6680 --- </details> **Install cursors inside the macOS application bundle.** The generic install path is correct for non-bundle builds. On macOS, `kyty_emulator` installs to `KytyPS5.app/Contents/MacOS`, but the cursor rule installs to the prefix-level `assets/cursors`. `LoadTouchCursorImage` therefore looks in `KytyPS5.app/Contents/MacOS/assets/cursors` and does not find the installed images. ```diff --- "a/CMakeLists.txt" +++ "b/CMakeLists.txt" @@ -766,7 +766,12 @@ "$<TARGET_FILE_DIR:kyty_emulator>/assets/cursors" VERBATIM) add_dependencies(kyty_emulator kyty_touch_cursors) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets) +if(APPLE AND KYTY_BUILD_LAUNCHER) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" + DESTINATION "KytyPS5.app/Contents/MacOS/assets") +else() + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets) +endif() target_link_libraries(kyty_emulator ${kyty_emulator_link_libraries}) if (WIN32) ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion if(APPLE AND KYTY_BUILD_LAUNCHER) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION "KytyPS5.app/Contents/MacOS/assets") else() install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets/cursors" DESTINATION assets) endif() ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:09f60b9d07f53c6c17d8baec --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -1194,0 +1471,4 @@
}
const auto now = Clock::now();
if (state.enabled && state.position_valid) {
const ImVec2 target {state.x * extent.width, state.y * extent.height};
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the current frame extent for the cursor target.

DrawTouchPadCursor scales the normalized position by the member extent. PrepareFrame assigns extent = frame_extent only after DrawTouchPadCursor returns. On the first overlay frame, extent is {0, 0}. The cursor therefore starts at (0, 0) and then glides across the screen. If drawing is active, the glide also produces a trail and particles. After a resize, the cursor uses the old size for one frame. Pass frame_extent into DrawTouchPadCursor, or assign extent before the draw calls.

🐛 Proposed fix
-		DrawTouchPadCursor(GetHostInputTouchPadVisualState());
+		extent = frame_extent;
+		DrawTouchPadCursor(GetHostInputTouchPadVisualState());
 		ImGui::Render();
-		extent = frame_extent;
**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047881) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Use the current frame extent for the cursor target.** `DrawTouchPadCursor` scales the normalized position by the member `extent`. `PrepareFrame` assigns `extent = frame_extent` only after `DrawTouchPadCursor` returns. On the first overlay frame, `extent` is `{0, 0}`. The cursor therefore starts at (0, 0) and then glides across the screen. If drawing is active, the glide also produces a trail and particles. After a resize, the cursor uses the old size for one frame. Pass `frame_extent` into `DrawTouchPadCursor`, or assign `extent` before the draw calls. <details> <summary>🐛 Proposed fix</summary> ```diff - DrawTouchPadCursor(GetHostInputTouchPadVisualState()); + extent = frame_extent; + DrawTouchPadCursor(GetHostInputTouchPadVisualState()); ImGui::Render(); - extent = frame_extent; ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:a7ed1a09827a1a85c7260ac3 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -213,1 +375,4 @@
void SetSwipeTouchPad(bool down, float x, float y) {
Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 1, down, x, y);
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Mouse touchpad drawing presses the touchpad click button.

SetSwipeTouchPad calls Controller::SetTouchPad with HOST_INPUT_CONTROLLER_ID. For that ID, GameController::TouchPad (src/libs/controller.cpp, lines 591-594) sets PAD_BUTTON_TOUCH_PAD while down is true and clears it on release. Each mouse drag in touchpad mode therefore sends a held touchpad click to the game. Many games open a map or menu on touchpad click, so drawing triggers that action.

There is a second effect. Releasing finger 1 clears the click bit even when the Backspace/TouchPad binding still holds finger 0. Gamepad drawing does not have this defect because it passes the gamepad ID.

Separate "finger contact" from "click button" in the controller API. Leave the click bit unchanged for the swipe finger.

🐛 Proposed fix
--- "a/src/graphics/presentation/window/hostInput.cpp"
+++ "b/src/graphics/presentation/window/hostInput.cpp"
@@ -361,9 +361,10 @@
 	Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 0, down, x, 0.5f);
 }
 
 void SetSwipeTouchPad(bool down, float x, float y) {
-	Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 1, down, x, y);
+	Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 1, down, x, y,
+	                        /*press_button=*/false);
 }
 
 void RecordMouseTouchPadPosition(float x, float y) {
 	int width  = 0;

In src/libs/controller.cpp / controller.h:

void SetTouchPad(int id, int finger, bool down, float x, float y, bool press_button = true);
// GameController::TouchPad:
if (id == HOST_INPUT_CONTROLLER_ID && press_button) {
	m_state.buttons = down ? m_state.buttons | PAD_BUTTON_TOUCH_PAD
	                       : m_state.buttons & ~PAD_BUTTON_TOUCH_PAD;
}
**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047886) **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Mouse touchpad drawing presses the touchpad click button.** `SetSwipeTouchPad` calls `Controller::SetTouchPad` with `HOST_INPUT_CONTROLLER_ID`. For that ID, `GameController::TouchPad` (`src/libs/controller.cpp`, lines 591-594) sets `PAD_BUTTON_TOUCH_PAD` while `down` is true and clears it on release. Each mouse drag in touchpad mode therefore sends a held touchpad click to the game. Many games open a map or menu on touchpad click, so drawing triggers that action. There is a second effect. Releasing finger 1 clears the click bit even when the Backspace/`TouchPad` binding still holds finger 0. Gamepad drawing does not have this defect because it passes the gamepad ID. Separate "finger contact" from "click button" in the controller API. Leave the click bit unchanged for the swipe finger. <details> <summary>🐛 Proposed fix</summary> ```diff --- "a/src/graphics/presentation/window/hostInput.cpp" +++ "b/src/graphics/presentation/window/hostInput.cpp" @@ -361,9 +361,10 @@ Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 0, down, x, 0.5f); } void SetSwipeTouchPad(bool down, float x, float y) { - Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 1, down, x, y); + Controller::SetTouchPad(Controller::HOST_INPUT_CONTROLLER_ID, 1, down, x, y, + /*press_button=*/false); } void RecordMouseTouchPadPosition(float x, float y) { int width = 0; ``` In `src/libs/controller.cpp` / `controller.h`: ```cpp void SetTouchPad(int id, int finger, bool down, float x, float y, bool press_button = true); // GameController::TouchPad: if (id == HOST_INPUT_CONTROLLER_ID && press_button) { m_state.buttons = down ? m_state.buttons | PAD_BUTTON_TOUCH_PAD : m_state.buttons & ~PAD_BUTTON_TOUCH_PAD; } ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:45f03e9458293cd89a2779b0 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -441,0 +865,4 @@
enabled = !g_mouse_touchpad.enabled;
}
HostInputSetTouchPadMode(enabled);
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · edited 2026-10-16 01:18 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

F6 does nothing while gamepad touchpad mode is active.

GetHostInputTouchPadVisualState().enabled returns true when g_gamepad_touchpad.enabled is true. In that state, F6 or a keyboard TouchPadMode binding calls HostInputSetTouchPadMode(false). That function skips the gamepad disconnect because enabled is false. It then returns early because g_mouse_touchpad.enabled is already false. The key press has no effect. The user cannot switch to mouse touchpad mode until gamepad touchpad mode is turned off.

Base the toggle on the mouse touchpad state only. HostInputSetTouchPadMode(true) already disconnects the gamepad touchpad.

🐛 Proposed fix
--- "a/src/graphics/presentation/window/hostInput.cpp"
+++ "b/src/graphics/presentation/window/hostInput.cpp"
@@ -828,9 +828,14 @@
 	LOGF("Mouse touchpad mode: %s\n", enabled ? "enabled" : "disabled");
 }
 
 void HostInputToggleTouchPadMode() {
-	HostInputSetTouchPadMode(!GetHostInputTouchPadVisualState().enabled);
+	bool mouse_enabled = false;
+	{
+		std::scoped_lock lock(g_touchpad_mutex);
+		mouse_enabled = g_mouse_touchpad.enabled;
+	}
+	HostInputSetTouchPadMode(!mouse_enabled);
 }
 
 void HostInputToggleGamepadTouchPad(int id) {
 	bool mouse_mode = false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

void HostInputToggleTouchPadMode() {
	bool mouse_enabled = false;
	{
		std::scoped_lock lock(g_touchpad_mutex);
		mouse_enabled = g_mouse_touchpad.enabled;
	}
	HostInputSetTouchPadMode(!mouse_enabled);
}

✅ Addressed in commit 5689fd8

**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047893) · edited 2026-10-16 01:18 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **F6 does nothing while gamepad touchpad mode is active.** `GetHostInputTouchPadVisualState().enabled` returns true when `g_gamepad_touchpad.enabled` is true. In that state, F6 or a keyboard `TouchPadMode` binding calls `HostInputSetTouchPadMode(false)`. That function skips the gamepad disconnect because `enabled` is false. It then returns early because `g_mouse_touchpad.enabled` is already false. The key press has no effect. The user cannot switch to mouse touchpad mode until gamepad touchpad mode is turned off. Base the toggle on the mouse touchpad state only. `HostInputSetTouchPadMode(true)` already disconnects the gamepad touchpad. <details> <summary>🐛 Proposed fix</summary> ```diff --- "a/src/graphics/presentation/window/hostInput.cpp" +++ "b/src/graphics/presentation/window/hostInput.cpp" @@ -828,9 +828,14 @@ LOGF("Mouse touchpad mode: %s\n", enabled ? "enabled" : "disabled"); } void HostInputToggleTouchPadMode() { - HostInputSetTouchPadMode(!GetHostInputTouchPadVisualState().enabled); + bool mouse_enabled = false; + { + std::scoped_lock lock(g_touchpad_mutex); + mouse_enabled = g_mouse_touchpad.enabled; + } + HostInputSetTouchPadMode(!mouse_enabled); } void HostInputToggleGamepadTouchPad(int id) { bool mouse_mode = false; ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion void HostInputToggleTouchPadMode() { bool mouse_enabled = false; { std::scoped_lock lock(g_touchpad_mutex); mouse_enabled = g_mouse_touchpad.enabled; } HostInputSetTouchPadMode(!mouse_enabled); } ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:a9247104c04a9d1fcb1fed2d --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 5689fd8
@ -441,0 +895,4 @@
g_gamepad_touchpad.y_axis = stick[1];
g_gamepad_touchpad.last_poll = SDL_GetTicks();
g_gamepad_touchpad.next_poll = g_gamepad_touchpad.last_poll + GAMEPAD_TOUCHPAD_POLL_MS;
g_mouse_touchpad.gesture++;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · edited 2026-10-16 01:18 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Turning on gamepad touchpad mode leaves the game's left stick at its last value.

When gamepad touchpad mode is on, HostInputGamepadAxis takes every left-stick event, so Controller::SetAxis no longer receives them. Enabling the mode does not center LeftX/LeftY. If the user holds the left stick while pressing the toggle, the game keeps that stick value for the whole mode. For example, the character keeps walking while the user moves the cursor.

Center both axes when the mode turns on. Center them again when it turns off, because the axis cache resets to 128.

🐛 Proposed fix
 	if (enabled) {
+		Controller::SetAxis(id, Controller::Axis::LeftX, 128);
+		Controller::SetAxis(id, Controller::Axis::LeftY, 128);
 		if (!SDL_HideCursor()) {

✅ Addressed in commit 5689fd8

**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047905) · edited 2026-10-16 01:18 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Turning on gamepad touchpad mode leaves the game's left stick at its last value.** When gamepad touchpad mode is on, `HostInputGamepadAxis` takes every left-stick event, so `Controller::SetAxis` no longer receives them. Enabling the mode does not center `LeftX`/`LeftY`. If the user holds the left stick while pressing the toggle, the game keeps that stick value for the whole mode. For example, the character keeps walking while the user moves the cursor. Center both axes when the mode turns on. Center them again when it turns off, because the axis cache resets to 128. <details> <summary>🐛 Proposed fix</summary> ```diff if (enabled) { + Controller::SetAxis(id, Controller::Axis::LeftX, 128); + Controller::SetAxis(id, Controller::Axis::LeftY, 128); if (!SDL_HideCursor()) { ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:bb7926af31aebc95c1439fec --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 5689fd8
@ -327,2 +327,4 @@
return 0;
}
if (!stream->speaker &&
SDL_GetGamepadTypeForID(static_cast<SDL_JoystickID>(controller)) != SDL_GAMEPAD_TYPE_PS5) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · edited 2026-10-16 01:18 UTC

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Close an active audio device before switching to rumble.

If a stream has an active DualSense audio device and Queue is next called for a non-PS5 controller, this early branch bypasses RefreshDevice and CloseDevice. The stream retains its old device and routing state until a later transition or Close. Close the old device when entering the rumble path.

✅ Addressed in commit 5689fd8

**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047910) · edited 2026-10-16 01:18 UTC **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** **Close an active audio device before switching to rumble.** If a stream has an active DualSense audio device and `Queue` is next called for a non-PS5 controller, this early branch bypasses `RefreshDevice` and `CloseDevice`. The stream retains its old device and routing state until a later transition or `Close`. Close the old device when entering the rumble path. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:43b945f5809c8f7ce5ac119b --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 5689fd8
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · edited 2026-10-16 01:18 UTC
On src/libs/dualSenseHaptics.cpp line 340 (outdated):

@@ -326,6 +326,31 @@ uint64_t Queue(Stream* stream, int controller, const void* data, uint32_t frames
 	if (frames == 0) {
 		return 0;
 	}
+	if (!stream->speaker &&
+	    SDL_GetGamepadTypeForID(static_cast<SDL_JoystickID>(controller)) != SDL_GAMEPAD_TYPE_PS5) {
+		// Non-DualSense pads have no haptic audio path: approximate it with the rumble motors.
+		float peak[2] = {0.0f, 0.0f};
+		for (uint32_t frame = 0; frame < frames; frame++) {
+			for (uint32_t ch = 0; ch < 2; ch++) {
+				const auto src_ch = channels == 1 ? 0 : ch;
+				const auto index  = (static_cast<size_t>(first_frame) + frame) * channels + src_ch;
+				float      value  = is_float ? static_cast<const float*>(data)[index]
+				                             : static_cast<const int16_t*>(data)[index] / 32768.0f;
+				value *= volume[src_ch] / 32768.0f * gain;
+				peak[ch] = std::max(peak[ch], std::fabs(value));

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply per-channel gains to rumble peaks.

When gains is non-null, this branch omits gains[src_ch]. The DualSense audio path applies it at Line 385. As a result, a muted channel can still drive a rumble motor. Apply the same gain before measuring each peak.

✅ Addressed in commit 5689fd8

**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#discussion_r4289047918) · edited 2026-10-16 01:18 UTC On `src/libs/dualSenseHaptics.cpp` line 340 (outdated): ```diff @@ -326,6 +326,31 @@ uint64_t Queue(Stream* stream, int controller, const void* data, uint32_t frames if (frames == 0) { return 0; } + if (!stream->speaker && + SDL_GetGamepadTypeForID(static_cast<SDL_JoystickID>(controller)) != SDL_GAMEPAD_TYPE_PS5) { + // Non-DualSense pads have no haptic audio path: approximate it with the rumble motors. + float peak[2] = {0.0f, 0.0f}; + for (uint32_t frame = 0; frame < frames; frame++) { + for (uint32_t ch = 0; ch < 2; ch++) { + const auto src_ch = channels == 1 ? 0 : ch; + const auto index = (static_cast<size_t>(first_frame) + frame) * channels + src_ch; + float value = is_float ? static_cast<const float*>(data)[index] + : static_cast<const int16_t*>(data)[index] / 32768.0f; + value *= volume[src_ch] / 32768.0f * gain; + peak[ch] = std::max(peak[ch], std::fabs(value)); ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Apply per-channel gains to rumble peaks.** When `gains` is non-null, this branch omits `gains[src_ch]`. The DualSense audio path applies it at Line 385. As a result, a muted channel can still drive a rumble motor. Apply the same gain before measuring each peak. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:2eaf7e7e98501ec3fb54788a --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 5689fd8
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-15 22:47 UTC · original · reviewed

Actionable comments posted: 7


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fdd101a3-ee19-45f7-8bc1-67e09c0974d6
📥 Commits

Reviewing files that changed from the base of the PR and between 9e41d8320a and b9c69dcadd.

⛔ Files ignored due to path filters: 2
  • assets/cursors/drawing.png is excluded by !**/*.png
  • assets/cursors/hand.png is excluded by !**/*.png
📒 Files selected for processing: 12
  • CMakeLists.txt
  • src/graphics/presentation/systemOverlay.cpp
  • src/graphics/presentation/window/hostInput.cpp
  • src/graphics/presentation/window/hostInput.h
  • src/graphics/presentation/window/window.cpp
  • src/launcher/include/controllerPreview.h
  • src/launcher/include/inputMappingDialog.h
  • src/launcher/src/controllerPreview.cpp
  • src/launcher/src/inputMappingDialog.cpp
  • src/libs/controller.cpp
  • src/libs/controller.h
  • src/libs/dualSenseHaptics.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-15 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#pullrequestreview-5540853827) · **reviewed** **Actionable comments posted: 7** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `fdd101a3-ee19-45f7-8bc1-67e09c0974d6` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9e41d8320a2774b303fbad344c2347e8d0292e83 and b9c69dcadd28d131a6435ccfadd2cb14e18a29b4. </details> <details> <summary>⛔ Files ignored due to path filters: 2</summary> * `assets/cursors/drawing.png` is excluded by `!**/*.png` * `assets/cursors/hand.png` is excluded by `!**/*.png` </details> <details> <summary>📒 Files selected for processing: 12</summary> * `CMakeLists.txt` * `src/graphics/presentation/systemOverlay.cpp` * `src/graphics/presentation/window/hostInput.cpp` * `src/graphics/presentation/window/hostInput.h` * `src/graphics/presentation/window/window.cpp` * `src/launcher/include/controllerPreview.h` * `src/launcher/include/inputMappingDialog.h` * `src/launcher/src/controllerPreview.cpp` * `src/launcher/src/inputMappingDialog.cpp` * `src/libs/controller.cpp` * `src/libs/controller.h` * `src/libs/dualSenseHaptics.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=61cde2ab-8f19-4548-9d2b-6bd4e6bed040 attempt=755e74e8-9ddc-4f11-8ad5-3c1eca783904 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 01:24 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Do not activate a mapped control when a mouse stroke starts. · window.cpp:251-253

src/graphics/presentation/window/window.cpp:251-253
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not activate a mapped control when a mouse stroke starts.

If Mouse:Left maps to Cross, a left-button press in mouse touchpad mode calls both HostInputMouseButton and HostInputMouseTouchPad. Drawing then presses Cross in the game. Suppress the mapped left-button press during mouse touchpad mode. Continue forwarding releases so a button pressed before mode entry can clear.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97830015-b87b-480c-b2b9-888381fa1c12
📥 Commits

Reviewing files that changed from the base of the PR and between b9c69dcadd and 5689fd8c7f.

📒 Files selected for processing: 11
  • .github/workflows/build.yml
  • CMakeLists.txt
  • src/graphics/presentation/systemOverlay.cpp
  • src/graphics/presentation/window/hostInput.cpp
  • src/graphics/presentation/window/hostInput.h
  • src/graphics/presentation/window/window.cpp
  • src/launcher/CMakeLists.txt
  • src/launcher/src/inputMappingDialog.cpp
  • src/libs/dualSenseHaptics.cpp
  • tests/HostInputTests.cpp
  • tests/PadHapticsTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 01:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1541#pullrequestreview-5541889848) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟡 Minor</strong> · Do not activate a mapped control when a mouse stroke starts. · <code>window.cpp:251-253</code></summary><blockquote> > > `src/graphics/presentation/window/window.cpp:251-253` > **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** > > **Do not activate a mapped control when a mouse stroke starts.** > > If `Mouse:Left` maps to `Cross`, a left-button press in mouse touchpad mode calls both `HostInputMouseButton` and `HostInputMouseTouchPad`. Drawing then presses `Cross` in the game. Suppress the mapped left-button **press** during mouse touchpad mode. Continue forwarding releases so a button pressed before mode entry can clear. > > <!-- cr-comment:v1:ba8ae19f29d07a70b6bf206c --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `97830015-b87b-480c-b2b9-888381fa1c12` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between b9c69dcadd28d131a6435ccfadd2cb14e18a29b4 and 5689fd8c7fa7b31361441f5acedb661e57922145. </details> <details> <summary>📒 Files selected for processing: 11</summary> * `.github/workflows/build.yml` * `CMakeLists.txt` * `src/graphics/presentation/systemOverlay.cpp` * `src/graphics/presentation/window/hostInput.cpp` * `src/graphics/presentation/window/hostInput.h` * `src/graphics/presentation/window/window.cpp` * `src/launcher/CMakeLists.txt` * `src/launcher/src/inputMappingDialog.cpp` * `src/libs/dualSenseHaptics.cpp` * `tests/HostInputTests.cpp` * `tests/PadHapticsTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=5d1e6a7a-d66b-423e-a879-d94f7dfccc00 attempt=cdbc91d5-a0fc-4250-824c-d31aec4501eb batch=1/1 -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.