mirror of https://github.com/encounter/SDL.git
Fixed picking up the correct mapping for virtual controllers on Android
Fixes https://github.com/libsdl-org/SDL/issues/5662
This commit is contained in:
parent
f7b774a7e0
commit
47f1cb550d
|
@ -696,19 +696,20 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG
|
||||||
return s_pXInputMapping;
|
return s_pXInputMapping;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef __ANDROID__
|
if (!mapping) {
|
||||||
if (!mapping && !SDL_IsJoystickHIDAPI(guid)) {
|
if (SDL_IsJoystickHIDAPI(guid)) {
|
||||||
mapping = SDL_CreateMappingForAndroidController(guid);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!mapping && SDL_IsJoystickHIDAPI(guid)) {
|
|
||||||
mapping = SDL_CreateMappingForHIDAPIController(guid);
|
mapping = SDL_CreateMappingForHIDAPIController(guid);
|
||||||
}
|
} else if (SDL_IsJoystickRAWINPUT(guid)) {
|
||||||
if (!mapping && SDL_IsJoystickRAWINPUT(guid)) {
|
|
||||||
mapping = SDL_CreateMappingForRAWINPUTController(guid);
|
mapping = SDL_CreateMappingForRAWINPUTController(guid);
|
||||||
}
|
} else if (SDL_IsJoystickWGI(guid)) {
|
||||||
if (!mapping && SDL_IsJoystickWGI(guid)) {
|
|
||||||
mapping = SDL_CreateMappingForWGIController(guid);
|
mapping = SDL_CreateMappingForWGIController(guid);
|
||||||
|
} else if (SDL_IsJoystickVirtual(guid)) {
|
||||||
|
/* We'll pick up a robust mapping in VIRTUAL_JoystickGetGamepadMapping */
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
} else {
|
||||||
|
mapping = SDL_CreateMappingForAndroidController(guid);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapping;
|
return mapping;
|
||||||
|
|
|
@ -899,9 +899,6 @@ static const char *s_ControllerMappings [] =
|
||||||
"050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
"050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
|
||||||
"050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
"050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
|
||||||
#endif
|
#endif
|
||||||
#if defined(SDL_JOYSTICK_VIRTUAL)
|
|
||||||
"00000000000000000000000000007601,Virtual Joystick,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
|
||||||
#endif
|
|
||||||
#if defined(SDL_JOYSTICK_EMSCRIPTEN)
|
#if defined(SDL_JOYSTICK_EMSCRIPTEN)
|
||||||
"default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
"default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -203,8 +203,8 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
|
||||||
*guid16++ = 0;
|
*guid16++ = 0;
|
||||||
*guid16++ = SDL_SwapLE16(hwdata->desc.product_id);
|
*guid16++ = SDL_SwapLE16(hwdata->desc.product_id);
|
||||||
*guid16++ = 0;
|
*guid16++ = 0;
|
||||||
*guid16++ = SDL_SwapLE16((Uint16)hwdata->desc.button_mask);
|
*guid16++ = 0;
|
||||||
*guid16++ = SDL_SwapLE16((Uint16)hwdata->desc.axis_mask);
|
*guid16++ = 0; /* This will be overwritten below with the virtual controller signature */
|
||||||
|
|
||||||
/* Note that this is a Virtual device and what subtype it is */
|
/* Note that this is a Virtual device and what subtype it is */
|
||||||
hwdata->guid.data[14] = 'v';
|
hwdata->guid.data[14] = 'v';
|
||||||
|
|
Loading…
Reference in New Issue