Delta
Delta copied to clipboard
Add support for clickable joysticks on game controllers, L3 and R3.
Mark the type contribution you are making:
- [x] 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)
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas: there were only straightforward changes.
- [x] 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.
Anything stopping this one from being merged? I have multiple hardware to test this with:
- Nintendo Joycons
- Xbox One controller
- Backbone One
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'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.