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

Add support for clickable joysticks on game controllers, L3 and R3. #274

Open
wants to merge 1 commit into
base: 1.5rc_wip
Choose a base branch
from

Conversation

CooperCorona
Copy link

Mark the type contribution you are making:

  • Experimental feature (new functionality that can be selectively enabled/disabled)
  • Bug fix (non-breaking change which fixes an issue)

Description

This pull request, along with pull request 45 in DeltaCore, adds support for clickable joysticks, referred to as L3 and R3. The DeltaCore PR adds the enum cases and value changed handler. This pull request adds the strings that appear controller remapping UI.

References issue #266.

Finally, let me know if I should merge this to a different branch. The only way I could both get the code to compile and use a recent revision of DeltaCore was to clone the 1.5rc_wip branch (cloning main or develop pinned DeltaCore to a sufficiently old version that MFiGameController had merge conflicts). I can recreate the pull request to a different branch if desired.

Testing

List all iOS versions and devices you've tested this change on.

  • iPhone 11, iOS 17.1.1

Checklist

General (All PRs)

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas: there were only straightforward changes.
  • My changes generate no new warnings: I spot checked the list of warnings, and I do not believe any are related to this change, or to the change in DeltaCore.
  • [] I've tested my changes with different device + OS version configurations: I only have one physical device. Does testing on simulators count?

Experimental Feature-specific

I couldn't find a (simple) way to gate this behind an experimental feature flag. The actual implementation changes are in the DeltaCore PR, which does not have access to ExperimentalFeatures. There's no way to disable it from Delta itself. I tried following the stack trace through ControllerInputsViewController, but there doesn't seem to be a way to determine what input got pressed or to reject an input. If you want, I can hardcode a type check gameController(_,didActivate:value:), and if it's .leftThumbstickButton or .rightThumbstickButton, return early. I believe that would prevent the user from mapping the L3 and R3 buttons. However, it doesn't actually prevent MFiGameController from recognizing them. I believe this satisfies the "When a feature is disabled, it should have no noticeable impact on the rest of the app" guideline.

  • Added property to ExperimentalFeatures struct annotated with @Feature: see above.
  • Uses @Option's to persist all feature-related data: Not needed.
  • Locked all behavior changes behind ExperimentalFeatures.shared.[feature].isEnabled runtime check: see above.
  • Isolates changes to separate files as much as possible (e.g. via Swift extensions): This wasn't possible without compilation errors.

@au5ton
Copy link

au5ton commented Apr 22, 2024

Anything stopping this one from being merged? I have multiple hardware to test this with:

  • Nintendo Joycons
  • Xbox One controller
  • Backbone One

@searls
Copy link

searls commented May 13, 2024

I'd be excited to see this merged for no other reason than to be able to bind shortcuts to save state management for SNES/n64

@jgottula
Copy link

I'd be excited to see this merged for no other reason than to be able to bind shortcuts to save state management for SNES/n64

I find myself wanting to do similar things.

But even when using a gamepad that has firmware button remapping and macro support, and the iOS button remapping settings, and Delta's own button mapping settings, the limited overall inputs supported by Delta (L3/R3 being the worst and most glaring) simply makes it really damn hard when you just need one or two extra buttons available in some form or capacity so you can maybe have a quicksave and/or quickload and/or fast-forward bind that doesn't require tediously swapping back and forth to the menu screen.

iOS has supported additional game controller inputs like L3 and R3 for years! There's no reason Delta shouldn't support them.

@cbyeh
Copy link

cbyeh commented Oct 4, 2024

Let's merge this!

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.

5 participants