mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-16 21:39:56 +00:00
Hide the home bar when a gamepad is connected and no on-screen controls are visible
Fixes #386
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
NSLock *_controllerStreamLock;
|
||||
NSMutableDictionary *_controllers;
|
||||
NSTimer *_rumbleTimer;
|
||||
id<GamepadPresenceDelegate> _presenceDelegate;
|
||||
|
||||
OnScreenControls *_osc;
|
||||
|
||||
@@ -464,7 +465,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(id) initWithConfig:(StreamConfiguration*)streamConfig
|
||||
-(NSUInteger) getConnectedGamepadCount
|
||||
{
|
||||
return _controllers.count;
|
||||
}
|
||||
|
||||
-(id) initWithConfig:(StreamConfiguration*)streamConfig presenceDelegate:(id<GamepadPresenceDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
@@ -472,6 +478,7 @@
|
||||
_controllers = [[NSMutableDictionary alloc] init];
|
||||
_controllerNumbers = 0;
|
||||
_multiController = streamConfig.multiController;
|
||||
_presenceDelegate = delegate;
|
||||
|
||||
_player0osc = [[Controller alloc] init];
|
||||
_player0osc.playerIndex = 0;
|
||||
@@ -513,6 +520,9 @@
|
||||
|
||||
// Re-evaluate the on-screen control mode
|
||||
[self updateAutoOnScreenControlMode];
|
||||
|
||||
// Notify the delegate
|
||||
[self->_presenceDelegate gamepadPresenceChanged];
|
||||
}];
|
||||
self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
Log(LOG_I, @"Controller disconnected!");
|
||||
@@ -538,6 +548,9 @@
|
||||
|
||||
// Re-evaluate the on-screen control mode
|
||||
[self updateAutoOnScreenControlMode];
|
||||
|
||||
// Notify the delegate
|
||||
[self->_presenceDelegate gamepadPresenceChanged];
|
||||
}];
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user