File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ void SDL_PrivateGamepadAdded(SDL_JoystickID instance_id)
312
312
{
313
313
SDL_Event event ;
314
314
315
- if (!SDL_gamepads_initialized ) {
315
+ if (!SDL_gamepads_initialized || SDL_IsJoystickBeingAdded () ) {
316
316
return ;
317
317
}
318
318
Original file line number Diff line number Diff line change @@ -2316,6 +2316,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
2316
2316
SDL_JoystickDriver * driver ;
2317
2317
int device_index ;
2318
2318
int player_index = -1 ;
2319
+ bool is_gamepad ;
2319
2320
2320
2321
SDL_AssertJoysticksLocked ();
2321
2322
@@ -2350,9 +2351,12 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
2350
2351
}
2351
2352
}
2352
2353
2354
+ // This might create an automatic gamepad mapping, so wait to send the event
2355
+ is_gamepad = SDL_IsGamepad (instance_id );
2356
+
2353
2357
SDL_joystick_being_added = false;
2354
2358
2355
- if (SDL_IsGamepad ( instance_id ) ) {
2359
+ if (is_gamepad ) {
2356
2360
SDL_PrivateGamepadAdded (instance_id );
2357
2361
}
2358
2362
}
You can’t perform that action at this time.
0 commit comments