|
|
@ -44,12 +44,6 @@ void Joycons::Reset() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
device->Stop();
|
|
|
|
device->Stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const auto& device : pro_joycons) {
|
|
|
|
|
|
|
|
if (!device) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device->Stop();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
SDL_hid_exit();
|
|
|
|
SDL_hid_exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -65,11 +59,6 @@ void Joycons::Setup() {
|
|
|
|
PreSetController(GetIdentifier(port, Joycon::ControllerType::Right));
|
|
|
|
PreSetController(GetIdentifier(port, Joycon::ControllerType::Right));
|
|
|
|
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
|
|
|
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
port = 0;
|
|
|
|
|
|
|
|
for (auto& device : pro_joycons) {
|
|
|
|
|
|
|
|
PreSetController(GetIdentifier(port, Joycon::ControllerType::Pro));
|
|
|
|
|
|
|
|
device = std::make_shared<Joycon::JoyconDriver>(port++);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!scan_thread_running) {
|
|
|
|
if (!scan_thread_running) {
|
|
|
|
scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); });
|
|
|
|
scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); });
|
|
|
@ -141,14 +130,6 @@ bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Joycon::ControllerType::Pro:
|
|
|
|
|
|
|
|
case Joycon::ControllerType::Grip:
|
|
|
|
|
|
|
|
for (const auto& device : pro_joycons) {
|
|
|
|
|
|
|
|
if (is_handle_identical(device)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -219,13 +200,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetNextFreeHandle(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) {
|
|
|
|
|
|
|
|
for (const auto& device : pro_joycons) {
|
|
|
|
|
|
|
|
if (!device->IsConnected()) {
|
|
|
|
|
|
|
|
return device;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -431,13 +405,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetHandle(PadIdentifier identifie
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) {
|
|
|
|
|
|
|
|
for (const auto& device : pro_joycons) {
|
|
|
|
|
|
|
|
if (is_handle_active(device)) {
|
|
|
|
|
|
|
|
return device;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -475,9 +442,6 @@ std::vector<Common::ParamPackage> Joycons::GetInputDevices() const {
|
|
|
|
for (const auto& controller : right_joycons) {
|
|
|
|
for (const auto& controller : right_joycons) {
|
|
|
|
add_entry(controller);
|
|
|
|
add_entry(controller);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const auto& controller : pro_joycons) {
|
|
|
|
|
|
|
|
add_entry(controller);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List dual joycon pairs
|
|
|
|
// List dual joycon pairs
|
|
|
|
for (std::size_t i = 0; i < MaxSupportedControllers; i++) {
|
|
|
|
for (std::size_t i = 0; i < MaxSupportedControllers; i++) {
|
|
|
|