瀏覽代碼

Mark the Apex 5 controller as being acquired by SDL

Sam Lantinga 1 月之前
父節點
當前提交
446fb65ca6
共有 1 個文件被更改,包括 2 次插入7 次删除
  1. 2 7
      src/joystick/hidapi/SDL_hidapi_flydigi.c

+ 2 - 7
src/joystick/hidapi/SDL_hidapi_flydigi.c

@@ -209,14 +209,9 @@ static bool SDL_HIDAPI_Flydigi_SendAcquireRequest(SDL_HIDAPI_Device *device, boo
         FLYDIGI_V2_ACQUIRE_CONTROLLER_COMMAND,
         23,
         acquire ? 1 : 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        'S', 'D', 'L', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     };
 
-    // Set the name of the application acquiring the controller
-    const char *name = SDL_GetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING);
-    SDL_assert(name != NULL);
-    SDL_strlcpy((char *)&acquireControllerCmd[6], name, sizeof(acquireControllerCmd) - 6);
-
     if (SDL_hid_write(device->dev, acquireControllerCmd, sizeof(acquireControllerCmd)) < 0) {
         return SDL_SetError("Couldn't send acquire command");
     }
@@ -225,7 +220,7 @@ static bool SDL_HIDAPI_Flydigi_SendAcquireRequest(SDL_HIDAPI_Device *device, boo
 
 static bool HIDAPI_DriverFlydigi_HandleAcquireResponse(Uint8 *data, int size)
 {
-    if (data[5] != 1) {
+    if (data[5] != 1 && data[6] == 0) {
         return SDL_SetError("Controller acquiring has been disabled");
     }
     return true;