mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-03 05:21:18 +12:00
nsyshid: Add backends for cross platform USB passthrough support (#950)
This commit is contained in:
parent
2a735f1fb7
commit
98b5a8758a
17 changed files with 2298 additions and 524 deletions
53
src/Cafe/OS/libs/nsyshid/Whitelist.cpp
Normal file
53
src/Cafe/OS/libs/nsyshid/Whitelist.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "Whitelist.h"
|
||||
|
||||
namespace nsyshid
|
||||
{
|
||||
Whitelist& Whitelist::GetInstance()
|
||||
{
|
||||
static Whitelist whitelist;
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
Whitelist::Whitelist()
|
||||
{
|
||||
// add known devices
|
||||
{
|
||||
// lego dimensions portal
|
||||
m_devices.emplace_back(0x0e6f, 0x0241);
|
||||
// skylanders portal
|
||||
m_devices.emplace_back(0x1430, 0x0150);
|
||||
// disney infinity base
|
||||
m_devices.emplace_back(0x0e6f, 0x0129);
|
||||
}
|
||||
}
|
||||
|
||||
bool Whitelist::IsDeviceWhitelisted(uint16 vendorId, uint16 productId)
|
||||
{
|
||||
auto it = std::find(m_devices.begin(), m_devices.end(),
|
||||
std::tuple<uint16, uint16>(vendorId, productId));
|
||||
return it != m_devices.end();
|
||||
}
|
||||
|
||||
void Whitelist::AddDevice(uint16 vendorId, uint16 productId)
|
||||
{
|
||||
if (!IsDeviceWhitelisted(vendorId, productId))
|
||||
{
|
||||
m_devices.emplace_back(vendorId, productId);
|
||||
}
|
||||
}
|
||||
|
||||
void Whitelist::RemoveDevice(uint16 vendorId, uint16 productId)
|
||||
{
|
||||
m_devices.remove(std::tuple<uint16, uint16>(vendorId, productId));
|
||||
}
|
||||
|
||||
std::list<std::tuple<uint16, uint16>> Whitelist::GetDevices()
|
||||
{
|
||||
return m_devices;
|
||||
}
|
||||
|
||||
void Whitelist::RemoveAllDevices()
|
||||
{
|
||||
m_devices.clear();
|
||||
}
|
||||
} // namespace nsyshid
|
Loading…
Add table
Add a link
Reference in a new issue