mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-03 21:41:19 +12:00
nsyshid: Make Libusb the Windows backend (#1471)
This commit is contained in:
parent
8dd809d725
commit
0a59085021
15 changed files with 412 additions and 773 deletions
|
@ -1,5 +1,4 @@
|
|||
#ifndef CEMU_NSYSHID_BACKEND_H
|
||||
#define CEMU_NSYSHID_BACKEND_H
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
@ -26,9 +25,9 @@ namespace nsyshid
|
|||
struct TransferCommand
|
||||
{
|
||||
uint8* data;
|
||||
sint32 length;
|
||||
uint32 length;
|
||||
|
||||
TransferCommand(uint8* data, sint32 length)
|
||||
TransferCommand(uint8* data, uint32 length)
|
||||
: data(data), length(length)
|
||||
{
|
||||
}
|
||||
|
@ -39,7 +38,7 @@ namespace nsyshid
|
|||
{
|
||||
sint32 bytesRead;
|
||||
|
||||
ReadMessage(uint8* data, sint32 length, sint32 bytesRead)
|
||||
ReadMessage(uint8* data, uint32 length, sint32 bytesRead)
|
||||
: bytesRead(bytesRead), TransferCommand(data, length)
|
||||
{
|
||||
}
|
||||
|
@ -50,7 +49,7 @@ namespace nsyshid
|
|||
{
|
||||
sint32 bytesWritten;
|
||||
|
||||
WriteMessage(uint8* data, sint32 length, sint32 bytesWritten)
|
||||
WriteMessage(uint8* data, uint32 length, sint32 bytesWritten)
|
||||
: bytesWritten(bytesWritten), TransferCommand(data, length)
|
||||
{
|
||||
}
|
||||
|
@ -59,14 +58,11 @@ namespace nsyshid
|
|||
|
||||
struct ReportMessage final : TransferCommand
|
||||
{
|
||||
uint8* reportData;
|
||||
sint32 length;
|
||||
uint8* originalData;
|
||||
sint32 originalLength;
|
||||
uint8 reportType;
|
||||
uint8 reportId;
|
||||
|
||||
ReportMessage(uint8* reportData, sint32 length, uint8* originalData, sint32 originalLength)
|
||||
: reportData(reportData), length(length), originalData(originalData),
|
||||
originalLength(originalLength), TransferCommand(reportData, length)
|
||||
ReportMessage(uint8 reportType, uint8 reportId, uint8* data, uint32 length)
|
||||
: reportType(reportType), reportId(reportId), TransferCommand(data, length)
|
||||
{
|
||||
}
|
||||
using TransferCommand::TransferCommand;
|
||||
|
@ -77,7 +73,8 @@ namespace nsyshid
|
|||
static_assert(offsetof(HID_t, ifIndex) == 0xC, "");
|
||||
static_assert(offsetof(HID_t, protocol) == 0xE, "");
|
||||
|
||||
class Device {
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
Device() = delete;
|
||||
|
||||
|
@ -131,16 +128,21 @@ namespace nsyshid
|
|||
|
||||
virtual bool GetDescriptor(uint8 descType,
|
||||
uint8 descIndex,
|
||||
uint8 lang,
|
||||
uint16 lang,
|
||||
uint8* output,
|
||||
uint32 outputMaxLength) = 0;
|
||||
|
||||
virtual bool SetIdle(uint8 ifIndex,
|
||||
uint8 reportId,
|
||||
uint8 duration) = 0;
|
||||
|
||||
virtual bool SetProtocol(uint8 ifIndex, uint8 protocol) = 0;
|
||||
|
||||
virtual bool SetReport(ReportMessage* message) = 0;
|
||||
};
|
||||
|
||||
class Backend {
|
||||
class Backend
|
||||
{
|
||||
public:
|
||||
Backend();
|
||||
|
||||
|
@ -188,5 +190,3 @@ namespace nsyshid
|
|||
void AttachDefaultBackends();
|
||||
}
|
||||
} // namespace nsyshid
|
||||
|
||||
#endif // CEMU_NSYSHID_BACKEND_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue