tvOS improvements (#14983)

The initial popup screen advertising the web server did not prevent
keys from passing through, so interactions with the alert would also
be handled by the menu. The alert would pop up any time there was a
network reconfiguration; now it only pops up once per run. Added a way
to turn off the webserver advertisement alert permanently.

Also fixed a bug around filtering the Siri remote out, and turning
controllers off while the app is running.
This commit is contained in:
warmenhoven 2023-02-15 05:59:06 -05:00 committed by GitHub
parent 5e7b48113e
commit c242586ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 20 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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<ApplePlatform, UIApplicationDelegate,
UINavigationControllerDelegate> {
UIView *_renderView;

View File

@ -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
}

View File

@ -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;