LilyPad: Add PS mouse support

Adds Playstation Mouse as a new pad type.

For use with PS1 games only.
This commit is contained in:
FlatOutPS2 2016-11-13 01:23:59 +01:00
parent a3478e02f4
commit de8d3fb1eb
7 changed files with 127 additions and 6 deletions

View File

@ -36,7 +36,8 @@ const wchar_t *padTypes[] = {
L"Unplugged", L"Unplugged",
L"Dualshock 2", L"Dualshock 2",
L"Guitar", L"Guitar",
L"Pop'n Music controller"}; L"Pop'n Music controller",
L"PS1 Mouse"};
// Hacks or configurations which PCSX2 needs with a specific value // Hacks or configurations which PCSX2 needs with a specific value
void PCSX2_overrideConfig(GeneralConfig &config_in_out) void PCSX2_overrideConfig(GeneralConfig &config_in_out)
@ -1890,6 +1891,8 @@ void UpdatePadPages()
psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG_GUITAR); psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG_GUITAR);
else if (config.padConfigs[port][slot].type == PopnPad) else if (config.padConfigs[port][slot].type == PopnPad)
psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG_POPN); psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG_POPN);
else if (config.padConfigs[port][slot].type == MousePad)
psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG_PS1_MOUSE);
else else
psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); psp.pszTemplate = MAKEINTRESOURCE(IDD_CONFIG);
@ -2055,6 +2058,7 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
AddTooltip(IDC_MOUSE_UNFOCUS, hWnd); AddTooltip(IDC_MOUSE_UNFOCUS, hWnd);
AddTooltip(IDC_MULTIPLE_BINDING, hWnd); AddTooltip(IDC_MULTIPLE_BINDING, hWnd);
AddTooltip(IDC_PAD_LIST, hWnd); AddTooltip(IDC_PAD_LIST, hWnd);
AddTooltip(IDC_PAD_TYPE, hWnd);
AddTooltip(ID_TEST, hWnd); AddTooltip(ID_TEST, hWnd);
AddTooltip(IDC_ANALOG_START1, hWnd); AddTooltip(IDC_ANALOG_START1, hWnd);

View File

@ -95,6 +95,12 @@ Binding 43=0x0020000D, 0, 24, 65536, 0, 0, 1, 3
Binding 44=0x0020000E, 0, 26, 65536, 0, 0, 1, 3 Binding 44=0x0020000E, 0, 26, 65536, 0, 0, 1, 3
Binding 45=0x00200010, 0, 29, 65536, 0, 0, 1, 3 Binding 45=0x00200010, 0, 29, 65536, 0, 0, 1, 3
Binding 46=0x00200011, 0, 20, 65536, 0, 0, 1, 3 Binding 46=0x00200011, 0, 20, 65536, 0, 0, 1, 3
Binding 47=0x00200008, 0, 29, 65536, 0, 0, 1, 4
Binding 48=0x00200009, 0, 30, 65536, 0, 0, 1, 4
Binding 49=0x01020013, 0, 33, 3000, 0, 0, 13172, 4
Binding 50=0x02020013, 0, 35, 3000, 0, 0, 13172, 4
Binding 51=0x01020014, 0, 32, 3000, 0, 0, 13172, 4
Binding 52=0x02020014, 0, 34, 3000, 0, 0, 13172, 4
FF Binding 0=Constant 0, 0, 0, 1, 0, 65536, 1, 0 FF Binding 0=Constant 0, 0, 0, 1, 0, 65536, 1, 0
FF Binding 1=Constant 0, 1, 0, 1, 0, 0, 1, 65536 FF Binding 1=Constant 0, 1, 0, 1, 0, 0, 1, 65536
[Device 1] [Device 1]
@ -149,6 +155,12 @@ Binding 43=0x0020000D, 1, 24, 65536, 0, 0, 1, 3
Binding 44=0x0020000E, 1, 26, 65536, 0, 0, 1, 3 Binding 44=0x0020000E, 1, 26, 65536, 0, 0, 1, 3
Binding 45=0x00200010, 1, 29, 65536, 0, 0, 1, 3 Binding 45=0x00200010, 1, 29, 65536, 0, 0, 1, 3
Binding 46=0x00200011, 1, 20, 65536, 0, 0, 1, 3 Binding 46=0x00200011, 1, 20, 65536, 0, 0, 1, 3
Binding 47=0x00200008, 1, 29, 65536, 0, 0, 1, 4
Binding 48=0x00200009, 1, 30, 65536, 0, 0, 1, 4
Binding 49=0x01020013, 1, 33, 3000, 0, 0, 13172, 4
Binding 50=0x02020013, 1, 35, 3000, 0, 0, 13172, 4
Binding 51=0x01020014, 1, 32, 3000, 0, 0, 13172, 4
Binding 52=0x02020014, 1, 34, 3000, 0, 0, 13172, 4
FF Binding 0=Constant 1, 0, 0, 1, 0, 65536, 1, 0 FF Binding 0=Constant 1, 0, 0, 1, 0, 65536, 1, 0
FF Binding 1=Constant 1, 1, 0, 1, 0, 0, 1, 65536 FF Binding 1=Constant 1, 1, 0, 1, 0, 0, 1, 65536
[Device 12] [Device 12]

View File

@ -37,6 +37,7 @@ enum PadType {
Dualshock2Pad, Dualshock2Pad,
GuitarPad, GuitarPad,
PopnPad, PopnPad,
MousePad,
numPadTypes // total number of PadTypes. Add new PadType above this line. numPadTypes // total number of PadTypes. Add new PadType above this line.
}; };

View File

@ -86,6 +86,7 @@ unsigned char inBuf[50];
// windowThreadId = GetWindowThreadProcessId(hWnd, 0); // windowThreadId = GetWindowThreadProcessId(hWnd, 0);
#define MODE_PS1_MOUSE 0x12
#define MODE_DIGITAL 0x41 #define MODE_DIGITAL 0x41
#define MODE_ANALOG 0x73 #define MODE_ANALOG 0x73
#define MODE_DS2_NATIVE 0x79 #define MODE_DS2_NATIVE 0x79
@ -789,7 +790,10 @@ void ResetPad(int port, int slot)
SetVibrate(port, slot, 1, 0); SetVibrate(port, slot, 1, 0);
memset(&pads[port][slot], 0, sizeof(pads[0][0])); memset(&pads[port][slot], 0, sizeof(pads[0][0]));
pads[port][slot].mode = MODE_DIGITAL; if (config.padConfigs[port][slot].type == MousePad)
pads[port][slot].mode = MODE_PS1_MOUSE;
else
pads[port][slot].mode = MODE_DIGITAL;
pads[port][slot].umask[0] = pads[port][slot].umask[1] = 0xFF; pads[port][slot].umask[0] = pads[port][slot].umask[1] = 0xFF;
// Sets up vibrate variable. // Sets up vibrate variable.
ResetVibrate(port, slot); ResetVibrate(port, slot);
@ -1224,6 +1228,23 @@ u8 CALLBACK PADpoll(u8 value)
Update(query.port, query.slot); Update(query.port, query.slot);
ButtonSum *sum = &pad->sum; ButtonSum *sum = &pad->sum;
if (config.padConfigs[query.port][query.slot].type == MousePad) {
u8 b1 = 0xFC;
if (sum->buttons[5 + 4] > 0) // Left button
b1 -= 2 << 2;
if (sum->buttons[6 + 4] > 0) // Right button
b1 -= 2 << 1;
query.response[3] = 0xFF;
query.response[4] = b1;
query.response[5] = sum->sticks[1].horiz / 2;
query.response[6] = sum->sticks[1].vert / 2;
query.numBytes = 7;
query.lastByte = 1;
DEBUG_OUT(pad->mode);
return pad->mode;
}
u8 b1 = 0xFF, b2 = 0xFF; u8 b1 = 0xFF, b2 = 0xFF;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
b1 -= (sum->buttons[i] > 0) << i; b1 -= (sum->buttons[i] > 0) << i;
@ -1291,7 +1312,7 @@ u8 CALLBACK PADpoll(u8 value)
// QUERY_DS2_ANALOG_MODE // QUERY_DS2_ANALOG_MODE
case 0x41: case 0x41:
// Right? Wrong? No clue. // Right? Wrong? No clue.
if (pad->mode == MODE_DIGITAL) { if (pad->mode == MODE_DIGITAL || pad->mode == MODE_PS1_MOUSE) {
queryMaskMode[1] = queryMaskMode[2] = queryMaskMode[3] = 0; queryMaskMode[1] = queryMaskMode[2] = queryMaskMode[3] = 0;
queryMaskMode[6] = 0x00; queryMaskMode[6] = 0x00;
} else { } else {
@ -1373,8 +1394,12 @@ u8 CALLBACK PADpoll(u8 value)
// SET_MODE_AND_LOCK // SET_MODE_AND_LOCK
case 0x44: case 0x44:
if (query.lastByte == 3 && value < 2) { if (query.lastByte == 3 && value < 2) {
static const u8 modes[2] = {MODE_DIGITAL, MODE_ANALOG}; if (value == 0 && config.padConfigs[query.port][query.slot].type == MousePad) {
pad->mode = modes[value]; pad->mode = MODE_PS1_MOUSE;
} else {
static const u8 modes[2] = {MODE_DIGITAL, MODE_ANALOG};
pad->mode = modes[value];
}
} else if (query.lastByte == 4) { } else if (query.lastByte == 4) {
if (value == 3) { if (value == 3) {
pad->modeLock = 3; pad->modeLock = 3;
@ -1596,7 +1621,7 @@ s32 CALLBACK PADfreeze(int mode, freezeData *data)
for (int slot = 0; slot < 4; slot++) { for (int slot = 0; slot < 4; slot++) {
u8 mode = pdata.padData[port][slot].mode; u8 mode = pdata.padData[port][slot].mode;
if (mode != MODE_DIGITAL && mode != MODE_ANALOG && mode != MODE_DS2_NATIVE) { if (mode != MODE_DIGITAL && mode != MODE_ANALOG && mode != MODE_DS2_NATIVE && mode != MODE_PS1_MOUSE) {
break; break;
} }

View File

@ -274,6 +274,70 @@ BEGIN
PUSHBUTTON "Small Motor",ID_SMALL_MOTOR,347,291,64,14 PUSHBUTTON "Small Motor",ID_SMALL_MOTOR,347,291,64,14
END END
IDD_CONFIG_PS1_MOUSE DIALOGEX 0, 0, 424, 318
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,7,7,183,285,WS_EX_CLIENTEDGE
PUSHBUTTON "Delete Selected",ID_DELETE,7,296,59,15
PUSHBUTTON "Clear All",ID_CLEAR,71,296,56,15
PUSHBUTTON "Ignore Key",ID_IGNORE,132,296,58,15
PUSHBUTTON "Mouse",ID_MOUSE,366,30,34,15
PUSHBUTTON "X-axis Left",ID_LSTICK_LEFT,256,112,45,15
PUSHBUTTON "X-axis Right",ID_LSTICK_RIGHT,307,112,45,15
PUSHBUTTON "Y-axis Up",ID_LSTICK_UP,283,92,45,15
PUSHBUTTON "Y-axis Down",ID_LSTICK_DOWN,283,132,45,15
PUSHBUTTON "Left-click", ID_CIRCLE,256,56,45,15
PUSHBUTTON "Right-click", ID_CROSS,307,56,45,15
GROUPBOX "",ID_FF,195,6,222,248
COMBOBOX IDC_FF_EFFECT,203,20,206,106,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_FF_AXIS1,"msctls_trackbar32",WS_TABSTOP,199,40,214,17
CONTROL "Axis 1",IDC_FF_AXIS1_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,60,91,10
CONTROL "Flip",IDC_FF_AXIS1_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,60,35,10
EDITTEXT IDC_FF_AXIS1_SCALE,375,60,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "",IDC_FF_AXIS2,"msctls_trackbar32",WS_TABSTOP,199,76,214,17
CONTROL "Axis 2",IDC_FF_AXIS2_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,96,91,10
CONTROL "Flip",IDC_FF_AXIS2_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,96,35,10
EDITTEXT IDC_FF_AXIS2_SCALE,375,96,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "",IDC_FF_AXIS3,"msctls_trackbar32",WS_TABSTOP,199,112,214,17
CONTROL "Axis 3",IDC_FF_AXIS3_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,132,91,10
CONTROL "Flip",IDC_FF_AXIS3_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,132,35,10
EDITTEXT IDC_FF_AXIS3_SCALE,375,132,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "",IDC_FF_AXIS4,"msctls_trackbar32",WS_TABSTOP,199,148,214,17
CONTROL "Axis 4",IDC_FF_AXIS4_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,168,91,10
CONTROL "Flip",IDC_FF_AXIS4_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,168,35,10
EDITTEXT IDC_FF_AXIS4_SCALE,375,168,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "",IDC_FF_AXIS5,"msctls_trackbar32",WS_TABSTOP,199,184,214,17
CONTROL "Axis 5",IDC_FF_AXIS5_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,204,91,10
CONTROL "Flip",IDC_FF_AXIS5_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,204,35,10
EDITTEXT IDC_FF_AXIS5_SCALE,375,204,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "",IDC_FF_AXIS6,"msctls_trackbar32",WS_TABSTOP,199,220,214,17
CONTROL "Axis 6",IDC_FF_AXIS6_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,240,91,10
CONTROL "Flip",IDC_FF_AXIS6_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,302,240,35,10
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 "Configure Binding",ID_SENSITIVITY,195,186,222,70
EDITTEXT IDC_AXIS_DEVICE,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_CONTROL,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_SLIDER_SENSITIVITY,"msctls_trackbar32",WS_TABSTOP,240,215,131,17
EDITTEXT IDC_AXIS_SENSITIVITY,377,213,33,12,ES_RIGHT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_RTLREADING
CONTROL "Flip",IDC_FLIP,"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_ALL_INPUT,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 "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
END
IDD_GENERAL DIALOGEX 0, 0, 424, 327 IDD_GENERAL DIALOGEX 0, 0, 424, 327
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
@ -376,6 +440,14 @@ BEGIN
BOTTOMMARGIN, 311 BOTTOMMARGIN, 311
END END
IDD_CONFIG_PS1_MOUSE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 417
TOPMARGIN, 7
BOTTOMMARGIN, 311
END
IDD_GENERAL, DIALOG IDD_GENERAL, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7

View File

@ -46,6 +46,12 @@ LPWSTR dialog_message(int ID, bool *updateText)
L"Right-click to show a pop-up menu that allows for swapping all the settings and bindings, or just the bindings of individual pad types," L"Right-click to show a pop-up menu that allows for swapping all the settings and bindings, or just the bindings of individual pad types,"
L"between the selected pad and one of other active pads, and clearing all the settings and bindings from the selected pad or just the bindings from a selected pad type.\n\n" L"between the selected pad and one of other active pads, and clearing all the settings and bindings from the selected pad or just the bindings from a selected pad type.\n\n"
L"Note: To allow swapping different kinds of pad types(like DS2 to Guitar), the \"Allow binding multiple PS2 Controls...\" option needs to be enabled as well."; L"Note: To allow swapping different kinds of pad types(like DS2 to Guitar), the \"Allow binding multiple PS2 Controls...\" option needs to be enabled as well.";
case IDC_PAD_TYPE:
return L"\"Unplugged\" disables the controller and removes the corresponding pad tab.\n\n"
L"\"Dualshock 2\" emulates the default PS2 controller for use in both PS1 and PS2 games.\n\n"
L"\"Guitar\" emulates a PS2 controller used in the Guitar Hero and Rock Band series of games.\n\n"
L"\"Pop'n Music controller\" emulates a PS2 controller used exclusively in the Japanese Pop'n Music series of games.\n\n"
L"\"PS1 Mouse\" emulates the Playstation Mouse. This controller can only be used in a number of PS1 games like \"Command & Conquer: Red Alert\" and \"Myst\".";
case IDC_ANALOG_START1: case IDC_ANALOG_START1:
return L"Automatically switch a pad from digital mode to analog mode whenever a pad is set to digital mode, if the pad's mode is not locked." return L"Automatically switch a pad from digital mode to analog mode whenever a pad is set to digital mode, if the pad's mode is not locked."
L"This removes the need for manually enabling analog mode with a press of the analog button for games that support, but do not automatically enable analog mode.\n\n" L"This removes the need for manually enabling analog mode with a press of the analog button for games that support, but do not automatically enable analog mode.\n\n"

View File

@ -13,6 +13,7 @@
#define IDD_DIAG 110 #define IDD_DIAG 110
#define IDR_INI1 111 #define IDR_INI1 111
#define IDD_CONFIG_POPN 112 #define IDD_CONFIG_POPN 112
#define IDD_CONFIG_PS1_MOUSE 113
#define IDC_CLOSE_HACK1 1099 #define IDC_CLOSE_HACK1 1099
#define IDC_KB_DISABLE 1100 #define IDC_KB_DISABLE 1100
#define IDC_KB_DI 1101 #define IDC_KB_DI 1101