mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-16 04:36:59 +00:00
[Linux/MacOS] Further Wiimote changes for parity with Windows (#945)
This commit is contained in:
parent
d8b9a74d86
commit
5e84862e28
8 changed files with 23 additions and 19 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)
|
||||
: m_handle(dev), m_identifier(identifier) {
|
||||
HidapiWiimote::HidapiWiimote(hid_device* dev, uint64_t identifier, std::string_view path)
|
||||
: m_handle(dev), m_identifier(identifier), m_path(path) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -35,11 +35,12 @@ std::vector<WiimoteDevicePtr> HidapiWiimote::get_devices() {
|
|||
cemuLog_logDebug(LogType::Force, "Unable to open Wiimote device at {}: {}", it->path, boost::nowide::narrow(hid_error(nullptr)));
|
||||
}
|
||||
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));
|
||||
wiimote_devices.push_back(std::make_shared<HidapiWiimote>(dev, id, it->path));
|
||||
}
|
||||
}
|
||||
hid_free_enumeration(device_enumeration);
|
||||
|
|
@ -47,7 +48,8 @@ std::vector<WiimoteDevicePtr> HidapiWiimote::get_devices() {
|
|||
}
|
||||
|
||||
bool HidapiWiimote::operator==(WiimoteDevice& o) const {
|
||||
return m_identifier == static_cast<HidapiWiimote&>(o).m_identifier;
|
||||
auto const& other_mote = static_cast<HidapiWiimote const&>(o);
|
||||
return m_identifier == other_mote.m_identifier && other_mote.m_path == m_path;
|
||||
}
|
||||
|
||||
HidapiWiimote::~HidapiWiimote() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue