mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Address review: remove redundant outer/output anti-deadzone controls
This commit is contained in:
1 parent
043b0a437c
commit
b585a1fcf4
5 files changed
+3
-85
No files matched your search
@@ -1026,9 +1026,6 @@ static const ConfigSetting controlSettings[] = {
|
||||
// Advanced analog deadzone settings.
|
||||
ConfigSetting("AnalogDeadzoneShape", SETTING(g_Config, iAnalogDeadzoneShape), 1, CfgFlag::PER_GAME), // Default 1 (Square) matches legacy max-norm behavior
|
||||
ConfigSetting("AnalogAxialDeadzone", SETTING(g_Config, fAnalogAxialDeadzone), 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("AnalogOuterDeadzone", SETTING(g_Config, fAnalogOuterDeadzone), 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("AnalogOutputAntiDeadzone", SETTING(g_Config, fAnalogOutputAntiDeadzone), 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("AnalogOutputAntiDeadzoneBuffer", SETTING(g_Config, fAnalogOutputAntiDeadzoneBuffer), 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("AnalogResponseCurve", SETTING(g_Config, iAnalogResponseCurve), 0, CfgFlag::PER_GAME),
|
||||
|
||||
ConfigSetting("AnalogLimiterDeadzone", SETTING(g_Config, fAnalogLimiterDeadzone), 0.6f, CfgFlag::DEFAULT),
|
||||
|
||||
@@ -521,12 +521,6 @@ public:
|
||||
// Cross-shaped axial anti-deadzone. Boosts small off-axis values past this threshold,
|
||||
// making the output skip the zone near each cardinal axis to prevent axis snapping.
|
||||
float fAnalogAxialDeadzone;
|
||||
// Outer deadzone: defines where 100% output is reached. Shrinks the effective stick range.
|
||||
float fAnalogOuterDeadzone;
|
||||
// Output anti-deadzone: minimum output floor to bypass game-internal deadzones.
|
||||
float fAnalogOutputAntiDeadzone;
|
||||
// Anti-deadzone buffer: re-adds a small safe zone after anti-deadzone is applied.
|
||||
float fAnalogOutputAntiDeadzoneBuffer;
|
||||
// Response curve type: 0 = Linear, 1 = Aggressive, 2 = Relaxed, 3 = Wide
|
||||
int iAnalogResponseCurve;
|
||||
|
||||
|
||||
+3
-28
@@ -134,32 +134,21 @@ static float ApplyAxialAntiDeadzone(float v, float antiDZ) {
|
||||
}
|
||||
|
||||
// This is applied on the circular radius, not directly on the axes.
|
||||
// Now includes outer deadzone, response curve, and output anti-deadzone stages.
|
||||
// Adds a response curve stage on top of the legacy inner-deadzone + sensitivity processing.
|
||||
|
||||
static float MapAxisValue(float v) {
|
||||
const float deadzone = g_Config.fAnalogDeadzone;
|
||||
const float invDeadzone = g_Config.fAnalogInverseDeadzone;
|
||||
const float sensitivity = g_Config.fAnalogSensitivity;
|
||||
const float outerDeadzone = g_Config.fAnalogOuterDeadzone;
|
||||
const float outputAntiDZ = g_Config.fAnalogOutputAntiDeadzone;
|
||||
const float outputADBuffer = g_Config.fAnalogOutputAntiDeadzoneBuffer;
|
||||
const int responseCurve = g_Config.iAnalogResponseCurve;
|
||||
const float sign = v >= 0.0f ? 1.0f : -1.0f;
|
||||
|
||||
float absV = fabsf(v);
|
||||
|
||||
// Stage 1: Apply inner deadzone and rescale to [0, 1].
|
||||
// The effective range is [deadzone, 1 - outerDeadzone].
|
||||
float effectiveMax = 1.0f - outerDeadzone;
|
||||
float effectiveRange = effectiveMax - deadzone;
|
||||
if (effectiveRange <= 0.0f) {
|
||||
// Degenerate case: deadzone + outerDeadzone >= 1.0. Output is either 0 or 1.
|
||||
absV = (absV > deadzone) ? 1.0f : 0.0f;
|
||||
} else {
|
||||
absV = Clamp((absV - deadzone) / effectiveRange, 0.0f, 1.0f);
|
||||
}
|
||||
absV = Clamp((absV - deadzone) / (1.0f - deadzone), 0.0f, 1.0f);
|
||||
|
||||
// Stage 2: Apply sensitivity (legacy, works the same as before when new settings are at defaults).
|
||||
// Stage 2: Apply sensitivity (legacy, matches prior behavior when response curve is Linear).
|
||||
if (absV != 0.0f) {
|
||||
absV = Clamp(invDeadzone + absV * (sensitivity - invDeadzone), 0.0f, 1.0f);
|
||||
}
|
||||
@@ -169,20 +158,6 @@ static float MapAxisValue(float v) {
|
||||
absV = ApplyResponseCurve(absV, responseCurve);
|
||||
}
|
||||
|
||||
// Stage 4: Apply output anti-deadzone with buffer.
|
||||
// Anti-deadzone sets a minimum output floor so that even the smallest
|
||||
// stick input past the deadzone produces enough signal to overcome
|
||||
// game-internal deadzones. The buffer re-adds a small safe zone so
|
||||
// resting your thumb on the stick doesn't cause unintended drift.
|
||||
if (absV != 0.0f && outputAntiDZ > 0.0f) {
|
||||
// Remap [0, 1] -> [outputAntiDZ, 1]
|
||||
absV = outputAntiDZ + absV * (1.0f - outputAntiDZ);
|
||||
}
|
||||
if (outputADBuffer > 0.0f && absV > 0.0f && absV < outputAntiDZ + outputADBuffer) {
|
||||
// Within the buffer zone past the anti-deadzone floor: zero it out.
|
||||
absV = 0.0f;
|
||||
}
|
||||
|
||||
return sign * Clamp(absV, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -569,13 +569,6 @@ void AnalogCalibrationScreen::CreateSettingsViews(UI::ViewGroup *scrollContents)
|
||||
return g_Config.iAnalogDeadzoneShape == 2; // Only enabled for Cross shape
|
||||
});
|
||||
|
||||
scrollContents->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogOuterDeadzone, 0.0f, 0.3f, 0.0f, co->T("Outer deadzone"), 0.01f, screenManager(), "/ 1.0"));
|
||||
scrollContents->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogOutputAntiDeadzone, 0.0f, 0.5f, 0.0f, co->T("Output anti-deadzone"), 0.01f, screenManager(), "/ 1.0"));
|
||||
PopupSliderChoiceFloat *adBuffer = scrollContents->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogOutputAntiDeadzoneBuffer, 0.0f, 0.2f, 0.0f, co->T("Anti-deadzone buffer"), 0.01f, screenManager(), "/ 1.0"));
|
||||
adBuffer->SetEnabledFunc([] {
|
||||
return g_Config.fAnalogOutputAntiDeadzone > 0.0f; // Buffer only makes sense with anti-deadzone active
|
||||
});
|
||||
|
||||
static const char *responseCurves[] = { "Linear", "Aggressive", "Relaxed", "Wide" };
|
||||
scrollContents->Add(new PopupMultiChoice(&g_Config.iAnalogResponseCurve, co->T("Response curve"), responseCurves, 0, ARRAY_SIZE(responseCurves), I18NCat::CONTROLS, screenManager()));
|
||||
|
||||
@@ -604,9 +597,6 @@ void AnalogCalibrationScreen::OnResetToDefaults(UI::EventParams &e) {
|
||||
// Advanced settings
|
||||
g_Config.iAnalogDeadzoneShape = 1; // Square (matches legacy default)
|
||||
g_Config.fAnalogAxialDeadzone = 0.0f;
|
||||
g_Config.fAnalogOuterDeadzone = 0.0f;
|
||||
g_Config.fAnalogOutputAntiDeadzone = 0.0f;
|
||||
g_Config.fAnalogOutputAntiDeadzoneBuffer = 0.0f;
|
||||
g_Config.iAnalogResponseCurve = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,44 +93,6 @@ void JoystickHistoryView::Draw(UIContext &dc) {
|
||||
}
|
||||
|
||||
|
||||
// Draw circular deadzone overlays on the raw input view (on top of the grid, textured context).
|
||||
if (type_ == StickHistoryViewType::INPUT) {
|
||||
float cx = bounds_.centerX();
|
||||
float cy = bounds_.centerY();
|
||||
|
||||
// Inner deadzone circle.
|
||||
float innerDZ = g_Config.fAnalogDeadzone;
|
||||
if (innerDZ > 0.0f) {
|
||||
float innerR = innerDZ * minRadius;
|
||||
const int segments = 32;
|
||||
for (int i = 0; i < segments; i++) {
|
||||
float a1 = (float)i / (float)segments * 2.0f * (float)M_PI;
|
||||
float a2 = (float)(i + 1) / (float)segments * 2.0f * (float)M_PI;
|
||||
float x1 = cx + cosf(a1) * innerR;
|
||||
float y1 = cy + sinf(a1) * innerR;
|
||||
float x2 = cx + cosf(a2) * innerR;
|
||||
float y2 = cy + sinf(a2) * innerR;
|
||||
dc.Draw()->Line(dc.GetTheme().whiteImage, x1, y1, x2, y2, 1.5f, 0x60FF6666);
|
||||
}
|
||||
}
|
||||
|
||||
// Outer deadzone ring.
|
||||
float outerDZ = g_Config.fAnalogOuterDeadzone;
|
||||
if (outerDZ > 0.0f) {
|
||||
float outerR = (1.0f - outerDZ) * minRadius;
|
||||
const int segments = 32;
|
||||
for (int i = 0; i < segments; i++) {
|
||||
float a1 = (float)i / (float)segments * 2.0f * (float)M_PI;
|
||||
float a2 = (float)(i + 1) / (float)segments * 2.0f * (float)M_PI;
|
||||
float x1 = cx + cosf(a1) * outerR;
|
||||
float y1 = cy + sinf(a1) * outerR;
|
||||
float x2 = cx + cosf(a2) * outerR;
|
||||
float y2 = cy + sinf(a2) * outerR;
|
||||
dc.Draw()->Line(dc.GetTheme().whiteImage, x1, y1, x2, y2, 1.5f, 0x6066FF66);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int a = maxCount_ - (int)locations_.size();
|
||||
for (auto iter = locations_.begin(); iter != locations_.end(); ++iter) {
|
||||
float x = bounds_.centerX() + minRadius * iter->x;
|
||||
|
||||
Reference in new issue
Block a user