diff --git a/VoidLink/Input/ControllerSupport.h b/VoidLink/Input/ControllerSupport.h index bde2d8e2..a13875ed 100644 --- a/VoidLink/Input/ControllerSupport.h +++ b/VoidLink/Input/ControllerSupport.h @@ -16,6 +16,7 @@ - (void)gamepadPresenceChanged; - (void)mousePresenceChanged; - (void)streamExitRequested; +- (void)controllerArrivalWithPlayerIndex:(int8_t)index; @end diff --git a/VoidLink/Input/ControllerSupport.m b/VoidLink/Input/ControllerSupport.m index 45da91b2..7b7246ee 100644 --- a/VoidLink/Input/ControllerSupport.m +++ b/VoidLink/Input/ControllerSupport.m @@ -781,6 +781,8 @@ static const double MOUSE_SPEED_DIVISOR = 1.25; if (controller) { // This is a physical controller with a corresponding GCController object + [_delegate controllerArrivalWithPlayerIndex:voidController.playerIndex]; + // Start is always present supportedButtonFlags |= PLAY_FLAG; diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index 29cd3e75..2b723131 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -3129,7 +3129,6 @@ import ObjectiveC.runtime !autoDockIsDocked else { return } - print("autoDockIdleDuration \(autoDockIdleDuration) \(CACurrentMediaTime())") autoDockTimer = Timer.scheduledTimer(withTimeInterval: autoDockIdleDuration, repeats: false) { [weak self] _ in self?.autoDockWidgetToNearestEdge() } diff --git a/VoidLink/Input/StreamView.m b/VoidLink/Input/StreamView.m index 5fe3363f..2b9e44c5 100644 --- a/VoidLink/Input/StreamView.m +++ b/VoidLink/Input/StreamView.m @@ -614,9 +614,10 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; // get streamFrameVC if(!self->_streamFrameVC) self->_streamFrameVC = [self parentViewController]; + /* if (@available(iOS 13.0, *)) { if(oscProfile.gamepadOverlayEnabled) [(StreamFrameViewController* )self->_streamFrameVC loadAbstractGamepadOverlayIfNeeded]; - } + } */ // bool customOscEnabled = [self isOscEnabled] && settings.onscreenControls.intValue == OnScreenControlsLevelCustom; diff --git a/VoidLink/ViewControllers/StreamFrameViewController.m b/VoidLink/ViewControllers/StreamFrameViewController.m index 249bbc30..4e9d929a 100644 --- a/VoidLink/ViewControllers/StreamFrameViewController.m +++ b/VoidLink/ViewControllers/StreamFrameViewController.m @@ -362,7 +362,7 @@ if (reloadSettings) { _settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here. } - _oscProfile = [[OSCProfilesManager sharedManager:CGRectZero] getSelectedProfile]; + if(!_viewJustLoaded) _oscProfile = [[OSCProfilesManager sharedManager:CGRectZero] getSelectedProfile]; overlayLevel = _settings.statsOverlayLevel.intValue; [self setupOverlayView]; @@ -622,6 +622,8 @@ [_spinner startAnimating]; _spinner.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2 - _stageLabel.frame.size.height - _spinner.frame.size.height); + _oscProfile = [[OSCProfilesManager sharedManager:CGRectZero] getSelectedProfile]; + _controllerSupport = [[ControllerSupport alloc] initWithConfig:self.streamConfig delegate:self]; _inactivityTimer = nil; @@ -1766,6 +1768,14 @@ dispatch_after(delayTime, dispatch_get_main_queue(), block); } +- (void)controllerArrivalWithPlayerIndex:(int8_t)index{ + if(index == 0 && _oscProfile.gamepadOverlayEnabled){ + if (@available(iOS 13.0, *)) { + [self loadAbstractGamepadOverlayIfNeeded]; + } + } +} + - (void)toggleGamepadOverlayWithOverlayEnabled:(BOOL)overlayEnabled API_AVAILABLE(ios(13.0)){ if(overlayEnabled) [self loadAbstractGamepadOverlayIfNeeded]; else {