This commit is contained in:
twinaphex 2017-08-09 15:54:24 +02:00
parent ee275c85d8
commit 4e49155147

View File

@ -51,7 +51,6 @@
#include "../../gfx/video_driver.h" #include "../../gfx/video_driver.h"
#include "../../verbosity.h" #include "../../verbosity.h"
#include "../../tasks/tasks_internal.h"
/* Keep track of which pad indexes are 360 controllers. /* Keep track of which pad indexes are 360 controllers.
* Not static, will be read in xinput_joypad.c * Not static, will be read in xinput_joypad.c
@ -102,23 +101,20 @@ void dinput_destroy_context(void)
bool dinput_init_context(void) bool dinput_init_context(void)
{ {
bool context_initialized = false;
if (g_dinput_ctx) if (g_dinput_ctx)
return true; return true;
CoInitialize(NULL); CoInitialize(NULL);
/* Who said we shouldn't have same call signature in a COM API? <_< */ /* Who said we shouldn't have same call signature in a COM API? <_< */
context_initialized = (SUCCEEDED(DirectInput8Create( if (!(SUCCEEDED(DirectInput8Create(
GetModuleHandle(NULL), DIRECTINPUT_VERSION, GetModuleHandle(NULL), DIRECTINPUT_VERSION,
#ifdef __cplusplus #ifdef __cplusplus
IID_IDirectInput8, IID_IDirectInput8,
#else #else
&IID_IDirectInput8, &IID_IDirectInput8,
#endif #endif
(void**)&g_dinput_ctx, NULL))); (void**)&g_dinput_ctx, NULL))))
if (!context_initialized)
goto error; goto error;
return true; return true;