mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-05 22:41:18 +12:00
nsyshid: Add infrastructure and support for emulating Skylander Portal (#971)
This commit is contained in:
parent
f3d20832c1
commit
93b58ae6f7
19 changed files with 1658 additions and 58 deletions
|
@ -241,11 +241,6 @@ namespace nsyshid::backend::libusb
|
|||
ret);
|
||||
return nullptr;
|
||||
}
|
||||
if (desc.idVendor == 0x0e6f && desc.idProduct == 0x0241)
|
||||
{
|
||||
cemuLog_logDebug(LogType::Force,
|
||||
"nsyshid::BackendLibusb::CheckAndCreateDevice(): lego dimensions portal detected");
|
||||
}
|
||||
auto device = std::make_shared<DeviceLibusb>(m_ctx,
|
||||
desc.idVendor,
|
||||
desc.idProduct,
|
||||
|
@ -471,7 +466,7 @@ namespace nsyshid::backend::libusb
|
|||
return m_libusbHandle != nullptr && m_handleInUseCounter >= 0;
|
||||
}
|
||||
|
||||
Device::ReadResult DeviceLibusb::Read(uint8* data, sint32 length, sint32& bytesRead)
|
||||
Device::ReadResult DeviceLibusb::Read(ReadMessage* message)
|
||||
{
|
||||
auto handleLock = AquireHandleLock();
|
||||
if (!handleLock->IsValid())
|
||||
|
@ -488,8 +483,8 @@ namespace nsyshid::backend::libusb
|
|||
{
|
||||
ret = libusb_bulk_transfer(handleLock->GetHandle(),
|
||||
this->m_libusbEndpointIn,
|
||||
data,
|
||||
length,
|
||||
message->data,
|
||||
message->length,
|
||||
&actualLength,
|
||||
timeout);
|
||||
}
|
||||
|
@ -500,8 +495,8 @@ namespace nsyshid::backend::libusb
|
|||
// success
|
||||
cemuLog_logDebug(LogType::Force, "nsyshid::DeviceLibusb::read(): read {} of {} bytes",
|
||||
actualLength,
|
||||
length);
|
||||
bytesRead = actualLength;
|
||||
message->length);
|
||||
message->bytesRead = actualLength;
|
||||
return ReadResult::Success;
|
||||
}
|
||||
cemuLog_logDebug(LogType::Force,
|
||||
|
@ -510,7 +505,7 @@ namespace nsyshid::backend::libusb
|
|||
return ReadResult::Error;
|
||||
}
|
||||
|
||||
Device::WriteResult DeviceLibusb::Write(uint8* data, sint32 length, sint32& bytesWritten)
|
||||
Device::WriteResult DeviceLibusb::Write(WriteMessage* message)
|
||||
{
|
||||
auto handleLock = AquireHandleLock();
|
||||
if (!handleLock->IsValid())
|
||||
|
@ -520,23 +515,23 @@ namespace nsyshid::backend::libusb
|
|||
return WriteResult::Error;
|
||||
}
|
||||
|
||||
bytesWritten = 0;
|
||||
message->bytesWritten = 0;
|
||||
int actualLength = 0;
|
||||
int ret = libusb_bulk_transfer(handleLock->GetHandle(),
|
||||
this->m_libusbEndpointOut,
|
||||
data,
|
||||
length,
|
||||
message->data,
|
||||
message->length,
|
||||
&actualLength,
|
||||
0);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
// success
|
||||
bytesWritten = actualLength;
|
||||
message->bytesWritten = actualLength;
|
||||
cemuLog_logDebug(LogType::Force,
|
||||
"nsyshid::DeviceLibusb::write(): wrote {} of {} bytes",
|
||||
bytesWritten,
|
||||
length);
|
||||
message->bytesWritten,
|
||||
message->length);
|
||||
return WriteResult::Success;
|
||||
}
|
||||
cemuLog_logDebug(LogType::Force,
|
||||
|
@ -713,8 +708,7 @@ namespace nsyshid::backend::libusb
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DeviceLibusb::SetReport(uint8* reportData, sint32 length, uint8* originalData,
|
||||
sint32 originalLength)
|
||||
bool DeviceLibusb::SetReport(ReportMessage* message)
|
||||
{
|
||||
auto handleLock = AquireHandleLock();
|
||||
if (!handleLock->IsValid())
|
||||
|
@ -731,8 +725,8 @@ namespace nsyshid::backend::libusb
|
|||
bRequest,
|
||||
wValue,
|
||||
wIndex,
|
||||
reportData,
|
||||
length,
|
||||
message->reportData,
|
||||
message->length,
|
||||
timeout);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue