summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/GCAdapter.cpp
AgeCommit message (Collapse)Author
2026-04-25GCAdapter: Fix data racesDentomologist
Make `s_is_adapter_wanted` and the elements of `s_config_rumble_enabled` atomic. The CPU thread reads `s_is_adapter_wanted` and `s_config_rumble_enabled` in `Output`, while the host thread writes to them in `RefreshConfig`. The simplest way to trigger this race is to close the `Settings` window while playing a game with the adapter active.
2026-04-24Merge pull request #14608 from JosJuice/gcadapter-auto-startDentomologist
GCAdapter: Automatically start and stop thread
2026-04-18GCAdapter: Automatically start and stop threadJosJuice
This keeps the logic encapsulated inside GCAdapter.cpp so callers don't have to think about it.
2026-04-17Improve usage of std::move and const references parametersMartino Fontana
Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`. Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move. Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible.
2026-02-25Send neutral stick positions when disconnected rather than down-leftJulien Bernard
2026-02-25Gcc adapter fixes (hotplugging, claim retries, shutdown, bad yields)Julien Bernard
2026-01-25Remove unused importsMartino Fontana
Yellow squiggly lines begone! Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes. If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed. The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports. Not everything is removed, but the cleanup should be substantial enough. Because this done on Linux, code that isn't used on it is mostly untouched. (Hopefully no open PR is depending on these imports...)
2026-01-17Fix various typos and spelling mistakesSintendo
2025-11-23GCAdapter: Calculate poll rate for display in UI. It's currently updated ↵Jordan Woyak
every 50 reads.
2025-07-27Revert "Android/GCAdapter: Don't join current thread"JosJuice
This reverts commit 74ed5e55326b9d8e67dfbb8dd6f61d04bcae2445. It solves a problem that no longer exists.
2025-07-27Android: Detect GCAdapter disconnection using BroadcastReceiverJosJuice
This lets us get rid of the Reset call in ProcessInputPayload, which was causing us some threading headaches (see 74ed5e5532). Instead we handle disconnection in the same way as the libusb implementation does.
2025-07-27Android: Detect GCAdapter connection using BroadcastReceiverJosJuice
We can register a BroadcastReceiver to have Android tell us when a GC adapter gets connected instead of having a loop where we continuously call SleepCurrentThread(1000) and poll the current status. When waiting for a GC adapter to connect, this both reduces power usage and improves responsiveness. Note that I made openAdapter get the UsbDevice that's been stored by the hotplug code instead of having openAdapter find the UsbDevice on its own like before. This is only because I want to ensure that the UsbDevice being tracked for disconnection is the same as the UsbDevice actually being used, in case the user has multiple adapters connected.
2025-07-27Android: Clean up naming in Java_GCAdapter and Java_WiimoteAdapterJosJuice
This isn't how we name things in Java/Kotlin.
2025-02-01LibusbDevice: Don't detach kernel drivers on macOSSanjay Govind
2025-01-24Fix segfault when passing invalid argumentsJoshua Vandaële
2024-12-01Android/GCAdapter: Don't join current threadJosJuice
The read thread could call Reset, which in turn tried to join the read thread, leading to a SIGABRT. This manifested as Dolphin consistently crashing when disconnecting a GC adapter and having a chance of crashing a few seconds after connecting a GC adapter.
2024-10-09Simplify `std::fill` with `std::array::fill`mitaclaw
2024-04-08Core::GetState: Avoid Global System Accessormitaclaw
2024-03-20GCAdapter: Adjust libusb transfer timeout to 100ms.Jordan Woyak
2024-01-04Core/SystemTimers: Refactor to class, move to System.Admiral H. Curtiss
2023-08-17Use structs for config callback IDsJosJuice
This way you can't mix up regular config callback IDs and CPU thread config callback IDs. (It would be rather bad if you did!)
2023-08-12GCAdapter: Fix Android unused constant warningDentomologist
CONTROLLER_OUTPUT_INIT_PAYLOAD_SIZE is only used by the libusb implementation.
2023-08-12GCAdapter: Fix spelling of constantsDentomologist
2023-07-05Switch libusb_config_descriptor to RAII typenyanpasu64
2023-07-05Workaround GC adapter detection breaking when reset failsnyanpasu64
2023-07-05Reset GC adapter upon IO error after sleep-wakenyanpasu64
Fixes GC adapter breaking on sleep-wake on Linux and burning a full CPU core. This is cleaner than alternative approaches.
2023-07-05Don't burn a CPU core and spam logs when GC Adapter failsnyanpasu64
2023-07-05Fix memory leak in libusb codenyanpasu64
2023-02-09Resolve various "no previous declaration" warningsPokechu22
2022-11-27CoreTiming: Refactor to class.Admiral H. Curtiss
2022-10-22GCAdapter: Process pad state in read thread and other general cleanups.Jordan Woyak
2022-06-08GCAdapter: Compare with LIBUSB_SUCCESS instead of 0Pokechu22
2022-06-08Log warnings when LibusbUtils::GetDeviceList failsPokechu22
2022-06-02GCAdapter: Use LibusbUtils::ErrorWrap in log messagesPokechu22
2022-06-02GCAdapter: Make local variables const where possiblePokechu22
2022-06-02GCAdapter: Merge Read logicPokechu22
2022-06-02GCAdapter: Have the read thread control the write threadPokechu22
This was done for Android in 6cc40b12357ae339abcb44517810af304bab77ea.
2022-06-02GCAdapter: Exit early if the adapter fails to open on AndroidPokechu22
This is only so that indentation is consistent with the non-android code.
2022-06-02GCAdapter: Remove check on write size on androidPokechu22
It was removed for non-android in 56239d1ae139998a7cde17ff02f0526ffb17f5ef, and android already uses a separate thread, so presumably this isn't needed anymore.
2022-06-02GCAdapter: Harmonize read/write thread variable namesPokechu22
2022-06-02GCAdapter: Remove unused includesPokechu22
2022-06-02GCAdapter: Use determinism hack on AndroidPokechu22
This hack was added in 8f0cbefbe57762de92284ef151e984f52ec8d7e6, and the part of it in SI_DeviceGCAdapter is present on Android already, so I don't see any reason why this part doesn't apply to Android.
2022-06-02GCAdapter: Convert ControllerType to an enum classPokechu22
2022-06-02GCAdapter: Fix rumble enabled config on AndroidPokechu22
I believe the setting already existed in the UI; it just wasn't implemented in GCAdapter_Android.cpp.
2022-06-02GCAdapter: Use std::array for controller read and write payloadsPokechu22
2022-06-02GCAdapter: Merge GCAdapter.cpp and GCAdapter_Android.cppPokechu22
This is mostly a brainless merge, #ifdef-ing anything that doesn't match between the two while preserving common logic. I didn't rename any variables (although similar ones do exist), but I did change one log that was ERROR on android and NOTICE elsewhere to just always be NOTICE. Further merging will follow.
2022-04-23Merge pull request #10540 from nyanpasu64/fix-gcadapter-atomicsJosJuice
Remove atomic usage and fix mutex locking in GCAdapter code
2022-04-22GCAdapter: don't call libusb_detach_kernel_driver on appleShawn Hoffman
2022-04-22GCAdapter: fix retval check of libusb_detach_kernel_driverShawn Hoffman
2022-04-22GCAdapter: move libusb context teardown lastShawn Hoffman