Renamed uInput to UInput
This commit is contained in:
parent
54a83fb352
commit
70a60dbd67
22 changed files with 118 additions and 119 deletions
src
axis_event.cppaxis_event.hppaxis_map.cppaxis_map.hppbutton_event.cppbutton_event.hppbutton_map.cppbutton_map.hppcontroller_config.cppcontroller_config.hppcontroller_config_set.cppcontroller_config_set.hppdefault_message_processor.cppdefault_message_processor.hppuinput.cppuinput.hppuinput_config.cppuinput_config.hppxboxdrv.cppxboxdrv.hppxboxdrv_daemon.cppxboxdrv_daemon.hpp
|
@ -115,13 +115,13 @@ AxisEvent::add_filter(AxisFilterPtr filter)
|
|||
}
|
||||
|
||||
void
|
||||
AxisEvent::init(uInput& uinput, int slot, bool extra_devices)
|
||||
AxisEvent::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
m_handler->init(uinput, slot, extra_devices);
|
||||
}
|
||||
|
||||
void
|
||||
AxisEvent::send(uInput& uinput, int value)
|
||||
AxisEvent::send(UInput& uinput, int value)
|
||||
{
|
||||
m_last_raw_value = value;
|
||||
|
||||
|
@ -138,7 +138,7 @@ AxisEvent::send(uInput& uinput, int value)
|
|||
}
|
||||
|
||||
void
|
||||
AxisEvent::update(uInput& uinput, int msec_delta)
|
||||
AxisEvent::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
for(std::vector<AxisFilterPtr>::const_iterator i = m_filters.begin(); i != m_filters.end(); ++i)
|
||||
{
|
||||
|
@ -217,14 +217,14 @@ RelAxisEventHandler::RelAxisEventHandler(int device_id, int code, int repeat, fl
|
|||
}
|
||||
|
||||
void
|
||||
RelAxisEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
RelAxisEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
m_code.resolve_device_id(slot, extra_devices);
|
||||
uinput.add_rel(m_code.get_device_id(), m_code.code);
|
||||
}
|
||||
|
||||
void
|
||||
RelAxisEventHandler::send(uInput& uinput, int value)
|
||||
RelAxisEventHandler::send(UInput& uinput, int value)
|
||||
{
|
||||
// FIXME: Need to know the min/max of value
|
||||
int v = m_value * value / 32767;
|
||||
|
@ -235,7 +235,7 @@ RelAxisEventHandler::send(uInput& uinput, int value)
|
|||
}
|
||||
|
||||
void
|
||||
RelAxisEventHandler::update(uInput& uinput, int msec_delta)
|
||||
RelAxisEventHandler::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ AbsAxisEventHandler::set_axis_range(int min, int max)
|
|||
}
|
||||
|
||||
void
|
||||
AbsAxisEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
AbsAxisEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
m_code.resolve_device_id(slot, extra_devices);
|
||||
uinput.add_abs(m_code.get_device_id(), m_code.code,
|
||||
|
@ -316,7 +316,7 @@ AbsAxisEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
|||
}
|
||||
|
||||
void
|
||||
AbsAxisEventHandler:: send(uInput& uinput, int value)
|
||||
AbsAxisEventHandler:: send(UInput& uinput, int value)
|
||||
{
|
||||
/*FIXME for(std::vector<AxisFilterPtr>::const_iterator i = m_filters.begin(); i != m_filters.end(); ++i)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ AbsAxisEventHandler:: send(uInput& uinput, int value)
|
|||
}
|
||||
|
||||
void
|
||||
AbsAxisEventHandler::update(uInput& uinput, int msec_delta)
|
||||
AbsAxisEventHandler::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ KeyAxisEventHandler::KeyAxisEventHandler() :
|
|||
}
|
||||
|
||||
void
|
||||
KeyAxisEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
KeyAxisEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
for(int i = 0; m_up_codes[i].is_valid(); ++i)
|
||||
{
|
||||
|
@ -420,7 +420,7 @@ KeyAxisEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
|||
}
|
||||
|
||||
void
|
||||
KeyAxisEventHandler::send(uInput& uinput, int value)
|
||||
KeyAxisEventHandler::send(UInput& uinput, int value)
|
||||
{
|
||||
if (::abs(m_old_value) < m_threshold &&
|
||||
::abs(value) >= m_threshold)
|
||||
|
@ -456,7 +456,7 @@ KeyAxisEventHandler::send(uInput& uinput, int value)
|
|||
}
|
||||
|
||||
void
|
||||
KeyAxisEventHandler::update(uInput& uinput, int msec_delta)
|
||||
KeyAxisEventHandler::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "axis_filter.hpp"
|
||||
#include "ui_event.hpp"
|
||||
|
||||
class uInput;
|
||||
class UInput;
|
||||
class AxisEvent;
|
||||
class AxisEventHandler;
|
||||
|
||||
|
@ -47,9 +47,9 @@ public:
|
|||
|
||||
void add_filter(AxisFilterPtr filter);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, int value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, int value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
void set_axis_range(int min, int max);
|
||||
|
||||
|
@ -69,9 +69,9 @@ class AxisEventHandler
|
|||
public:
|
||||
virtual ~AxisEventHandler() {}
|
||||
|
||||
virtual void init(uInput& uinput, int slot, bool extra_devices) =0;
|
||||
virtual void send(uInput& uinput, int value) =0;
|
||||
virtual void update(uInput& uinput, int msec_delta) =0;
|
||||
virtual void init(UInput& uinput, int slot, bool extra_devices) =0;
|
||||
virtual void send(UInput& uinput, int value) =0;
|
||||
virtual void update(UInput& uinput, int msec_delta) =0;
|
||||
|
||||
virtual void set_axis_range(int min, int max) {}
|
||||
|
||||
|
@ -87,9 +87,9 @@ public:
|
|||
RelAxisEventHandler();
|
||||
RelAxisEventHandler(int device_id, int code, int repeat = 10, float value = 5);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, int value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, int value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -110,9 +110,9 @@ public:
|
|||
|
||||
void set_axis_range(int min, int max);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, int value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, int value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -132,9 +132,9 @@ public:
|
|||
public:
|
||||
KeyAxisEventHandler();
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, int value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, int value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ AxisMap::clear()
|
|||
}
|
||||
|
||||
void
|
||||
AxisMap::init(uInput& uinput, int slot, bool extra_devices) const
|
||||
AxisMap::init(UInput& uinput, int slot, bool extra_devices) const
|
||||
{
|
||||
for(int shift_code = 0; shift_code < XBOX_BTN_MAX; ++shift_code)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ AxisMap::init(uInput& uinput, int slot, bool extra_devices) const
|
|||
}
|
||||
|
||||
void
|
||||
AxisMap::update(uInput& uinput, int msec_delta)
|
||||
AxisMap::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
for(int shift_code = 0; shift_code < XBOX_BTN_MAX; ++shift_code)
|
||||
{
|
||||
|
|
|
@ -38,8 +38,8 @@ public:
|
|||
|
||||
void clear();
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices) const;
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices) const;
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -126,13 +126,13 @@ ButtonEvent::add_filter(ButtonFilterPtr filter)
|
|||
}
|
||||
|
||||
void
|
||||
ButtonEvent::init(uInput& uinput, int slot, bool extra_devices)
|
||||
ButtonEvent::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
return m_handler->init(uinput, slot, extra_devices);
|
||||
}
|
||||
|
||||
void
|
||||
ButtonEvent::send(uInput& uinput, bool raw_state)
|
||||
ButtonEvent::send(UInput& uinput, bool raw_state)
|
||||
{
|
||||
m_last_raw_state = raw_state;
|
||||
bool filtered_state = raw_state;
|
||||
|
@ -155,7 +155,7 @@ ButtonEvent::send(uInput& uinput, bool raw_state)
|
|||
}
|
||||
|
||||
void
|
||||
ButtonEvent::update(uInput& uinput, int msec_delta)
|
||||
ButtonEvent::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
for(std::vector<ButtonFilterPtr>::const_iterator i = m_filters.begin(); i != m_filters.end(); ++i)
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ KeyButtonEventHandler::KeyButtonEventHandler(int code) :
|
|||
}
|
||||
|
||||
void
|
||||
KeyButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
KeyButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
for(int i = 0; m_codes[i].is_valid(); ++i)
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ KeyButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
|||
}
|
||||
|
||||
void
|
||||
KeyButtonEventHandler::send(uInput& uinput, bool value)
|
||||
KeyButtonEventHandler::send(UInput& uinput, bool value)
|
||||
{
|
||||
if (m_state != value)
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ KeyButtonEventHandler::send(uInput& uinput, bool value)
|
|||
}
|
||||
|
||||
void
|
||||
KeyButtonEventHandler::update(uInput& uinput, int msec_delta)
|
||||
KeyButtonEventHandler::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
if (m_state && m_hold_threshold)
|
||||
{
|
||||
|
@ -392,12 +392,12 @@ AbsButtonEventHandler::AbsButtonEventHandler(int code) :
|
|||
}
|
||||
|
||||
void
|
||||
AbsButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
AbsButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AbsButtonEventHandler::send(uInput& uinput, bool value)
|
||||
AbsButtonEventHandler::send(UInput& uinput, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
|
@ -451,14 +451,14 @@ RelButtonEventHandler::RelButtonEventHandler(const UIEvent& code) :
|
|||
}
|
||||
|
||||
void
|
||||
RelButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
RelButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
m_code.resolve_device_id(slot, extra_devices);
|
||||
uinput.add_rel(m_code.get_device_id(), m_code.code);
|
||||
}
|
||||
|
||||
void
|
||||
RelButtonEventHandler::send(uInput& uinput, bool value)
|
||||
RelButtonEventHandler::send(UInput& uinput, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
|
@ -497,13 +497,13 @@ ExecButtonEventHandler::ExecButtonEventHandler(const std::vector<std::string>& a
|
|||
}
|
||||
|
||||
void
|
||||
ExecButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
ExecButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
void
|
||||
ExecButtonEventHandler::send(uInput& uinput, bool value)
|
||||
ExecButtonEventHandler::send(UInput& uinput, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
|
@ -623,7 +623,7 @@ MacroButtonEventHandler::MacroButtonEventHandler(const std::vector<MacroEvent>&
|
|||
}
|
||||
|
||||
void
|
||||
MacroButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
||||
MacroButtonEventHandler::init(UInput& uinput, int slot, bool extra_devices)
|
||||
{
|
||||
for(std::vector<MacroEvent>::iterator i = m_events.begin(); i != m_events.end(); ++i)
|
||||
{
|
||||
|
@ -656,7 +656,7 @@ MacroButtonEventHandler::init(uInput& uinput, int slot, bool extra_devices)
|
|||
}
|
||||
|
||||
void
|
||||
MacroButtonEventHandler::send(uInput& uinput, bool value)
|
||||
MacroButtonEventHandler::send(UInput& uinput, bool value)
|
||||
{
|
||||
if (value && !m_send_in_progress)
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ MacroButtonEventHandler::send(uInput& uinput, bool value)
|
|||
}
|
||||
|
||||
void
|
||||
MacroButtonEventHandler::update(uInput& uinput, int msec_delta)
|
||||
MacroButtonEventHandler::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
if (m_send_in_progress)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "button_filter.hpp"
|
||||
#include "ui_event.hpp"
|
||||
|
||||
class uInput;
|
||||
class UInput;
|
||||
class ButtonEvent;
|
||||
class ButtonEventHandler;
|
||||
|
||||
|
@ -46,9 +46,9 @@ protected:
|
|||
ButtonEvent(ButtonEventHandler* handler);
|
||||
|
||||
public:
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
std::string str() const;
|
||||
|
||||
void add_filters(const std::vector<ButtonFilterPtr>& filters);
|
||||
|
@ -66,9 +66,9 @@ class ButtonEventHandler
|
|||
public:
|
||||
virtual ~ButtonEventHandler() {}
|
||||
|
||||
virtual void init(uInput& uinput, int slot, bool extra_devices) =0;
|
||||
virtual void send(uInput& uinput, bool value) =0;
|
||||
virtual void update(uInput& uinput, int msec_delta) =0;
|
||||
virtual void init(UInput& uinput, int slot, bool extra_devices) =0;
|
||||
virtual void send(UInput& uinput, bool value) =0;
|
||||
virtual void update(UInput& uinput, int msec_delta) =0;
|
||||
virtual std::string str() const =0;
|
||||
};
|
||||
|
||||
|
@ -81,9 +81,9 @@ public:
|
|||
KeyButtonEventHandler();
|
||||
KeyButtonEventHandler(int code);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -106,9 +106,9 @@ public:
|
|||
public:
|
||||
AbsButtonEventHandler(int code);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta) {}
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta) {}
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -125,9 +125,9 @@ public:
|
|||
public:
|
||||
RelButtonEventHandler(const UIEvent& code);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta) {}
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta) {}
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -146,9 +146,9 @@ public:
|
|||
public:
|
||||
ExecButtonEventHandler(const std::vector<std::string>& args);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta) {}
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta) {}
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
@ -181,9 +181,9 @@ public:
|
|||
public:
|
||||
MacroButtonEventHandler(const std::vector<MacroEvent>& events);
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices);
|
||||
void send(uInput& uinput, bool value);
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
void init(UInput& uinput, int slot, bool extra_devices);
|
||||
void send(UInput& uinput, bool value);
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
std::string str() const;
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ ButtonMap::lookup(XboxButton shift_code, XboxButton code) const
|
|||
}
|
||||
|
||||
bool
|
||||
ButtonMap::send(uInput& uinput, XboxButton code, bool value) const
|
||||
ButtonMap::send(UInput& uinput, XboxButton code, bool value) const
|
||||
{
|
||||
return send(uinput, XBOX_BTN_UNKNOWN, code, value);
|
||||
}
|
||||
|
||||
bool
|
||||
ButtonMap::send(uInput& uinput, XboxButton shift_code, XboxButton code, bool value) const
|
||||
ButtonMap::send(UInput& uinput, XboxButton shift_code, XboxButton code, bool value) const
|
||||
{
|
||||
const ButtonEventPtr& event = lookup(shift_code, code);
|
||||
if (event)
|
||||
|
@ -81,7 +81,7 @@ ButtonMap::clear()
|
|||
}
|
||||
|
||||
void
|
||||
ButtonMap::init(uInput& uinput, int slot, bool extra_devices) const
|
||||
ButtonMap::init(UInput& uinput, int slot, bool extra_devices) const
|
||||
{
|
||||
for(int shift_code = 0; shift_code < XBOX_BTN_MAX; ++shift_code)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ ButtonMap::init(uInput& uinput, int slot, bool extra_devices) const
|
|||
}
|
||||
|
||||
void
|
||||
ButtonMap::update(uInput& uinput, int msec_delta)
|
||||
ButtonMap::update(UInput& uinput, int msec_delta)
|
||||
{
|
||||
for(int shift_code = 0; shift_code < XBOX_BTN_MAX; ++shift_code)
|
||||
{
|
||||
|
|
|
@ -36,11 +36,11 @@ public:
|
|||
ButtonEventPtr lookup(XboxButton code) const;
|
||||
ButtonEventPtr lookup(XboxButton shift_code, XboxButton code) const;
|
||||
|
||||
void init(uInput& uinput, int slot, bool extra_devices) const;
|
||||
void init(UInput& uinput, int slot, bool extra_devices) const;
|
||||
|
||||
bool send(uInput& uinput, XboxButton code, bool value) const;
|
||||
bool send(uInput& uinput, XboxButton shift_code, XboxButton code, bool value) const;
|
||||
void update(uInput& uinput, int msec_delta);
|
||||
bool send(UInput& uinput, XboxButton code, bool value) const;
|
||||
bool send(UInput& uinput, XboxButton shift_code, XboxButton code, bool value) const;
|
||||
void update(UInput& uinput, int msec_delta);
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "options.hpp"
|
||||
|
||||
ControllerConfig::ControllerConfig(uInput& uinput, int slot, bool extra_devices, const ControllerOptions& opts) :
|
||||
ControllerConfig::ControllerConfig(UInput& uinput, int slot, bool extra_devices, const ControllerOptions& opts) :
|
||||
m_modifier(),
|
||||
m_uinput(uinput, slot, extra_devices, opts.uinput)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
UInputConfig m_uinput;
|
||||
|
||||
public:
|
||||
ControllerConfig(uInput& uinput, int slot, bool extra_devices,
|
||||
ControllerConfig(UInput& uinput, int slot, bool extra_devices,
|
||||
const ControllerOptions& opts);
|
||||
|
||||
std::vector<ModifierPtr>& get_modifier();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "modifier/square_axis_modifier.hpp"
|
||||
|
||||
ControllerConfigSetPtr
|
||||
ControllerConfigSet::create(uInput& uinput, int slot, bool extra_devices, const Options::ControllerConfigs& opts)
|
||||
ControllerConfigSet::create(UInput& uinput, int slot, bool extra_devices, const Options::ControllerConfigs& opts)
|
||||
{
|
||||
ControllerConfigSetPtr m_config(new ControllerConfigSet);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "options.hpp"
|
||||
|
||||
class Options;
|
||||
class uInput;
|
||||
class UInput;
|
||||
class ControllerConfigSet;
|
||||
|
||||
typedef boost::shared_ptr<ControllerConfigSet> ControllerConfigSetPtr;
|
||||
|
@ -31,8 +31,8 @@ typedef boost::shared_ptr<ControllerConfigSet> ControllerConfigSetPtr;
|
|||
class ControllerConfigSet
|
||||
{
|
||||
public:
|
||||
/** Creates a ControllerConfigSet from the Options object and connects it to uInput */
|
||||
static ControllerConfigSetPtr create(uInput& uinput, int slot, bool extra_devices,
|
||||
/** Creates a ControllerConfigSet from the Options object and connects it to UInput */
|
||||
static ControllerConfigSetPtr create(UInput& uinput, int slot, bool extra_devices,
|
||||
const Options::ControllerConfigs& opts);
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "log.hpp"
|
||||
#include "uinput.hpp"
|
||||
|
||||
DefaultMessageProcessor::DefaultMessageProcessor(uInput& uinput, ControllerConfigSetPtr config,
|
||||
DefaultMessageProcessor::DefaultMessageProcessor(UInput& uinput, ControllerConfigSetPtr config,
|
||||
const Options& opts) :
|
||||
m_uinput(uinput),
|
||||
m_config(config),
|
||||
|
|
|
@ -22,21 +22,21 @@
|
|||
#include "controller_config_set.hpp"
|
||||
#include "message_processor.hpp"
|
||||
|
||||
class uInput;
|
||||
class UInput;
|
||||
class Options;
|
||||
class ControllerOptions;
|
||||
|
||||
class DefaultMessageProcessor : public MessageProcessor
|
||||
{
|
||||
private:
|
||||
uInput& m_uinput;
|
||||
UInput& m_uinput;
|
||||
ControllerConfigSetPtr m_config;
|
||||
|
||||
XboxGenericMsg m_oldmsg; /// last data send to uinput
|
||||
XboxButton m_config_toggle_button;
|
||||
|
||||
public:
|
||||
DefaultMessageProcessor(uInput& uinput, ControllerConfigSetPtr config,
|
||||
DefaultMessageProcessor(UInput& uinput, ControllerConfigSetPtr config,
|
||||
const Options& opts);
|
||||
~DefaultMessageProcessor();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "log.hpp"
|
||||
|
||||
uInput::uInput() :
|
||||
UInput::UInput() :
|
||||
uinput_devs(),
|
||||
rel_repeat_lst(),
|
||||
m_mutex()
|
||||
|
@ -76,7 +76,7 @@ uInput::uInput() :
|
|||
}
|
||||
|
||||
LinuxUinput*
|
||||
uInput::create_uinput_device(uint32_t device_id)
|
||||
UInput::create_uinput_device(uint32_t device_id)
|
||||
{
|
||||
// DEVICEID_AUTO should not happen at this point as the user should
|
||||
// have called resolve_device_id()
|
||||
|
@ -125,33 +125,33 @@ uInput::create_uinput_device(uint32_t device_id)
|
|||
}
|
||||
}
|
||||
|
||||
uInput::~uInput()
|
||||
UInput::~UInput()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
uInput::add_key(uint32_t device_id, int ev_code)
|
||||
UInput::add_key(uint32_t device_id, int ev_code)
|
||||
{
|
||||
LinuxUinput* dev = create_uinput_device(device_id);
|
||||
dev->add_key(ev_code);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::add_rel(uint32_t device_id, int ev_code)
|
||||
UInput::add_rel(uint32_t device_id, int ev_code)
|
||||
{
|
||||
LinuxUinput* dev = create_uinput_device(device_id);
|
||||
dev->add_rel(ev_code);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::add_abs(uint32_t device_id, int ev_code, int min, int max, int fuzz, int flat)
|
||||
UInput::add_abs(uint32_t device_id, int ev_code, int min, int max, int fuzz, int flat)
|
||||
{
|
||||
LinuxUinput* dev = create_uinput_device(device_id);
|
||||
dev->add_abs(ev_code, min, max, fuzz, flat);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::finish()
|
||||
UInput::finish()
|
||||
{
|
||||
for(UInputDevs::iterator i = uinput_devs.begin(); i != uinput_devs.end(); ++i)
|
||||
{
|
||||
|
@ -160,20 +160,20 @@ uInput::finish()
|
|||
}
|
||||
|
||||
void
|
||||
uInput::send(uint32_t device_id, int ev_type, int ev_code, int value)
|
||||
UInput::send(uint32_t device_id, int ev_type, int ev_code, int value)
|
||||
{
|
||||
get_uinput(device_id)->send(ev_type, ev_code, value);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::send_abs(uint32_t device_id, int ev_code, int value)
|
||||
UInput::send_abs(uint32_t device_id, int ev_code, int value)
|
||||
{
|
||||
assert(ev_code != -1);
|
||||
get_uinput(device_id)->send(EV_ABS, ev_code, value);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::send_key(uint32_t device_id, int ev_code, bool value)
|
||||
UInput::send_key(uint32_t device_id, int ev_code, bool value)
|
||||
{
|
||||
assert(ev_code != -1);
|
||||
|
||||
|
@ -181,7 +181,7 @@ uInput::send_key(uint32_t device_id, int ev_code, bool value)
|
|||
}
|
||||
|
||||
void
|
||||
uInput::update(int msec_delta)
|
||||
UInput::update(int msec_delta)
|
||||
{
|
||||
for(std::map<UIEvent, RelRepeat>::iterator i = rel_repeat_lst.begin(); i != rel_repeat_lst.end(); ++i)
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ uInput::update(int msec_delta)
|
|||
}
|
||||
|
||||
void
|
||||
uInput::sync()
|
||||
UInput::sync()
|
||||
{
|
||||
for(UInputDevs::iterator i = uinput_devs.begin(); i != uinput_devs.end(); ++i)
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ uInput::sync()
|
|||
}
|
||||
|
||||
void
|
||||
uInput::send_rel_repetitive(const UIEvent& code, int value, int repeat_interval)
|
||||
UInput::send_rel_repetitive(const UIEvent& code, int value, int repeat_interval)
|
||||
{
|
||||
if (repeat_interval < 0)
|
||||
{ // remove rel_repeats from list
|
||||
|
@ -239,7 +239,7 @@ uInput::send_rel_repetitive(const UIEvent& code, int value, int repeat_interval)
|
|||
}
|
||||
|
||||
LinuxUinput*
|
||||
uInput::get_uinput(uint32_t device_id) const
|
||||
UInput::get_uinput(uint32_t device_id) const
|
||||
{
|
||||
UInputDevs::const_iterator it = uinput_devs.find(device_id);
|
||||
if (it != uinput_devs.end())
|
||||
|
@ -256,13 +256,13 @@ uInput::get_uinput(uint32_t device_id) const
|
|||
}
|
||||
|
||||
LinuxUinput*
|
||||
uInput::get_force_feedback_uinput() const
|
||||
UInput::get_force_feedback_uinput() const
|
||||
{
|
||||
return get_uinput(0);
|
||||
}
|
||||
|
||||
void
|
||||
uInput::set_ff_callback(const boost::function<void (uint8_t, uint8_t)>& callback)
|
||||
UInput::set_ff_callback(const boost::function<void (uint8_t, uint8_t)>& callback)
|
||||
{
|
||||
get_force_feedback_uinput()->set_ff_callback(callback);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ struct Xbox360Msg;
|
|||
struct XboxMsg;
|
||||
struct Xbox360GuitarMsg;
|
||||
|
||||
class uInput
|
||||
class UInput
|
||||
{
|
||||
private:
|
||||
typedef std::map<uint32_t, boost::shared_ptr<LinuxUinput> > UInputDevs;
|
||||
|
@ -57,8 +57,8 @@ private:
|
|||
boost::mutex m_mutex;
|
||||
|
||||
public:
|
||||
uInput();
|
||||
~uInput();
|
||||
UInput();
|
||||
~UInput();
|
||||
|
||||
void update(int msec_delta);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ int16_t u8_to_s16(uint8_t value)
|
|||
}
|
||||
} // namespace
|
||||
|
||||
UInputConfig::UInputConfig(uInput& uinput, int slot, bool extra_devices, const UInputOptions& opts) :
|
||||
UInputConfig::UInputConfig(UInput& uinput, int slot, bool extra_devices, const UInputOptions& opts) :
|
||||
m_uinput(uinput),
|
||||
m_btn_map(opts.get_btn_map()), // FIXME: insert resolve magic right here
|
||||
m_axis_map(opts.get_axis_map())
|
||||
|
|
|
@ -32,7 +32,7 @@ class UInputOptions;
|
|||
class UInputConfig
|
||||
{
|
||||
private:
|
||||
uInput& m_uinput;
|
||||
UInput& m_uinput;
|
||||
|
||||
ButtonMap m_btn_map;
|
||||
AxisMap m_axis_map;
|
||||
|
@ -42,7 +42,7 @@ private:
|
|||
bool last_button_state[XBOX_BTN_MAX];
|
||||
|
||||
public:
|
||||
UInputConfig(uInput& uinput, int slot, bool extra_devices, const UInputOptions& opts);
|
||||
UInputConfig(UInput& uinput, int slot, bool extra_devices, const UInputOptions& opts);
|
||||
|
||||
void send(XboxGenericMsg& msg);
|
||||
void update(int msec_delta);
|
||||
|
|
|
@ -430,12 +430,12 @@ Xboxdrv::run_main(const Options& opts)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<uInput> uinput;
|
||||
std::auto_ptr<UInput> uinput;
|
||||
if (!opts.no_uinput)
|
||||
{
|
||||
if (!opts.quiet)
|
||||
std::cout << "Starting with uinput" << std::endl;
|
||||
uinput = std::auto_ptr<uInput>(new uInput());
|
||||
uinput = std::auto_ptr<UInput>(new UInput());
|
||||
if (opts.get_controller_options().uinput.force_feedback) // FIXME: wrong
|
||||
{
|
||||
uinput->set_ff_callback(boost::bind(&set_rumble, controller.get(), opts.rumble_gain, _1, _2));
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
struct XPadDevice;
|
||||
class Options;
|
||||
class Options;
|
||||
class uInput;
|
||||
class XboxGenericController;
|
||||
|
||||
class Xboxdrv
|
||||
|
|
|
@ -85,7 +85,7 @@ XboxdrvDaemon::cleanup_threads()
|
|||
}
|
||||
|
||||
void
|
||||
XboxdrvDaemon::process_match(const Options& opts, uInput* uinput, struct udev_device* device)
|
||||
XboxdrvDaemon::process_match(const Options& opts, UInput* uinput, struct udev_device* device)
|
||||
{
|
||||
// 1) Match vendor/product against the xpad list
|
||||
// value = udev_device_get_property_value(device, "ID_VENDOR_ID"); // 045e
|
||||
|
@ -185,12 +185,12 @@ XboxdrvDaemon::run_real(const Options& opts)
|
|||
}
|
||||
|
||||
// Setup uinput
|
||||
std::auto_ptr<uInput> uinput;
|
||||
std::auto_ptr<UInput> uinput;
|
||||
if (!opts.no_uinput)
|
||||
{
|
||||
if (!opts.quiet) std::cout << "Starting with uinput" << std::endl;
|
||||
|
||||
uinput.reset(new uInput());
|
||||
uinput.reset(new UInput());
|
||||
|
||||
// FIXME:
|
||||
/* must setup this callback later when we have a controller
|
||||
|
@ -365,7 +365,7 @@ XboxdrvDaemon::print_info(struct udev_device* device)
|
|||
}
|
||||
|
||||
void
|
||||
XboxdrvDaemon::launch_xboxdrv(uInput* uinput, const XPadDevice& dev_type, const Options& opts,
|
||||
XboxdrvDaemon::launch_xboxdrv(UInput* uinput, const XPadDevice& dev_type, const Options& opts,
|
||||
uint8_t busnum, uint8_t devnum)
|
||||
{
|
||||
// FIXME: results must be libusb_unref_device()'ed
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "controller_config_set.hpp"
|
||||
|
||||
class Options;
|
||||
class uInput;
|
||||
class UInput;
|
||||
struct XPadDevice;
|
||||
class XboxdrvThread;
|
||||
|
||||
|
@ -81,9 +81,9 @@ private:
|
|||
void run_real(const Options& opts);
|
||||
|
||||
void cleanup_threads();
|
||||
void process_match(const Options& opts, uInput* uinput, struct udev_device* device);
|
||||
void process_match(const Options& opts, UInput* uinput, struct udev_device* device);
|
||||
void print_info(struct udev_device* device);
|
||||
void launch_xboxdrv(uInput* uinput,
|
||||
void launch_xboxdrv(UInput* uinput,
|
||||
const XPadDevice& dev_type, const Options& opts,
|
||||
uint8_t busnum, uint8_t devnum);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue