Fix DirectInput controllers on game startup

Now SDL and DirectInput don't complain when a game starts with a DirectInput controller already connected. Fixes "JoypadSDL::process_events: Error opening gamepad at index 1: IDirectInputDevice8::SetCooperativeLevel() DirectX error 0x80070006"
This commit is contained in:
Nintorch
2025-08-21 13:21:48 +05:00
parent 7cc3f374a5
commit dd2e1b104b
3 changed files with 18 additions and 18 deletions

View File

@@ -7188,10 +7188,8 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
}
#ifdef SDL_ENABLED
joypad_sdl = memnew(JoypadSDL());
if (joypad_sdl->initialize() == OK) {
joypad_sdl->setup_sdl_helper_window(windows[MAIN_WINDOW_ID].hWnd);
} else {
joypad_sdl = memnew(JoypadSDL(windows[MAIN_WINDOW_ID].hWnd));
if (joypad_sdl->initialize() != OK) {
ERR_PRINT("Couldn't initialize SDL joypad input driver.");
memdelete(joypad_sdl);
joypad_sdl = nullptr;