Added proper word wrap to --list-all output

This commit is contained in:
Ingo Ruhnke 2011-01-22 23:37:22 +01:00
parent 13e1612e3b
commit 7365d6c798
4 changed files with 63 additions and 55 deletions

17
NEWS
View file

@ -1,4 +1,4 @@
xboxdrv 0.6.5 - (??/Jan/2011)
xboxdrv 0.7.0 - (??/Jan/2011)
=============================
* switched to libusb-1.0
@ -9,12 +9,25 @@ xboxdrv 0.6.5 - (??/Jan/2011)
* startup output got cleaned up
* fixed double Ctrl-c issue
* added --modifier MODIFIER,...
* configuration toggle now works with modifiers too
* configuration toggle button now works with modifiers too
* renamed --ui-new to --next
* renamed --ui-toggle to --toggle
* fixed incorrect endpoint detection for Xbox1 controller
* native Playstation 3 USB controller support
* added axis rotation modifier
* renamed A, B, X, Y axis to BTN_A, BTN_B, BTN_X, BTN_Y to avoid
confusion with X1, Y1
* added --list-all, --list-key, -list-rel, ... to display all
available symbolic name
xboxdrv 0.6.5 - (22/Jan/2011)
=============================
* fixed incorrect variable initalisation, leading to button presses
getting lost sometimes
* fixed initialisation issue for Chatpad connected to controllers with
bcdDevice 0x0114
xboxdrv 0.6.4 - (13/Jan/2011)

17
TODO
View file

@ -94,18 +94,14 @@ List Output
-> doesn't really work, as some gamepads just emulate other message
types, need to restructure the whole messaging infrastructure
* do modifier/filter dump when --verbose is given
* fix inconsistent case in output of --list-all
* do modifier/filter dump when --verbose is given, make verbose
overall more useful
* turn EnumBox into singleton
* Keysym2Keycode is currently always constructed at startup, even when
not used, construct it on demand
* add --list-keys --list-x11-keys --list-abs --list-rel --list-button --list-axis etc.
- add pretty printer, to make output look nice
* document significant patches in AUTHORS
2 Added latest version of runxboxdrv from Michael Rans <rans@email.com>
@ -122,6 +118,15 @@ List Output
Stuff to do before 0.7.x release:
=================================
* allow named sections in INI files:
[controller1/modifier]
[controller1/config1/modifier]
[controller2/modifier]
[controller2/modifier]
[controller3/config1/modifier]
[controller3/config2/modifier]
* get rid of set_button()/get_button(), turn the message objects into full classes
* document common problems, such as lack of deadzone handling in games

View file

@ -19,6 +19,7 @@
#include "xboxdrv.hpp"
#include <boost/format.hpp>
#include <boost/algorithm/string/join.hpp>
#include <signal.h>
#include <stdio.h>
@ -627,75 +628,64 @@ Xboxdrv::run_list_enums(uint32_t enums)
{
const int terminal_width = get_terminal_width();
WordWrap wrap(terminal_width);
if (enums & Options::LIST_ABS)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "EV_ABS:\n ";
for(EvDevRelEnum::const_iterator i = evdev_abs_names.begin();
i != evdev_abs_names.end(); ++i)
{
wrap.add_item(i->second);
}
std::cout << std::endl << std::endl;
wrap.println("EV_ABS:");
wrap.para(" ", boost::algorithm::join(evdev_abs_names.get_names(), ", "));
wrap.newline();
}
if (enums & Options::LIST_REL)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "EV_REL:\n ";
for(EvDevRelEnum::const_iterator i = evdev_rel_names.begin();
i != evdev_rel_names.end(); ++i)
{
wrap.add_item(i->second);
}
std::cout << std::endl << std::endl;
wrap.println("EV_REL:");
wrap.para(" ", boost::algorithm::join(evdev_rel_names.get_names(), ", "));
wrap.newline();
}
if (enums & Options::LIST_KEY)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "EV_KEY:\n ";
for(EvDevRelEnum::const_iterator i = evdev_key_names.begin();
i != evdev_key_names.end(); ++i)
{
wrap.add_item(i->second);
}
std::cout << std::endl << std::endl;
wrap.println("EV_KEY:");
wrap.para(" ", boost::algorithm::join(evdev_key_names.get_names(), ", "));
wrap.newline();
}
if (enums & Options::LIST_X11KEYSYM)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "X11Keysym:\n ";
std::vector<std::string> lst;
for(X11KeysymEnum::const_iterator i = x11keysym_names.begin();
i != x11keysym_names.end(); ++i)
{
wrap.add_item(i->second);
lst.push_back(i->second);
}
std::cout << std::endl << std::endl;
wrap.println("X11Keysym:");
wrap.para(" ", boost::algorithm::join(lst, ", "));
wrap.newline();
}
if (enums & Options::LIST_AXIS)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "XboxAxis:\n ";
std::vector<std::string> lst;
for(int i = 1; i < XBOX_AXIS_MAX; ++i)
{
wrap.add_item(axis2string(static_cast<XboxAxis>(i)));
lst.push_back(axis2string(static_cast<XboxAxis>(i)));
}
std::cout << std::endl << std::endl;
wrap.println("XboxAxis:");
wrap.para(" ", boost::algorithm::join(lst, ", "));
wrap.newline();
}
if (enums & Options::LIST_BUTTON)
{
WordWrap wrap(terminal_width, " ", ", ");
std::cout << "XboxButton:\n ";
std::vector<std::string> lst;
for(int i = 1; i < XBOX_BTN_MAX; ++i)
{
wrap.add_item(btn2string(static_cast<XboxButton>(i)));
lst.push_back(btn2string(static_cast<XboxButton>(i)));
}
std::cout << std::endl << std::endl;
wrap.println("XboxButton:");
wrap.para(" ", boost::algorithm::join(lst, ", "));
wrap.newline();
}
}

View file

@ -1312,16 +1312,16 @@ XboxAxis string2axis(const std::string& str_)
else if (str == "trigger" || str == "z" || str == "rudder")
return XBOX_AXIS_TRIGGER;
else if (str == "a")
else if (str == "btn_a")
return XBOX_AXIS_A;
else if (str == "b")
else if (str == "btn_b")
return XBOX_AXIS_B;
else if (str == "x")
else if (str == "btn_x")
return XBOX_AXIS_X;
else if (str == "y")
else if (str == "btn_y")
return XBOX_AXIS_Y;
else if (str == "black")
@ -1355,12 +1355,12 @@ std::string axis2string(XboxAxis axis)
case XBOX_AXIS_LT: return "LT";
case XBOX_AXIS_RT: return "RT";
case XBOX_AXIS_A: return "a";
case XBOX_AXIS_B: return "b";
case XBOX_AXIS_X: return "x";
case XBOX_AXIS_Y: return "y";
case XBOX_AXIS_BLACK: return "black";
case XBOX_AXIS_WHITE: return "white";
case XBOX_AXIS_A: return "BTN_A";
case XBOX_AXIS_B: return "BTN_B";
case XBOX_AXIS_X: return "BTN_X";
case XBOX_AXIS_Y: return "BTN_Y";
case XBOX_AXIS_BLACK: return "Black";
case XBOX_AXIS_WHITE: return "White";
}
return "unknown";
}