diff --git a/plugins/LilyPad/Config.cpp b/plugins/LilyPad/Config.cpp index 1aa050bd25..3c31bffb79 100644 --- a/plugins/LilyPad/Config.cpp +++ b/plugins/LilyPad/Config.cpp @@ -1,6 +1,9 @@ #include "Global.h" -#include "PS2Edefs.h" +#include "resource.h" +#include "InputManager.h" +#include "Config.h" + #include "Diagnostics.h" #include "DeviceEnumerator.h" #include "KeyboardQueue.h" @@ -96,6 +99,7 @@ void SetLogSliderVal(HWND hWnd, int id, HWND hWndText, int val) { int sliderPos = 0; wchar_t temp[30]; EnableWindow(hWndSlider, val != 0); + EnableWindow(hWndText, val != 0); EnableWindow(GetDlgItem(hWnd, id+1), val != 0); if (!val) val = BASE_SENSITIVITY; CheckDlgButton(hWnd, id+1, BST_CHECKED * (val<0)); @@ -268,7 +272,7 @@ inline void GetSettingsFileName(wchar_t *out) { } int GetBinding(int port, int slot, int index, Device *&dev, Binding *&b, ForceFeedbackBinding *&ffb); -int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, int command, int sensitivity, int turbo); +int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, int command, int sensitivity, int turbo, int deadZone); int CreateEffectBinding(Device *dev, wchar_t *effectName, unsigned int port, unsigned int slot, unsigned int motor, ForceFeedbackBinding **binding); @@ -283,6 +287,8 @@ void SelChanged(int port, int slot) { // Second value is now turbo. int turbo = -1; int sensitivity = 0; + int deadZone = 0; + int nonButtons = 0; // Set if sensitivity != 0, but need to disable flip anyways. // Only used to relative axes. int disableFlip = 0; @@ -350,6 +356,10 @@ void SelChanged(int port, int slot) { else { sensitivity += b->sensitivity; } + if (((control->uid >> 16)&0xFF) != PSHBTN && ((control->uid >> 16)&0xFF) != TGLBTN) { + deadZone += b->deadZone; + nonButtons++; + } } else disableFlip = 1; } @@ -360,6 +370,7 @@ void SelChanged(int port, int slot) { if ((bFound && ffbFound) || ffbFound > 1) { ffb = 0; turbo = -1; + deadZone = 0; sensitivity = 0; disableFlip = 1; bFound = ffbFound = 0; @@ -367,6 +378,9 @@ void SelChanged(int port, int slot) { else if (bFound) { turbo++; sensitivity /= bFound; + if (nonButtons) { + deadZone /= nonButtons; + } if (bFound > 1) disableFlip = 1; else if (flipped) { sensitivity = -sensitivity; @@ -417,8 +431,9 @@ void SelChanged(int port, int slot) { ShowWindow(hWndTemp, enable); } } - if (!ffb) { + if (!ffb) { SetLogSliderVal(hWnd, IDC_SLIDER1, GetDlgItem(hWnd, IDC_AXIS_SENSITIVITY1), sensitivity); + SetLogSliderVal(hWnd, IDC_SLIDER_DEADZONE, GetDlgItem(hWnd, IDC_AXIS_DEADZONE), deadZone); if (disableFlip) EnableWindow(GetDlgItem(hWnd, IDC_FLIP1), 0); @@ -570,7 +585,7 @@ int ListBoundEffect(int port, int slot, Device *dev, ForceFeedbackBinding *b) { } // Only for use with control bindings. Affects all highlighted bindings. -void ChangeValue(int port, int slot, int *newSensitivity, int *turbo) { +void ChangeValue(int port, int slot, int *newSensitivity, int *newTurbo, int *newDeadZone) { if (!hWnds[port][slot]) return; HWND hWndList = GetDlgItem(hWnds[port][slot], IDC_LIST); int count = ListView_GetSelectedCount(hWndList); @@ -590,8 +605,11 @@ void ChangeValue(int port, int slot, int *newSensitivity, int *turbo) { else b->sensitivity = *newSensitivity; } - if (turbo) { - b->turbo = *turbo; + if (newDeadZone) { + b->deadZone = *newDeadZone; + } + if (newTurbo) { + b->turbo = *newTurbo; } } PropSheet_Changed(hWndProp, hWnds[port][slot]); @@ -758,7 +776,7 @@ int SaveSettings(wchar_t *file=0) { Binding *b = dev->pads[port][slot].bindings+j; VirtualControl *c = &dev->virtualControls[b->controlIndex]; wsprintfW(temp, L"Binding %i", bindingCount++); - wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->turbo, slot); + wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->turbo, slot, b->deadZone); noError &= WritePrivateProfileStringW(id, temp, temp2, file); } for (int j=0; jpads[port][slot].numFFBindings; j++) { @@ -891,7 +909,7 @@ int LoadSettings(int force, wchar_t *file) { } last = 1; unsigned int uid; - int port, command, sensitivity, turbo, slot = 0; + int port, command, sensitivity, turbo, slot = 0, deadZone = 0; int w = 0; char string[1000]; while (temp2[w]) { @@ -899,12 +917,12 @@ int LoadSettings(int force, wchar_t *file) { w++; } string[w] = 0; - int len = sscanf(string, " %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &turbo, &slot); + int len = sscanf(string, " %i , %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &turbo, &slot, &deadZone); if (len >= 5 && type) { VirtualControl *c = dev->GetVirtualControl(uid); if (!c) c = dev->AddVirtualControl(uid, -1); if (c) { - BindCommand(dev, uid, port, slot, command, sensitivity, turbo); + BindCommand(dev, uid, port, slot, command, sensitivity, turbo, deadZone); } } } @@ -1119,12 +1137,20 @@ int CreateEffectBinding(Device *dev, wchar_t *effectID, unsigned int port, unsig return ListBoundEffect(port, slot, dev, b); } -int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, int command, int sensitivity, int turbo) { +int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, int command, int sensitivity, int turbo, int deadZone) { // Checks needed because I use this directly when loading bindings. if (port > 1 || slot>3) { return -1; } if (!sensitivity) sensitivity = BASE_SENSITIVITY; + else if (!deadZone) { + if (dev->api != DS3 || !((uid>>16) & PRESSURE_BTN)) { + deadZone = DEFAULT_DEADZONE; + } + else { + deadZone = 1; + } + } // Relative axes can have negative sensitivity. else if (((uid>>16) & 0xFF) == RELAXIS) { sensitivity = abs(sensitivity); @@ -1146,6 +1172,7 @@ int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int s b->controlIndex = controlIndex; b->turbo = turbo; b->sensitivity = sensitivity; + b->deadZone = deadZone; // Where it appears in listview. int count = ListBoundCommand(port, slot, dev, b); @@ -1253,8 +1280,8 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l slot = (int)((PROPSHEETPAGE *)lParam)->lParam >> 1; hWnds[port][slot] = hWnd; SendMessage(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); - HWND hWndSlider = GetDlgItem(hWnd, IDC_SLIDER1); - SetupLogSlider(hWndSlider); + SetupLogSlider(GetDlgItem(hWnd, IDC_SLIDER1)); + SetupLogSlider(GetDlgItem(hWnd, IDC_SLIDER_DEADZONE)); if (port || slot) EnableWindow(GetDlgItem(hWnd, ID_IGNORE), 0); @@ -1286,14 +1313,15 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l UnselectAll(hWndList); int index = -1; if (command == 0x7F && dev->api == IGNORE_KEYBOARD) { - index = BindCommand(dev, uid, 0, 0, command, BASE_SENSITIVITY, 0); + index = BindCommand(dev, uid, 0, 0, command, BASE_SENSITIVITY, 0, 0); } else if (command < 0x30) { - index = BindCommand(dev, uid, port, slot, command, BASE_SENSITIVITY, 0); + index = BindCommand(dev, uid, port, slot, command, BASE_SENSITIVITY, 0, 0); } if (index >= 0) { PropSheet_Changed(hWndProp, hWnds[port][slot]); ListView_SetItemState(hWndList, index, LVIS_SELECTED, LVIS_SELECTED); + ListView_EnsureVisible(hWndList, index, 0); } } } @@ -1355,7 +1383,10 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l int id = GetDlgCtrlID((HWND)lParam); int val = GetLogSliderVal(hWnd, id); if (id == IDC_SLIDER1) { - ChangeValue(port, slot, &val, 0); + ChangeValue(port, slot, &val, 0, 0); + } + else if (id == IDC_SLIDER_DEADZONE) { + ChangeValue(port, slot, 0, 0, &val); } else { ChangeEffect(port, slot, id, &val, 0); @@ -1377,7 +1408,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l uid = (uid&0x00FFFFFF) | axisUIDs[cbsel]; Binding backup = *b; DeleteSelected(port, slot); - int index = BindCommand(dev, uid, port, slot, backup.command, backup.sensitivity, backup.turbo); + int index = BindCommand(dev, uid, port, slot, backup.command, backup.sensitivity, backup.turbo, backup.deadZone); ListView_SetItemState(hWndList, index, LVIS_SELECTED, LVIS_SELECTED); PropSheet_Changed(hWndProp, hWnd); } @@ -1464,6 +1495,7 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l } UnselectAll(hWndList); ListView_SetItemState(hWndList, count, LVIS_SELECTED, LVIS_SELECTED); + ListView_EnsureVisible(hWndList, count, 0); } PropSheet_Changed(hWndProp, hWnd); } @@ -1532,11 +1564,11 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l // Don't allow setting it back to indeterminate. SendMessage(GetDlgItem(hWnd, IDC_TURBO), BM_SETSTYLE, BS_AUTOCHECKBOX, 0); int turbo = (IsDlgButtonChecked(hWnd, IDC_TURBO) == BST_CHECKED); - ChangeValue(port, slot, 0, &turbo); + ChangeValue(port, slot, 0, &turbo, 0); } - else if (cmd == IDC_FLIP1 || cmd == IDC_TURBO) { + else if (cmd == IDC_FLIP1) { int val = GetLogSliderVal(hWnd, IDC_SLIDER1); - ChangeValue(port, slot, &val, 0); + ChangeValue(port, slot, &val, 0, 0); } else if (cmd >= IDC_FF_AXIS1_ENABLED && cmd < IDC_FF_AXIS8_ENABLED + 16) { int index = (cmd - IDC_FF_AXIS1_ENABLED)/16; @@ -1825,26 +1857,7 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L } int mtap = config.multitap[0] + 2*config.multitap[1]; - - if (IsDlgButtonChecked(hWnd, IDC_G_DS3) && !config.gameApis.dualShock3) { - if (IDOK != - MessageBoxA(hWnd, - "This option will attempt to connect directly to any connected\n" - "DualShock 3 devices. It is completely experimental, and based\n" - "on no published specs.\n" - "\n" - "Furthermore, It uses libusb to Initialize DS3 pads. Libusb can\n" - "do odd things to USB and non-USB devices when it enumerates them.\n" - "\n" - "That having been said, I know of no serious problems with it.\n" - "\n" - "I have no idea if it works with bluetooth or not.\n" - "\n" - "Are you sure you wish to continue?", "Warning", MB_OKCANCEL | MB_ICONWARNING)) { - CheckDlgButton(hWnd, IDC_G_DS3, BST_UNCHECKED); - } - - } + int vistaVol = config.vistaVolume; for (int j=0; j +#include "InputManager.h" #include "VKey.h" #include "DirectInput.h" -#include #include "DeviceEnumerator.h" #include "PS2Etypes.h" @@ -597,7 +598,13 @@ BOOL CALLBACK EnumCallback (LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) { } IDirectInputDevice8 *did; if (DI_OK == di8->CreateDevice(lpddi->guidInstance, &did, 0)) { - dm->AddDevice(new DirectInputDevice(type, did, fullName, instanceID, productID, lpddi->guidInstance)); + DirectInputDevice *dev = new DirectInputDevice(type, did, fullName, instanceID, productID, lpddi->guidInstance); + if (dev->numPhysicalControls || dev->numFFAxes) { + dm->AddDevice(dev); + } + else { + delete dev; + } } free(fullName); return DIENUM_CONTINUE; diff --git a/plugins/LilyPad/DualShock3.cpp b/plugins/LilyPad/DualShock3.cpp index 663b7e18b3..ec6707862e 100644 --- a/plugins/LilyPad/DualShock3.cpp +++ b/plugins/LilyPad/DualShock3.cpp @@ -1,4 +1,6 @@ #include "Global.h" +#include "InputManager.h" + #include "usb.h" #include "HidDevice.h" @@ -242,7 +244,12 @@ public: this->index = index; int i; for (i=0; i<16; i++) { - AddPhysicalControl(PSHBTN, i, 0); + if (i != 14 && i != 15 && i != 8 && i != 9) { + AddPhysicalControl(PRESSURE_BTN, i, 0); + } + else { + AddPhysicalControl(PSHBTN, i, 0); + } } for (; i<23; i++) { AddPhysicalControl(ABSAXIS, i, 0); diff --git a/plugins/LilyPad/Global.h b/plugins/LilyPad/Global.h index 88cad949ed..9d4d39eff0 100644 --- a/plugins/LilyPad/Global.h +++ b/plugins/LilyPad/Global.h @@ -7,6 +7,11 @@ #ifdef NO_CRT #define _CRT_ALLOCATION_DEFINED + +inline void * malloc(size_t size); +inline void * calloc(size_t num, size_t size); +inline void free(void * mem); +inline void * realloc(void *mem, size_t size); #endif #define UNICODE @@ -50,10 +55,6 @@ #include "PS2Etypes.h" #include "PS2Edefs.h" -#include "resource.h" -#include "InputManager.h" -#include "Config.h" - extern HINSTANCE hInst; // Needed for config screen void GetNameAndVersionString(wchar_t *out); @@ -92,10 +93,6 @@ EXPORT_C_(s32) PADqueryMtap(u8 port); #ifdef NO_CRT -#define malloc MyMalloc -#define calloc MyCalloc -#define free MyFree -#define realloc MyRealloc #define wcsdup MyWcsdup #define wcsicmp MyWcsicmp @@ -110,7 +107,7 @@ inline void * calloc(size_t num, size_t size) { return out; } -inline void free(__inout_opt void * mem) { +inline void free(void * mem) { if (mem) HeapFree(GetProcessHeap(), 0, mem); } @@ -126,14 +123,6 @@ inline void * realloc(void *mem, size_t size) { return HeapReAlloc(GetProcessHeap(), 0, mem, size); } -inline wchar_t * __cdecl wcsdup(const wchar_t *in) { - size_t size = sizeof(wchar_t) * (1+wcslen(in)); - wchar_t *out = (wchar_t*) malloc(size); - if (out) - memcpy(out, in, size); - return out; -} - inline void * __cdecl operator new(size_t lSize) { return HeapAlloc(GetProcessHeap(), 0, lSize); } @@ -142,6 +131,14 @@ inline void __cdecl operator delete(void *pBlock) { HeapFree(GetProcessHeap(), 0, pBlock); } +inline wchar_t * __cdecl wcsdup(const wchar_t *in) { + size_t size = sizeof(wchar_t) * (1+wcslen(in)); + wchar_t *out = (wchar_t*) malloc(size); + if (out) + memcpy(out, in, size); + return out; +} + inline int __cdecl wcsicmp(const wchar_t *s1, const wchar_t *s2) { int res = CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, s1, -1, s2, -1); if (res) return res-2; diff --git a/plugins/LilyPad/InputManager.cpp b/plugins/LilyPad/InputManager.cpp index d9510fdc0f..4fbe503266 100644 --- a/plugins/LilyPad/InputManager.cpp +++ b/plugins/LilyPad/InputManager.cpp @@ -392,6 +392,10 @@ Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, i if (((devices[i]->virtualControls[j].uid>>16) & 0xFF) == RELAXIS) { diff = diff/4+1; } + // Less pressure needed to bind DS3 buttons. + if (devices[i]->api == DS3 && (((devices[i]->virtualControls[j].uid>>16) & 0xFF) & BUTTON)) { + diff *= 4; + } if (diff > bestDiff) { if (devices[i]->virtualControls[j].uid & UID_AXIS) { if ((((devices[i]->virtualControls[j].uid>>16)&0xFF) != ABSAXIS)) continue; diff --git a/plugins/LilyPad/InputManager.h b/plugins/LilyPad/InputManager.h index 610b9b55ec..0080472325 100644 --- a/plugins/LilyPad/InputManager.h +++ b/plugins/LilyPad/InputManager.h @@ -9,6 +9,7 @@ #define BASE_SENSITIVITY (1<<16) #define FULLY_DOWN (1<<16) +#define DEFAULT_DEADZONE (BASE_SENSITIVITY/0x10) /* Idea is for this file and the associated cpp file to be Windows independent. * Still more effort than it's worth to port to Linux, however. @@ -34,16 +35,19 @@ enum ControlType { // that range is treated as -1 (Though 36000-37000 is treated // like 0 to 1000, just in case). POV = 16, + PRESSURE_BTN = 32, }; // Masks to determine button type. Don't need one for POV. -#define BUTTON 12 +#define BUTTON (PSHBTN | TGLBTN | PRESSURE_BTN) +#define BINARY_BUTTON (PSHBTN | TGLBTN) #define AXIS 3 struct Binding { int controlIndex; int command; int sensitivity; + int deadZone; unsigned char turbo; }; diff --git a/plugins/LilyPad/KeyboardHook.cpp b/plugins/LilyPad/KeyboardHook.cpp index f5e6227249..4e17d1880c 100644 --- a/plugins/LilyPad/KeyboardHook.cpp +++ b/plugins/LilyPad/KeyboardHook.cpp @@ -1,10 +1,11 @@ #include "Global.h" +#include "InputManager.h" +#include "Config.h" #include "KeyboardHook.h" #include "WindowsKeyboard.h" #include "VKey.h" #include "WndProcEater.h" -#include "DeviceEnumerator.h" extern HINSTANCE hInst; LRESULT CALLBACK IgnoreKeyboardHook(int code, WPARAM wParam, LPARAM lParam); diff --git a/plugins/LilyPad/LilyPad.cpp b/plugins/LilyPad/LilyPad.cpp index d4347be2fa..a063461b9e 100644 --- a/plugins/LilyPad/LilyPad.cpp +++ b/plugins/LilyPad/LilyPad.cpp @@ -2,6 +2,9 @@ // For escape timer, so as not to break GSDX+DX9. #include +#include "resource.h" +#include "InputManager.h" +#include "Config.h" #define PADdefs @@ -328,21 +331,24 @@ void AddForce(ButtonSum *sum, u8 cmd, int delta = 255) { } void ProcessButtonBinding(Binding *b, ButtonSum *sum, int value) { + if (value < b->deadZone || !value) return; + int sensitivity = b->sensitivity; if (sensitivity < 0) { sensitivity = -sensitivity; value = (1<<16)-value; } - if (value > 0) { - /* Note: Value ranges of FULLY_DOWN, and sensitivity of - * BASE_SENSITIVITY corresponds to an axis/button being exactly fully down. - * Math in next line takes care of those two conditions, rounding as necessary. - * Done using __int64s because overflows will occur when - * sensitivity > BASE_SENSITIVITY and/or value > FULLY_DOWN. Latter only happens - * for relative axis. - */ - AddForce(sum, b->command, (int)((((sensitivity*(255*(__int64)value)) + BASE_SENSITIVITY/2)/BASE_SENSITIVITY + FULLY_DOWN/2)/FULLY_DOWN)); - } + if (value < 0) return; + + /* Note: Value ranges of FULLY_DOWN, and sensitivity of + * BASE_SENSITIVITY corresponds to an axis/button being exactly fully down. + * Math in next line takes care of those two conditions, rounding as necessary. + * Done using __int64s because overflows will occur when + * sensitivity > BASE_SENSITIVITY and/or value > FULLY_DOWN. Latter only happens + * for relative axis. + */ + int force = (int)((((sensitivity*(255*(__int64)value)) + BASE_SENSITIVITY/2)/BASE_SENSITIVITY + FULLY_DOWN/2)/FULLY_DOWN); + AddForce(sum, b->command, force); } // Restricts d-pad/analog stick values to be from -255 to 255 and button values to be from 0 to 255. @@ -1020,20 +1026,20 @@ u8 CALLBACK PADpoll(u8 value) { u8 b1 = 0xFF, b2 = 0xFF; for (i = 0; i<4; i++) { - b1 -= (sum->buttons[i]>=0x10) << i; + b1 -= (sum->buttons[i] > 0) << i; } for (i = 0; i<8; i++) { - b2 -= (sum->buttons[i+4]>=0x10) << i; + b2 -= (sum->buttons[i+4] > 0) << i; } if (config.padConfigs[query.port][query.slot].type == GuitarPad && !config.GH2) { sum->sticks[0].horiz = -255; // Not sure about this. Forces wammy to be from 0 to 0x7F. // if (sum->sticks[2].vert > 0) sum->sticks[2].vert = 0; } - b1 -= ((sum->sticks[0].vert<=-0x10) << 4); - b1 -= ((sum->sticks[0].horiz>=0x10) << 5); - b1 -= ((sum->sticks[0].vert>=0x10) << 6); - b1 -= ((sum->sticks[0].horiz<=-0x10) << 7); + b1 -= ((sum->sticks[0].vert < 0) << 4); + b1 -= ((sum->sticks[0].horiz > 0) << 5); + b1 -= ((sum->sticks[0].vert > 0) << 6); + b1 -= ((sum->sticks[0].horiz < 0) << 7); query.response[3] = b1; query.response[4] = b2; diff --git a/plugins/LilyPad/LilyPad.rc b/plugins/LilyPad/LilyPad.rc index f63e8e4de6..02446c077f 100644 --- a/plugins/LilyPad/LilyPad.rc +++ b/plugins/LilyPad/LilyPad.rc @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include \r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -117,14 +117,18 @@ BEGIN EDITTEXT IDC_FF_AXIS6_SCALE,375,240,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING PUSHBUTTON "Test",ID_TEST,196,260,59,15 PUSHBUTTON "Back to Controls",ID_CONTROLS,196,296,59,15 - GROUPBOX "Sensitivity",ID_SENSITIVITY,195,188,222,66 - EDITTEXT IDC_AXIS_DEVICE1,203,202,208,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - COMBOBOX IDC_AXIS_DIRECTION,202,218,70,47,CBS_DROPDOWNLIST | WS_TABSTOP - EDITTEXT IDC_AXIS_CONTROL1,203,240,74,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - CONTROL "",IDC_SLIDER1,"msctls_trackbar32",WS_TABSTOP,276,217,138,17 - CONTROL "Flip",IDC_FLIP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,240,27,10 - CONTROL "Turbo",IDC_TURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,240,34,10 - EDITTEXT IDC_AXIS_SENSITIVITY1,375,240,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING + GROUPBOX "Configure Binding",ID_SENSITIVITY,195,186,222,70 + EDITTEXT IDC_AXIS_DEVICE1,202,199,74,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP + COMBOBOX IDC_AXIS_DIRECTION,276,197,70,47,CBS_DROPDOWNLIST | WS_TABSTOP + EDITTEXT IDC_AXIS_CONTROL1,349,199,65,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP + LTEXT "Sensitivity",IDC_LABEL_SENSITIVITY,202,215,42,8 + CONTROL "Turbo",IDC_TURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,225,34,10 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",WS_TABSTOP,240,215,131,17 + EDITTEXT IDC_AXIS_SENSITIVITY1,377,213,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING + CONTROL "Flip",IDC_FLIP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,385,224,27,10 + LTEXT "Dead Zone",IDC_LABEL_DEADZONE,202,240,42,8 + CONTROL "",IDC_SLIDER_DEADZONE,"msctls_trackbar32",WS_TABSTOP,240,236,131,17 + EDITTEXT IDC_AXIS_DEADZONE,377,239,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING PUSHBUTTON "Lock Input",ID_LOCK,196,260,59,15 PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,278,59,15 PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,296,59,15 @@ -181,18 +185,22 @@ BEGIN EDITTEXT IDC_FF_AXIS6_SCALE,375,240,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING PUSHBUTTON "Test",ID_TEST,196,260,59,15 PUSHBUTTON "Back to Controls",ID_CONTROLS,196,296,59,15 - GROUPBOX "Binding Details",ID_SENSITIVITY,195,188,222,66 - EDITTEXT IDC_AXIS_DEVICE1,203,202,208,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - COMBOBOX IDC_AXIS_DIRECTION,202,218,70,47,CBS_DROPDOWNLIST | WS_TABSTOP - EDITTEXT IDC_AXIS_CONTROL1,203,240,74,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - CONTROL "",IDC_SLIDER1,"msctls_trackbar32",WS_TABSTOP,276,217,138,17 - CONTROL "Flip",IDC_FLIP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,240,27,10 - CONTROL "Turbo",IDC_TURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,240,34,10 - EDITTEXT IDC_AXIS_SENSITIVITY1,375,240,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING + GROUPBOX "Configure Binding",ID_SENSITIVITY,195,186,222,70 + EDITTEXT IDC_AXIS_DEVICE1,202,199,74,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP + COMBOBOX IDC_AXIS_DIRECTION,276,197,70,47,CBS_DROPDOWNLIST | WS_TABSTOP + EDITTEXT IDC_AXIS_CONTROL1,349,199,65,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP + LTEXT "Sensitivity",IDC_LABEL_SENSITIVITY,202,215,42,8 + CONTROL "Turbo",IDC_TURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,225,34,10 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",WS_TABSTOP,240,215,131,17 + EDITTEXT IDC_AXIS_SENSITIVITY1,377,213,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING + CONTROL "Flip",IDC_FLIP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,385,224,27,10 + LTEXT "Dead Zone",IDC_LABEL_DEADZONE,202,240,42,8 + CONTROL "",IDC_SLIDER_DEADZONE,"msctls_trackbar32",WS_TABSTOP,240,236,131,17 + EDITTEXT IDC_AXIS_DEADZONE,377,239,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING PUSHBUTTON "Lock Input",ID_LOCK,196,260,59,15 PUSHBUTTON "Lock Direction",ID_LOCK_DIRECTION,196,278,59,15 PUSHBUTTON "Lock Buttons",ID_LOCK_BUTTONS,196,296,59,15 - GROUPBOX "New Force Feedback Effect",IDC_STATIC,262,260,155,51 + GROUPBOX "Add Force Feedback Effect",IDC_STATIC,262,260,155,51 COMBOBOX IDC_FORCEFEEDBACK,269,273,142,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Big Motor",ID_BIG_MOTOR,269,291,64,14 PUSHBUTTON "Small Motor",ID_SMALL_MOTOR,347,291,64,14 @@ -274,7 +282,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_CONFIG, DIALOG BEGIN diff --git a/plugins/LilyPad/LilyPad_VC2008.vcproj b/plugins/LilyPad/LilyPad_VC2008.vcproj index e1e4f94de6..81aeedf9fa 100644 --- a/plugins/LilyPad/LilyPad_VC2008.vcproj +++ b/plugins/LilyPad/LilyPad_VC2008.vcproj @@ -96,6 +96,89 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -581,23 +585,6 @@ PreprocessorDefinitions="" /> - - - - - - @@ -608,6 +595,15 @@ PreprocessorDefinitions="" /> + + + @@ -642,6 +638,14 @@ PreprocessorDefinitions="" /> + + + @@ -651,23 +655,6 @@ PreprocessorDefinitions="" /> - - - - - - @@ -678,6 +665,15 @@ PreprocessorDefinitions="" /> + + + @@ -705,22 +701,6 @@ UsePrecompiledHeader="1" /> - - - - - - @@ -729,6 +709,14 @@ UsePrecompiledHeader="1" /> + + + @@ -737,6 +725,14 @@ UsePrecompiledHeader="1" /> + + + @@ -778,22 +774,6 @@ PreprocessorDefinitions="" /> - - - - - - @@ -802,6 +782,14 @@ PreprocessorDefinitions="" /> + + + @@ -810,6 +798,14 @@ PreprocessorDefinitions="" /> + + + @@ -938,6 +934,14 @@ PreprocessorDefinitions="" /> + + + @@ -947,23 +951,6 @@ PreprocessorDefinitions="" /> - - - - - - @@ -974,6 +961,15 @@ PreprocessorDefinitions="" /> + + + diff --git a/plugins/LilyPad/RawInput.cpp b/plugins/LilyPad/RawInput.cpp index 6f03a61180..23bfc88b59 100644 --- a/plugins/LilyPad/RawInput.cpp +++ b/plugins/LilyPad/RawInput.cpp @@ -1,4 +1,5 @@ #include "Global.h" +#include "InputManager.h" #include "WindowsMessaging.h" #include "VKey.h" #include "DeviceEnumerator.h" diff --git a/plugins/LilyPad/WindowsKeyboard.cpp b/plugins/LilyPad/WindowsKeyboard.cpp index 83eb180a44..6144ef360c 100644 --- a/plugins/LilyPad/WindowsKeyboard.cpp +++ b/plugins/LilyPad/WindowsKeyboard.cpp @@ -1,4 +1,5 @@ #include "Global.h" +#include "InputManager.h" #include "VKey.h" #include "WindowsKeyboard.h" #include "KeyboardQueue.h" diff --git a/plugins/LilyPad/WindowsMessaging.cpp b/plugins/LilyPad/WindowsMessaging.cpp index 64a8ef38fe..c827899c61 100644 --- a/plugins/LilyPad/WindowsMessaging.cpp +++ b/plugins/LilyPad/WindowsMessaging.cpp @@ -1,4 +1,5 @@ #include "Global.h" +#include "InputManager.h" #include "WindowsMessaging.h" #include "VKey.h" #include "DeviceEnumerator.h" diff --git a/plugins/LilyPad/WindowsMouse.cpp b/plugins/LilyPad/WindowsMouse.cpp index 6d2e4db653..9f105108a0 100644 --- a/plugins/LilyPad/WindowsMouse.cpp +++ b/plugins/LilyPad/WindowsMouse.cpp @@ -1,4 +1,5 @@ #include "Global.h" +#include "InputManager.h" #include "VKey.h" #include "WindowsMouse.h" diff --git a/plugins/LilyPad/XInput.cpp b/plugins/LilyPad/XInput.cpp index 6d4f85118c..0b89cb2292 100644 --- a/plugins/LilyPad/XInput.cpp +++ b/plugins/LilyPad/XInput.cpp @@ -1,6 +1,7 @@ #include "Global.h" -#include "VKey.h" #include +#include "VKey.h" +#include "InputManager.h" // This way, I don't require that XInput junk be installed. typedef void (CALLBACK *_XInputEnable)(BOOL enable); @@ -36,10 +37,14 @@ public: memset(&xInputVibration, 0, sizeof(xInputVibration)); this->index = index; int i; - for (i=0; i<16; i++) { + for (i=0; i<14; i++) { // The i > 9 accounts for the 2 bit skip in button flags. AddPhysicalControl(PSHBTN, i + 2*(i > 9), 0); } + for (i=14; i<16; i++) { + // The i > 9 accounts for the 2 bit skip in button flags. + AddPhysicalControl(PRESSURE_BTN, i + 2*(i > 9), 0); + } for (; i<20; i++) { AddPhysicalControl(ABSAXIS, i + 2, 0); } diff --git a/plugins/LilyPad/resource.h b/plugins/LilyPad/resource.h index 01203943b3..672ec89b63 100644 --- a/plugins/LilyPad/resource.h +++ b/plugins/LilyPad/resource.h @@ -55,6 +55,10 @@ #define IDC_DPAD 0x1008 #define IDC_LSTICK 0x1009 #define IDC_RSTICK 0x100A +#define IDC_SLIDER_DEADZONE 0x1010 +#define IDC_AXIS_DEADZONE 0x1014 +#define IDC_LABEL_SENSITIVITY 0x1020 +#define IDC_LABEL_DEADZONE 0x1021 #define ID_LOCK_BUTTONS 0x10FC #define ID_LOCK 0x10FD #define ID_LOCK_DIRECTION 0x10FE