42
42
#endif
43
43
#endif // SDL_PLATFORM_MACOS
44
44
45
- #ifdef SDL_JOYSTICK_MFI
46
45
#import < GameController/GameController.h>
47
46
47
+ #ifdef SDL_JOYSTICK_MFI
48
48
static id connectObserver = nil ;
49
49
static id disconnectObserver = nil ;
50
50
@@ -1201,6 +1201,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
1201
1201
#endif // SDL_JOYSTICK_MFI
1202
1202
}
1203
1203
1204
+ #ifdef SDL_JOYSTICK_MFI
1204
1205
@interface SDL3_RumbleMotor : NSObject
1205
1206
@property (nonatomic , strong ) CHHapticEngine *engine API_AVAILABLE (macos(10.16 ), ios(13.0 ), tvos(14.0 ));
1206
1207
@property (nonatomic , strong ) id <CHHapticPatternPlayer> player API_AVAILABLE (macos(10.16 ), ios(13.0 ), tvos(14.0 ));
@@ -1395,8 +1396,11 @@ - (void)cleanup
1395
1396
return nil ;
1396
1397
}
1397
1398
1399
+ #endif // SDL_JOYSTICK_MFI
1400
+
1398
1401
static bool IOS_JoystickRumble (SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
1399
1402
{
1403
+ #ifdef SDL_JOYSTICK_MFI
1400
1404
SDL_JoystickDeviceItem *device = joystick->hwdata ;
1401
1405
1402
1406
if (device == NULL ) {
@@ -1415,13 +1419,14 @@ static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumb
1415
1419
if (device->rumble ) {
1416
1420
SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble ;
1417
1421
return [rumble rumbleWithLowFrequency: low_frequency_rumble andHighFrequency: high_frequency_rumble];
1418
- } else {
1419
- return SDL_Unsupported ();
1420
1422
}
1423
+ #endif
1424
+ return SDL_Unsupported ();
1421
1425
}
1422
1426
1423
1427
static bool IOS_JoystickRumbleTriggers (SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
1424
1428
{
1429
+ #ifdef SDL_JOYSTICK_MFI
1425
1430
SDL_JoystickDeviceItem *device = joystick->hwdata ;
1426
1431
1427
1432
if (device == NULL ) {
@@ -1440,9 +1445,9 @@ static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumbl
1440
1445
if (device->rumble ) {
1441
1446
SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble ;
1442
1447
return [rumble rumbleLeftTrigger: left_rumble andRightTrigger: right_rumble];
1443
- } else {
1444
- return SDL_Unsupported ();
1445
1448
}
1449
+ #endif
1450
+ return SDL_Unsupported ();
1446
1451
}
1447
1452
1448
1453
static bool IOS_JoystickSetLED (SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
@@ -1465,7 +1470,6 @@ static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, U
1465
1470
}
1466
1471
}
1467
1472
}
1468
-
1469
1473
return SDL_Unsupported ();
1470
1474
}
1471
1475
@@ -1519,6 +1523,7 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
1519
1523
1520
1524
device->joystick = NULL ;
1521
1525
1526
+ #ifdef SDL_JOYSTICK_MFI
1522
1527
@autoreleasepool {
1523
1528
if (device->rumble ) {
1524
1529
SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble ;
@@ -1529,7 +1534,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
1529
1534
}
1530
1535
1531
1536
if (device->controller ) {
1532
- #ifdef SDL_JOYSTICK_MFI
1533
1537
GCController *controller = device->controller ;
1534
1538
controller.controllerPausedHandler = nil ;
1535
1539
controller.playerIndex = -1 ;
@@ -1542,9 +1546,10 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
1542
1546
}
1543
1547
}
1544
1548
}
1545
- #endif // SDL_JOYSTICK_MFI
1546
1549
}
1547
1550
}
1551
+ #endif // SDL_JOYSTICK_MFI
1552
+
1548
1553
if (device->is_siri_remote ) {
1549
1554
--SDL_AppleTVRemoteOpenedAsJoystick;
1550
1555
}
0 commit comments