LilyPad: Add Exclude Input option

This new option on the pad tabs disables an input so it will be ignored
when trying to bind another input. This is helpful when binding controls
for a device with an input that's difficult to center like an
accelerator, or just always active like a faulty button or analog stick.
This commit is contained in:
FlatOutPS2 2016-12-30 20:03:58 +01:00
parent f8a79e5d40
commit 9163ed351c
3 changed files with 66 additions and 48 deletions

View File

@ -288,7 +288,7 @@ wchar_t *GetCommandStringW(u8 command, int port, int slot)
return temp;
}
/* Get text from the buttons. */
if (command >= 0x0C && command <= 0x28) {
if (command >= 0x0C && command <= 0x29) {
HWND hWnd = GetDlgItem(hWnds[port][slot][padtype], 0x10F0 + command);
if (!hWnd) {
wchar_t *strings[] = {
@ -321,6 +321,7 @@ wchar_t *GetCommandStringW(u8 command, int port, int slot)
L"R-Stick Down",
L"R-Stick Left",
L"Analog",
L"Excluded Input",
};
return strings[command - 0xC];
}
@ -1614,25 +1615,36 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l
InitInfo info = {selected == 0x7F, 1, hWndProp, &hWndButtonProc};
Device *dev = dm->GetActiveDevice(&info, &uid, &index, &value);
int selectedDevice = config.deviceSelect[port][slot];
if (dev && (selectedDevice == -1 || dm->devices[selectedDevice] == dev)) {
int command = selected;
// Good idea to do this first, as BindCommand modifies the ListView, which will
// call it anyways, which is a bit funky.
EndBinding(hWnd);
UnselectAll(hWndList);
int index = -1;
if (command == 0x7F && dev->api == IGNORE_KEYBOARD) {
index = BindCommand(dev, uid, 0, 0, 0, command, BASE_SENSITIVITY, 0, 0, 0);
} else if (command < 0x30) {
index = BindCommand(dev, uid, port, slot, padtype, command, BASE_SENSITIVITY, 0, 0, 0);
}
if (index >= 0) {
PropSheet_Changed(hWndProp, hWnds[port][slot][padtype]);
ListView_SetItemState(hWndList, index, LVIS_SELECTED, LVIS_SELECTED);
ListView_EnsureVisible(hWndList, index, 0);
config.bind = true;
if (dev == nullptr || (selectedDevice != -1 && dm->devices[selectedDevice] != dev))
return 0;
//Check the bindings for an excluded input, and ignore it if found.
PadBindings *p_c = dev->pads[port][slot] + padtype;
for (int i = 0; i < p_c->numBindings; i++) {
Binding *b2 = p_c->bindings + i;
int uid2 = dev->virtualControls[b2->controlIndex].uid;
if (b2->command == 0x29 && uid == uid2) {
return 0;
}
}
int command = selected;
// Good idea to do this first, as BindCommand modifies the ListView, which will
// call it anyways, which is a bit funky.
EndBinding(hWnd);
UnselectAll(hWndList);
int index = -1;
if (command < 0x30) {
index = BindCommand(dev, uid, port, slot, padtype, command, BASE_SENSITIVITY, 0, 0, 0);
}
if (index >= 0) {
PropSheet_Changed(hWndProp, hWnds[port][slot][padtype]);
ListView_SetItemState(hWndList, index, LVIS_SELECTED, LVIS_SELECTED);
ListView_EnsureVisible(hWndList, index, 0);
config.bind = true;
ListView_SetColumnWidth(hWndList, 2, LVSCW_AUTOSIZE_USEHEADER);
}
}
break;
case WM_SYSKEYDOWN:
@ -1851,7 +1863,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l
SetTimer(hWnd, 1, 3000, 0);
}
}
} else if ((cmd >= ID_LOCK_BUTTONS && cmd <= ID_ANALOG) || cmd == ID_IGNORE) { // || cmd == ID_FORCE_FEEDBACK) {
} else if ((cmd >= ID_LOCK_BUTTONS && cmd <= ID_EXCLUDE) || cmd == ID_IGNORE) { // || cmd == ID_FORCE_FEEDBACK) {
// Messes up things, unfortunately.
// End binding on a bunch of notification messages, and
// this will send a bunch.

View File

@ -95,10 +95,11 @@ BEGIN
// Special bindings and options:
CONTROL "Configure on bind",IDC_CONFIGURE_ON_BIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,250,70,15
COMBOBOX IDC_DEVICE_SELECT,259,250,72,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,15
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,214,59,15
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,232,59,15
PUSHBUTTON "Ignore Key",ID_IGNORE,196,250,59,15
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,14
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,213,59,14
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,230,59,14
PUSHBUTTON "Ignore Key",ID_IGNORE,196,247,59,14
PUSHBUTTON "Exclude Input",ID_EXCLUDE,196,264,59,14
// Force Feedback configuration:
GROUPBOX "",ID_FF,195,9,222,248
COMBOBOX IDC_FF_EFFECT,203,23,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -172,10 +173,11 @@ BEGIN
// Special bindings and options:
CONTROL "Configure on bind",IDC_CONFIGURE_ON_BIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,250,70,15
COMBOBOX IDC_DEVICE_SELECT,259,250,72,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,15
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,214,59,15
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,232,59,15
PUSHBUTTON "Ignore Key",ID_IGNORE,196,250,59,15
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,14
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,213,59,14
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,230,59,14
PUSHBUTTON "Ignore Key",ID_IGNORE,196,247,59,14
PUSHBUTTON "Exclude Input",ID_EXCLUDE,196,264,59,14
// Force Feedback configuration:
GROUPBOX "",ID_FF,195,9,222,248
COMBOBOX IDC_FF_EFFECT,203,23,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -249,10 +251,11 @@ BEGIN
// Special bindings and options:
CONTROL "Configure on bind",IDC_CONFIGURE_ON_BIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,250,70,15
COMBOBOX IDC_DEVICE_SELECT,259,250,72,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,15
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,214,59,15
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,232,59,15
PUSHBUTTON "Ignore Key",ID_IGNORE,196,250,59,15
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,14
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,213,59,14
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,230,59,14
PUSHBUTTON "Ignore Key",ID_IGNORE,196,247,59,14
PUSHBUTTON "Exclude Input",ID_EXCLUDE,196,264,59,14
// Force Feedback configuration:
GROUPBOX "",ID_FF,195,9,222,248
COMBOBOX IDC_FF_EFFECT,203,23,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -322,10 +325,11 @@ BEGIN
// Special bindings and options:
CONTROL "Configure on bind",IDC_CONFIGURE_ON_BIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,250,70,15
COMBOBOX IDC_DEVICE_SELECT,259,250,72,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,15
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,214,59,15
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,232,59,15
PUSHBUTTON "Ignore Key",ID_IGNORE,196,250,59,15
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,14
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,213,59,14
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,230,59,14
PUSHBUTTON "Ignore Key",ID_IGNORE,196,247,59,14
PUSHBUTTON "Exclude Input",ID_EXCLUDE,196,264,59,14
// Force Feedback configuration:
GROUPBOX "",ID_FF,195,9,222,248
COMBOBOX IDC_FF_EFFECT,203,23,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -407,10 +411,11 @@ BEGIN
// Special bindings and options:
CONTROL "Configure on bind",IDC_CONFIGURE_ON_BIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,250,70,15
COMBOBOX IDC_DEVICE_SELECT,259,250,72,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,15
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,214,59,15
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,232,59,15
PUSHBUTTON "Ignore Key",ID_IGNORE,196,250,59,15
PUSHBUTTON "Lock Input",ID_LOCK_ALL_INPUT,196,196,59,14
PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,213,59,14
PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,230,59,14
PUSHBUTTON "Ignore Key",ID_IGNORE,196,247,59,14
PUSHBUTTON "Exclude Input",ID_EXCLUDE,196,264,59,14
// Force Feedback configuration:
GROUPBOX "",ID_FF,195,9,222,248
COMBOBOX IDC_FF_EFFECT,203,23,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP

View File

@ -97,15 +97,16 @@
#define ID_RSTICK_DOWN 0x1116
#define ID_RSTICK_LEFT 0x1117
#define ID_ANALOG 0x1118
#define ID_IGNORE 0x1119
#define IDC_FORCEFEEDBACK 0x111A
#define IDC_FORCEFEEDBACK_FUNCTION 0x111B
#define ID_BIG_MOTOR 0x111C
#define ID_SMALL_MOTOR 0x111D
#define ID_FORCEFEEDBACK_BOX 0x111E
#define IDC_CONFIGURE_ON_BIND 0x111F
#define IDC_DEVICE_SELECT 0x1120
#define IDC_FACE_ANALOG 0x1121
#define ID_EXCLUDE 0x1119
#define ID_IGNORE 0x111A
#define IDC_FORCEFEEDBACK 0x111B
#define IDC_FORCEFEEDBACK_FUNCTION 0x111C
#define ID_BIG_MOTOR 0x111D
#define ID_SMALL_MOTOR 0x111E
#define ID_FORCEFEEDBACK_BOX 0x111F
#define IDC_CONFIGURE_ON_BIND 0x1120
#define IDC_DEVICE_SELECT 0x1121
#define IDC_FACE_ANALOG 0x1122
#define IDC_BINDINGS_LIST 0x1200
#define ID_SAVE 0x1201
#define ID_LOAD 0x1202