Commit Graph

387 Commits

Author SHA1 Message Date
Admiral H. Curtiss 9d15a1c5a1
Merge pull request #10858 from AdmiralCurtiss/mouse-center-hotkey
Add hotkey for centering mouse in render window.
2022-07-26 12:52:33 +02:00
Shawn Hoffman f92541fbd9 StripSpaces: only strip spaces
StripWhitespace maintains old behavior
2022-07-25 18:40:12 -07:00
Admiral H. Curtiss d14bd10cd7
Quartz: Handle mouse centering hotkey.
Co-authored-by: Dentomologist <dentomologist@gmail.com>
2022-07-25 01:26:57 +02:00
Admiral H. Curtiss e0870166ef
XInput2: Handle mouse centering hotkey. 2022-07-25 01:26:56 +02:00
Admiral H. Curtiss d57d04bb04
DInput: Handle mouse centering hotkey. 2022-07-25 01:26:56 +02:00
Admiral H. Curtiss 4d27022d0e
Add hotkey for centering mouse in render window. 2022-07-25 00:59:47 +02:00
Admiral H. Curtiss 89067e66f9
InputCommon: Get rid of static strings. 2022-07-15 19:53:10 +02:00
Admiral H. Curtiss e79c7d4985
InputCommon: Don't force-link against SDL2.lib on Windows. 2022-07-13 01:37:05 +02:00
Shawn Hoffman 54b4ad8f55 ci/sdl: pump messages for SDL_hidapi so device detection works 2022-07-10 15:39:06 -07:00
Shawn Hoffman ddf83462ac sdl: enable SDL_HINT_JOYSTICK_THREAD
fixes window message pumping
2022-07-10 15:39:06 -07:00
Shawn Hoffman 655fb94e61 ci/win32: give the wndclass a unique name
other things (like SDL) may try to use "Message"
2022-07-10 15:39:06 -07:00
Shawn Hoffman dd20c7cf78 ci/sdl: re-add the x360 controller block 2022-07-10 15:39:06 -07:00
Shawn Hoffman 3f7a2c6d4d ci/sdl: minor cleanup 2022-07-10 15:39:06 -07:00
Jun Bo Bi ceed42a0ee Add SDL as a submodule 2022-07-10 15:38:59 -07:00
Jun Bo Bi 6cb936d0cf Add SDL motion input and rumble support 2022-07-10 14:49:49 -07:00
TellowKrinkle 994210e369 InputCommon: SDL 2.0.22 init crash workaround
See https://github.com/libsdl-org/SDL/pull/5598
2022-06-14 21:02:45 -05:00
Pokechu22 a86fb9b475 Core/WGInput: Use fmt logging and include HRESULT in messages 2022-05-19 12:12:19 -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
Jordan Woyak b589d720bf MappingCommon: Fix detection of hotkey and conjunction expressions. 2022-03-16 22:25:04 -05: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
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
Pokechu22 0c19f895d3 Replace remaining uses of zlib crc32 with Common/Hash.h 2022-01-01 10:36:38 -08:00
Pokechu22 2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08: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
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 78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
OatmealDome 1bb72f00b5 QuartzKeyboardAndMouse: Ensure windowNumber is fetched on the main thread 2021-07-06 04:46:27 -04:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Filoppi a77e3b4a9b InputCommon: Make Wiimote rumble variable thread safe 2021-06-07 11:48:30 +03:00
Filoppi 08f8c27927 ControllerInterface: fix DSU thread safety and use PlatformPopulateDevices() 2021-06-07 11:48:29 +03:00
Filoppi 8b53af9cbc ControllerInterface: polish DInput Keyboard and Mouse (add comments and logs)
Also fix the cursor axis not being updated when the mouse device had failed aquiring,
despite them being completely unrelated
2021-06-07 11:07:06 +03:00
Filoppi 038b57fecc ControllerInterface: DInput Joystick fix non thread safe static variable
also fix devices being added to its own custom list of devices even when rejected by the CI
2021-06-07 11:07:06 +03:00
Filoppi a0ecca1a84 ControllerInterface: Implement ChangeWindow on DInput without recreating the devices
Also polished DInput code in general to try and mitigate issue 11702.
Added a lot of logging and comments.
2021-06-07 11:07:06 +03:00
Filoppi dcc345400e ControllerInterface: devices population is now async so implement devices sorting priority
This helps us keeping the most important devices (e.g. Mouse and Keyboard) on the top
of the list of devices (they still are on all OSes supported by dolphin
and to make hotplug devices like DSU appear at the bottom.
2021-06-07 11:07:06 +03:00
Filoppi 0718cfd7d7 ControllerInterface: make evdev use PlatformPopulateDevices
Also fix evdev non thread safe acces to static variables
2021-06-07 11:07:06 +03:00
Filoppi 2aa941081e ControllerInterface: make SDL use PlatformPopulateDevices()
and avoid waiting on SDL async population being finished for no reason
2021-06-07 11:07:06 +03:00
Filoppi 1d816f8f26 ControllerInterface: make real Wiimote use PlatformPopulateDevices() 2021-06-07 11:07:06 +03:00
Filoppi c238e49119 ControllerInterface: Remove OSX window handle
also make it more thread safe (avoid rare deadlock)
and fix it trying to add devices before the CI has init
2021-06-07 11:07:05 +03:00
Filoppi 2376aec135 ControllerInterface: Refactor
-Fix Add/Remove/Refresh device safety, devices could be added and removed at the same time, causing missing or duplicated devices (rare but possible)
-Fix other devices population race conditions in ControllerInterface
-Avoid re-creating all devices when dolphin is being shut down
-Avoid re-creating devices when the render window handle has changed (just the relevantr ones now)
-Avoid sending Devices Changed events if devices haven't actually changed
-Made most devices populations will be made async, to increase performance and avoid hanging the host or CPU thread on manual devices refresh
2021-06-07 11:07:05 +03:00
Filoppi f90d851e25 ControllerInterface: mixed comments 2021-06-07 11:07:05 +03:00
Filoppi c285ae57fb ControllerInterface: fix rare deadlock
A "devices changed" callback could have ended up waiting on another thread that was also populating devices
and waiting on the previous thread to release the callbacks mutex.
2021-06-07 11:07:05 +03:00
Filoppi 98b00a28e4 ControllerInterface: make DSU inputs start from resting pose instead of 0. Add battery level 2021-05-31 02:24:41 +03:00
Filoppi 16e4dede72 ControllerInterface: DSU polish: avoid hanging host thread, add disconnection detection, ...
-Reworked thread waits to never hang the Host thread for more than a really small time
(e.g. when disabling DSU its thread now closes almost immediately)
-Improve robustness when a large amount of devices are connected
-Add devices disconnection detection (they'd stay there forever until manually refreshed)
2021-05-31 02:21:17 +03:00
Filoppi 83806462ec ControllerInterface: fix DSU using the same client uid between server and controllers queries
that's not the way it's supposed to work
2021-05-31 02:17:25 +03:00
Filoppi a261e61e9e InputCommon: add a ton of missing consts
fix some related grammar errors
only the ButtonManager required code changes
2021-05-10 23:48:10 +03:00
Filoppi 81092cf7e4 InputCommon: replace SerialInterface log with ControllerInterface
where appropriate. SerialInterface was a leftover from the past,
and makes no sense to be used on actual/real controllers.
2021-05-05 00:16:08 +03:00