소스 검색

fix: use productCategory instead of vendorName for joy name for apple driver

Sora 3 일 전
부모
커밋
964bedfdd9
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      src/joystick/apple/SDL_mfijoystick.m

+ 8 - 2
src/joystick/apple/SDL_mfijoystick.m

@@ -300,8 +300,14 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
      * struct, and ARC doesn't work with structs. */
     device->controller = (__bridge GCController *)CFBridgingRetain(controller);
 
-    if (controller.vendorName) {
-        name = controller.vendorName.UTF8String;
+    if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
+        if (controller.productCategory) {
+            name = controller.productCategory.UTF8String;
+        }
+    } else {
+        if (controller.vendorName) {
+            name = controller.vendorName.UTF8String;
+        }
     }
 
     if (!name) {