diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 757937eee0f9..f2be54f803d5 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -185,7 +185,7 @@ - (id)init */ self.controllerUserInteractionEnabled = YES; #endif - + #if TARGET_OS_IOS self.shouldLockCurrentInterfaceOrientation = NO; #endif @@ -228,50 +228,50 @@ - (bool)didMicroGamepadPress:(UIPressType)type bool foundSiri = false; bool nonSiriPress = false; for (GCController *controller in controllers) { - if ([self isSiri:controller]) - { - foundSiri = true; - if (type == UIPressTypeSelect) - return controller.microGamepad.buttonA.pressed; - else if (type == UIPressTypePlayPause) - return controller.microGamepad.buttonX.pressed; - } - else if (controller.extendedGamepad) - { - if (type == UIPressTypeUpArrow) - nonSiriPress |= controller.extendedGamepad.dpad.up.pressed - || controller.extendedGamepad.leftThumbstick.up.pressed - || controller.extendedGamepad.rightThumbstick.up.pressed; - else if (type == UIPressTypeDownArrow) - nonSiriPress |= controller.extendedGamepad.dpad.down.pressed - || controller.extendedGamepad.leftThumbstick.down.pressed - || controller.extendedGamepad.rightThumbstick.down.pressed; - else if (type == UIPressTypeLeftArrow) - nonSiriPress |= controller.extendedGamepad.dpad.left.pressed - || controller.extendedGamepad.leftShoulder.pressed - || controller.extendedGamepad.leftTrigger.pressed - || controller.extendedGamepad.leftThumbstick.left.pressed - || controller.extendedGamepad.rightThumbstick.left.pressed; - else if (type == UIPressTypeRightArrow) - nonSiriPress |= controller.extendedGamepad.dpad.right.pressed - || controller.extendedGamepad.rightShoulder.pressed - || controller.extendedGamepad.rightTrigger.pressed - || controller.extendedGamepad.leftThumbstick.right.pressed - || controller.extendedGamepad.rightThumbstick.right.pressed; - else if (type == UIPressTypeSelect) - nonSiriPress |= controller.extendedGamepad.buttonA.pressed; - else if (type == UIPressTypeMenu) - nonSiriPress |= controller.extendedGamepad.buttonB.pressed; - else if (type == UIPressTypePlayPause) - nonSiriPress |= controller.extendedGamepad.buttonX.pressed; - } - else - { - /* we have a remote that is not extended. some of these remotes send - * spurious presses. the only way to get them to work properly is to - * make the siri remote work improperly. */ - nonSiriPress = true; - } + if ([self isSiri:controller]) + { + foundSiri = true; + if (type == UIPressTypeSelect) + return controller.microGamepad.buttonA.pressed; + else if (type == UIPressTypePlayPause) + return controller.microGamepad.buttonX.pressed; + } + else if (controller.extendedGamepad) + { + if (type == UIPressTypeUpArrow) + nonSiriPress |= controller.extendedGamepad.dpad.up.pressed + || controller.extendedGamepad.leftThumbstick.up.pressed + || controller.extendedGamepad.rightThumbstick.up.pressed; + else if (type == UIPressTypeDownArrow) + nonSiriPress |= controller.extendedGamepad.dpad.down.pressed + || controller.extendedGamepad.leftThumbstick.down.pressed + || controller.extendedGamepad.rightThumbstick.down.pressed; + else if (type == UIPressTypeLeftArrow) + nonSiriPress |= controller.extendedGamepad.dpad.left.pressed + || controller.extendedGamepad.leftShoulder.pressed + || controller.extendedGamepad.leftTrigger.pressed + || controller.extendedGamepad.leftThumbstick.left.pressed + || controller.extendedGamepad.rightThumbstick.left.pressed; + else if (type == UIPressTypeRightArrow) + nonSiriPress |= controller.extendedGamepad.dpad.right.pressed + || controller.extendedGamepad.rightShoulder.pressed + || controller.extendedGamepad.rightTrigger.pressed + || controller.extendedGamepad.leftThumbstick.right.pressed + || controller.extendedGamepad.rightThumbstick.right.pressed; + else if (type == UIPressTypeSelect) + nonSiriPress |= controller.extendedGamepad.buttonA.pressed; + else if (type == UIPressTypeMenu) + nonSiriPress |= controller.extendedGamepad.buttonB.pressed; + else if (type == UIPressTypePlayPause) + nonSiriPress |= controller.extendedGamepad.buttonX.pressed; + } + else + { + /* we have a remote that is not extended. some of these remotes send + * spurious presses. the only way to get them to work properly is to + * make the siri remote work improperly. */ + nonSiriPress = true; + } } if (!foundSiri || [controllers count] == 1) @@ -333,12 +333,12 @@ - (void)pressesBegan:(NSSet *)presses -(void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)event { for (UIPress *press in presses) { - if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause) - [self sendKeyForPress:press.type down:false]; - else - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ + if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause) + [self sendKeyForPress:press.type down:false]; + else + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ [[CocoaView get] sendKeyForPress:press.type down:false]; - }); + }); } } @@ -770,7 +770,6 @@ - (void)webServerDidCompleteBonjourRegistration:(GCDWebServer*)server 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) { rarch_start_draw_observer(); @@ -780,7 +779,7 @@ - (void)webServerDidCompleteBonjourRegistration:(GCDWebServer*)server rarch_start_draw_observer(); configuration_set_bool(settings, settings->bools.gcdwebserver_alert, false); }]]; -#elif TARGET_OS_IOS +#if TARGET_OS_IOS [alert addAction:[UIAlertAction actionWithTitle:@"Stop Server" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [[WebServer sharedInstance] webUploader].delegate = nil; [[WebServer sharedInstance] stopUploader];