Add SDL_HINT_DIRECTINPUT_ENABLED (on by default)

This commit is contained in:
Jade Macho authored and Sam Lantinga committed 2022-06-28 15:59:05 -07:00
1 parent db7dfece16
commit 6a2e6c82a0
3 files changed
+26

No files matched your search

+6
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);