mirror of
https://github.com/cathery/sys-con.git
synced 2024-07-01 01:38:44 +00:00
Roll back some safety checks
This commit is contained in:
parent
50b0a158ce
commit
4cd616570f
|
@ -34,7 +34,7 @@ void SwitchVirtualGamepadHandler::OutputThreadLoop(void *handler)
|
||||||
|
|
||||||
Result SwitchVirtualGamepadHandler::InitInputThread()
|
Result SwitchVirtualGamepadHandler::InitInputThread()
|
||||||
{
|
{
|
||||||
R_TRY(m_inputThread.Initialize(&SwitchVirtualGamepadHandler::InputThreadLoop, this, 0x30).GetValue());
|
R_TRY(m_inputThread.Initialize(&SwitchVirtualGamepadHandler::InputThreadLoop, this, 0x3E).GetValue());
|
||||||
m_inputThreadIsRunning = true;
|
m_inputThreadIsRunning = true;
|
||||||
return m_inputThread.Start().GetValue();
|
return m_inputThread.Start().GetValue();
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,13 @@ Result SwitchVirtualGamepadHandler::InitInputThread()
|
||||||
void SwitchVirtualGamepadHandler::ExitInputThread()
|
void SwitchVirtualGamepadHandler::ExitInputThread()
|
||||||
{
|
{
|
||||||
m_inputThreadIsRunning = false;
|
m_inputThreadIsRunning = false;
|
||||||
|
m_inputThread.CancelSynchronization();
|
||||||
m_inputThread.Join();
|
m_inputThread.Join();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SwitchVirtualGamepadHandler::InitOutputThread()
|
Result SwitchVirtualGamepadHandler::InitOutputThread()
|
||||||
{
|
{
|
||||||
R_TRY(m_outputThread.Initialize(&SwitchVirtualGamepadHandler::OutputThreadLoop, this, 0x30).GetValue());
|
R_TRY(m_outputThread.Initialize(&SwitchVirtualGamepadHandler::OutputThreadLoop, this, 0x3E).GetValue());
|
||||||
m_outputThreadIsRunning = true;
|
m_outputThreadIsRunning = true;
|
||||||
return m_outputThread.Start().GetValue();
|
return m_outputThread.Start().GetValue();
|
||||||
}
|
}
|
||||||
|
@ -55,5 +56,6 @@ Result SwitchVirtualGamepadHandler::InitOutputThread()
|
||||||
void SwitchVirtualGamepadHandler::ExitOutputThread()
|
void SwitchVirtualGamepadHandler::ExitOutputThread()
|
||||||
{
|
{
|
||||||
m_outputThreadIsRunning = false;
|
m_outputThreadIsRunning = false;
|
||||||
|
m_inputThread.CancelSynchronization();
|
||||||
m_outputThread.Join();
|
m_outputThread.Join();
|
||||||
}
|
}
|
|
@ -42,10 +42,10 @@ namespace syscon::usb
|
||||||
UsbHsInterface interfaces[MaxUsbHsInterfacesSize];
|
UsbHsInterface interfaces[MaxUsbHsInterfacesSize];
|
||||||
|
|
||||||
s32 QueryInterfaces(u8 iclass, u8 isubclass, u8 iprotocol);
|
s32 QueryInterfaces(u8 iclass, u8 isubclass, u8 iprotocol);
|
||||||
|
s32 QueryVendorProduct(uint16_t vendor_id, uint16_t product_id);
|
||||||
|
|
||||||
void UsbEventThreadFunc(void *arg)
|
void UsbEventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
WriteToLog("Starting USB Catch-all Event Thread!");
|
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, U64_MAX)))
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,6 @@ namespace syscon::usb
|
||||||
|
|
||||||
void UsbDs3EventThreadFunc(void *arg)
|
void UsbDs3EventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
WriteToLog("Starting USB DS3 Event Thread!");
|
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbDualshock3Event, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbDualshock3Event, U64_MAX)))
|
||||||
{
|
{
|
||||||
|
@ -84,7 +83,8 @@ namespace syscon::usb
|
||||||
if (!controllers::IsAtControllerLimit())
|
if (!controllers::IsAtControllerLimit())
|
||||||
{
|
{
|
||||||
s32 total_entries;
|
s32 total_entries;
|
||||||
if ((total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
|
if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK3) != 0)
|
||||||
|
&& (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
|
||||||
WriteToLog("Initializing Dualshock 3 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
|
WriteToLog("Initializing Dualshock 3 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ namespace syscon::usb
|
||||||
|
|
||||||
void UsbDs4EventThreadFunc(void *arg)
|
void UsbDs4EventThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
WriteToLog("Starting USB DS4 Event Thread!");
|
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(&g_usbDualshock4Event, U64_MAX)))
|
if (R_SUCCEEDED(eventWait(&g_usbDualshock4Event, U64_MAX)))
|
||||||
{
|
{
|
||||||
|
@ -103,7 +102,8 @@ namespace syscon::usb
|
||||||
if (!controllers::IsAtControllerLimit())
|
if (!controllers::IsAtControllerLimit())
|
||||||
{
|
{
|
||||||
s32 total_entries;
|
s32 total_entries;
|
||||||
if ((total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
|
if ((QueryVendorProduct(VENDOR_SONY, config::globalConfig.dualshock4_productID) != 0)
|
||||||
|
&& (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
|
||||||
WriteToLog("Initializing Dualshock 4 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
|
WriteToLog("Initializing Dualshock 4 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,6 @@ namespace syscon::usb
|
||||||
|
|
||||||
void UsbInterfaceChangeThreadFunc(void *arg)
|
void UsbInterfaceChangeThreadFunc(void *arg)
|
||||||
{
|
{
|
||||||
WriteToLog("Starting USB Interface Change Thread!");
|
|
||||||
do {
|
do {
|
||||||
if (R_SUCCEEDED(eventWait(usbHsGetInterfaceStateChangeEvent(), UINT64_MAX)))
|
if (R_SUCCEEDED(eventWait(usbHsGetInterfaceStateChangeEvent(), UINT64_MAX)))
|
||||||
{
|
{
|
||||||
|
@ -168,6 +167,18 @@ namespace syscon::usb
|
||||||
return out_entries;
|
return out_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 QueryVendorProduct(uint16_t vendor_id, uint16_t product_id)
|
||||||
|
{
|
||||||
|
UsbHsInterfaceFilter filter {
|
||||||
|
.Flags = UsbHsInterfaceFilterFlags_idVendor | UsbHsInterfaceFilterFlags_idProduct,
|
||||||
|
.idVendor = vendor_id,
|
||||||
|
.idProduct = product_id,
|
||||||
|
};
|
||||||
|
s32 out_entries = 0;
|
||||||
|
usbHsQueryAvailableInterfaces(&filter, interfaces, sizeof(interfaces), &out_entries);
|
||||||
|
return out_entries;
|
||||||
|
}
|
||||||
|
|
||||||
inline Result CreateCatchAllAvailableEvent()
|
inline Result CreateCatchAllAvailableEvent()
|
||||||
{
|
{
|
||||||
constexpr UsbHsInterfaceFilter filter {
|
constexpr UsbHsInterfaceFilter filter {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user