Do not probe joypads if DirectInput cannot be initialized.
This commit is contained in:
parent
d19257eb2b
commit
97a529b1d8
|
@ -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)) {
|
|
||||||
printf("Couldn't initialize DirectInput: %ld\n", result);
|
|
||||||
printf("Rebooting your PC may solve this issue.\n");
|
|
||||||
}
|
|
||||||
probe_joypads();
|
probe_joypads();
|
||||||
|
} else {
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JoypadWindows::~JoypadWindows() {
|
JoypadWindows::~JoypadWindows() {
|
||||||
|
|
Loading…
Reference in New Issue