Skip to content

Lifted 4 device hard limit for WGI backend#16

Merged
nefarius merged 1 commit into
masterfrom
wgi-caps-fix
Apr 25, 2026
Merged

Lifted 4 device hard limit for WGI backend#16
nefarius merged 1 commit into
masterfrom
wgi-caps-fix

Conversation

@nefarius

@nefarius nefarius commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Fixed #15

Summary by CodeRabbit

  • Improvements
    • Gamepad and input device support now dynamically adjusts based on connected hardware instead of being limited to a fixed maximum count.

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cedb071e-acb4-4266-a946-d4b39017f002

📥 Commits

Reviewing files that changed from the base of the PR and between e0f274a and 16dee30.

📒 Files selected for processing (1)
  • src/wgi_backend.cpp

📝 Walkthrough

Walkthrough

The WGI backend transitions from a fixed four-slot maximum enforced by kMaxSlots and static arrays to dynamically sized vectors driven by active gamepad enumeration. A new ResyncFromSystemLocked() helper rebuilds all slot state when hardware changes occur. Polling and public queries now operate against dynamic vector sizes rather than compile-time limits.

Changes

Cohort / File(s) Summary
WGI Backend Dynamic Slot Management
src/wgi_backend.cpp
Replaced static kMaxSlots constant and fixed-size arrays with dynamic vectors. Added ResyncFromSystemLocked() helper to re-enumerate all gamepads on hardware events. Modified GetMaxSlots() to return current vector size. Updated event handlers, polling loop, and public query methods (GetState(), GetSlotDisplayName(), GetSlotDeviceIds()) to use dynamic bounds checks and thread-local buffers for stable references during concurrent resizing.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • PR #9: Modifies slot management initialization and per-slot display name/device ID retrieval in the same file, indicating ongoing slot management refactoring.

Poem

🐇 Four slots once capped our gamepad dreams,
Now vectors bloom in boundless streams!
No more the hardcoded 4 does reign—
Six, seven, more now join the game.
Resync whispers, states align, 🎮✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: removing the 4-device hard limit in the WGI backend, which aligns directly with the changeset.
Linked Issues check ✅ Passed The PR successfully addresses issue #15 by replacing the hardcoded kMaxSlots constant with dynamic slot management that enumerates all available gamepads, allowing WGI to display more than 4 controllers.
Out of Scope Changes check ✅ Passed All changes are directly related to lifting the 4-device hard limit; no out-of-scope modifications unrelated to the primary objective were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@nefarius nefarius merged commit 235bb2e into master Apr 25, 2026
2 checks passed
@nefarius nefarius deleted the wgi-caps-fix branch April 25, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WGI backend caps display at 4 controllers via hardcoded kMaxSlots

1 participant