LilyPad: Replace Turbo hack

The "L3 Toggles Turbo" hack has been removed and been replaced by a
bindable Turbo button on the Pad tabs. The Turbo function in the input
configuration has been renamed Rapid Fire.
This commit is contained in:
FlatOutPS2 2017-01-26 19:14:34 +01:00
parent 6e54dfe5ba
commit 6074d60a90
8 changed files with 56 additions and 59 deletions

View File

@ -112,7 +112,6 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
{L"Save State in Title", IDC_SAVE_STATE_TITLE, 0}, // Not required for PCSX2
{L"GH2", IDC_GH2_HACK, 0},
{L"Turbo Key Hack", IDC_TURBO_KEY_HACK, 0},
};
void Populate(int port, int slot, int padtype);
@ -287,7 +286,7 @@ wchar_t *GetCommandStringW(u8 command, int port, int slot)
return temp;
}
/* Get text from the buttons. */
if (command >= 0x0C && command <= 0x29) {
if (command >= 0x0C && command <= 0x2A) {
HWND hWnd = GetDlgItem(hWnds[port][slot][padtype], 0x10F0 + command);
if (!hWnd) {
wchar_t *strings[] = {
@ -321,6 +320,7 @@ wchar_t *GetCommandStringW(u8 command, int port, int slot)
L"R-Stick Left",
L"Analog",
L"Excluded Input",
L"Turbo",
};
return strings[command - 0xC];
}
@ -365,7 +365,7 @@ void CALLBACK PADsetSettingsDir(const char *dir)
}
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, unsigned int padtype, int command, int sensitivity, int turbo, int deadZone, int skipDeadZone);
int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, unsigned int padtype, int command, int sensitivity, int rapidFire, int deadZone, int skipDeadZone);
int CreateEffectBinding(Device *dev, wchar_t *effectName, unsigned int port, unsigned int slot, unsigned int padtype, unsigned int motor, ForceFeedbackBinding **binding);
@ -380,8 +380,8 @@ void SelChanged(int port, int slot)
wchar_t *devName = L"N/A";
wchar_t *key = L"N/A";
wchar_t *command = L"N/A";
// Second value is now turbo.
int turbo = -1;
// Second value is now rapidFire.
int rapidFire = -1;
int sensitivity = 0;
int deadZone = 0;
int skipDeadZone = 0;
@ -451,7 +451,7 @@ void SelChanged(int port, int slot)
if (((control->uid >> 16) & 0xFF) == RELAXIS) {
disableFlip = 1;
}
turbo += b->turbo;
rapidFire += b->rapidFire;
if (b->sensitivity < 0) {
flipped++;
sensitivity -= b->sensitivity;
@ -470,14 +470,14 @@ void SelChanged(int port, int slot)
}
if ((bFound && ffbFound) || ffbFound > 1) {
ffb = 0;
turbo = -1;
rapidFire = -1;
deadZone = 0;
skipDeadZone = 0;
sensitivity = 0;
disableFlip = 1;
bFound = ffbFound = 0;
} else if (bFound) {
turbo++;
rapidFire++;
sensitivity /= bFound;
if (nonButtons) {
deadZone /= nonButtons;
@ -551,13 +551,13 @@ void SelChanged(int port, int slot)
if (disableFlip)
EnableWindow(GetDlgItem(hWnd, IDC_FLIP), 0);
EnableWindow(GetDlgItem(hWnd, IDC_TURBO), turbo >= 0);
if (turbo > 0 && turbo < bFound) {
SendMessage(GetDlgItem(hWnd, IDC_TURBO), BM_SETSTYLE, BS_AUTO3STATE, 0);
CheckDlgButton(hWnd, IDC_TURBO, BST_INDETERMINATE);
EnableWindow(GetDlgItem(hWnd, IDC_RAPID_FIRE), rapidFire >= 0);
if (rapidFire > 0 && rapidFire < bFound) {
SendMessage(GetDlgItem(hWnd, IDC_RAPID_FIRE), BM_SETSTYLE, BS_AUTO3STATE, 0);
CheckDlgButton(hWnd, IDC_RAPID_FIRE, BST_INDETERMINATE);
} else {
SendMessage(GetDlgItem(hWnd, IDC_TURBO), BM_SETSTYLE, BS_AUTOCHECKBOX, 0);
CheckDlgButton(hWnd, IDC_TURBO, BST_CHECKED * (bFound && turbo == bFound));
SendMessage(GetDlgItem(hWnd, IDC_RAPID_FIRE), BM_SETSTYLE, BS_AUTOCHECKBOX, 0);
CheckDlgButton(hWnd, IDC_RAPID_FIRE, BST_CHECKED * (bFound && rapidFire == bFound));
}
HWND hWndCombo = GetDlgItem(hWnd, IDC_AXIS_DIRECTION);
int enableCombo = 0;
@ -712,7 +712,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 *newTurbo, int *newDeadZone, int *newSkipDeadZone)
void ChangeValue(int port, int slot, int *newSensitivity, int *newRapidFire, int *newDeadZone, int *newSkipDeadZone)
{
int padtype = config.padConfigs[port][slot].type;
if (!hWnds[port][slot][padtype])
@ -748,8 +748,8 @@ void ChangeValue(int port, int slot, int *newSensitivity, int *newTurbo, int *ne
b->skipDeadZone = *newSkipDeadZone;
}
}
if (newTurbo) {
b->turbo = *newTurbo;
if (newRapidFire) {
b->rapidFire = *newRapidFire;
}
}
PropSheet_Changed(hWndProp, hWnds[port][slot][padtype]);
@ -912,7 +912,7 @@ int SaveSettings(wchar_t *file = 0)
Binding *b = dev->pads[port][slot][padtype].bindings + j;
VirtualControl *c = &dev->virtualControls[b->controlIndex];
wsprintfW(temp, L"Binding %i", bindingCount++);
wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->turbo, slot, b->deadZone, b->skipDeadZone, padtype);
wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->rapidFire, slot, b->deadZone, b->skipDeadZone, padtype);
noError &= WritePrivateProfileStringW(id, temp, temp2, file);
}
for (int j = 0; j < dev->pads[port][slot][padtype].numFFBindings; j++) {
@ -1039,7 +1039,7 @@ int LoadSettings(int force, wchar_t *file)
}
last = 1;
unsigned int uid;
int port, command, sensitivity, turbo, slot = 0, deadZone = 0, skipDeadZone = 0, padtype = 0;
int port, command, sensitivity, rapidFire, slot = 0, deadZone = 0, skipDeadZone = 0, padtype = 0;
int w = 0;
char string[1000];
while (temp2[w]) {
@ -1047,7 +1047,7 @@ int LoadSettings(int force, wchar_t *file)
w++;
}
string[w] = 0;
int len = sscanf(string, " %i , %i , %i , %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &turbo, &slot, &deadZone, &skipDeadZone, &padtype);
int len = sscanf(string, " %i , %i , %i , %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &rapidFire, &slot, &deadZone, &skipDeadZone, &padtype);
if (len >= 5 && type) {
VirtualControl *c = dev->GetVirtualControl(uid);
if (!c)
@ -1064,7 +1064,7 @@ int LoadSettings(int force, wchar_t *file)
padtype = skipDeadZone;
skipDeadZone = 0;
}
BindCommand(dev, uid, port, slot, padtype, command, sensitivity, turbo, deadZone, skipDeadZone);
BindCommand(dev, uid, port, slot, padtype, command, sensitivity, rapidFire, deadZone, skipDeadZone);
}
}
}
@ -1376,7 +1376,7 @@ 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, unsigned int padtype, int command, int sensitivity, int turbo, int deadZone, int skipDeadZone)
int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, unsigned int padtype, int command, int sensitivity, int rapidFire, int deadZone, int skipDeadZone)
{
// Checks needed because I use this directly when loading bindings.
if (port > 1 || slot > 3 || padtype >= numPadTypes)
@ -1418,7 +1418,7 @@ int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int s
p->numBindings++;
b->command = command;
b->controlIndex = controlIndex;
b->turbo = turbo;
b->rapidFire = rapidFire;
b->sensitivity = sensitivity;
b->deadZone = deadZone;
b->skipDeadZone = skipDeadZone;
@ -1547,7 +1547,8 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l
AddTooltip(ID_LOCK_ALL_INPUT, hWnd);
AddTooltip(ID_LOCK_DIRECTION, hWnd);
AddTooltip(ID_LOCK_BUTTONS, hWnd);
AddTooltip(IDC_TURBO, hWnd);
AddTooltip(ID_TURBO_KEY, hWnd);
AddTooltip(IDC_RAPID_FIRE, hWnd);
AddTooltip(IDC_FLIP, hWnd);
AddTooltip(IDC_SLIDER_DEADZONE, hWnd);
AddTooltip(IDC_SLIDER_SKIP_DEADZONE, hWnd);
@ -1740,7 +1741,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, padtype, backup.command, backup.sensitivity, backup.turbo, backup.deadZone, backup.skipDeadZone);
int index = BindCommand(dev, uid, port, slot, padtype, backup.command, backup.sensitivity, backup.rapidFire, backup.deadZone, backup.skipDeadZone);
ListView_SetItemState(hWndList, index, LVIS_SELECTED, LVIS_SELECTED);
PropSheet_Changed(hWndProp, hWnd);
}
@ -1851,7 +1852,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_EXCLUDE) { // || cmd == ID_FORCE_FEEDBACK) {
} else if (cmd >= ID_LOCK_BUTTONS && cmd <= ID_TURBO_KEY) { // || cmd == ID_FORCE_FEEDBACK) {
// Messes up things, unfortunately.
// End binding on a bunch of notification messages, and
// this will send a bunch.
@ -1873,11 +1874,11 @@ INT_PTR CALLBACK DialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM l
} else if (cmd == IDC_CONFIGURE_ON_BIND) {
config.configureOnBind = IsDlgButtonChecked(hWnd, IDC_CONFIGURE_ON_BIND);
}
if (cmd == IDC_TURBO) {
if (cmd == IDC_RAPID_FIRE) {
// 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, 0, 0);
SendMessage(GetDlgItem(hWnd, IDC_RAPID_FIRE), BM_SETSTYLE, BS_AUTOCHECKBOX, 0);
int rapidFire = (IsDlgButtonChecked(hWnd, IDC_RAPID_FIRE) == BST_CHECKED);
ChangeValue(port, slot, 0, &rapidFire, 0, 0);
} else if (cmd == IDC_FLIP) {
int val = GetLogSliderVal(hWnd, IDC_SLIDER_SENSITIVITY);
ChangeValue(port, slot, &val, 0, 0, 0);

View File

@ -1,5 +1,5 @@
/* LilyPad - Pad plugin for PS2 Emulator
* Copyright (C) 2002-2014 PCSX2 Dev Team/ChickenLiver
* Copyright (C) 2002-2017 PCSX2 Dev Team/ChickenLiver
*
* PCSX2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
@ -68,7 +68,6 @@ public:
u8 saveStateTitle;
u8 GH2;
u8 turboKeyHack;
};
u8 bools[15];
};

View File

@ -15,7 +15,6 @@ Disable Screen Saver=0
Logging=0
Save State in Title=0
GH2=0
Turbo Key Hack=0
Close Hack=0
Keyboard Mode=2
Mouse Mode=0

View File

@ -1,5 +1,5 @@
/* LilyPad - Pad plugin for PS2 Emulator
* Copyright (C) 2002-2014 PCSX2 Dev Team/ChickenLiver
* Copyright (C) 2002-2017 PCSX2 Dev Team/ChickenLiver
*
* PCSX2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
@ -82,7 +82,7 @@ struct Binding
int sensitivity;
int deadZone;
int skipDeadZone;
unsigned char turbo;
unsigned char rapidFire;
};
#define UID_AXIS (1U << 31)

View File

@ -392,16 +392,13 @@ void ProcessButtonBinding(Binding *b, ButtonSum *sum, int value)
value = std::min((int)(((__int64)value * (FULLY_DOWN - (__int64)b->skipDeadZone)) / FULLY_DOWN) + b->skipDeadZone, FULLY_DOWN);
}
if (config.turboKeyHack == 1) { // send a tabulator keypress to emulator
//printf("%x\n", b->command);
if (b->command == 0x11) { // L3 button
static unsigned int LastCheck = 0;
unsigned int t = timeGetTime();
if (t - LastCheck < 300)
return;
QueueKeyEvent(VK_TAB, KEYPRESS);
LastCheck = t;
}
if (b->command == 0x2A) { // Turbo key
static unsigned int LastCheck = 0;
unsigned int t = timeGetTime();
if (t - LastCheck < 300)
return;
QueueKeyEvent(VK_TAB, KEYPRESS);
LastCheck = t;
}
int sensitivity = b->sensitivity;
@ -530,8 +527,8 @@ void Update(unsigned int port, unsigned int slot)
0, 0, hWndTop, &hWndGSProc};
#endif
dm->Update(&info);
static int turbo = 0;
turbo++;
static int rapidFire = 0;
rapidFire++;
for (i = 0; i < dm->numDevices; i++) {
Device *dev = dm->devices[i];
// Skip both disabled devices and inactive enabled devices.
@ -547,7 +544,7 @@ void Update(unsigned int port, unsigned int slot)
Binding *b = dev->pads[port][slot][padtype].bindings + j;
int cmd = b->command;
int state = dev->virtualControlState[b->controlIndex];
if (!(turbo & b->turbo)) {
if (!(rapidFire & b->rapidFire)) {
if (cmd > 0x0F && cmd != 0x28) {
ProcessButtonBinding(b, &s[port][slot], state);
} else if ((state >> 15) && !(dev->oldVirtualControlState[b->controlIndex] >> 15)) {

View File

@ -1,5 +1,5 @@
/* LilyPad - Pad plugin for PS2 Emulator
* Copyright (C) 2002-2014 PCSX2 Dev Team/ChickenLiver
* Copyright (C) 2002-2017 PCSX2 Dev Team/ChickenLiver
*
* PCSX2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
@ -99,7 +99,7 @@ void DeleteBinding(int port, int slot, Device *dev, ForceFeedbackBinding *b)
dev->pads[port][slot][padtype].numFFBindings--;
}
int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, unsigned int padtype, int command, int sensitivity, int turbo, int deadZone)
int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int slot, unsigned int padtype, int command, int sensitivity, int rapidFire, int deadZone)
{
// Checks needed because I use this directly when loading bindings.
if (port > 1 || slot > 3 || padtype >= numPadTypes)
@ -136,7 +136,7 @@ int BindCommand(Device *dev, unsigned int uid, unsigned int port, unsigned int s
p->numBindings++;
b->command = command;
b->controlIndex = controlIndex;
b->turbo = turbo;
b->rapidFire = rapidFire;
b->sensitivity = sensitivity;
b->deadZone = deadZone;
// Where it appears in listview.
@ -214,7 +214,6 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
{L"Save State in Title", 0 /*IDC_SAVE_STATE_TITLE*/, 0}, //No longer required, PCSX2 now handles it - avih 2011-05-17
{L"GH2", 0 /*IDC_GH2_HACK*/, 0},
{L"Turbo Key Hack", 0 /*IDC_TURBO_KEY_HACK*/, 0},
};
void CALLBACK PADsetSettingsDir(const char *dir)
@ -277,7 +276,7 @@ int SaveSettings(wchar_t *file = 0)
Binding *b = dev->pads[port][slot][padtype].bindings + j;
VirtualControl *c = &dev->virtualControls[b->controlIndex];
wsprintfW(temp, L"Binding %i", bindingCount++);
wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->turbo, slot, b->deadZone, padtype);
wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i, %i, %i, %i", c->uid, port, b->command, b->sensitivity, b->rapidFire, slot, b->deadZone, padtype);
cfg.WriteStr(id, temp, temp2);
}
@ -376,7 +375,7 @@ int LoadSettings(int force, wchar_t *file)
}
last = 1;
unsigned int uid;
int port, command, sensitivity, turbo, slot = 0, deadZone = 0, padtype = 0;
int port, command, sensitivity, rapidFire, slot = 0, deadZone = 0, padtype = 0;
int w = 0;
char string[1000];
while (temp2[w]) {
@ -384,7 +383,7 @@ int LoadSettings(int force, wchar_t *file)
w++;
}
string[w] = 0;
int len = sscanf(string, " %u , %i , %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &turbo, &slot, &deadZone, &padtype);
int len = sscanf(string, " %u , %i , %i , %i , %i , %i , %i , %i", &uid, &port, &command, &sensitivity, &rapidFire, &slot, &deadZone, &padtype);
if (len >= 5 && type) {
VirtualControl *c = dev->GetVirtualControl(uid);
if (!c)
@ -398,7 +397,7 @@ int LoadSettings(int force, wchar_t *file)
padtype = 1;
}
}
BindCommand(dev, uid, port, slot, padtype, command, sensitivity, turbo, deadZone);
BindCommand(dev, uid, port, slot, padtype, command, sensitivity, rapidFire, deadZone);
}
}
}

View File

@ -88,6 +88,8 @@ LPWSTR dialog_message(int ID, bool *updateText)
L"This option is useful when analog mode is enabled in a game that does not support it, as this causes the game to not recognise any input or to not even detect a controller.\n\n"
L"This option can also be used to enable analog mode in games that support, but do not automatically enable analog mode.\n\n"
L"Note: Analog mode enables the analog sticks to function on a DualShock controller, while in digital mode it behaves as an original PlayStation controller.\n\n";
case ID_TURBO_KEY:
return L"Sets a key to send a TAB press to the emulator, which toggles Turbo mode(200% speed) in PCSX2.";
case ID_LOCK_ALL_INPUT:
return L"Locks the current state of the pad. Any further input is handled normally, but the initial pad state is the locked state instead of a state with no buttons pressed. "
L"Pressing it again releases the old pad state, if the old pad state had any keys pressed. Otherwise, it's released automatically.";
@ -97,7 +99,7 @@ LPWSTR dialog_message(int ID, bool *updateText)
case ID_LOCK_BUTTONS:
return L"Locks the current state of the buttons. Pressing this when all input is locked unlocks only the buttons. "
L"Pressing it again will lock them again, keeping the d-pad and analog sticks locked.";
case IDC_TURBO:
case IDC_RAPID_FIRE:
return L"Automatically presses/releases the input every other time the button is polled.";
case IDC_FLIP:
return L"Inverts a button or axis, making down up and up down.";

View File

@ -40,7 +40,6 @@
#define IDC_MULTIPLE_BINDING 1122
#define IDC_FORCE_HIDE 1124
#define IDC_GH2_HACK 1125
#define IDC_TURBO_KEY_HACK 1128
#define IDC_SAVE_STATE_TITLE 1129
#define IDC_PAD_LIST 1130
#define IDC_COMBO1 1131
@ -51,7 +50,7 @@
#define IDC_AXIS_DIRECTION 0x1002
#define IDC_AXIS_CONTROL 0x1003
#define IDC_AXIS_SENSITIVITY 0x1004
#define IDC_TURBO 0x1005
#define IDC_RAPID_FIRE 0x1005
#define IDC_AXIS_DEVICE 0x1006
#define ID_SENSITIVITY 0x1007
#define IDC_SLIDER_DEADZONE 0x1008
@ -105,6 +104,7 @@
#define IDC_CONFIGURE_ON_BIND 0x1120
#define IDC_DEVICE_SELECT 0x1121
#define IDC_FACE_ANALOG 0x1122
#define ID_TURBO_KEY 0x111A
#define IDC_BINDINGS_LIST 0x1200
#define ID_SAVE 0x1201
#define ID_LOAD 0x1202