Commit graph

1178 commits

Author SHA1 Message Date
Jordan Woyak
1fc86cacd7 WiimoteEmu: Expose IMU pointing accelerometer weight setting. 2022-06-13 00:07:00 -05:00
Pokechu22
6823b4d7a0 GCAdapter: Use LibusbUtils::ErrorWrap in log messages 2022-06-02 19:39:36 -07:00
Pokechu22
0d8772ccbe GCAdapter: Make local variables const where possible 2022-06-02 19:39:36 -07:00
Pokechu22
cd9edeacda GCAdapter: Merge Read logic 2022-06-02 19:39:36 -07:00
Pokechu22
9ec65baf46 GCAdapter: Have the read thread control the write thread
This was done for Android in 6cc40b1235.
2022-06-02 19:39:36 -07:00
Pokechu22
0fa92694d1 GCAdapter: Exit early if the adapter fails to open on Android
This is only so that indentation is consistent with the non-android code.
2022-06-02 19:39:36 -07:00
Pokechu22
749a4ad1ef GCAdapter: Remove check on write size on android
It was removed for non-android in 56239d1ae1, and android already uses a separate thread, so presumably this isn't needed anymore.
2022-06-02 19:39:36 -07:00
Pokechu22
27947046af GCAdapter: Harmonize read/write thread variable names 2022-06-02 19:39:36 -07:00
Pokechu22
279888da8c GCAdapter: Remove unused includes 2022-06-02 19:39:36 -07:00
Pokechu22
3ae775e574 GCAdapter: Use determinism hack on Android
This hack was added in 8f0cbefbe5, 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-02 19:39:36 -07:00
Pokechu22
55922e6d17 GCAdapter: Convert ControllerType to an enum class 2022-06-02 19:39:36 -07:00
Pokechu22
682d86f4da GCAdapter: Fix rumble enabled config on Android
I believe the setting already existed in the UI; it just wasn't implemented in GCAdapter_Android.cpp.
2022-06-02 19:39:36 -07:00
Pokechu22
36d4ee0939 GCAdapter: Use std::array for controller read and write payloads 2022-06-02 19:39:36 -07:00
Pokechu22
dd6592698e GCAdapter: Merge GCAdapter.cpp and GCAdapter_Android.cpp
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-06-02 19:39:36 -07:00
Admiral H. Curtiss
580c721c82
cmake: Don't use PCH with Qt6. 2022-05-22 01:19:44 +02:00
Pokechu22
a86fb9b475 Core/WGInput: Use fmt logging and include HRESULT in messages 2022-05-19 12:12:19 -07:00
JosJuice
e0afcb3b94
Merge pull request #10540 from nyanpasu64/fix-gcadapter-atomics
Remove atomic usage and fix mutex locking in GCAdapter code
2022-04-23 22:04:10 +02:00
Shawn Hoffman
12cd81bdb3 GCAdapter: don't call libusb_detach_kernel_driver on apple 2022-04-22 09:56:47 -07:00
Shawn Hoffman
5cd3cf9072 GCAdapter: fix retval check of libusb_detach_kernel_driver 2022-04-22 09:56:47 -07:00
Shawn Hoffman
978c90845b GCAdapter: move libusb context teardown last 2022-04-22 09:56:47 -07:00
Shawn Hoffman
1c9dfb7bb6 GCAdapter: some macro cleanup 2022-04-22 09:56:47 -07:00
Shawn Hoffman
f52d94832e GCAdapter: set read/write thread names 2022-04-22 07:12:09 -07:00
Admiral H. Curtiss
5fda8ee8ec
Core/WGInput: Dynamically load winrt function addresses. 2022-04-08 03:26:09 +02:00
Jordan Woyak
566dfc1cf4 ControllerInterface: Update sort priorities. 2022-04-03 19:03:44 -05:00
Jordan Woyak
076a262b9e InputCommon: Add Windows.Gaming.Input to ControllerInterface. 2022-04-03 19:03:35 -05:00
nyanpasu64
b5a7ae52b5 Fix locking the wrong mutex in GCAdapter_Android.cpp ResetRumble()
I am not confident there are no race conditions between s_write_mutex,
s_controller_write_payload_size, and s_controller_write_payload. But
this code should be safer than before.
2022-03-27 22:39:26 -07:00
nyanpasu64
7616027684 Remove unnecessary atomic usage in GCAdapter_Android.cpp
s_controller_write_payload_size needs to remain an atomic because Read()
loads and stores without holding a mutex, Output() stores while holding
s_write_mutex, and ResetRumble() stores while holding s_read_mutex! I'm
pretty sure this code is wrong, specifically ResetRumble().
2022-03-27 22:39:26 -07:00
nyanpasu64
871b01a5d9 Remove unnecessary atomic usage in GCAdapter.cpp
You can safely read or write non-atomic integers on multiple threads,
as long as every thread reading or writing it holds the same mutex
while doing so (here, s_mutex).

Removing the atomic accesses makes the code faster, but the actual
performance difference is probably negligible.
2022-03-27 22:27:57 -07:00
Jordan Woyak
b589d720bf MappingCommon: Fix detection of hotkey and conjunction expressions. 2022-03-16 22:25:04 -05:00
Léo Lam
e10967e918
Merge pull request #10502 from Pokechu22/defer-gcadapter
GCAdapter: Defer initialization until MainWindow::InitControllers
2022-03-15 16:00:28 +01:00
Pokechu22
37806472e1 GCAdapter: Defer initialization until MainWindow::InitControllers
If libusb fails to initialize, an assertion fails, but if that happens before the main window is created, then Dolphin just dies.  Now, the panic alert is properly shown and the user can ignore it.
2022-03-10 10:35:45 -08:00
JosJuice
1bc057614e Move parts of MappingCommon out of DolphinQt
Some of the functions in MappingCommon would be useful to use on
mobile in the future.
2022-03-06 14:30:49 +01:00
Pokechu22
6e5f4125e3 Use Common::ToLower and Common::ToUpper 2022-01-16 17:00:12 -08:00
Mai M
1cea399e9c
Merge pull request #10345 from jordan-woyak/modifier-range
InputCommon: Re-enable "Modifier" "Range" settings.
2022-01-13 08:32:15 -05:00
Pokechu22
ca9bf3174f Use HRWrap in remaining locations
Note that D3DCommon can't use DX11HRWrap or DX12HRWrap since it's shared between them.
2022-01-09 12:44:55 -08:00
Pokechu22
558de04cfc Common/Assert: Actually use the ASSERT_MSG's log type parameter
Since it was unused, nonexistent values were used in a few places.  I've replaced them.
2022-01-09 12:44:14 -08:00
Admiral H. Curtiss
5c325eef38
Config: Port SI device settings to new config system. 2022-01-08 20:08:21 +01:00
Admiral H. Curtiss
0bfffe4095
Config: Port GC Adapter settings to new config system. 2022-01-05 03:25:19 +01:00
Jordan Woyak
78a9bdf04a InputCommon: Use value of "Modifier" button "Range" setting rather than always applying 50%.
Make "Clear" button reset "Modifier" "Range" settings to 50%.
2022-01-04 14:09:50 -06:00
Pokechu22
0c19f895d3 Replace remaining uses of zlib crc32 with Common/Hash.h 2022-01-01 10:36:38 -08:00
Pokechu22
de7c78ef3d ControllerEmu: Hide the cursor if the input gate is disabled 2021-12-23 15:22:35 -08:00
Pokechu22
2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
JosJuice
2f4ecde5cc
Merge pull request #10253 from Filoppi/fix_input_config_loading
Fix InputConfig::LoadConfig() not always replacing emu controllers values
2021-12-09 22:21:02 +01:00
Filoppi
689545a795 InputCommon: fix InputConfig::LoadConfig() not always replacing emu controllers values
If InputConfig::LoadConfig() was called once with a non empty/customized config,
then called again after manually deleting the config (dolphin calls LoadConfig() every time it opens the mapping widget),
the second load would fail to clear the values on any non first EmulatedController and would instead keep the
previous config values despite it being deleted (while it would instead correctly default the first EmulatedController).

This is not a big bug though the code is better now.
2021-12-05 23:37:58 +02:00
Filoppi
125971d9f2 InputCommon: fix default input config default device not being loaded/found
Fixes bug: https://bugs.dolphin-emu.org/issues/12744

Before e1e3db13ba
the ControllerInterface m_devices_mutex was "wrongfully" locked for the whole Initialize() call, which included the first device population refresh,
this has the unwanted (accidental) consequence of often preventing the different pads (GC Pad, Wii Contollers, ...) input configs from loading
until that mutex was released (the input config defaults loading was blocked in EmulatedController::LoadDefaults()), which meant that the devices
population would often have the time to finish adding its first device, which would then be selected as default device (by design, the first device
added to the CI is the default default device, usually the "Keyboard and Mouse" device).

After the commit mentioned above removed the unnecessary m_devices_mutex calls, the default default device would fail to load (be found)
causing the default input mappings, which are specifically written for the default default device on every platform, to not be bound to any
physical device input, breaking input on new dolphin installations (until a user tried to customize the default device manually).

Default devices are now always added synchronously to avoid the problem, and so they should in the future (I added comments and warnings to help with that)
2021-12-05 23:35:47 +02:00
Léo Lam
aa5cb35c86
Merge pull request #10143 from Pokechu22/png-compression-level
Add option for setting the PNG zlib compression level
2021-11-23 16:40:34 +01:00
Filoppi
1badceb455 ControllerInterface: fix UpdateReferences() deadlock
Removed useless locks to DeviceContainer::m_devices_mutex, as they were all already protected by m_devices_population_mutex.
We have no interest in blocking other threads that were potentially reading devices at the same time so this seems fine.
This simplifies the code, and I've adjusted a few comments which mentioned possible deadlock that should now be totally gone.

The deadlock could have happen if a thread directly called EmulatedController::UpdateReferences(), while another another thread also reached EmulatedController::UpdateReferences() within a call to ControllerInterface::UpdateDevices(), as the mentioned function locked both the DeviceContainer::m_devices_mutex and s_get_state_mutex at the same time.

The deadlock was frequent on game emulation startup on Android, due to the UpdateReferences() call in InputConfig::LoadConfig() and the UI thread triggering calls to ControllerInterface::UpdateDevices().
It could also have happened on Desktop if a user pressed "Refresh Devices" manually in the UI while the input config was loading.

Also brought some UpdateReferences() comments and thread safety fixes from https://github.com/dolphin-emu/dolphin/pull/9489
2021-11-20 16:54:36 +02:00
Pokechu22
94ccf765af Add option for setting the PNG zlib compression level 2021-11-18 13:10:22 -08:00
Pokechu22
78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Bonta
8ee21acf34 Pad: GBA config 2021-07-13 16:42:35 +02:00