mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +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
|
||||
|
||||
@ -191,20 +191,27 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
||||
{
|
||||
// string is now axis0+
|
||||
unsigned int axis;
|
||||
Sint16 min;
|
||||
Sint16 max;
|
||||
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, "+", "");
|
||||
}
|
||||
@ -213,7 +220,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
||||
std::stringstream ss;
|
||||
ss << joydesc;
|
||||
ss >> axis;
|
||||
Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad axis " + ss.str() );
|
||||
Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad axis " + ss.str());
|
||||
keyHandlers_[key] = new JoyAxisHandler(joynum, axis, min, max);
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user