diff --git a/configuration.c b/configuration.c index d4903f1ef7..b38773b52c 100644 --- a/configuration.c +++ b/configuration.c @@ -2082,6 +2082,10 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("android_input_disconnect_workaround", &settings->bools.android_input_disconnect_workaround, true, false, false); #endif +#if defined(HAVE_COCOATOUCH) && defined(TARGET_OS_TV) + SETTING_BOOL("gcdwebserver_alert", &settings->bools.gcdwebserver_alert, true, true, false); +#endif + *size = count; return tmp; diff --git a/configuration.h b/configuration.h index 3619ca7f0a..5198374488 100644 --- a/configuration.h +++ b/configuration.h @@ -976,6 +976,10 @@ typedef struct settings #ifdef ANDROID bool android_input_disconnect_workaround; #endif + +#if defined(HAVE_COCOATOUCH) && defined(TARGET_OS_TV) + bool gcdwebserver_alert; +#endif } bools; } settings_t; diff --git a/input/drivers_joypad/mfi_joypad.m b/input/drivers_joypad/mfi_joypad.m index 07ca8f2240..89337b6afd 100644 --- a/input/drivers_joypad/mfi_joypad.m +++ b/input/drivers_joypad/mfi_joypad.m @@ -387,14 +387,8 @@ static void mfi_joypad_autodetect_add(unsigned autoconf_pad) - (void)shutdown { if (@available(iOS 14, tvOS 14, macOS 11, *)) { - if (self.weakPlayer) - [self.weakPlayer cancelAndReturnError:nil]; _weakPlayer = nil; - if (self.strongPlayer) - [self.strongPlayer cancelAndReturnError:nil]; _strongPlayer = nil; - if (self.engine) - [self.engine stopWithCompletionHandler:nil]; self.engine = nil; } } @@ -454,7 +448,7 @@ static void apple_gamecontroller_joypad_connect(GCController *controller) for (GCController *connectedController in mfiControllers) { if ( connectedController.microGamepad != nil - || connectedController.extendedGamepad == nil ) + && connectedController.extendedGamepad == nil ) connectedNonGameControllerIndex = index; index++; } @@ -626,7 +620,6 @@ static bool apple_gamecontroller_joypad_set_rumble(unsigned pad, initWithParameterID:CHHapticDynamicParameterIDHapticIntensityControl value:str relativeTime:0]; - NSError *error; [player sendParameters:[NSArray arrayWithObject:param] atTime:0 error:&error]; if (!error) [player startAtTime:0 error:&error]; diff --git a/ui/drivers/cocoa/apple_platform.h b/ui/drivers/cocoa/apple_platform.h index 07683ffd5d..0e8e2da058 100644 --- a/ui/drivers/cocoa/apple_platform.h +++ b/ui/drivers/cocoa/apple_platform.h @@ -52,6 +52,9 @@ extern id apple_platform; #endif #if defined(HAVE_COCOATOUCH) +void rarch_start_draw_observer(); +void rarch_stop_draw_observer(); + @interface RetroArch_iOS : UINavigationController { UIView *_renderView; diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 0d1e72b317..5d77509d45 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -394,19 +394,33 @@ void *glkitview_init(void); [servers appendString:[NSString stringWithFormat:@"%@",server.bonjourServerURL]]; #if TARGET_OS_TV || TARGET_OS_IOS - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Welcome to RetroArch" message:[NSString stringWithFormat:@"To transfer files from your computer, go to one of these addresses on your web browser:\n\n%@",servers] preferredStyle:UIAlertControllerStyleAlert]; + settings_t *settings = config_get_ptr(); + if (!settings->bools.gcdwebserver_alert) + return; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Welcome to RetroArch" message:[NSString stringWithFormat:@"To transfer files from your computer, go to one of these addresses on your web browser:\n\n%@",servers] preferredStyle:UIAlertControllerStyleAlert]; #if TARGET_OS_TV - [alert addAction:[UIAlertAction actionWithTitle:@"OK" - style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - }]]; + [alert addAction:[UIAlertAction actionWithTitle:@"OK" + style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + rarch_start_draw_observer(); + }]]; + [alert addAction:[UIAlertAction actionWithTitle:@"Don't Show Again" + style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + rarch_start_draw_observer(); + configuration_set_bool(settings, settings->bools.gcdwebserver_alert, false); + }]]; #elif TARGET_OS_IOS - [alert addAction:[UIAlertAction actionWithTitle:@"Stop Server" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [[WebServer sharedInstance] webUploader].delegate = nil; - [[WebServer sharedInstance] stopUploader]; - }]]; + [alert addAction:[UIAlertAction actionWithTitle:@"Stop Server" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[WebServer sharedInstance] webUploader].delegate = nil; + [[WebServer sharedInstance] stopUploader]; + }]]; #endif - [self presentViewController:alert animated:YES completion:^{ - }]; + [self presentViewController:alert animated:YES completion:^{ + rarch_stop_draw_observer(); + }]; + }); #endif } diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m index cd272686bb..f9df985e1f 100644 --- a/ui/drivers/ui_cocoatouch.m +++ b/ui/drivers/ui_cocoatouch.m @@ -75,7 +75,7 @@ static void rarch_draw_observer(CFRunLoopObserverRef observer, CFRunLoopWakeUp(CFRunLoopGetMain()); } -static void rarch_start_draw_observer() +void rarch_start_draw_observer() { if (iterate_observer && CFRunLoopObserverIsValid(iterate_observer)) return; @@ -87,7 +87,7 @@ static void rarch_start_draw_observer() CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes); } -static void rarch_stop_draw_observer() +void rarch_stop_draw_observer() { if (!iterate_observer || !CFRunLoopObserverIsValid(iterate_observer)) return;