Replace the "Test Analogs" screen with a new screen that lets you directly try the settings.

This commit is contained in:
Henrik Rydgård
2021-07-09 13:10:16 +02:00
parent 42f7ab7341
commit 2303926e88
6 changed files with 133 additions and 86 deletions
+10 -1
View File
@@ -13,7 +13,7 @@ static float MapAxisValue(float v) {
return sign * Clamp(invDeadzone + (abs(v) - deadzone) / (1.0f - deadzone) * (sensitivity - invDeadzone), 0.0f, 1.0f);
}
static void ConvertAnalogStick(float &x, float &y) {
void ConvertAnalogStick(float &x, float &y) {
const bool isCircular = g_Config.bAnalogIsCircular;
float norm = std::max(fabsf(x), fabsf(y));
@@ -40,6 +40,11 @@ void ControlMapper::SetCallbacks(std::function<void(int)> onVKeyDown, std::funct
setPSPAnalog_ = setPSPAnalog;
}
void ControlMapper::SetRawCallback(std::function<void(int, float, float)> setRawAnalog) {
setRawAnalog_ = setRawAnalog;
}
void ControlMapper::SetPSPAxis(char axis, float value, int stick) {
static float history[2][2] = {};
@@ -50,6 +55,10 @@ void ControlMapper::SetPSPAxis(char axis, float value, int stick) {
float x = history[stick][0];
float y = history[stick][1];
if (setRawAnalog_) {
setRawAnalog_(stick, x, y);
}
ConvertAnalogStick(x, y);
setPSPAnalog_(stick, x, y);