mirror of https://github.com/mgba-emu/mgba.git
SDL: Fix joystick initialization on BSD
This commit is contained in:
parent
bc742f8aa9
commit
9c73cf536a
1
CHANGES
1
CHANGES
|
@ -6,6 +6,7 @@ Bugfixes:
|
|||
- GBA BIOS: Fix RegisterRamReset setting DISPCNT to the wrong value
|
||||
- OpenGL: Correct boolean vector strcmp strings for uniforms
|
||||
- Wii: Fix tilting direction
|
||||
- SDL: Fix joystick initialization on BS
|
||||
Misc:
|
||||
- GBA: Slightly optimize GBAProcessEvents
|
||||
- Qt: Add preset for DualShock 4
|
||||
|
|
|
@ -57,6 +57,19 @@ bool GBASDLInitEvents(struct GBASDLEvents* context) {
|
|||
SDL_JoystickListInit(&context->joysticks, nJoysticks);
|
||||
if (nJoysticks > 0) {
|
||||
GBASDLUpdateJoysticks(context);
|
||||
// Some OSes don't do hotplug detection
|
||||
if (!SDL_JoystickListSize(&context->joysticks)) {
|
||||
int i;
|
||||
for (i = 0; i < nJoysticks; ++i) {
|
||||
struct SDL_JoystickCombo* joystick = SDL_JoystickListAppend(&context->joysticks);
|
||||
joystick->joystick = SDL_JoystickOpen(i);
|
||||
joystick->id = SDL_JoystickInstanceID(joystick->joystick);
|
||||
joystick->index = SDL_JoystickListSize(&context->joysticks) - 1;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
joystick->haptic = SDL_HapticOpenFromJoystick(joystick->joystick);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context->playersAttached = 0;
|
||||
|
|
Loading…
Reference in New Issue