Skip to content

Commit 3861da8

Browse files
committed
Fixes: return of the old touchpad button press
1 parent 4440700 commit 3861da8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Source/DS4Emulator.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ int main(int argc, char **argv)
276276
int SleepTimeOutXbox = IniFile.ReadInteger("Xbox", "SleepTimeOut", 1);
277277
bool SwapTriggersShoulders = IniFile.ReadBoolean("Xbox", "SwapTriggersShoulders", false);
278278
SwapShareTouchPad = IniFile.ReadBoolean("Xbox", "SwapShareTouchPad", false);
279+
bool TouchPadPressedWhenSwiping = IniFile.ReadBoolean("Xbox", "TouchPadPressedWhenSwiping", true);
279280
bool EnableXboxButton = IniFile.ReadBoolean("Xbox", "EnableXboxButton", true);
280281

281282
KEY_ID_XBOX_ACTIVATE_MULTI_NAME = IniFile.ReadString("Xbox", "MultiActivateKey", "BACK");
@@ -339,9 +340,9 @@ int main(int argc, char **argv)
339340
bool MotionShaking = false, MotionShakingSwap = false;
340341
bool MotionUp = false, MotionDown = false, MotionLeft = false, MotionRight = false;
341342

342-
int MotionKeyOnlyCheckCount = 0;
343-
int MotionKeyReleasedCount = 0;
344-
bool MotionKeyOnlyPressed = false;
343+
//int MotionKeyOnlyCheckCount = 0;
344+
//int MotionKeyReleasedCount = 0;
345+
//bool MotionKeyOnlyPressed = false;
345346

346347
int SkipPollCount = 0;
347348

@@ -498,7 +499,7 @@ int main(int argc, char **argv)
498499

499500
// Motion key exclude
500501
bool XboxActivateMotionPressed = myPState.Gamepad.wButtons & KEY_ID_XBOX_ACTIVATE_MULTI ? true : false;
501-
if (myPState.Gamepad.wButtons == KEY_ID_XBOX_ACTIVATE_MULTI && MotionKeyOnlyCheckCount == 0) { MotionKeyOnlyCheckCount = 20; MotionKeyOnlyPressed = true; }
502+
/*if (myPState.Gamepad.wButtons == KEY_ID_XBOX_ACTIVATE_MULTI && MotionKeyOnlyCheckCount == 0) { MotionKeyOnlyCheckCount = 20; MotionKeyOnlyPressed = true; }
502503
if (MotionKeyOnlyCheckCount > 0) {
503504
MotionKeyOnlyCheckCount--;
504505
if (myPState.Gamepad.wButtons != KEY_ID_XBOX_ACTIVATE_MULTI && (myPState.Gamepad.wButtons != 0 || (report.bThumbLX != 127 || report.bThumbLY != 129) || (report.bThumbRX != 127 || report.bThumbRY != 129) )) {
@@ -519,7 +520,7 @@ int main(int argc, char **argv)
519520
myPState.Gamepad.wButtons |= KEY_ID_XBOX_ACTIVATE_MULTI; //|=
520521
MotionKeyReleasedCount = 30; // Timeout to release the motion key button and don't execute other buttons
521522
//printf("Motion Key pressed\n");
522-
}
523+
}*/
523524

524525
// Swap share and touchpad
525526
if (SwapShareTouchPad == false) {
@@ -596,8 +597,11 @@ int main(int argc, char **argv)
596597
}
597598

598599
// Touchpad swipes
599-
if (XboxActivateMotionPressed) {
600-
if (myPState.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) { report.wButtons &= ~DS4_BUTTON_THUMB_RIGHT; report.bSpecial |= DS4_SPECIAL_BUTTON_TOUCHPAD; }
600+
if (report.bSpecial & DS4_SPECIAL_BUTTON_TOUCHPAD) {
601+
if (!TouchPadPressedWhenSwiping && (report.bThumbRX != 127 || report.bThumbRY != 129)) {
602+
report.bSpecial &= ~DS4_SPECIAL_BUTTON_TOUCHPAD;
603+
if (myPState.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) { report.wButtons &= ~DS4_BUTTON_THUMB_RIGHT; report.bSpecial |= DS4_SPECIAL_BUTTON_TOUCHPAD; }
604+
}
601605
TouchX = 960; TouchY = 471;
602606
if (report.bThumbRX > 127)
603607
TouchX = 320 + (report.bThumbRX - 127) * 10;

0 commit comments

Comments
 (0)