mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 10:35:03 +00:00
Use signals on button/trigger to release to make GUI more responsive
This commit is contained in:
parent
cd4931b16f
commit
86be802223
@ -752,6 +752,8 @@ void ControlSettings::CheckMapping(QPushButton*& button) {
|
|||||||
button->setText(mapping);
|
button->setText(mapping);
|
||||||
EnableButtonMapping = false;
|
EnableButtonMapping = false;
|
||||||
EnableAxisMapping = false;
|
EnableAxisMapping = false;
|
||||||
|
L2Pressed = false;
|
||||||
|
R2Pressed = false;
|
||||||
EnableMappingButtons();
|
EnableMappingButtons();
|
||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
@ -844,20 +846,33 @@ void ControlSettings::processSDLEvents(int Type, int Input, int Value) {
|
|||||||
if (Type == SDL_EVENT_GAMEPAD_AXIS_MOTION) {
|
if (Type == SDL_EVENT_GAMEPAD_AXIS_MOTION) {
|
||||||
// SDL trigger axis values range from 0 to 32000, set mapping on half movement
|
// SDL trigger axis values range from 0 to 32000, set mapping on half movement
|
||||||
// Set zone for trigger release signal arbitrarily at 5000
|
// Set zone for trigger release signal arbitrarily at 5000
|
||||||
if (Value > 16000) {
|
switch (Input) {
|
||||||
switch (Input) {
|
case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
|
||||||
case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
|
if (Value > 16000) {
|
||||||
pressedButtons.insert("l2");
|
pressedButtons.insert("l2");
|
||||||
break;
|
L2Pressed = true;
|
||||||
case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
|
} else if (Value < 5000) {
|
||||||
pressedButtons.insert("r2");
|
if (L2Pressed)
|
||||||
break;
|
emit PushGamepadEvent();
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
|
||||||
|
if (Value > 16000) {
|
||||||
|
pressedButtons.insert("r2");
|
||||||
|
R2Pressed = true;
|
||||||
|
} else if (Value < 5000) {
|
||||||
|
if (R2Pressed)
|
||||||
|
emit PushGamepadEvent();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Type == SDL_EVENT_GAMEPAD_BUTTON_UP)
|
||||||
|
emit PushGamepadEvent();
|
||||||
|
|
||||||
} else if (EnableAxisMapping) {
|
} else if (EnableAxisMapping) {
|
||||||
if (Type == SDL_EVENT_GAMEPAD_AXIS_MOTION) {
|
if (Type == SDL_EVENT_GAMEPAD_AXIS_MOTION) {
|
||||||
// SDL stick axis values range from -32000 to 32000, set mapping on half movement
|
// SDL stick axis values range from -32000 to 32000, set mapping on half movement
|
||||||
|
@ -51,6 +51,8 @@ private:
|
|||||||
QSet<QString> pressedButtons;
|
QSet<QString> pressedButtons;
|
||||||
|
|
||||||
bool GameRunning;
|
bool GameRunning;
|
||||||
|
bool L2Pressed = false;
|
||||||
|
bool R2Pressed = false;
|
||||||
bool EnableButtonMapping = false;
|
bool EnableButtonMapping = false;
|
||||||
bool EnableAxisMapping = false;
|
bool EnableAxisMapping = false;
|
||||||
bool MappingCompleted = false;
|
bool MappingCompleted = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user