From ede07638c11c29fe7545e58e57f5929011431965 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 8 Jan 2018 20:18:29 +0200 Subject: [PATCH] Re-enabled command line only non-rawinput keyboard and mouse support. --- od-win32/dinput.cpp | 10 ++++++---- od-win32/win32.cpp | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index f344dd86..bf21471e 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -2592,7 +2592,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) bool is_hid_rawinput(void) { - if (no_rawinput) + if (no_rawinput & 4) return false; if (!rawinput_enabled_hid && !rawinput_enabled_hid_reset) return false; @@ -2914,7 +2914,7 @@ static BOOL CALLBACK EnumObjectsCallback (const DIDEVICEOBJECTINSTANCE* pdidoi, } if (pdidoi->dwType & DIDFT_BUTTON) { - if (did->buttons >= ID_BUTTON_TOTAL) + if (did->buttons >= ID_BUTTON_TOTAL && did->type != DID_KEYBOARD) return DIENUM_CONTINUE; TCHAR *bname = did->buttonname[did->buttons] = my_strdup (pdidoi->tszName); if (did->type == DID_JOYSTICK) { @@ -3196,8 +3196,10 @@ static int di_do_init (void) rawinput_enabled_hid = 0; if (!rawinput_decided) { - rawinput_enabled_keyboard = true; - rawinput_enabled_mouse = true; + if (!(no_rawinput & 1)) + rawinput_enabled_keyboard = true; + if (!(no_rawinput & 2)) + rawinput_enabled_mouse = true; rawinput_decided = true; } if (!rawhid_found) { diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index e3170df9..5eba68ab 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -5795,8 +5795,20 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2) pngprint = 1; return 1; } - if (!_tcscmp (arg, _T("norawinput"))) { - no_rawinput = 1; + if (!_tcscmp(arg, _T("norawinput"))) { + no_rawinput |= 4; + return 1; + } + if (!_tcscmp(arg, _T("norawinput_all"))) { + no_rawinput = 7; + return 1; + } + if (!_tcscmp(arg, _T("norawinput_keyboard"))) { + no_rawinput |= 1; + return 1; + } + if (!_tcscmp(arg, _T("norawinput_mouse"))) { + no_rawinput |= 2; return 1; } if (!_tcscmp (arg, _T("nodirectinput"))) { -- 2.47.3