We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4721

Summary: [Patch] iOS MFi guide button not detected after latest game controller changes
Product: SDL Reporter: Caleb Cornett <spydog>
Component: joystickAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.10   
Hardware: x86   
OS: iOS 11   
Attachments: Patch for the described issue

Description Caleb Cornett 2019-07-13 00:04:09 UTC
Created attachment 3879 [details]
Patch for the described issue

The changes made to support Xbox / PS4 controllers on iOS broke existing controllers' support for the guide button. No presses were being detected because the `buttons` array didn't contain an entry for the guide button. Attached is a patch that fixes the issue.
Comment 1 Ryan C. Gordon 2019-07-13 01:29:03 UTC
This patch is now https://hg.libsdl.org/SDL/rev/68977584a5d9, thanks!

--ryan.
Comment 2 Sam Lantinga 2019-07-14 23:47:27 UTC
This is not right, that should have been handled here:
        if (joystick->hwdata->uses_pause_handler) {
            for (i = 0; i < joystick->hwdata->num_pause_presses; i++) {
                SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_PRESSED);
                SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_RELEASED);
                updateplayerindex = YES;
            }
            joystick->hwdata->num_pause_presses = 0;
        }

I tested this code with an MFi controller and it worked. Why didn't that work for you?
Comment 3 Caleb Cornett 2019-07-15 00:29:33 UTC
Perhaps I should have been more clear. SDL could detect the press as an SDL_CONTROLLERBUTTONDOWN event, but it could not detect the button when polling for it via SDL_GameControllerGetButton(). The use case is the same as this previously reported bug/patch: https://bugzilla.libsdl.org/show_bug.cgi?id=4463
Comment 4 Sam Lantinga 2019-07-15 03:28:13 UTC
Ah, got it, thanks!