Added --name option
This commit is contained in:
parent
a33b96519a
commit
0b28737416
4 changed files with 26 additions and 3 deletions
6
TODO
6
TODO
|
@ -9,6 +9,12 @@ Pre Release Testing:
|
|||
Stuff to do before 0.5 release:
|
||||
===============================
|
||||
|
||||
* seperate XboxMsg type from Gamepad type
|
||||
|
||||
* add a --mimic-xpad option that behaves exactly like xpad
|
||||
|
||||
* add a --ui-buttonmap X=JS_0
|
||||
|
||||
* fix names in non '--silent' output to match names used for button bindings
|
||||
|
||||
* print unused dummy bytes
|
||||
|
|
|
@ -197,6 +197,8 @@ AxisEvent::from_string(const std::string& str)
|
|||
|
||||
uInputCfg::uInputCfg()
|
||||
{
|
||||
device_name = "Xbox Gamepad (userspace driver)";
|
||||
|
||||
trigger_as_button = false;
|
||||
dpad_as_button = false;
|
||||
trigger_as_zaxis = false;
|
||||
|
@ -335,16 +337,16 @@ uInput::uInput(GamepadType type, uInputCfg config_)
|
|||
std::fill_n(axis_state, (int)XBOX_AXIS_MAX, 0);
|
||||
std::fill_n(button_state, (int)XBOX_BTN_MAX, false);
|
||||
|
||||
joystick_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput("Xbox Gamepad (userspace driver)"));
|
||||
joystick_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput(cfg.device_name));
|
||||
|
||||
if (cfg.extra_devices && need_mouse_device())
|
||||
{
|
||||
mouse_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput("Xbox Gamepad - Mouse Emulation (userspace driver)"));
|
||||
mouse_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput(cfg.device_name + " - Mouse Emulation"));
|
||||
}
|
||||
|
||||
if (cfg.extra_devices && need_keyboard_device())
|
||||
{
|
||||
keyboard_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput("Xbox Gamepad - Keyboard Emulation (userspace driver)"));
|
||||
keyboard_uinput_dev = std::auto_ptr<LinuxUinput>(new LinuxUinput(cfg.device_name + " - Keyboard Emulation"));
|
||||
}
|
||||
|
||||
if (type == GAMEPAD_XBOX360 || type == GAMEPAD_XBOX || type == GAMEPAD_XBOX360_WIRELESS)
|
||||
|
|
|
@ -90,6 +90,7 @@ struct AxisEvent
|
|||
class uInputCfg
|
||||
{
|
||||
public:
|
||||
std::string device_name;
|
||||
bool trigger_as_button;
|
||||
bool dpad_as_button;
|
||||
bool trigger_as_zaxis;
|
||||
|
|
|
@ -409,6 +409,7 @@ void print_command_line_help(int argc, char** argv)
|
|||
std::cout << " -b, --buttonmap MAP Remap the buttons as specified by MAP (example: B=A,X=A,Y=A)" << std::endl;
|
||||
std::cout << " -a, --axismap MAP Remap the axis as specified by MAP (example: -Y1=Y1,X1=X2)" << std::endl;
|
||||
|
||||
std::cout << " --name DEVNAME Changes the descriptive name the device will have" << std::endl;
|
||||
std::cout << " --ui-clear Removes all existing uinput bindings" << std::endl;
|
||||
std::cout << " --ui-buttonmap MAP Changes the uinput events send when hitting a button (example: X=BTN_Y,A=KEY_A)" << std::endl;
|
||||
std::cout << " --ui-axismap MAP Changes the uinput events send when moving a axis (example: X1=ABS_X2)" << std::endl;
|
||||
|
@ -606,6 +607,19 @@ void parse_command_line(int argc, char** argv, CommandLineOptions& opts)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[i], "--name") == 0)
|
||||
{
|
||||
++i;
|
||||
if (i < argc)
|
||||
{
|
||||
opts.uinput_config.device_name = argv[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error: " << argv[i-1] << " expected an argument" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[i], "--ui-clear") == 0)
|
||||
{
|
||||
std::fill_n(opts.uinput_config.axis_map, (int)XBOX_AXIS_MAX, AxisEvent::invalid());
|
||||
|
|
Loading…
Add table
Reference in a new issue