Add SDL_HINT_DIRECTINPUT_ENABLED (on by default)

This commit is contained in:
Jade Macho
2022-06-28 21:03:16 +02:00
committed by Sam Lantinga
parent db7dfece16
commit 6a2e6c82a0
3 changed files with 26 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
#if SDL_HAPTIC_DINPUT
#include "SDL_hints.h"
#include "SDL_stdinc.h"
#include "SDL_timer.h"
#include "SDL_windowshaptic_c.h"
@@ -77,6 +78,11 @@ SDL_DINPUT_HapticInit(void)
return SDL_SetError("Haptic: SubSystem already open.");
}
if (!SDL_GetHintBoolean(SDL_HINT_DIRECTINPUT_ENABLED, SDL_TRUE)) {
/* In some environments, IDirectInput8_Initialize / _EnumDevices can take a minute even with no controllers. */
return 0;
}
ret = WIN_CoInitialize();
if (FAILED(ret)) {
return DI_SetError("Coinitialize", ret);