mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
WiimoteReal/IOhidapi: Move VID/PID check to a helper function that other backends can use in the future.
This commit is contained in:
parent
6c91e30a0d
commit
4a39ca249c
@ -70,8 +70,7 @@ void WiimoteScannerHidapi::FindWiimotes(std::vector<Wiimote*>& wiimotes, Wiimote
|
||||
{
|
||||
const std::string name = device->product_string ? WStringToUTF8(device->product_string) : "";
|
||||
const bool is_wiimote =
|
||||
IsValidDeviceName(name) || (device->vendor_id == 0x057e &&
|
||||
(device->product_id == 0x0306 || device->product_id == 0x0330));
|
||||
IsValidDeviceName(name) || IsKnownDeviceId({device->vendor_id, device->product_id});
|
||||
if (!is_wiimote || !IsNewWiimote(device->path) || !IsDeviceUsable(device->path))
|
||||
continue;
|
||||
|
||||
|
||||
@ -983,6 +983,11 @@ bool IsNewWiimote(const std::string& identifier)
|
||||
return !s_known_ids.contains(identifier);
|
||||
}
|
||||
|
||||
bool IsKnownDeviceId(const USBUtils::DeviceInfo& device_info)
|
||||
{
|
||||
return device_info.vid == 0x057e && (device_info.pid == 0x0306 || device_info.pid == 0x0330);
|
||||
}
|
||||
|
||||
void HandleWiimoteSourceChange(unsigned int index)
|
||||
{
|
||||
std::lock_guard wm_lk(g_wiimotes_mutex);
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
|
||||
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
|
||||
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
|
||||
#include "Core/USBUtils.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
@ -222,6 +223,8 @@ bool IsValidDeviceName(const std::string& name);
|
||||
bool IsBalanceBoardName(const std::string& name);
|
||||
bool IsNewWiimote(const std::string& identifier);
|
||||
|
||||
bool IsKnownDeviceId(const USBUtils::DeviceInfo&);
|
||||
|
||||
void HandleWiimoteSourceChange(unsigned int wiimote_number);
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
Loading…
Reference in New Issue
Block a user