mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-14 18:58:52 +01:00
Dead zone of analogue control has been made programmable by KMetalMind.
The parameter is in %, and is defined by deadZone in controls.conf, with a default value of 3 (current RetroFE behavior).
This commit is contained in:
parent
bf24f6cba2
commit
1ab7d129d0
@ -14,6 +14,8 @@ select = Space
|
||||
back = Escape
|
||||
quit = Q
|
||||
|
||||
# Define controller analogue dead zone. Default (when not configured) is 3%.
|
||||
# deadZone = 3
|
||||
|
||||
##############################################################################
|
||||
# MOUSE CODES
|
||||
|
||||
@ -193,18 +193,25 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
||||
unsigned int axis;
|
||||
Sint16 min;
|
||||
Sint16 max;
|
||||
int deadZone;
|
||||
|
||||
joydesc = Utils::replace(joydesc, "axis", "");
|
||||
|
||||
if(!config_.getProperty("controls.deadZone", deadZone))
|
||||
{
|
||||
deadZone = 3;
|
||||
}
|
||||
|
||||
// string is now 0+
|
||||
if(joydesc.find("-") != std::string::npos)
|
||||
{
|
||||
min = -32768;
|
||||
max = -1000;
|
||||
max = -32768 / 100 * deadZone;
|
||||
joydesc = Utils::replace(joydesc, "-", "");
|
||||
}
|
||||
else if(joydesc.find("+") != std::string::npos)
|
||||
{
|
||||
min = 1000;
|
||||
min = 32767 / 100 * deadZone;
|
||||
max = 32767;
|
||||
joydesc = Utils::replace(joydesc, "+", "");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user