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
This commit is contained in:
mattmenke 2009-08-25 12:05:08 +00:00
parent 487775dea9
commit 143b2f63d3
2 changed files with 10 additions and 9 deletions

View File

@ -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);

View File

@ -379,12 +379,8 @@ Device *InputDeviceManager::GetActiveDevice(void *info, unsigned int *uid, int *
for (j=0; j<devices[i]->numVirtualControls; 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;