1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-03 02:18:43 +00:00

Rename ::handler namespace to ::controllers

This commit is contained in:
cathery 2020-03-02 18:52:38 +03:00
parent a7e1c5d204
commit 1750201216
4 changed files with 14 additions and 14 deletions

View File

@ -7,7 +7,7 @@
#include "log.h"
namespace syscon::handler
namespace syscon::controllers
{
namespace
{

View File

@ -3,7 +3,7 @@
#include "ControllerHelpers.h"
#include "SwitchVirtualGamepadHandler.h"
namespace syscon::handler
namespace syscon::controllers
{
bool IsAtControllerLimit();

View File

@ -79,7 +79,7 @@ int main(int argc, char *argv[])
{
WriteToLog("\n\nNew sysmodule session started on version " APP_VERSION);
config::Initialize();
handler::Initialize();
controllers::Initialize();
usb::Initialize();
psc::Initialize();
@ -90,6 +90,6 @@ int main(int argc, char *argv[])
psc::Exit();
usb::Exit();
handler::Exit();
controllers::Exit();
config::Exit();
}

View File

@ -43,28 +43,28 @@ namespace syscon::usb
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, U64_MAX)))
{
WriteToLog("Event got caught!");
if (handler::IsAtControllerLimit())
if (controllers::IsAtControllerLimit())
continue;
WriteToLog("Querying interfaces now");
s32 total_entries;
if ((total_entries = QueryInterfaces(USB_CLASS_VENDOR_SPEC, 93, 1)) != 0)
handler::Insert(std::make_unique<Xbox360Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
controllers::Insert(std::make_unique<Xbox360Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
else if ((total_entries = QueryInterfaces(USB_CLASS_VENDOR_SPEC, 93, 129)) != 0)
for (int i = 0; i != total_entries; ++i)
handler::Insert(std::make_unique<Xbox360WirelessController>(std::make_unique<SwitchUSBDevice>(interfaces + i, 1)));
controllers::Insert(std::make_unique<Xbox360WirelessController>(std::make_unique<SwitchUSBDevice>(interfaces + i, 1)));
else if ((total_entries = QueryInterfaces(0x58, 0x42, 0x00)) != 0)
handler::Insert(std::make_unique<XboxController>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
controllers::Insert(std::make_unique<XboxController>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
else if ((total_entries = QueryInterfaces(USB_CLASS_VENDOR_SPEC, 71, 208)) != 0)
handler::Insert(std::make_unique<XboxOneController>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
controllers::Insert(std::make_unique<XboxOneController>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
else if ((total_entries = QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK3)) != 0)
handler::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
controllers::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
else if ((total_entries = QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_2X)) != 0)
handler::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
controllers::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)));
}
} while (is_usb_event_thread_running);
}
@ -80,7 +80,7 @@ namespace syscon::usb
eventClear(usbHsGetInterfaceStateChangeEvent());
if (R_SUCCEEDED(usbHsQueryAcquiredInterfaces(interfaces, sizeof(interfaces), &total_entries)))
{
for (auto it = handler::Get().begin(); it != handler::Get().end(); ++it)
for (auto it = controllers::Get().begin(); it != controllers::Get().end(); ++it)
{
bool found_flag = false;
@ -101,7 +101,7 @@ namespace syscon::usb
if (!found_flag)
{
//WriteToLog("Erasing controller! %i", (*it)->GetController()->GetType());
handler::Get().erase(it--);
controllers::Get().erase(it--);
WriteToLog("Controller erased!");
}
}
@ -201,7 +201,7 @@ namespace syscon::usb
g_usb_event_thread.Join();
g_usb_interface_change_thread.Join();
handler::Reset();
controllers::Reset();
}
Result CreateUsbEvents()