mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 04:56:24 +02:00
Remove in/out function arguments
This commit is contained in:
1 parent
526b4f782d
commit
7dfa587fe2
3 files changed
+16
-14
No files matched your search
+11
-9
@@ -41,13 +41,15 @@ static float MapAxisValue(float v) {
|
||||
return sign * Clamp(invDeadzone + (abs(v) - deadzone) / (1.0f - deadzone) * (sensitivity - invDeadzone), 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void ConvertAnalogStick(float &x, float &y) {
|
||||
void ConvertAnalogStick(float x, float y, float *outX, float *outY) {
|
||||
const bool isCircular = g_Config.bAnalogIsCircular;
|
||||
|
||||
float norm = std::max(fabsf(x), fabsf(y));
|
||||
|
||||
if (norm == 0.0f)
|
||||
if (norm == 0.0f) {
|
||||
*outX = x;
|
||||
*outY = y;
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCircular) {
|
||||
float newNorm = sqrtf(x * x + y * y);
|
||||
@@ -58,8 +60,8 @@ void ConvertAnalogStick(float &x, float &y) {
|
||||
}
|
||||
|
||||
float mappedNorm = MapAxisValue(norm);
|
||||
x = Clamp(x / norm * mappedNorm, -1.0f, 1.0f);
|
||||
y = Clamp(y / norm * mappedNorm, -1.0f, 1.0f);
|
||||
*outX = Clamp(x / norm * mappedNorm, -1.0f, 1.0f);
|
||||
*outY = Clamp(y / norm * mappedNorm, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void ControlMapper::SetCallbacks(
|
||||
@@ -102,7 +104,7 @@ void ControlMapper::SetPSPAxis(int device, int stick, char axis, float value) {
|
||||
bool ignore = false;
|
||||
if (inDeadZone && lastNonDeadzoneDeviceID_[stick] != device) {
|
||||
// Ignore this event! See issue #15465
|
||||
ignore = true;
|
||||
ignore = true;
|
||||
}
|
||||
|
||||
if (!inDeadZone) {
|
||||
@@ -114,9 +116,9 @@ void ControlMapper::SetPSPAxis(int device, int stick, char axis, float value) {
|
||||
|
||||
float x = history_[stick][0];
|
||||
float y = history_[stick][1];
|
||||
|
||||
ConvertAnalogStick(x, y);
|
||||
setPSPAnalog_(stick, x, y);
|
||||
float convertedX, convertedY;
|
||||
ConvertAnalogStick(x, y, &convertedX, &convertedY);
|
||||
setPSPAnalog_(stick, convertedX, convertedY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,4 +66,4 @@ private:
|
||||
std::function<void(int, float, float)> setRawAnalog_;
|
||||
};
|
||||
|
||||
void ConvertAnalogStick(float &x, float &y);
|
||||
void ConvertAnalogStick(float x, float y, float *outX, float *outY);
|
||||
@@ -34,8 +34,8 @@ void JoystickHistoryView::Draw(UIContext &dc) {
|
||||
float by = (iy + 1) * dx;
|
||||
|
||||
if (type_ == StickHistoryViewType::OUTPUT) {
|
||||
ConvertAnalogStick(ax, ay);
|
||||
ConvertAnalogStick(bx, by);
|
||||
ConvertAnalogStick(ax, ay, &ax, &ay);
|
||||
ConvertAnalogStick(bx, by, &bx, &by);
|
||||
}
|
||||
|
||||
ax = ax * minRadius + bounds_.centerX();
|
||||
@@ -58,8 +58,8 @@ void JoystickHistoryView::Draw(UIContext &dc) {
|
||||
float by = fy;
|
||||
|
||||
if (type_ == StickHistoryViewType::OUTPUT) {
|
||||
ConvertAnalogStick(ax, ay);
|
||||
ConvertAnalogStick(bx, by);
|
||||
ConvertAnalogStick(ax, ay, &ax, &ay);
|
||||
ConvertAnalogStick(bx, by, &bx, &by);
|
||||
}
|
||||
|
||||
ax = ax * minRadius + bounds_.centerX();
|
||||
|
||||
Reference in new issue
Block a user