You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
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:
@@ -58,6 +58,19 @@ JoypadSDL::JoypadSDL() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
extern "C" {
|
||||
HWND SDL_HelperWindow;
|
||||
}
|
||||
|
||||
// Required for DInput joypads to work
|
||||
// TODO: remove this workaround when we update to newer version of SDL
|
||||
JoypadSDL::JoypadSDL(HWND p_helper_window) :
|
||||
JoypadSDL() {
|
||||
SDL_HelperWindow = p_helper_window;
|
||||
}
|
||||
#endif
|
||||
|
||||
JoypadSDL::~JoypadSDL() {
|
||||
// Process any remaining input events
|
||||
process_events();
|
||||
@@ -247,17 +260,6 @@ void JoypadSDL::process_events() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
extern "C" {
|
||||
HWND SDL_HelperWindow;
|
||||
}
|
||||
|
||||
// Required for DInput joypads to work
|
||||
void JoypadSDL::setup_sdl_helper_window(HWND p_hwnd) {
|
||||
SDL_HelperWindow = p_hwnd;
|
||||
}
|
||||
#endif
|
||||
|
||||
void JoypadSDL::close_joypad(int p_pad_idx) {
|
||||
int sdl_instance_idx = joypads[p_pad_idx].sdl_instance_idx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user