Moved device_id building into proper function

This commit is contained in:
Ingo Ruhnke 2011-01-28 21:20:27 +01:00
parent f2557b3cae
commit 1c47bff655
3 changed files with 8 additions and 2 deletions

View file

@ -73,7 +73,7 @@ ControllerSlotConfig::create(UInput& uinput, int slot, bool extra_devices, const
// '- FF_CUSTOM
// FIXME: this should go through the regular resolution process
uint32_t ff_device = (slot<<16) | opts.get_ff_device();
uint32_t ff_device = UInput::create_device_id(slot, opts.get_ff_device());
// basic types
uinput.add_ff(ff_device, FF_RUMBLE);

View file

@ -140,7 +140,7 @@ UIEvent::get_device_id() const
{
assert(m_device_id_resolved);
return (m_slot_id << 16) | m_device_id;
return UInput::create_device_id(m_slot_id, m_device_id);
}
namespace {

View file

@ -30,6 +30,12 @@ struct Xbox360GuitarMsg;
class UInput
{
public:
static inline uint32_t create_device_id(uint16_t slot_id, uint16_t device_id)
{
return (slot_id << 16) | device_id;
}
private:
typedef std::map<uint32_t, boost::shared_ptr<LinuxUinput> > UInputDevs;
UInputDevs uinput_devs;