Added toggle button option to INI, allow to set toggle button to 'void' to disable it even when multiple configurations are given
This commit is contained in:
parent
bb10adb20d
commit
b3ed2c9494
4 changed files with 31 additions and 9 deletions
|
@ -1035,7 +1035,10 @@ start=KEY_ESC
|
|||
<listitem>
|
||||
<para>
|
||||
Sets the button that will be used to toggle between
|
||||
different different configurations.
|
||||
different different configurations. A value of 'void'
|
||||
will disable the toggle button. If no toggle button is
|
||||
specified, the guide button will be used to toggle
|
||||
between configurations.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -347,6 +347,7 @@ CommandLineParser::init_ini(Options* opts)
|
|||
("next-controller", boost::bind(&Options::next_controller, boost::ref(opts)), boost::function<void ()>())
|
||||
("extra-devices", &opts->extra_devices)
|
||||
("extra-events", &opts->extra_events)
|
||||
("toggle", boost::bind(&Options::set_toggle_button, boost::ref(opts), _1))
|
||||
|
||||
("deadzone", boost::bind(&CommandLineParser::set_deadzone, this, _1))
|
||||
("deadzone-trigger", boost::bind(&CommandLineParser::set_deadzone_trigger, this, _1))
|
||||
|
@ -692,7 +693,7 @@ CommandLineParser::parse_args(int argc, char** argv, Options* options)
|
|||
break;
|
||||
|
||||
case OPTION_TOGGLE:
|
||||
opts.config_toggle_button = string2btn(opt.argument);
|
||||
opts.set_toggle_button(opt.argument);
|
||||
break;
|
||||
|
||||
case OPTION_UI_CLEAR:
|
||||
|
|
|
@ -67,6 +67,7 @@ Options::Options() :
|
|||
exec(),
|
||||
list_enums(0),
|
||||
config_toggle_button(XBOX_BTN_UNKNOWN),
|
||||
config_toggle_button_is_set(false),
|
||||
controller_slot(0),
|
||||
config_slot(0),
|
||||
extra_devices(true),
|
||||
|
@ -165,12 +166,6 @@ Options::next_config()
|
|||
{
|
||||
config_slot += 1;
|
||||
|
||||
// FIXME: move this somewhere else
|
||||
if (config_toggle_button == XBOX_BTN_UNKNOWN)
|
||||
{
|
||||
config_toggle_button = XBOX_BTN_GUIDE;
|
||||
}
|
||||
|
||||
// create the entry if not already available
|
||||
controller_slots[controller_slot].get_options(config_slot);
|
||||
}
|
||||
|
@ -206,6 +201,21 @@ Options::set_device_name(const std::string& name)
|
|||
uinput_device_names[device_id] = name;
|
||||
}
|
||||
|
||||
void
|
||||
Options::set_toggle_button(const std::string& toggle)
|
||||
{
|
||||
if (opt.argument == "void")
|
||||
{
|
||||
opts.config_toggle_button = XBOX_BTN_UNKNOWN;
|
||||
opts.config_toggle_button_is_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
opts.config_toggle_button = string2btn(opt.argument);
|
||||
opts.config_toggle_button_is_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Options::set_device_usbid(const std::string& name)
|
||||
{
|
||||
|
@ -316,7 +326,13 @@ Options::set_match_group(const std::string& str)
|
|||
void
|
||||
Options::finish()
|
||||
{
|
||||
// FIXME: add some checks for conflicting options here
|
||||
// if we have multiple configurations and the toggle button isn't
|
||||
// set, set it to the guide button
|
||||
if (!opts.config_toggle_button_is_set &&
|
||||
controller_slots[controller_slot].size() > 1)
|
||||
{
|
||||
opts.config_toggle_button = XBOX_BTN_GUIDE;
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -115,6 +115,7 @@ public:
|
|||
uint32_t list_enums;
|
||||
|
||||
XboxButton config_toggle_button;
|
||||
bool config_toggle_button_is_set;
|
||||
|
||||
int controller_slot;
|
||||
int config_slot;
|
||||
|
@ -151,6 +152,7 @@ public:
|
|||
void set_led(const std::string& value);
|
||||
void set_device_name(const std::string& name);
|
||||
void set_device_usbid(const std::string& name);
|
||||
void set_toggle_button(const std::string& toggle);
|
||||
void set_mouse();
|
||||
void set_guitar();
|
||||
void set_trigger_as_button();
|
||||
|
|
Loading…
Reference in a new issue