mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-11 10:26:04 +00:00
Implement controller LED support
This commit is contained in:
@@ -175,6 +175,23 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
|
||||
}
|
||||
}
|
||||
|
||||
-(void) setControllerLed:(uint16_t)controllerNumber r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b {
|
||||
if (@available(iOS 14.0, tvOS 14.0, *)) {
|
||||
Controller* controller = [_controllers objectForKey:[NSNumber numberWithInteger:controllerNumber]];
|
||||
if (controller == nil) {
|
||||
// No connected controller for this player
|
||||
return;
|
||||
}
|
||||
|
||||
if (controller.gamepad.light == nil) {
|
||||
// No LED control supported for this controller
|
||||
return;
|
||||
}
|
||||
|
||||
controller.gamepad.light.color = [[GCColor alloc] initWithRed:(r / 255.0f) green:(g / 255.0f) blue:(b / 255.0f)];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) updateLeftStick:(Controller*)controller x:(short)x y:(short)y
|
||||
{
|
||||
@synchronized(controller) {
|
||||
@@ -514,6 +531,11 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
|
||||
}
|
||||
}
|
||||
|
||||
// Detect RGB LED support
|
||||
if (controller.light) {
|
||||
capabilities |= LI_CCAP_RGB_LED;
|
||||
}
|
||||
|
||||
LiSendControllerArrivalEvent(controller.playerIndex, [self getActiveGamepadMask], type, supportedButtonFlags, capabilities);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user