Fix/trigger effect state #1132

Manually merged
github merged 7 commits from gh-pr/1132/head into gh-pr/1132/base 2026-11-26 09:44:24 +00:00
Owner

@⁠Jetsku on GitHub · 2026-10-07 07:29 UTC · original
Jetsku:fix/trigger-effect-state → main · +249 −21 · 4 files · 7 commits · merged 2026-10-08 12:00 UTC

Pad: report the adaptive trigger effect state (scePadGetTriggerEffectState)

What

scePadGetTriggerEffectState always returned 0 for both triggers. Games that set an adaptive-trigger effect and then
wait for its state before acting on L2/R2 never saw the state change:

  • Astro Bot (PPSA21567 1.018): in some levels L2/R2 actions (e.g. punches) did nothing.
  • Astro's Playroom (PPSA01325): the gacha capsules did not break on R2, and once the state was reported the gun
    could fire by itself from an untouched trigger.

How

The reported state now follows from the game's last trigger effect per trigger (Kyty already keeps it for the
DualSense output) and the trigger's travel (0..255 over the effect's ten positions):

  • feedback: no force / pushing;
  • weapon: not / almost / fully pressed;
  • vibration: not firing / firing;

using the values 1..7 that duaLib (WujekFoliarz/duaLib) reads from a DualSense input report. SDL does not expose that
report, so this is an approximation based on the effect and the travel. It also works with other pads and the
keyboard, where a digital L2/R2 counts as full travel. The trigger intensity setting only changes the output, not the
reported state.

Feedback (modes 1, 4, 5) and vibration (modes 3, 6) states require some travel (>= 8 of 255), so an effect starting at
position 0 does not report "pushing" or "firing" on an untouched trigger.

Commits:

  1. Pad: report the adaptive trigger state instead of always 0
  2. tests: controller_settings covers scePadGetTriggerEffectState
  3. Pad: a feedback trigger reports pushing only while it is pressed
  4. Pad: a vibration trigger reports firing only while it is pressed

Testing

  • Unit tests: controller_settings (tests/ControllerSettingsTests.cpp) covers feedback, weapon and vibration states
    across the trigger travel, a trigger without an effect, a masked update keeping the other trigger's effect, and the
    intensity setting leaving the reported state unchanged.
  • In game:
    • Astro Bot (PPSA21567 1.018): the L2/R2 actions that did nothing now work.
    • Astro's Playroom (PPSA01325): the gacha capsules break on R2 again, and the gun no longer fires by itself.

AI use

This change was developed with an AI coding assistant (Claude Code). Scope of the AI involvement:

  • The AI wrote the code changes, the unit tests and the commit messages, and drafted this description, under my
    direction (I reported the in-game problems and decided what should change).
  • I reviewed the diff and understand the change.
  • Verification before submission: the unit tests above pass, and the fix was tested in game as listed under
    Testing. I was able to play astrobot correctly and many others through my fork and there haven't been any reports as regressions from others.

I acknowledge that the project asks for pull-request descriptions to come from the human contributor rather than an AI
agent; this description was drafted with AI help and then reviewed and edited by me, and I take responsibility for the
code and its correctness.

**@⁠Jetsku** on GitHub · 2026-10-07 07:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132) `Jetsku:fix/trigger-effect-state` → `main` · +249 −21 · 4 files · 7 commits · merged 2026-10-08 12:00 UTC # Pad: report the adaptive trigger effect state (scePadGetTriggerEffectState) ## What `scePadGetTriggerEffectState` always returned 0 for both triggers. Games that set an adaptive-trigger effect and then wait for its state before acting on L2/R2 never saw the state change: - **Astro Bot (PPSA21567 1.018):** in some levels L2/R2 actions (e.g. punches) did nothing. - **Astro's Playroom (PPSA01325):** the gacha capsules did not break on R2, and once the state was reported the gun could fire by itself from an untouched trigger. ## How The reported state now follows from the game's last trigger effect per trigger (Kyty already keeps it for the DualSense output) and the trigger's travel (0..255 over the effect's ten positions): - feedback: no force / pushing; - weapon: not / almost / fully pressed; - vibration: not firing / firing; using the values 1..7 that duaLib (WujekFoliarz/duaLib) reads from a DualSense input report. SDL does not expose that report, so this is an approximation based on the effect and the travel. It also works with other pads and the keyboard, where a digital L2/R2 counts as full travel. The trigger intensity setting only changes the output, not the reported state. Feedback (modes 1, 4, 5) and vibration (modes 3, 6) states require some travel (>= 8 of 255), so an effect starting at position 0 does not report "pushing" or "firing" on an untouched trigger. Commits: 1. Pad: report the adaptive trigger state instead of always 0 2. tests: controller_settings covers scePadGetTriggerEffectState 3. Pad: a feedback trigger reports pushing only while it is pressed 4. Pad: a vibration trigger reports firing only while it is pressed ## Testing - **Unit tests:** `controller_settings` (tests/ControllerSettingsTests.cpp) covers feedback, weapon and vibration states across the trigger travel, a trigger without an effect, a masked update keeping the other trigger's effect, and the intensity setting leaving the reported state unchanged. <!-- EDIT: confirm it passes on the current upstream main --> - **In game:** - Astro Bot (PPSA21567 1.018): the L2/R2 actions that did nothing now work. <!-- EDIT: who tested, which levels --> - Astro's Playroom (PPSA01325): the gacha capsules break on R2 again, and the gun no longer fires by itself. <!-- EDIT: who tested --> ## AI use This change was developed with an AI coding assistant (Claude Code). Scope of the AI involvement: - The AI wrote the code changes, the unit tests and the commit messages, and drafted this description, under my direction (I reported the in-game problems and decided what should change). - I reviewed the diff and understand the change. - Verification before submission: the unit tests above pass, and the fix was tested in game as listed under Testing. I was able to play astrobot correctly and many others through my fork and there haven't been any reports as regressions from others. I acknowledge that the project asks for pull-request descriptions to come from the human contributor rather than an AI agent; this description was drafted with AI help and then reviewed and edited by me, and I take responsibility for the code and its correctness.
scePadGetTriggerEffectState returned 0 for both triggers. Games that wait for
the state of the trigger effect they set before acting on L2/R2 never saw it
change; in Astro Bot, L2/R2 actions such as punches did nothing in some levels.

The state now follows from the game's last effect per trigger (already kept
for the DualSense output) and the trigger's travel, 0..255 over the effect's
ten positions: feedback no force / pushing, weapon not / almost / fully
pressed, vibration not firing / firing, with the values 1..7 that duaLib
(WujekFoliarz/duaLib) reads from a DualSense input report. SDL does not expose
that report, so this is an approximation; it also works with other pads and
the keyboard, where a digital L2/R2 is full travel. The trigger intensity
setting changes only the output, not the reported state.

Tested in Astro Bot (PPSA21567 1.018) by a player in the levels where the
triggers did nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Feedback, weapon and vibration states across the trigger travel, a trigger without an effect, a masked update keeping the other trigger's effect, and the intensity setting leaving the reported state unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A feedback effect from position 0 reported FEEDBACK_IS_PUSHING on an untouched trigger, so a game waiting for the change from no force to pushing never saw it. In Astro's Playroom the gacha capsules did not break on R2. Feedback states (modes 1, 4, 5) now need some travel (>= 8 of 255). Tested in Astro's Playroom (PPSA01325): the capsules break on R2 again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A vibration effect from position 0 reported VIBRATION_IS_FIRING on an untouched trigger; in Astro's Playroom the gun fired by itself. Vibration states (modes 3 and 6) now need some travel, as the feedback states do. Tested in Astro's Playroom.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scePadGetTriggerEffectState ignored its handle and returned pad 1's state for any handle. It now returns
SCE_PAD_ERROR_INVALID_HANDLE (0x80920003) for handles other than 1, like the other pad queries in libPad.cpp
and duaLib.

controller_settings now also covers multiple-position feedback (mode 4: pushes only at positions with a
strength), slope feedback (mode 5: pushes from its start position, not on an untouched trigger) and
multiple-position vibration (mode 6: fires only at positions with an amplitude and a frequency).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A null state returned 0x80960005, which is SCE_USER_SERVICE_ERROR_INVALID_ARGUMENT,
not a pad error; libScePad's code is SCE_PAD_ERROR_INVALID_ARG (0x80920001), as
scePadSetTriggerEffect returns. The call now lives with the other pad calls in
controller.cpp so controller_settings tests its handle and argument checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:44:23 +00:00
github manually merged commit 912ef339af into gh-pr/1132/base 2026-11-26 09:44:24 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-07 07:32 UTC · original · edited 2026-10-07 12:59 UTC

Review in Change Stack →

📝 Walkthrough

Walkthrough

The controller calculates each trigger’s effect state from its command, input position, and previous state. It updates these states when trigger axes change, input resets, the active controller changes, or an effect is set. PadGetTriggerEffectState validates the handle and output pointer before returning both states. The export now uses the controller implementation. Tests cover validation, effect modes, thresholds, resets, and controller switching.

Suggested reviewers: cosmo, mehmetcambaz

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to 912ef

Some games may see an active trigger effect while the trigger is at rest or barely pressed. Correct the threshold and its tests before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the trigger-effect state fix, which is the main change in the pull request.
Description check ✅ Passed The description explains the trigger-state behavior, implementation approach, affected games, and reported testing. It is related to 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.
  • 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-07 07:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#issuecomment-6033190755) · edited 2026-10-07 12:59 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/1132?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 The controller calculates each trigger’s effect state from its command, input position, and previous state. It updates these states when trigger axes change, input resets, the active controller changes, or an effect is set. `PadGetTriggerEffectState` validates the handle and output pointer before returning both states. The export now uses the controller implementation. Tests cover validation, effect modes, thresholds, resets, and controller switching. **Suggested reviewers:** `cosmo`, `mehmetcambaz` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"912ef339af9de5293623803d112348a0c19e7288" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🔵 Low_ · up to `912ef` <!-- final_review_risk_coverage:{"sourceCommitId":"912ef339af9de5293623803d112348a0c19e7288","coveredCommitId":"912ef339af9de5293623803d112348a0c19e7288","kind":"reviewed"} --> Some games may see an active trigger effect while the trigger is at rest or barely pressed. Correct the threshold and its tests before merging. <!-- 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 4.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 4 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title identifies the trigger-effect state fix, which is the main change in the pull request. | | Description check | ✅ Passed | The description explains the trigger-state behavior, implementation approach, affected games, and reported testing. It is related to 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. | </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=1132)! 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 -->
Author
Owner

@⁠Copilot on GitHub · 2026-10-07 07:32 UTC · original
On src/libs/libPad.cpp line 39 (outdated):

@@ -36,8 +36,7 @@ static int KYTY_SYSV_ABI PadGetTriggerEffectState(int
 		return -2137653243; /* 0x80960005 */
 	}
 
-	info->state[0] = 0;
-	info->state[1] = 0;
+	Controller::GetTriggerEffectState(info->state);

The supplied handle is still ignored, so this now returns success and handle 1's live trigger state even for an invalid handle. Other pad queries reject handles other than 1, and the referenced duaLib implementation also returns SCE_PAD_ERROR_INVALID_HANDLE; validate the handle before reading the controller state.

**@⁠Copilot** on GitHub · 2026-10-07 07:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#discussion_r4204239461) On `src/libs/libPad.cpp` line 39 (outdated): ```diff @@ -36,8 +36,7 @@ static int KYTY_SYSV_ABI PadGetTriggerEffectState(int return -2137653243; /* 0x80960005 */ } - info->state[0] = 0; - info->state[1] = 0; + Controller::GetTriggerEffectState(info->state); ``` The supplied handle is still ignored, so this now returns success and handle 1's live trigger state even for an invalid handle. Other pad queries reject handles other than 1, and the referenced duaLib implementation also returns `SCE_PAD_ERROR_INVALID_HANDLE`; validate the handle before reading the controller state.
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-10-07 07:32 UTC · original · reviewed

Copilot review overview

Invalid handles expose the active controller state, and several new effect-mode branches lack coverage.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Implements adaptive-trigger state reporting based on configured effects and trigger travel.

Changes:

  • Derives feedback, weapon, and vibration states.
  • Preserves masked trigger effects and intensity-independent reporting.
  • Adds controller-state tests.
File Description
src/​libs/​controller.cpp Computes and returns trigger states.
src/​libs/​controller.h Declares the state-query API.
src/​libs/​libPad.cpp Connects the exported pad function.
tests/​ControllerSettingsTests.cpp Tests trigger-state transitions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-10-07 07:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#pullrequestreview-5439037627) · **reviewed** <!-- ccr-overview-v2 --> ## Copilot review overview ### 🟡 Changes recommended Invalid handles expose the active controller state, and several new effect-mode branches lack coverage. **Review effort:** Balanced **Findings:** 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> · 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> <details open> <summary><strong>Open (2)</strong></summary> - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Validate handle before reading controller state](#discussion_r4204239461) · New - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Add tests for multi-position and slope feedback boundaries](#discussion_r4204239527) · New </details> <details> <summary><strong>What changed in this PR</strong></summary> Implements adaptive-trigger state reporting based on configured effects and trigger travel. **Changes:** - Derives feedback, weapon, and vibration states. - Preserves masked trigger effects and intensity-independent reporting. - Adds controller-state tests. | File | Description | | ---- | ----------- | | `src/​libs/​controller.cpp` | Computes and returns trigger states. | | `src/​libs/​controller.h` | Declares the state-query API. | | `src/​libs/​libPad.cpp` | Connects the exported pad function. | | `tests/​ControllerSettingsTests.cpp` | Tests trigger-state transitions. | </details> --- 💡 <a href="/KytyPS5/KytyPS5/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a `code-review` agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
Author
Owner

@⁠Copilot on GitHub · 2026-10-07 07:32 UTC · original
On src/libs/controller.cpp line 376 (outdated):

@@ -330,6 +331,67 @@ static bool trigger_effect_to_dualsense(const PadTriggerEffectCommand& command,
 	}
 }
 
+// scePadGetTriggerEffectState values (libScePad; duaLib names them SCE_PAD_TRIGGER_STATE_*).
+enum TriggerState : int32_t {
+	TRIGGER_STATE_FEEDBACK_NO_FORCE     = 1,
+	TRIGGER_STATE_FEEDBACK_IS_PUSHING   = 2,
+	TRIGGER_STATE_WEAPON_NOT_PRESSED    = 3,
+	TRIGGER_STATE_WEAPON_ALMOST_PRESSED = 4,
+	TRIGGER_STATE_WEAPON_FULLY_PRESSED  = 5,
+	TRIGGER_STATE_VIBRATION_NOT_FIRING  = 6,
+	TRIGGER_STATE_VIBRATION_IS_FIRING   = 7,
+};
+
+// A real DualSense reports which effect runs and where the trigger is against it. Without that
+// report (SDL does not expose it, and other pads have no trigger motors) the state follows from the
+// game's effect and the trigger's travel: 0..255 maps to the effect's ten positions 0..9. Games
+// such as Astro Bot wait for the weapon or feedback state before acting on L2/R2; the state
+// stayed 0 before, so those actions never happened.
+// Travel below which a trigger counts as released (analog rest noise).
+constexpr int TRIGGER_PRESSED_MIN = 8;
+
+int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value) {
+	const int pos = std::clamp(value, 0, 255) * 10 / 256;
+	// A feedback trigger pushes, and a vibration trigger fires, only while it is pressed: an effect from
+	// position 0 on an untouched trigger is "no force" (Astro's Playroom waits for the change).
+	const bool pressed = value >= TRIGGER_PRESSED_MIN;
+	switch (command.mode) {
+		case 1: // feedback: resistance from position data[0], strength data[1]
+			return pressed && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING
+			                                                      : TRIGGER_STATE_FEEDBACK_NO_FORCE;
+		case 2: // weapon: resistance from data[0], released at data[1]
+			if (pos >= command.data[1]) {
+				return TRIGGER_STATE_WEAPON_FULLY_PRESSED;
+			}
+			return pos >= command.data[0] ? TRIGGER_STATE_WEAPON_ALMOST_PRESSED
+			                              : TRIGGER_STATE_WEAPON_NOT_PRESSED;
+		case 3: // vibration from position data[0], amplitude data[1], frequency data[2]
+			return pressed && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0]
+			           ? TRIGGER_STATE_VIBRATION_IS_FIRING
+			           : TRIGGER_STATE_VIBRATION_NOT_FIRING;
+		case 4: // multiple-position feedback: strength per position
+			return pressed && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_IS_PUSHING
+			                              : TRIGGER_STATE_FEEDBACK_NO_FORCE;
+		case 5: // slope feedback from position data[0]
+			return pressed && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING

The new multi-position and slope feedback branches are not exercised by the added tests, which only send feedback mode 1. Please add boundary cases for the current-position lookup and slope start threshold so these distinct calculations are covered.

This issue also appears on line 378 of the same file.

**@⁠Copilot** on GitHub · 2026-10-07 07:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#discussion_r4204239527) On `src/libs/controller.cpp` line 376 (outdated): ```diff @@ -330,6 +331,67 @@ static bool trigger_effect_to_dualsense(const PadTriggerEffectCommand& command, } } +// scePadGetTriggerEffectState values (libScePad; duaLib names them SCE_PAD_TRIGGER_STATE_*). +enum TriggerState : int32_t { + TRIGGER_STATE_FEEDBACK_NO_FORCE = 1, + TRIGGER_STATE_FEEDBACK_IS_PUSHING = 2, + TRIGGER_STATE_WEAPON_NOT_PRESSED = 3, + TRIGGER_STATE_WEAPON_ALMOST_PRESSED = 4, + TRIGGER_STATE_WEAPON_FULLY_PRESSED = 5, + TRIGGER_STATE_VIBRATION_NOT_FIRING = 6, + TRIGGER_STATE_VIBRATION_IS_FIRING = 7, +}; + +// A real DualSense reports which effect runs and where the trigger is against it. Without that +// report (SDL does not expose it, and other pads have no trigger motors) the state follows from the +// game's effect and the trigger's travel: 0..255 maps to the effect's ten positions 0..9. Games +// such as Astro Bot wait for the weapon or feedback state before acting on L2/R2; the state +// stayed 0 before, so those actions never happened. +// Travel below which a trigger counts as released (analog rest noise). +constexpr int TRIGGER_PRESSED_MIN = 8; + +int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value) { + const int pos = std::clamp(value, 0, 255) * 10 / 256; + // A feedback trigger pushes, and a vibration trigger fires, only while it is pressed: an effect from + // position 0 on an untouched trigger is "no force" (Astro's Playroom waits for the change). + const bool pressed = value >= TRIGGER_PRESSED_MIN; + switch (command.mode) { + case 1: // feedback: resistance from position data[0], strength data[1] + return pressed && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING + : TRIGGER_STATE_FEEDBACK_NO_FORCE; + case 2: // weapon: resistance from data[0], released at data[1] + if (pos >= command.data[1]) { + return TRIGGER_STATE_WEAPON_FULLY_PRESSED; + } + return pos >= command.data[0] ? TRIGGER_STATE_WEAPON_ALMOST_PRESSED + : TRIGGER_STATE_WEAPON_NOT_PRESSED; + case 3: // vibration from position data[0], amplitude data[1], frequency data[2] + return pressed && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0] + ? TRIGGER_STATE_VIBRATION_IS_FIRING + : TRIGGER_STATE_VIBRATION_NOT_FIRING; + case 4: // multiple-position feedback: strength per position + return pressed && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_IS_PUSHING + : TRIGGER_STATE_FEEDBACK_NO_FORCE; + case 5: // slope feedback from position data[0] + return pressed && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING ``` The new multi-position and slope feedback branches are not exercised by the added tests, which only send feedback mode 1. Please add boundary cases for the current-position lookup and slope start threshold so these distinct calculations are covered. This issue also appears on line 378 of the same file.
Author
Owner

@⁠Jetsku on GitHub · 2026-10-07 07:50 UTC · original
On src/libs/libPad.cpp line 39 (outdated):

@@ -36,8 +36,7 @@ static int KYTY_SYSV_ABI PadGetTriggerEffectState(int
 		return -2137653243; /* 0x80960005 */
 	}
 
-	info->state[0] = 0;
-	info->state[1] = 0;
+	Controller::GetTriggerEffectState(info->state);

Fixed in 23405a5

**@⁠Jetsku** on GitHub · 2026-10-07 07:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#discussion_r4204384154) On `src/libs/libPad.cpp` line 39 (outdated): ```diff @@ -36,8 +36,7 @@ static int KYTY_SYSV_ABI PadGetTriggerEffectState(int return -2137653243; /* 0x80960005 */ } - info->state[0] = 0; - info->state[1] = 0; + Controller::GetTriggerEffectState(info->state); ``` Fixed in 23405a5
Author
Owner

@⁠Jetsku on GitHub · 2026-10-07 07:50 UTC · original
On src/libs/controller.cpp line 376 (outdated):

@@ -330,6 +331,67 @@ static bool trigger_effect_to_dualsense(const PadTriggerEffectCommand& command,
 	}
 }
 
+// scePadGetTriggerEffectState values (libScePad; duaLib names them SCE_PAD_TRIGGER_STATE_*).
+enum TriggerState : int32_t {
+	TRIGGER_STATE_FEEDBACK_NO_FORCE     = 1,
+	TRIGGER_STATE_FEEDBACK_IS_PUSHING   = 2,
+	TRIGGER_STATE_WEAPON_NOT_PRESSED    = 3,
+	TRIGGER_STATE_WEAPON_ALMOST_PRESSED = 4,
+	TRIGGER_STATE_WEAPON_FULLY_PRESSED  = 5,
+	TRIGGER_STATE_VIBRATION_NOT_FIRING  = 6,
+	TRIGGER_STATE_VIBRATION_IS_FIRING   = 7,
+};
+
+// A real DualSense reports which effect runs and where the trigger is against it. Without that
+// report (SDL does not expose it, and other pads have no trigger motors) the state follows from the
+// game's effect and the trigger's travel: 0..255 maps to the effect's ten positions 0..9. Games
+// such as Astro Bot wait for the weapon or feedback state before acting on L2/R2; the state
+// stayed 0 before, so those actions never happened.
+// Travel below which a trigger counts as released (analog rest noise).
+constexpr int TRIGGER_PRESSED_MIN = 8;
+
+int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value) {
+	const int pos = std::clamp(value, 0, 255) * 10 / 256;
+	// A feedback trigger pushes, and a vibration trigger fires, only while it is pressed: an effect from
+	// position 0 on an untouched trigger is "no force" (Astro's Playroom waits for the change).
+	const bool pressed = value >= TRIGGER_PRESSED_MIN;
+	switch (command.mode) {
+		case 1: // feedback: resistance from position data[0], strength data[1]
+			return pressed && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING
+			                                                      : TRIGGER_STATE_FEEDBACK_NO_FORCE;
+		case 2: // weapon: resistance from data[0], released at data[1]
+			if (pos >= command.data[1]) {
+				return TRIGGER_STATE_WEAPON_FULLY_PRESSED;
+			}
+			return pos >= command.data[0] ? TRIGGER_STATE_WEAPON_ALMOST_PRESSED
+			                              : TRIGGER_STATE_WEAPON_NOT_PRESSED;
+		case 3: // vibration from position data[0], amplitude data[1], frequency data[2]
+			return pressed && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0]
+			           ? TRIGGER_STATE_VIBRATION_IS_FIRING
+			           : TRIGGER_STATE_VIBRATION_NOT_FIRING;
+		case 4: // multiple-position feedback: strength per position
+			return pressed && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_IS_PUSHING
+			                              : TRIGGER_STATE_FEEDBACK_NO_FORCE;
+		case 5: // slope feedback from position data[0]
+			return pressed && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING

Fixed in 23405a5

**@⁠Jetsku** on GitHub · 2026-10-07 07:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#discussion_r4204384761) On `src/libs/controller.cpp` line 376 (outdated): ```diff @@ -330,6 +331,67 @@ static bool trigger_effect_to_dualsense(const PadTriggerEffectCommand& command, } } +// scePadGetTriggerEffectState values (libScePad; duaLib names them SCE_PAD_TRIGGER_STATE_*). +enum TriggerState : int32_t { + TRIGGER_STATE_FEEDBACK_NO_FORCE = 1, + TRIGGER_STATE_FEEDBACK_IS_PUSHING = 2, + TRIGGER_STATE_WEAPON_NOT_PRESSED = 3, + TRIGGER_STATE_WEAPON_ALMOST_PRESSED = 4, + TRIGGER_STATE_WEAPON_FULLY_PRESSED = 5, + TRIGGER_STATE_VIBRATION_NOT_FIRING = 6, + TRIGGER_STATE_VIBRATION_IS_FIRING = 7, +}; + +// A real DualSense reports which effect runs and where the trigger is against it. Without that +// report (SDL does not expose it, and other pads have no trigger motors) the state follows from the +// game's effect and the trigger's travel: 0..255 maps to the effect's ten positions 0..9. Games +// such as Astro Bot wait for the weapon or feedback state before acting on L2/R2; the state +// stayed 0 before, so those actions never happened. +// Travel below which a trigger counts as released (analog rest noise). +constexpr int TRIGGER_PRESSED_MIN = 8; + +int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value) { + const int pos = std::clamp(value, 0, 255) * 10 / 256; + // A feedback trigger pushes, and a vibration trigger fires, only while it is pressed: an effect from + // position 0 on an untouched trigger is "no force" (Astro's Playroom waits for the change). + const bool pressed = value >= TRIGGER_PRESSED_MIN; + switch (command.mode) { + case 1: // feedback: resistance from position data[0], strength data[1] + return pressed && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING + : TRIGGER_STATE_FEEDBACK_NO_FORCE; + case 2: // weapon: resistance from data[0], released at data[1] + if (pos >= command.data[1]) { + return TRIGGER_STATE_WEAPON_FULLY_PRESSED; + } + return pos >= command.data[0] ? TRIGGER_STATE_WEAPON_ALMOST_PRESSED + : TRIGGER_STATE_WEAPON_NOT_PRESSED; + case 3: // vibration from position data[0], amplitude data[1], frequency data[2] + return pressed && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0] + ? TRIGGER_STATE_VIBRATION_IS_FIRING + : TRIGGER_STATE_VIBRATION_NOT_FIRING; + case 4: // multiple-position feedback: strength per position + return pressed && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_IS_PUSHING + : TRIGGER_STATE_FEEDBACK_NO_FORCE; + case 5: // slope feedback from position data[0] + return pressed && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_IS_PUSHING ``` Fixed in 23405a5
Author
Owner

@⁠Nmzik on GitHub · 2026-10-07 12:52 UTC · original

@⁠Jetsku Thank you! Please re-test

**@⁠Nmzik** on GitHub · 2026-10-07 12:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#issuecomment-6038313526) @⁠Jetsku Thank you! Please re-test
@ -333,0 +379,4 @@
return command.data[0] != 0 && command.data[1 + pos] != 0
? TRIGGER_STATE_VIBRATION_ACTIVE
: TRIGGER_STATE_VIBRATION_STANDBY;
default: return TRIGGER_STATE_OFF;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-07 12:59 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '235,340p' src/libs/controller.cpp
sed -n '340,385p' src/libs/controller.cpp
sed -n '390,480p' tests/ControllerSettingsTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 9734


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- PR diff summary ---'
git diff --stat 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288
printf '%s\n' '--- State API and conversion diff ---'
git diff -U12 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 -- src/libs/controller.cpp tests/ControllerSettingsTests.cpp | sed -n '1,320p'
printf '%s\n' '--- State API references/contracts ---'
rg -n -i 'TriggerEffectState|TRIGGER_STATE|trigger state|minimum.*(travel|position)|8/255|trigger.*dead.?zone' src tests docs include 2>/dev/null || test "$?" -eq 1
printf '%s\n' '--- Test setup around state assertions ---'
sed -n '300,435p' tests/ControllerSettingsTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 21825


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- PR diff summary ---'
git diff --stat 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288
printf '%s\n' '--- State API and conversion diff ---'
git diff -U12 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 -- src/libs/controller.cpp tests/ControllerSettingsTests.cpp | sed -n '1,320p'
printf '%s\n' '--- State API and threshold references ---'
rg -n -i 'TriggerEffectState|TRIGGER_STATE|trigger state|minimum.*(travel|position)|8/255|trigger.*dead.?zone' src tests docs include 2>/dev/null || test "$?" -eq 1
printf '%s\n' '--- Test setup around state assertions ---'
sed -n '300,435p' tests/ControllerSettingsTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 21829


Enforce the 8/255 floor in reported trigger states.

For modes 1, 3, 4, 5, and 6, TriggerEffectState can return an active state at travel values 0–7. PadGetTriggerEffectState exposes that result, contrary to E1’s minimum. Gate these active branches on value >= 8 and update the low-travel tests to expect standby.

 		case 1: // feedback: resistance from position data[0], strength data[1]
-			return command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE
+			return value >= 8 && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE
 			                                                      : TRIGGER_STATE_FEEDBACK_STANDBY;
@@
 		case 3: // vibration from position data[0], amplitude data[1], frequency data[2]
-			return command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0]
+			return value >= 8 && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0]
 			           ? TRIGGER_STATE_VIBRATION_ACTIVE
 			           : TRIGGER_STATE_VIBRATION_STANDBY;
 		case 4: // multiple-position feedback: strength per position
-			return command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE
+			return value >= 8 && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE
 			                              : TRIGGER_STATE_FEEDBACK_STANDBY;
 		case 5: // slope feedback between data[0] and data[1]
-			return pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE
+			return value >= 8 && pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE
 			                                                       : TRIGGER_STATE_FEEDBACK_STANDBY;
 		case 6: // multiple-position vibration: frequency data[0], amplitude per position
-			return command.data[0] != 0 && command.data[1 + pos] != 0
+			return value >= 8 && command.data[0] != 0 && command.data[1 + pos] != 0
 			           ? TRIGGER_STATE_VIBRATION_ACTIVE
 			           : TRIGGER_STATE_VIBRATION_STANDBY;
📝 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.

static int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value,
                                  int32_t previous) {
	// Trigger positions use nonuniform travel ranges, with endpoints at 0 and 255.
	const int pos = value == 0 ? 0 : value == 255 ? 9 : 1 + value / 32;
	switch (command.mode) {
		case 1: // feedback: resistance from position data[0], strength data[1]
			return value >= 8 && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE
			                                                      : TRIGGER_STATE_FEEDBACK_STANDBY;
		case 2: // weapon: resistance from data[0], released at data[1]
			if (value < command.data[0] * 32) {
				return TRIGGER_STATE_WEAPON_STANDBY;
			}
			return previous == TRIGGER_STATE_WEAPON_FIRED ||
			               value >= std::min(command.data[1] * 32, 254)
			           ? TRIGGER_STATE_WEAPON_FIRED
			           : TRIGGER_STATE_WEAPON_PULLING;
		case 3: // vibration from position data[0], amplitude data[1], frequency data[2]
			return value >= 8 && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0]
			           ? TRIGGER_STATE_VIBRATION_ACTIVE
			           : TRIGGER_STATE_VIBRATION_STANDBY;
		case 4: // multiple-position feedback: strength per position
			return value >= 8 && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE
			                              : TRIGGER_STATE_FEEDBACK_STANDBY;
		case 5: // slope feedback between data[0] and data[1]
			return value >= 8 && pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE
			                                                       : TRIGGER_STATE_FEEDBACK_STANDBY;
		case 6: // multiple-position vibration: frequency data[0], amplitude per position
			return value >= 8 && command.data[0] != 0 && command.data[1 + pos] != 0
			           ? TRIGGER_STATE_VIBRATION_ACTIVE
			           : TRIGGER_STATE_VIBRATION_STANDBY;
		default: return TRIGGER_STATE_OFF;
**@⁠coderabbitai[bot]** on GitHub · 2026-10-07 12:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#discussion_r4207166012) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '235,340p' src/libs/controller.cpp sed -n '340,385p' src/libs/controller.cpp sed -n '390,480p' tests/ControllerSettingsTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 9734 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- PR diff summary ---' git diff --stat 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 printf '%s\n' '--- State API and conversion diff ---' git diff -U12 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 -- src/libs/controller.cpp tests/ControllerSettingsTests.cpp | sed -n '1,320p' printf '%s\n' '--- State API references/contracts ---' rg -n -i 'TriggerEffectState|TRIGGER_STATE|trigger state|minimum.*(travel|position)|8/255|trigger.*dead.?zone' src tests docs include 2>/dev/null || test "$?" -eq 1 printf '%s\n' '--- Test setup around state assertions ---' sed -n '300,435p' tests/ControllerSettingsTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 21825 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- PR diff summary ---' git diff --stat 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 printf '%s\n' '--- State API and conversion diff ---' git diff -U12 719e02574a8cdcccf47dbd3118290a3e2ebd965e 912ef339af9de5293623803d112348a0c19e7288 -- src/libs/controller.cpp tests/ControllerSettingsTests.cpp | sed -n '1,320p' printf '%s\n' '--- State API and threshold references ---' rg -n -i 'TriggerEffectState|TRIGGER_STATE|trigger state|minimum.*(travel|position)|8/255|trigger.*dead.?zone' src tests docs include 2>/dev/null || test "$?" -eq 1 printf '%s\n' '--- Test setup around state assertions ---' sed -n '300,435p' tests/ControllerSettingsTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 21829 --- </details> **Enforce the 8/255 floor in reported trigger states.** For modes 1, 3, 4, 5, and 6, `TriggerEffectState` can return an active state at travel values 0–7. `PadGetTriggerEffectState` exposes that result, contrary to E1’s minimum. Gate these active branches on `value >= 8` and update the low-travel tests to expect standby. ```diff case 1: // feedback: resistance from position data[0], strength data[1] - return command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE + return value >= 8 && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; @@ case 3: // vibration from position data[0], amplitude data[1], frequency data[2] - return command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0] + return value >= 8 && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0] ? TRIGGER_STATE_VIBRATION_ACTIVE : TRIGGER_STATE_VIBRATION_STANDBY; case 4: // multiple-position feedback: strength per position - return command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE + return value >= 8 && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; case 5: // slope feedback between data[0] and data[1] - return pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE + return value >= 8 && pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; case 6: // multiple-position vibration: frequency data[0], amplitude per position - return command.data[0] != 0 && command.data[1 + pos] != 0 + return value >= 8 && command.data[0] != 0 && command.data[1 + pos] != 0 ? TRIGGER_STATE_VIBRATION_ACTIVE : TRIGGER_STATE_VIBRATION_STANDBY; ``` <!-- 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 static int32_t TriggerEffectState(const PadTriggerEffectCommand& command, int value, int32_t previous) { // Trigger positions use nonuniform travel ranges, with endpoints at 0 and 255. const int pos = value == 0 ? 0 : value == 255 ? 9 : 1 + value / 32; switch (command.mode) { case 1: // feedback: resistance from position data[0], strength data[1] return value >= 8 && command.data[1] != 0 && pos >= command.data[0] ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; case 2: // weapon: resistance from data[0], released at data[1] if (value < command.data[0] * 32) { return TRIGGER_STATE_WEAPON_STANDBY; } return previous == TRIGGER_STATE_WEAPON_FIRED || value >= std::min(command.data[1] * 32, 254) ? TRIGGER_STATE_WEAPON_FIRED : TRIGGER_STATE_WEAPON_PULLING; case 3: // vibration from position data[0], amplitude data[1], frequency data[2] return value >= 8 && command.data[1] != 0 && command.data[2] != 0 && pos >= command.data[0] ? TRIGGER_STATE_VIBRATION_ACTIVE : TRIGGER_STATE_VIBRATION_STANDBY; case 4: // multiple-position feedback: strength per position return value >= 8 && command.data[pos] != 0 ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; case 5: // slope feedback between data[0] and data[1] return value >= 8 && pos >= command.data[0] && pos < command.data[1] ? TRIGGER_STATE_FEEDBACK_ACTIVE : TRIGGER_STATE_FEEDBACK_STANDBY; case 6: // multiple-position vibration: frequency data[0], amplitude per position return value >= 8 && command.data[0] != 0 && command.data[1 + pos] != 0 ? TRIGGER_STATE_VIBRATION_ACTIVE : TRIGGER_STATE_VIBRATION_STANDBY; default: return TRIGGER_STATE_OFF; ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:94ad166e9aef2fa422365cea --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-07 12:59 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: 3e3966b4-722e-4540-b7a4-62d6a75035c9
📥 Commits

Reviewing files that changed from the base of the PR and between e53936070b and 912ef339af.

📒 Files selected for processing (3)
  • src/libs/controller.cpp
  • src/libs/controller.h
  • tests/ControllerSettingsTests.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-07 12:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1132#pullrequestreview-5442630509) · **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**: `3e3966b4-722e-4540-b7a4-62d6a75035c9` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e53936070ba77589dcad00ef42892c9b5a39f7de and 912ef339af9de5293623803d112348a0c19e7288. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/libs/controller.cpp` * `src/libs/controller.h` * `tests/ControllerSettingsTests.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=7034023f-104e-4046-8a7a-138e9c6f53f0 attempt=e2dd0223-87b2-41c1-a7fe-550065a34260 batch=1/1 -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.