Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor gamepad emulation code to use the DS4 extended report format #1426

Merged
merged 1 commit into from
Jul 8, 2023

Conversation

cgutman
Copy link
Collaborator

@cgutman cgutman commented Jul 7, 2023

Description

This is a preparatory PR for implementing the extended controller protocol features (motion, touch, battery, and RGB LED control) on Windows. We must send the full DS4 extended report rather than just filling out the simple report and relying on ViGEmBus to fill in the rest with default values.

This has the side-effect of fixing #1407 due to the incorrect assumption that it's safe to cast our gamepad_state_t directly to a XUSB_REPORT. That broke in #1401 when I extended the buttonFlags from a 16-bit to a 32-bit value and caused all the subsequent values to become offset when emulating an Xbox 360 controller.

I was going to wait to PR this until I had finished plumbing some of the extended features, but decided to do it sooner after I realized it fixes the root cause of #1407.

Screenshot

Issues Fixed or Closed

Fixes #1407

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

This has the side-effect of fixing LizardByte#1407 due to the incorrect assumption that
it's safe to cast our gamepad_state_t to a XUSB_REPORT.
@cgutman cgutman force-pushed the ds4_extended_features branch from 6a91e7f to bcbe743 Compare July 8, 2023 15:48
@cgutman cgutman merged commit 70dc582 into LizardByte:nightly Jul 8, 2023
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.

1 participant