diff --git a/configuration.c b/configuration.c index 11e9bd712f..fd43ab6edb 100644 --- a/configuration.c +++ b/configuration.c @@ -238,6 +238,7 @@ enum input_driver_enum INPUT_QNX, INPUT_RWEBINPUT, INPUT_DOS, + INPUT_WINRAW, INPUT_NULL }; @@ -457,8 +458,10 @@ static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_ANDROID; static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_SDL2; #elif defined(EMSCRIPTEN) static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_RWEBINPUT; -#elif defined(_WIN32) +#elif defined(_WIN32) && defined(HAVE_DINPUT) static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_DINPUT; +#elif defined(_WIN32) && !defined(HAVE_DINPUT) && _WIN32_WINNT >= 0x0501 +static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_WINRAW; #elif defined(ORBIS) static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_PS4; #elif defined(__CELLOS_LV2__) @@ -875,6 +878,8 @@ const char *config_get_default_input(void) return "sdl2"; case INPUT_DINPUT: return "dinput"; + case INPUT_WINRAW: + return "raw"; case INPUT_X: return "x"; case INPUT_WAYLAND: diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index e7af7248f6..f18cb2235c 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -163,7 +163,9 @@ void d3d_input_driver(const char* input_name, const char* joypad_name, const inp } #endif +#ifdef HAVE_DINPUT *input_data = input_dinput.init(joypad_name); *input = *input_data ? &input_dinput : NULL; #endif +#endif } diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index aa115c4713..9b486b89ff 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -98,6 +98,12 @@ extern void *dinput_wgl; extern void *dinput; #endif +#if defined(HAVE_XINPUT) && !defined(HAVE_DINPUT) +#ifndef MAX_PADS +#define MAX_PADS 4 +#endif +#endif + typedef struct DISPLAYCONFIG_RATIONAL_CUSTOM { UINT32 Numerator; UINT32 Denominator; @@ -601,6 +607,10 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, if (input_get_ptr() == &input_dinput && (lparam >> 24 & 0x1)) keysym |= 0x80; } +#else + { + /* fix key binding issues on winraw when DirectInput is not available */ + } #endif /* Key released? */ if (message == WM_KEYUP || message == WM_SYSKEYUP)