mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-16 04:36:59 +00:00
More changes to finding wiimotes (#961)
This commit is contained in:
parent
98b5a8758a
commit
323bdfa183
4 changed files with 38 additions and 25 deletions
|
|
@ -5,8 +5,8 @@ static constexpr uint16 WIIMOTE_PRODUCT_ID = 0x0306;
|
|||
static constexpr uint16 WIIMOTE_MP_PRODUCT_ID = 0x0330;
|
||||
static constexpr uint16 WIIMOTE_MAX_INPUT_REPORT_LENGTH = 22;
|
||||
|
||||
HidapiWiimote::HidapiWiimote(hid_device* dev, uint64_t identifier, std::string_view path)
|
||||
: m_handle(dev), m_identifier(identifier), m_path(path) {
|
||||
HidapiWiimote::HidapiWiimote(hid_device* dev, std::string_view path)
|
||||
: m_handle(dev), m_path(path) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -36,11 +36,7 @@ std::vector<WiimoteDevicePtr> HidapiWiimote::get_devices() {
|
|||
}
|
||||
else {
|
||||
hid_set_nonblocking(dev, true);
|
||||
// Enough to have a unique id for each device within a session
|
||||
uint64_t id = (static_cast<uint64>(it->interface_number) << 32) |
|
||||
(static_cast<uint64>(it->usage_page) << 16) |
|
||||
(it->usage);
|
||||
wiimote_devices.push_back(std::make_shared<HidapiWiimote>(dev, id, it->path));
|
||||
wiimote_devices.push_back(std::make_shared<HidapiWiimote>(dev, it->path));
|
||||
}
|
||||
}
|
||||
hid_free_enumeration(device_enumeration);
|
||||
|
|
@ -48,8 +44,7 @@ std::vector<WiimoteDevicePtr> HidapiWiimote::get_devices() {
|
|||
}
|
||||
|
||||
bool HidapiWiimote::operator==(WiimoteDevice& o) const {
|
||||
auto const& other_mote = static_cast<HidapiWiimote const&>(o);
|
||||
return m_identifier == other_mote.m_identifier && other_mote.m_path == m_path;
|
||||
return static_cast<HidapiWiimote const&>(o).m_path == m_path;
|
||||
}
|
||||
|
||||
HidapiWiimote::~HidapiWiimote() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue