XInput/DInput: Rename settings, fix sensitivity

* Change deadzone inverter naming convention to 'analog mapper'
* Remove hokey mathematics from sensitivity calculations
This commit is contained in:
Josh Palmer 2015-02-05 06:30:29 +00:00
parent 4c6410cd0d
commit 929866edd3
3 changed files with 12 additions and 12 deletions

View File

@ -376,15 +376,15 @@ void GameSettingsScreen::CreateViews() {
controlsSettings->Add(new ItemHeader(c->T("DInput Analog Settings", "DInput Analog Settings")));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fDInputAnalogDeadzone, 0.0f, 1.0f, c->T("Dead Zone"), screenManager()));
controlsSettings->Add(new PopupMultiChoice(&g_Config.iDInputAnalogInverseMode, c->T("Inverse Dead Zone Mode"), inverseDeadzoneModes, 0, ARRAY_SIZE(inverseDeadzoneModes), c, screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fDInputAnalogInverseDeadzone, 0.0f, 1.0f, c->T("Inverse Dead Zone Size"), screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fDInputAnalogSensitivity, 0.0f, 10.0f, c->T("Sensitivity"), screenManager()));
controlsSettings->Add(new PopupMultiChoice(&g_Config.iDInputAnalogInverseMode, c->T("Analog Mapper Mode"), inverseDeadzoneModes, 0, ARRAY_SIZE(inverseDeadzoneModes), c, screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fDInputAnalogInverseDeadzone, 0.0f, 1.0f, c->T("Analog Mapper Low End (Inverse Deadzone)"), screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fDInputAnalogSensitivity, 0.0f, 10.0f, c->T("Analog Mapper High End (Axis Sensitivity)"), screenManager()));
controlsSettings->Add(new ItemHeader(c->T("XInput Analog Settings", "XInput Analog Settings")));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fXInputAnalogDeadzone, 0.0f, 1.0f, c->T("Dead Zone"), screenManager()));
controlsSettings->Add(new PopupMultiChoice(&g_Config.iXInputAnalogInverseMode, c->T("Inverse Dead Zone Mode"), inverseDeadzoneModes, 0, ARRAY_SIZE(inverseDeadzoneModes), c, screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fXInputAnalogInverseDeadzone, 0.0f, 1.0f, c->T("Inverse Dead Zone Size"), screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fXInputAnalogSensitivity, 0.0f, 10.0f, c->T("Sensitivity"), screenManager()));
controlsSettings->Add(new PopupMultiChoice(&g_Config.iXInputAnalogInverseMode, c->T("Analog Mapper Mode"), inverseDeadzoneModes, 0, ARRAY_SIZE(inverseDeadzoneModes), c, screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fXInputAnalogInverseDeadzone, 0.0f, 1.0f, c->T("Analog Mapper Low End (Inverse Deadzone)"), screenManager()));
controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fXInputAnalogSensitivity, 0.0f, 10.0f, c->T("Analog Mapper High End (Axis Sensitivity)"), screenManager()));
controlsSettings->Add(new ItemHeader(c->T("Keyboard", "Keyboard Control Settings")));
#if defined(USING_WIN_UI)

View File

@ -261,21 +261,21 @@ int DinputDevice::UpdateState(InputState &input_state) {
{
short xSign = Signs(js.lX);
if (xSign != 0.0f) {
js.lX = LinearMaps(js.lX, xSign * (short)(dz * 10000), xSign * 10000, xSign * (short)(md * 10000), (xSign * 10000 * st) - (short)(md * 10000) );
js.lX = LinearMaps(js.lX, xSign * (short)(dz * 10000), xSign * 10000, xSign * (short)(md * 10000), xSign * 10000 * st);
}
}
else if (idzm == 2)
{
short ySign = Signs(js.lY);
if (ySign != 0.0f) {
js.lY = LinearMaps(js.lY, ySign * (short)(dz * 10000.0f), ySign * 10000, ySign * (short)(md * 10000.0f), (ySign * 10000 * st) - (short)(md * 10000));
js.lY = LinearMaps(js.lY, ySign * (short)(dz * 10000.0f), ySign * 10000, ySign * (short)(md * 10000.0f), ySign * 10000 * st);
}
}
else if (idzm == 3)
{
float xNorm = (float)js.lX / magnitude;
float yNorm = (float)js.lY / magnitude;
float mapMag = LinearMaps(magnitude, dz * 10000.0f, 10000.0f, md * 10000.0f, (10000.0f * st) - (short)(md * 10000));
float mapMag = LinearMaps(magnitude, dz * 10000.0f, 10000.0f, md * 10000.0f, 10000.0f * st);
js.lX = (short)(xNorm * mapMag);
js.lY = (short)(yNorm * mapMag);
}

View File

@ -156,21 +156,21 @@ static Stick NormalizedDeadzoneFilter(short x, short y, float dz, int idzm, floa
{
float xSign = Signf(s.x);
if (xSign != 0.0f) {
s.x = LinearMapf(s.x, xSign * dz, xSign, xSign * md, (xSign * st) - md);
s.x = LinearMapf(s.x, xSign * dz, xSign, xSign * md, xSign * st);
}
}
else if (idzm == 2)
{
float ySign = Signf(s.y);
if (ySign != 0.0f) {
s.y = LinearMapf(s.y, ySign * dz, ySign, ySign * md, (ySign * st) - md);
s.y = LinearMapf(s.y, ySign * dz, ySign, ySign * md, ySign * st);
}
}
else if (idzm == 3)
{
float xNorm = s.x / magnitude;
float yNorm = s.y / magnitude;
float mapMag = LinearMapf(magnitude, dz, 1.0f, md, (1.0f * st) - md);
float mapMag = LinearMapf(magnitude, dz, 1.0f, md, st);
s.x = xNorm * mapMag;
s.y = yNorm * mapMag;
}