Unverified Commit ef5910ee by Rémi Verschelde Committed by GitHub

Merge pull request #39143 from madmiraal/fix-39116

Do not probe joypads if DirectInput cannot be initialized.
parents d19257eb 97a529b1
...@@ -67,13 +67,16 @@ JoypadWindows::JoypadWindows(HWND *hwnd) { ...@@ -67,13 +67,16 @@ JoypadWindows::JoypadWindows(HWND *hwnd) {
for (int i = 0; i < JOYPADS_MAX; i++) for (int i = 0; i < JOYPADS_MAX; i++)
attached_joypads[i] = false; attached_joypads[i] = false;
HRESULT result; HRESULT result = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&dinput, nullptr);
result = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&dinput, nullptr); if (result == DI_OK) {
if (FAILED(result)) { probe_joypads();
printf("Couldn't initialize DirectInput: %ld\n", result); } else {
printf("Rebooting your PC may solve this issue.\n"); ERR_PRINT("Couldn't initialize DirectInput. Error: " + itos(result));
if (result == DIERR_OUTOFMEMORY) {
ERR_PRINT("The Windows DirectInput subsystem could not allocate sufficient memory.");
ERR_PRINT("Rebooting your PC may solve this issue.");
}
} }
probe_joypads();
} }
JoypadWindows::~JoypadWindows() { JoypadWindows::~JoypadWindows() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment