refactor: Removed non-windows calls as I don't support other OS APIs
This commit is contained in:
parent
0c2ff64639
commit
e8996a382d
1 changed files with 2 additions and 30 deletions
|
@ -60,37 +60,9 @@ public class JoyConRead : IGamepadReader {
|
||||||
|
|
||||||
private static HidDevice? GetHidDevice() {
|
private static HidDevice? GetHidDevice() {
|
||||||
DeviceList list = DeviceList.Local;
|
DeviceList list = DeviceList.Local;
|
||||||
HidDevice? device = null;
|
IEnumerable<HidDevice>? nintendos = list.GetHidDevices(0x057e);
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows()) {
|
return nintendos.FirstOrDefault();
|
||||||
var nintendos = list.GetHidDevices(0x057e);
|
|
||||||
device = nintendos.FirstOrDefault();
|
|
||||||
} else {
|
|
||||||
var hidDevices = list.GetHidDevices();
|
|
||||||
foreach (var d in hidDevices) {
|
|
||||||
var rd = d.GetReportDescriptor();
|
|
||||||
if (rd != null) {
|
|
||||||
if (
|
|
||||||
rd.OutputReports.Count() == 4
|
|
||||||
&& rd.OutputReports.Count(r => r.ReportID == 0x01) == 1
|
|
||||||
&& rd.OutputReports.Count(r => r.ReportID == 0x10) == 1
|
|
||||||
&& rd.OutputReports.Count(r => r.ReportID == 0x11) == 1
|
|
||||||
&& rd.OutputReports.Count(r => r.ReportID == 0x12) == 1
|
|
||||||
&& rd.InputReports.Count() == 6
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x21) == 1
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x30) == 1
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x31) == 1
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x32) == 1
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x33) == 1
|
|
||||||
&& rd.InputReports.Count(r => r.ReportID == 0x3F) == 1
|
|
||||||
) {
|
|
||||||
device = d;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task OnJoyConOnReportReceived(JoyCon _, IJoyConReport input) {
|
private Task OnJoyConOnReportReceived(JoyCon _, IJoyConReport input) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue