Skip to content

Commit 5233843

Browse files
warmenhovenJoeMatt
authored andcommitted
iOS: ensure webserver notice can be dismissed (libretro#17356)
1 parent c811b43 commit 5233843

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

ui/drivers/cocoa/cocoa_common.m

+51-52
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ - (id)init
185185
*/
186186
self.controllerUserInteractionEnabled = YES;
187187
#endif
188-
188+
189189
#if TARGET_OS_IOS
190190
self.shouldLockCurrentInterfaceOrientation = NO;
191191
#endif
@@ -228,50 +228,50 @@ - (bool)didMicroGamepadPress:(UIPressType)type
228228
bool foundSiri = false;
229229
bool nonSiriPress = false;
230230
for (GCController *controller in controllers) {
231-
if ([self isSiri:controller])
232-
{
233-
foundSiri = true;
234-
if (type == UIPressTypeSelect)
235-
return controller.microGamepad.buttonA.pressed;
236-
else if (type == UIPressTypePlayPause)
237-
return controller.microGamepad.buttonX.pressed;
238-
}
239-
else if (controller.extendedGamepad)
240-
{
241-
if (type == UIPressTypeUpArrow)
242-
nonSiriPress |= controller.extendedGamepad.dpad.up.pressed
243-
|| controller.extendedGamepad.leftThumbstick.up.pressed
244-
|| controller.extendedGamepad.rightThumbstick.up.pressed;
245-
else if (type == UIPressTypeDownArrow)
246-
nonSiriPress |= controller.extendedGamepad.dpad.down.pressed
247-
|| controller.extendedGamepad.leftThumbstick.down.pressed
248-
|| controller.extendedGamepad.rightThumbstick.down.pressed;
249-
else if (type == UIPressTypeLeftArrow)
250-
nonSiriPress |= controller.extendedGamepad.dpad.left.pressed
251-
|| controller.extendedGamepad.leftShoulder.pressed
252-
|| controller.extendedGamepad.leftTrigger.pressed
253-
|| controller.extendedGamepad.leftThumbstick.left.pressed
254-
|| controller.extendedGamepad.rightThumbstick.left.pressed;
255-
else if (type == UIPressTypeRightArrow)
256-
nonSiriPress |= controller.extendedGamepad.dpad.right.pressed
257-
|| controller.extendedGamepad.rightShoulder.pressed
258-
|| controller.extendedGamepad.rightTrigger.pressed
259-
|| controller.extendedGamepad.leftThumbstick.right.pressed
260-
|| controller.extendedGamepad.rightThumbstick.right.pressed;
261-
else if (type == UIPressTypeSelect)
262-
nonSiriPress |= controller.extendedGamepad.buttonA.pressed;
263-
else if (type == UIPressTypeMenu)
264-
nonSiriPress |= controller.extendedGamepad.buttonB.pressed;
265-
else if (type == UIPressTypePlayPause)
266-
nonSiriPress |= controller.extendedGamepad.buttonX.pressed;
267-
}
268-
else
269-
{
270-
/* we have a remote that is not extended. some of these remotes send
271-
* spurious presses. the only way to get them to work properly is to
272-
* make the siri remote work improperly. */
273-
nonSiriPress = true;
274-
}
231+
if ([self isSiri:controller])
232+
{
233+
foundSiri = true;
234+
if (type == UIPressTypeSelect)
235+
return controller.microGamepad.buttonA.pressed;
236+
else if (type == UIPressTypePlayPause)
237+
return controller.microGamepad.buttonX.pressed;
238+
}
239+
else if (controller.extendedGamepad)
240+
{
241+
if (type == UIPressTypeUpArrow)
242+
nonSiriPress |= controller.extendedGamepad.dpad.up.pressed
243+
|| controller.extendedGamepad.leftThumbstick.up.pressed
244+
|| controller.extendedGamepad.rightThumbstick.up.pressed;
245+
else if (type == UIPressTypeDownArrow)
246+
nonSiriPress |= controller.extendedGamepad.dpad.down.pressed
247+
|| controller.extendedGamepad.leftThumbstick.down.pressed
248+
|| controller.extendedGamepad.rightThumbstick.down.pressed;
249+
else if (type == UIPressTypeLeftArrow)
250+
nonSiriPress |= controller.extendedGamepad.dpad.left.pressed
251+
|| controller.extendedGamepad.leftShoulder.pressed
252+
|| controller.extendedGamepad.leftTrigger.pressed
253+
|| controller.extendedGamepad.leftThumbstick.left.pressed
254+
|| controller.extendedGamepad.rightThumbstick.left.pressed;
255+
else if (type == UIPressTypeRightArrow)
256+
nonSiriPress |= controller.extendedGamepad.dpad.right.pressed
257+
|| controller.extendedGamepad.rightShoulder.pressed
258+
|| controller.extendedGamepad.rightTrigger.pressed
259+
|| controller.extendedGamepad.leftThumbstick.right.pressed
260+
|| controller.extendedGamepad.rightThumbstick.right.pressed;
261+
else if (type == UIPressTypeSelect)
262+
nonSiriPress |= controller.extendedGamepad.buttonA.pressed;
263+
else if (type == UIPressTypeMenu)
264+
nonSiriPress |= controller.extendedGamepad.buttonB.pressed;
265+
else if (type == UIPressTypePlayPause)
266+
nonSiriPress |= controller.extendedGamepad.buttonX.pressed;
267+
}
268+
else
269+
{
270+
/* we have a remote that is not extended. some of these remotes send
271+
* spurious presses. the only way to get them to work properly is to
272+
* make the siri remote work improperly. */
273+
nonSiriPress = true;
274+
}
275275
}
276276

277277
if (!foundSiri || [controllers count] == 1)
@@ -333,12 +333,12 @@ - (void)pressesBegan:(NSSet<UIPress *> *)presses
333333
-(void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
334334
{
335335
for (UIPress *press in presses) {
336-
if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause)
337-
[self sendKeyForPress:press.type down:false];
338-
else
339-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
336+
if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause)
337+
[self sendKeyForPress:press.type down:false];
338+
else
339+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
340340
[[CocoaView get] sendKeyForPress:press.type down:false];
341-
});
341+
});
342342
}
343343
}
344344

@@ -770,7 +770,6 @@ - (void)webServerDidCompleteBonjourRegistration:(GCDWebServer*)server
770770
static dispatch_once_t onceToken;
771771
dispatch_once(&onceToken, ^{
772772
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];
773-
#if TARGET_OS_TV
774773
[alert addAction:[UIAlertAction actionWithTitle:@"OK"
775774
style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
776775
rarch_start_draw_observer();
@@ -780,7 +779,7 @@ - (void)webServerDidCompleteBonjourRegistration:(GCDWebServer*)server
780779
rarch_start_draw_observer();
781780
configuration_set_bool(settings, settings->bools.gcdwebserver_alert, false);
782781
}]];
783-
#elif TARGET_OS_IOS
782+
#if TARGET_OS_IOS
784783
[alert addAction:[UIAlertAction actionWithTitle:@"Stop Server" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
785784
[[WebServer sharedInstance] webUploader].delegate = nil;
786785
[[WebServer sharedInstance] stopUploader];

0 commit comments

Comments
 (0)