Compare commits

..

2 Commits

Author SHA1 Message Date
lizzie 2603e77f37 Fix license headers 2026-09-26 17:14:17 +00:00
lizzie 2f53c0ef6b 2026-09-26 17:12:00
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-26 17:12:00 +00:00
+13 -12
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
@@ -83,20 +83,21 @@ void Joycons::ScanThread(std::stop_token stop_token) {
constexpr u16 nintendo_vendor_id = 0x057e; constexpr u16 nintendo_vendor_id = 0x057e;
Common::SetCurrentThreadName("JoyconScanThread"); Common::SetCurrentThreadName("JoyconScanThread");
auto last_ret = 0u;
do { do {
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); auto ret = SDL_hid_device_change_count();
SDL_hid_device_info* cur_dev = devs; if (last_ret == 0u || last_ret != ret) {
last_ret = ret;
while (cur_dev) { SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
if (IsDeviceNew(cur_dev)) { for (auto* cur_dev = devs; cur_dev; cur_dev = cur_dev->next) {
LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, if (IsDeviceNew(cur_dev)) {
cur_dev->product_id); LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, cur_dev->product_id);
RegisterNewDevice(cur_dev); RegisterNewDevice(cur_dev);
}
cur_dev = cur_dev->next;
} }
cur_dev = cur_dev->next; SDL_hid_free_enumeration(devs);
} }
SDL_hid_free_enumeration(devs);
} while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5})); } while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5}));
} }