diff --git a/Limelight/Input/ControllerSupport.m b/Limelight/Input/ControllerSupport.m index 2160e5d..3479949 100644 --- a/Limelight/Input/ControllerSupport.m +++ b/Limelight/Input/ControllerSupport.m @@ -216,8 +216,12 @@ // Yay, iOS 12.1 now supports analog stick buttons if (@available(iOS 12.1, tvOS 12.1, *)) { - UPDATE_BUTTON_FLAG(limeController, LS_CLK_FLAG, gamepad.leftThumbstickButton.pressed); - UPDATE_BUTTON_FLAG(limeController, RS_CLK_FLAG, gamepad.rightThumbstickButton.pressed); + if (gamepad.leftThumbstickButton != nil) { + UPDATE_BUTTON_FLAG(limeController, LS_CLK_FLAG, gamepad.leftThumbstickButton.pressed); + } + if (gamepad.rightThumbstickButton != nil) { + UPDATE_BUTTON_FLAG(limeController, RS_CLK_FLAG, gamepad.rightThumbstickButton.pressed); + } } leftStickX = gamepad.leftThumbstick.xAxis.value * 0x7FFE; @@ -276,6 +280,12 @@ if (controller != NULL) { if (controller.extendedGamepad != NULL) { level = OnScreenControlsLevelAutoGCExtendedGamepad; + if (@available(iOS 12.1, tvOS 12.1, *)) { + if (controller.extendedGamepad.leftThumbstickButton != nil && + controller.extendedGamepad.rightThumbstickButton != nil) { + level = OnScreenControlsLevelAutoGCExtendedGamepadWithStickButtons; + } + } break; } else if (controller.gamepad != NULL) { diff --git a/Limelight/Input/OnScreenControls.h b/Limelight/Input/OnScreenControls.h index a294bdf..8a438b0 100644 --- a/Limelight/Input/OnScreenControls.h +++ b/Limelight/Input/OnScreenControls.h @@ -22,6 +22,7 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) { // Internal levels selected by ControllerSupport OnScreenControlsLevelAutoGCGamepad, OnScreenControlsLevelAutoGCExtendedGamepad, + OnScreenControlsLevelAutoGCExtendedGamepadWithStickButtons }; #if TARGET_OS_IPHONE diff --git a/Limelight/Input/OnScreenControls.m b/Limelight/Input/OnScreenControls.m index 28b531d..b855e55 100644 --- a/Limelight/Input/OnScreenControls.m +++ b/Limelight/Input/OnScreenControls.m @@ -202,6 +202,18 @@ static float L3_Y; [self hideSticks]; [self drawL3R3]; break; + case OnScreenControlsLevelAutoGCExtendedGamepadWithStickButtons: + // This variant of GCExtendedGamepad has L3 and R3 but + // is still missing Select + [self setupExtendedGamepadControls]; + + [self hideButtons]; + [self hideBumpers]; + [self hideTriggers]; + [self hideL3R3]; + [self drawStartSelect]; + [self hideSticks]; + break; case OnScreenControlsLevelSimple: [self setupSimpleControls];