From 143b2f63d33cd2a5ac9777a7ac4c16582e2d0c9d Mon Sep 17 00:00:00 2001 From: mattmenke Date: Tue, 25 Aug 2009 12:05:08 +0000 Subject: [PATCH] LilyPad: bugfix that should (hopefully) make it more difficult to accidentally bind an entire axis. May make issues with devices incorrectly reporting initial state worse. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1679 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/LilyPad/Config.cpp | 2 +- plugins/LilyPad/InputManager.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/LilyPad/Config.cpp b/plugins/LilyPad/Config.cpp index a5bb915bf2..2a8fe44f6b 100644 --- a/plugins/LilyPad/Config.cpp +++ b/plugins/LilyPad/Config.cpp @@ -1519,7 +1519,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l dm->Update(&info); dm->PostRead(); // Workaround for things that return 0 on first poll and something else ever after. - Sleep(40); + Sleep(80); dm->Update(&info); dm->PostRead(); SetTimer(hWnd, 1, 30, 0); diff --git a/plugins/LilyPad/InputManager.cpp b/plugins/LilyPad/InputManager.cpp index 1686838e0a..43b82668d5 100644 --- a/plugins/LilyPad/InputManager.cpp +++ b/plugins/LilyPad/InputManager.cpp @@ -379,12 +379,8 @@ Device *InputDeviceManager::GetActiveDevice(void *info, unsigned int *uid, int * for (j=0; jnumVirtualControls; j++) { if (devices[i]->virtualControlState[j] == devices[i]->oldVirtualControlState[j]) continue; if (devices[i]->virtualControls[j].uid & UID_POV) continue; - // Fix for two things: - // Releasing button used to click on bind button, and - // DirectInput not updating control state. - //Note: Handling latter not great for pressure sensitive button handling, but should still work... - // with some effort. - if (!(devices[i]->virtualControls[j].uid & (POV|RELAXIS))) { + // Fix for releasing button used to click on bind button + if (!((devices[i]->virtualControls[j].uid>>16) & (POV|RELAXIS|ABSAXIS))) { if (abs(devices[i]->oldVirtualControlState[j]) > abs(devices[i]->virtualControlState[j])) { devices[i]->oldVirtualControlState[j] = 0; } @@ -398,11 +394,16 @@ Device *InputDeviceManager::GetActiveDevice(void *info, unsigned int *uid, int * if (devices[i]->virtualControls[j].uid & UID_AXIS) { if ((((devices[i]->virtualControls[j].uid>>16)&0xFF) != ABSAXIS)) continue; // Very picky when binding entire axes. Prefer binding half-axes. - if (!((devices[i]->oldVirtualControlState[j] < FULLY_DOWN/16 && devices[i]->virtualControlState[j] > FULLY_DOWN/8) || - (devices[i]->oldVirtualControlState[j] > 15*FULLY_DOWN/16 && devices[i]->virtualControlState[j] < 7*FULLY_DOWN/8))) + if (!((devices[i]->oldVirtualControlState[j] < FULLY_DOWN/32 && devices[i]->virtualControlState[j] > FULLY_DOWN/8) || + (devices[i]->oldVirtualControlState[j] > 31*FULLY_DOWN/32 && devices[i]->virtualControlState[j] < 7*FULLY_DOWN/8))) { continue; + } devices[i]->virtualControls[j].uid = devices[i]->virtualControls[j].uid; } + else if ((((devices[i]->virtualControls[j].uid>>16)&0xFF) == ABSAXIS)) { + if (devices[i]->oldVirtualControlState[j] > 15*FULLY_DOWN/16) + continue; + } bestDiff = diff; *uid = devices[i]->virtualControls[j].uid; *index = j;