mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Some more renaming
This commit is contained in:
parent
534896d2ab
commit
a4bfb83982
@ -56,8 +56,8 @@ void ControlMapper::SetPSPAxis(int device, char axis, float value, int stick) {
|
||||
int axisId = axis == 'X' ? 0 : 1;
|
||||
|
||||
float position[2];
|
||||
position[0] = history[stick][0];
|
||||
position[1] = history[stick][1];
|
||||
position[0] = history_[stick][0];
|
||||
position[1] = history_[stick][1];
|
||||
|
||||
position[axisId] = value;
|
||||
|
||||
@ -83,10 +83,10 @@ void ControlMapper::SetPSPAxis(int device, char axis, float value, int stick) {
|
||||
}
|
||||
|
||||
if (!ignore) {
|
||||
history[stick][axisId] = value;
|
||||
history_[stick][axisId] = value;
|
||||
|
||||
float x = history[stick][0];
|
||||
float y = history[stick][1];
|
||||
float x = history_[stick][0];
|
||||
float y = history_[stick][1];
|
||||
|
||||
ConvertAnalogStick(x, y);
|
||||
setPSPAnalog_(stick, x, y);
|
||||
@ -103,7 +103,7 @@ bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < pspKeys.size(); i++) {
|
||||
pspKey(key.deviceId, pspKeys[i], key.flags);
|
||||
SetPSPKey(key.deviceId, pspKeys[i], key.flags);
|
||||
}
|
||||
|
||||
DEBUG_LOG(SYSTEM, "Key: %d DeviceId: %d", key.keyCode, key.deviceId);
|
||||
@ -120,13 +120,13 @@ bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) {
|
||||
|
||||
void ControlMapper::Axis(const AxisInput &axis) {
|
||||
if (axis.value > 0) {
|
||||
processAxis(axis, 1);
|
||||
ProcessAxis(axis, 1);
|
||||
} else if (axis.value < 0) {
|
||||
processAxis(axis, -1);
|
||||
ProcessAxis(axis, -1);
|
||||
} else if (axis.value == 0) {
|
||||
// Both directions! Prevents sticking for digital input devices that are axises (like HAT)
|
||||
processAxis(axis, 1);
|
||||
processAxis(axis, -1);
|
||||
ProcessAxis(axis, 1);
|
||||
ProcessAxis(axis, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,12 +175,12 @@ static int RotatePSPKeyCode(int x) {
|
||||
}
|
||||
}
|
||||
|
||||
void ControlMapper::setVKeyAnalog(int deviceId, char axis, int stick, int virtualKeyMin, int virtualKeyMax, bool setZero) {
|
||||
// The down events can repeat, so just trust the virtKeys array.
|
||||
bool minDown = virtKeys[virtualKeyMin - VIRTKEY_FIRST];
|
||||
bool maxDown = virtKeys[virtualKeyMax - VIRTKEY_FIRST];
|
||||
void ControlMapper::SetVKeyAnalog(int deviceId, char axis, int stick, int virtualKeyMin, int virtualKeyMax, bool setZero) {
|
||||
// The down events can repeat, so just trust the virtKeys_ array.
|
||||
bool minDown = virtKeys_[virtualKeyMin - VIRTKEY_FIRST];
|
||||
bool maxDown = virtKeys_[virtualKeyMax - VIRTKEY_FIRST];
|
||||
|
||||
const float scale = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f;
|
||||
const float scale = virtKeys_[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f;
|
||||
float value = 0.0f;
|
||||
if (minDown)
|
||||
value -= scale;
|
||||
@ -191,36 +191,40 @@ void ControlMapper::setVKeyAnalog(int deviceId, char axis, int stick, int virtua
|
||||
}
|
||||
}
|
||||
|
||||
void ControlMapper::pspKey(int deviceId, int pspKeyCode, int flags) {
|
||||
int rotations = 0;
|
||||
switch (g_Config.iInternalScreenRotation) {
|
||||
case ROTATION_LOCKED_HORIZONTAL180:
|
||||
rotations = 2;
|
||||
break;
|
||||
case ROTATION_LOCKED_VERTICAL:
|
||||
rotations = 1;
|
||||
break;
|
||||
case ROTATION_LOCKED_VERTICAL180:
|
||||
rotations = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rotations; i++) {
|
||||
pspKeyCode = RotatePSPKeyCode(pspKeyCode);
|
||||
}
|
||||
void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) {
|
||||
SetPSPKey(deviceId, pspKeyCode, flags);
|
||||
}
|
||||
|
||||
void ControlMapper::SetPSPKey(int deviceId, int pspKeyCode, int flags) {
|
||||
if (pspKeyCode >= VIRTKEY_FIRST) {
|
||||
int vk = pspKeyCode - VIRTKEY_FIRST;
|
||||
if (flags & KEY_DOWN) {
|
||||
virtKeys[vk] = true;
|
||||
virtKeys_[vk] = true;
|
||||
onVKeyDown(deviceId, pspKeyCode);
|
||||
}
|
||||
if (flags & KEY_UP) {
|
||||
virtKeys[vk] = false;
|
||||
virtKeys_[vk] = false;
|
||||
onVKeyUp(deviceId, pspKeyCode);
|
||||
}
|
||||
} else {
|
||||
// INFO_LOG(SYSTEM, "pspKey %i %i", pspKeyCode, flags);
|
||||
int rotations = 0;
|
||||
switch (g_Config.iInternalScreenRotation) {
|
||||
case ROTATION_LOCKED_HORIZONTAL180:
|
||||
rotations = 2;
|
||||
break;
|
||||
case ROTATION_LOCKED_VERTICAL:
|
||||
rotations = 1;
|
||||
break;
|
||||
case ROTATION_LOCKED_VERTICAL180:
|
||||
rotations = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rotations; i++) {
|
||||
pspKeyCode = RotatePSPKeyCode(pspKeyCode);
|
||||
}
|
||||
|
||||
// INFO_LOG(SYSTEM, "pspKey %d %d", pspKeyCode, flags);
|
||||
if (flags & KEY_DOWN)
|
||||
setPSPButtonState_(pspKeyCode, true);
|
||||
if (flags & KEY_UP)
|
||||
@ -230,30 +234,29 @@ void ControlMapper::pspKey(int deviceId, int pspKeyCode, int flags) {
|
||||
|
||||
void ControlMapper::onVKeyDown(int deviceId, int vkey) {
|
||||
switch (vkey) {
|
||||
|
||||
case VIRTKEY_AXIS_X_MIN:
|
||||
case VIRTKEY_AXIS_X_MAX:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
|
||||
break;
|
||||
case VIRTKEY_AXIS_Y_MIN:
|
||||
case VIRTKEY_AXIS_Y_MAX:
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
|
||||
break;
|
||||
|
||||
case VIRTKEY_AXIS_RIGHT_X_MIN:
|
||||
case VIRTKEY_AXIS_RIGHT_X_MAX:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
|
||||
break;
|
||||
case VIRTKEY_AXIS_RIGHT_Y_MIN:
|
||||
case VIRTKEY_AXIS_RIGHT_Y_MAX:
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
|
||||
break;
|
||||
|
||||
case VIRTKEY_ANALOG_LIGHTLY:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX, false);
|
||||
break;
|
||||
|
||||
case VIRTKEY_ANALOG_ROTATE_CW:
|
||||
@ -277,27 +280,27 @@ void ControlMapper::onVKeyUp(int deviceId, int vkey) {
|
||||
|
||||
case VIRTKEY_AXIS_X_MIN:
|
||||
case VIRTKEY_AXIS_X_MAX:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
|
||||
break;
|
||||
case VIRTKEY_AXIS_Y_MIN:
|
||||
case VIRTKEY_AXIS_Y_MAX:
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
|
||||
break;
|
||||
|
||||
case VIRTKEY_AXIS_RIGHT_X_MIN:
|
||||
case VIRTKEY_AXIS_RIGHT_X_MAX:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
|
||||
break;
|
||||
case VIRTKEY_AXIS_RIGHT_Y_MIN:
|
||||
case VIRTKEY_AXIS_RIGHT_Y_MAX:
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
|
||||
break;
|
||||
|
||||
case VIRTKEY_ANALOG_LIGHTLY:
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX, false);
|
||||
setVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'X', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX, false);
|
||||
SetVKeyAnalog(deviceId, 'Y', CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX, false);
|
||||
break;
|
||||
|
||||
case VIRTKEY_ANALOG_ROTATE_CW:
|
||||
@ -317,13 +320,13 @@ void ControlMapper::onVKeyUp(int deviceId, int vkey) {
|
||||
}
|
||||
}
|
||||
|
||||
void ControlMapper::processAxis(const AxisInput &axis, int direction) {
|
||||
void ControlMapper::ProcessAxis(const AxisInput &axis, int direction) {
|
||||
// Sanity check
|
||||
if (axis.axisId < 0 || axis.axisId >= JOYSTICK_AXIS_MAX) {
|
||||
return;
|
||||
}
|
||||
|
||||
const float scale = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f;
|
||||
const float scale = virtKeys_[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f;
|
||||
|
||||
std::vector<int> results;
|
||||
KeyMap::AxisToPspButton(axis.deviceId, axis.axisId, direction, &results);
|
||||
@ -386,22 +389,22 @@ void ControlMapper::processAxis(const AxisInput &axis, int direction) {
|
||||
if (axisState != 0) {
|
||||
for (size_t i = 0; i < results.size(); i++) {
|
||||
if (!IsAnalogStickKey(results[i]))
|
||||
pspKey(axis.deviceId, results[i], KEY_DOWN);
|
||||
SetPSPKey(axis.deviceId, results[i], KEY_DOWN);
|
||||
}
|
||||
// Also unpress the other direction (unless both directions press the same key.)
|
||||
for (size_t i = 0; i < resultsOpposite.size(); i++) {
|
||||
if (!IsAnalogStickKey(resultsOpposite[i]) && std::find(results.begin(), results.end(), resultsOpposite[i]) == results.end())
|
||||
pspKey(axis.deviceId, resultsOpposite[i], KEY_UP);
|
||||
SetPSPKey(axis.deviceId, resultsOpposite[i], KEY_UP);
|
||||
}
|
||||
} else if (axisState == 0) {
|
||||
// Release both directions, trying to deal with some erratic controllers that can cause it to stick.
|
||||
for (size_t i = 0; i < results.size(); i++) {
|
||||
if (!IsAnalogStickKey(results[i]))
|
||||
pspKey(axis.deviceId, results[i], KEY_UP);
|
||||
SetPSPKey(axis.deviceId, results[i], KEY_UP);
|
||||
}
|
||||
for (size_t i = 0; i < resultsOpposite.size(); i++) {
|
||||
if (!IsAnalogStickKey(resultsOpposite[i]))
|
||||
pspKey(axis.deviceId, resultsOpposite[i], KEY_UP);
|
||||
SetPSPKey(axis.deviceId, resultsOpposite[i], KEY_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ class ControlMapper {
|
||||
public:
|
||||
void Update();
|
||||
|
||||
// Inputs to the table-based mapping
|
||||
bool Key(const KeyInput &key, bool *pauseTrigger);
|
||||
void pspKey(int deviceId, int pspKeyCode, int flags);
|
||||
void Axis(const AxisInput &axis);
|
||||
|
||||
// Required callbacks
|
||||
@ -26,13 +26,18 @@ public:
|
||||
std::function<void(int, bool)> setPSPButtonState,
|
||||
std::function<void(int, float, float)> setPSPAnalog);
|
||||
|
||||
// Inject raw PSP key input directly, such as from touch screen controls.
|
||||
// Combined with the mapped input.
|
||||
void PSPKey(int deviceId, int pspKeyCode, int flags);
|
||||
|
||||
// Optional callback, only used in config
|
||||
void SetRawCallback(std::function<void(int, float, float)> setRawAnalog);
|
||||
|
||||
private:
|
||||
void processAxis(const AxisInput &axis, int direction);
|
||||
void setVKeyAnalog(int deviceId, char axis, int stick, int virtualKeyMin, int virtualKeyMax, bool setZero = true);
|
||||
void ProcessAxis(const AxisInput &axis, int direction);
|
||||
void SetVKeyAnalog(int deviceId, char axis, int stick, int virtualKeyMin, int virtualKeyMax, bool setZero = true);
|
||||
|
||||
void SetPSPKey(int deviceId, int pspKeyCode, int flags);
|
||||
void SetPSPAxis(int deviceId, char axis, float value, int stick);
|
||||
void ProcessAnalogSpeed(const AxisInput &axis, bool opposite);
|
||||
|
||||
@ -40,14 +45,14 @@ private:
|
||||
void onVKeyUp(int deviceId, int vkey);
|
||||
|
||||
// To track mappable virtual keys. We can have as many as we want.
|
||||
bool virtKeys[VIRTKEY_COUNT]{};
|
||||
bool virtKeys_[VIRTKEY_COUNT]{};
|
||||
|
||||
// De-noise mapped axis updates
|
||||
int axisState_[JOYSTICK_AXIS_MAX]{};
|
||||
|
||||
int lastNonDeadzoneDeviceID_[2]{};
|
||||
|
||||
float history[2][2]{};
|
||||
float history_[2][2]{};
|
||||
|
||||
// Mappable auto-rotation. Useful for keyboard/dpad->analog in a few games.
|
||||
bool autoRotatingAnalogCW_ = false;
|
||||
|
@ -124,11 +124,11 @@ void WebSocketGPUStatsState::FlipListener() {
|
||||
|
||||
int valid;
|
||||
double *sleepHistory;
|
||||
double *history = __DisplayGetFrameTimes(&valid, &stats.frameTimePos, &sleepHistory);
|
||||
double *history_ = __DisplayGetFrameTimes(&valid, &stats.frameTimePos, &sleepHistory);
|
||||
|
||||
stats.frameTimes.resize(valid);
|
||||
stats.sleepTimes.resize(valid);
|
||||
memcpy(&stats.frameTimes[0], history, sizeof(double) * valid);
|
||||
memcpy(&stats.frameTimes[0], history_, sizeof(double) * valid);
|
||||
memcpy(&stats.sleepTimes[0], sleepHistory, sizeof(double) * valid);
|
||||
|
||||
sendNext_ = false;
|
||||
|
@ -215,7 +215,7 @@ bool CustomKey::Touch(const TouchInput &input) {
|
||||
if (!repeat_) {
|
||||
for (int i = 0; i < ARRAY_SIZE(customKeyList); i++) {
|
||||
if (pspButtonBit_ & (1ULL << i)) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, customKeyList[i].c, (on_ && toggle_) ? KEY_UP : KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, customKeyList[i].c, (on_ && toggle_) ? KEY_UP : KEY_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ bool CustomKey::Touch(const TouchInput &input) {
|
||||
if (!repeat_) {
|
||||
for (int i = 0; i < ARRAY_SIZE(customKeyList); i++) {
|
||||
if (pspButtonBit_ & (1ULL << i)) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,13 +246,13 @@ void CustomKey::Update() {
|
||||
} else if (pressedFrames_ == DOWN_FRAME) {
|
||||
for (int i = 0; i < ARRAY_SIZE(customKeyList); i++) {
|
||||
if (pspButtonBit_ & (1ULL << i)) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_UP);
|
||||
}
|
||||
}
|
||||
} else if (on_ && pressedFrames_ == 0) {
|
||||
for (int i = 0; i < ARRAY_SIZE(customKeyList); i++) {
|
||||
if (pspButtonBit_ & (1ULL << i)) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, customKeyList[i].c, KEY_DOWN);
|
||||
}
|
||||
}
|
||||
pressedFrames_ = 1;
|
||||
@ -923,7 +923,7 @@ bool GestureGamepad::Touch(const TouchInput &input) {
|
||||
const float now = time_now_d();
|
||||
if (now - lastTapRelease_ < 0.3f && !haveDoubleTapped_) {
|
||||
if (g_Config.iDoubleTapGesture != 0 )
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_DOWN);
|
||||
haveDoubleTapped_ = true;
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ bool GestureGamepad::Touch(const TouchInput &input) {
|
||||
|
||||
if (haveDoubleTapped_) {
|
||||
if (g_Config.iDoubleTapGesture != 0)
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_UP);
|
||||
haveDoubleTapped_ = false;
|
||||
}
|
||||
}
|
||||
@ -960,37 +960,37 @@ void GestureGamepad::Update() {
|
||||
float dy = deltaY_ * g_display.dpi_scale_y * g_Config.fSwipeSensitivity;
|
||||
if (g_Config.iSwipeRight != 0) {
|
||||
if (dx > th) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_DOWN);
|
||||
swipeRightReleased_ = false;
|
||||
} else if (!swipeRightReleased_) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_UP);
|
||||
swipeRightReleased_ = true;
|
||||
}
|
||||
}
|
||||
if (g_Config.iSwipeLeft != 0) {
|
||||
if (dx < -th) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_DOWN);
|
||||
swipeLeftReleased_ = false;
|
||||
} else if (!swipeLeftReleased_) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_UP);
|
||||
swipeLeftReleased_ = true;
|
||||
}
|
||||
}
|
||||
if (g_Config.iSwipeUp != 0) {
|
||||
if (dy < -th) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_DOWN);
|
||||
swipeUpReleased_ = false;
|
||||
} else if (!swipeUpReleased_) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_UP);
|
||||
swipeUpReleased_ = true;
|
||||
}
|
||||
}
|
||||
if (g_Config.iSwipeDown != 0) {
|
||||
if (dy > th) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_DOWN);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_DOWN);
|
||||
swipeDownReleased_ = false;
|
||||
} else if (!swipeDownReleased_) {
|
||||
controlMapper_->pspKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_UP);
|
||||
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_UP);
|
||||
swipeDownReleased_ = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user