Commit graph

159 commits

Author SHA1 Message Date
Dentomologist
527f8e783c ControllerEmu: Convert Translatability to enum class 2023-06-12 18:11:04 -07:00
Lioncash
e4caace6bb Common/IniFile: Move interface into Common namespace
Gets this out of the global namespace and into the Common namespace
2023-04-13 10:19:28 -04:00
JosJuice
1b55d7c594 Android: Change how the overlay controller setting works
Up until now, there have been two settings on Android that stored the
selected Wii Remote extension: the normal one that's also used on PC,
and a SharedPreferences one that's used by the overlay controls to
determine what controls to show. It is possible for these two to end up
out of sync, and my input changes have made that more likely to happen.

To fix this, let's rework how the overlay controller setting works.
We don't want it to encode the currently selected Wii Remote extension.
However, we can't simply get rid of the setting, because for some Wii
games we need the ability to switch between a GameCube controller and a
Wii Remote. What this commit does is give the user the option to select
any of the 4 GameCube controllers and any of the 4 Wii Remotes. (Before,
controllers 2-4 weren't available in the overlay.) Could be useful for
things like the Psycho Mantis fight in Metal Gear Solid. I'm also
switching from SharedPreferences to Dolphin.ini while I'm at it.
2023-03-07 17:39:34 +01:00
JosJuice
9b3816c993 InputCommon: Fix ControlGroup::SaveConfig with DefaultValue::Disabled
I also changed LoadConfig, but that change doesn't affect correctness,
it's only so it looks neat by matching SaveConfig.

This bug was added in 18a4afb053, the
commit that introduced DefaultValue::Disabled. The bug can't actually be
triggered in master, but it can be triggered in the Android input
overhaul PR.
2023-02-26 17:45:09 +01:00
JosJuice
b296248b49 DolphinQt: Use input override system for TAS input windows
This lets the TAS input code use a higher-level interface for
overriding inputs instead of having to fiddle with raw bits.
WiiTASInputWindow in particular was messy with how much
controller code it had to re-implement.
2022-10-03 22:04:09 +02:00
JosJuice
cb16d20f2d ControllerEmu: Add new "input override" system 2022-10-03 22:00:21 +02:00
Admiral H. Curtiss
02a967f786
InputCommon: Add equality operators to RawValue. 2022-09-24 01:44:21 +02:00
Admiral H. Curtiss
24a1fe32f1
InputCommon: Make RawValue constructors constexpr. 2022-09-24 01:38:09 +02:00
Minty-Meeo
73dfcc15a5 Use std::llround in MapFloat
I don't see why not.
2022-09-22 11:30:32 -05:00
Admiral H. Curtiss
b8ca1b2907
InputCommon: Fix deadlock in EmulatedController::UpdateReferences(). 2022-09-07 22:37:24 +02:00
Admiral H. Curtiss
eccf527bf6
Merge pull request #9147 from jordan-woyak/imu-accel-weight-setting
WiimoteEmu: Expose IMU pointing accelerometer weight setting.
2022-07-07 23:17:47 +02:00
Admiral H. Curtiss
24498ca315
Merge pull request #10712 from tellowkrinkle/ControllerLocks
InputCommon/ControllerEmu: Use more locks
2022-07-05 11:39:48 +02:00
Jordan Woyak
4c409411ed DolphinQt: Don't show the advanced input settings on the main dialog. 2022-06-26 22:48:13 -05:00
Jordan Woyak
80d9e79cf1 ControllerEmu: Allow settings to be categorized as "advanced". Make "Virtual Notches" and "Gate Size" categorized as such. 2022-06-26 22:42:16 -05:00
Jordan Woyak
643f82539c ControllerEmu: Expose gate size setting for octagon analog sticks. 2022-06-26 22:33:44 -05:00
Jordan Woyak
1fc86cacd7 WiimoteEmu: Expose IMU pointing accelerometer weight setting. 2022-06-13 00:07:00 -05:00
TellowKrinkle
f9c6eb7b98 InputCommon/ControllerEmu: Use more locks
Loading configs while another thread is messing with stuff just doesn't feel like a good idea
Hopefully fixes Wiimote Scanning Thread crashes on startup
2022-05-31 20:17:37 -05: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
de7c78ef3d ControllerEmu: Hide the cursor if the input gate is disabled 2021-12-23 15:22:35 -08: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
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
93e3e691f9 Expose Control Expression variables to mappings UI
-add a way to reset their value (from the mappings UI)
-fix "memory leak" where they would never be cleaned,
one would be created every time you wrote a character after a "$"
-fix ability to create variables with an empty string by just writing "$" (+added error for it)
-Add $ operator to the UI operators list, to expose this functionality even more
2021-05-24 02:38:06 +03:00
Filoppi
379ffc268d IMUGyroscope: make GetState update optional (on by default), fix const, clean code
My future PRs will split the UI state from the Emulation State of some of these emulated
controller values and this readies the code for it.
2021-05-19 20:51:35 +03:00
Filoppi
a19a0096db InputCommon: improve code that returns a controller attachment index
casting a value to a u32 when it's originally an int, and it's exposed as int to users,
could end up in cases where a negative number would result as a positive one.
This doesn't really affect the value range of the attachment enum,
still I think the code was wrong.

Heavily tested.
2021-05-19 20:51:34 +03:00
Filoppi
d43a06ff6a IMUAccelerometer: consistency of BoundCount checks
Similar to the guitar, only control[0] was checked, and that felt random.
2021-05-19 20:51:34 +03:00
Scott Mansell
9f91fb6447
Merge pull request #9688 from Filoppi/input_cleanup
Input cleanup
2021-05-14 20:51:33 +12:00
Filoppi
26f6648421 StickGate: add custom clamp value
Works exactly as before by default.
It will be used by my upcoming input PRs.
2021-05-12 18:27:24 +03:00
Filoppi
4625359a4f InputCommon: clamp the attachment setting max to its actual enum max
NumericSettings support a max, so let's use it.
It might not do much now, but the max and min values will be used to give visual feeback
in the UI in one of my upcoming input PRs
2021-05-12 18:27:24 +03:00
Filoppi
f4fec42165 Add mixed comments to input code, make some tooltip clearer 2021-05-12 18:27:23 +03:00
Filoppi
574477866f InputCommon: fix serialization of control expression with line breaks
The control expression editor allows line breaks, but the serialization was
losing anything after the first line break (/r /n).
Instead of opting to encode them and decode them on serialization
(which I tried but was not safe, as it would lose /n written in the string by users),
I opted to replace them with a space.
2021-05-12 18:25:56 +03:00
Filoppi
e9e41b925b InputCommon: follow coding conventions and rename GetState() to UpdateState()
And remove useless include
2021-05-10 23:48:10 +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
iwubcode
8055919905 InputCommon: Allow for partial gyro mapping; for Free Look, this allows you to only pitch or only yaw 2021-03-17 20:58:33 -05:00
iwubcode
32d584a0f5 InputCommon: reduce number of image loads and texture cache invalidations by only running dynamic input textures once for all controllers 2021-02-27 17:29:48 -06:00
Shawn Hoffman
7e1df34735 rename InputCommon/ControllerInterface/Device to CoreDevice 2021-01-27 14:29:48 -08:00
Filippo Tarpini
a5a6ef8512
Fix a couple of typos
[committer note: fixed commit message style]
2021-01-05 15:24:21 +01:00
JosJuice
52c615f1b1 Remove a redundant i18n comment 2020-11-17 18:23:27 +01:00
Nick Michael
55dd3d7337 Virtual Notch settings and UI for octagonal stick 2020-11-03 22:06:27 +00:00
Léo Lam
f653bd7559
Merge pull request #9142 from jordan-woyak/expose-fov
WiimoteEmu: Expose IR camera FOV to adjust IMU pointing sensitivity.
2020-10-20 14:32:02 +02:00
Léo Lam
fc3b474cce
Merge pull request #8318 from iwubcode/dynamic_input_textures
InputCommon: Dynamic Input Textures
2020-10-20 02:10:29 +02:00
Léo Lam
911704611e
Merge pull request #9096 from jordan-woyak/calibration-cleanup
ControllerEmu: Improve and simplify UpdateCalibrationData.
2020-10-20 02:01:16 +02:00
Jordan Woyak
1dae834c62 WiimoteEmu: Tweak IMUCursor total yaw setting tool-tip. 2020-10-19 17:08:02 -05:00
iwubcode
fd3af4c5d3 InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image. 2020-10-03 17:10:35 -05:00
Jordan Woyak
0295d470b1 ControllerEmu: Increase "IMUPointer" "Total Yaw" default value to match that of regular "Point" settings.
Removed "Total Yaw" from included Wii remote input profile to take on the default value.
2020-09-28 18:09:34 -05:00
Jordan Woyak
f766c89a08 ControllerEmu: Increase Total Yaw/Pitch default values to compensate for new FOV and to reach screen edges in the Wii Menu. 2020-09-28 18:09:34 -05:00
Jordan Woyak
0ca73355a8 ControllerEmu: Improve and simplify UpdateCalibrationData. 2020-09-19 08:40:55 -05:00
Tillmann Karras
d2b06f4786 Fix various -Wshadow warnings 2020-08-08 21:45:03 +01:00
LC
4d36f6a5b0
Merge pull request #8936 from jordan-woyak/wiimote-extension-calibration-fix
ControllerInterface/Wiimote: Provide fallback values for extensions with bad calibration.
2020-07-12 12:46:15 -04:00
Jordan Woyak
d9e7d0514c WiimoteEmu: Allow writes of the i2c bus to play speaker data. 2020-07-11 21:19:16 -05:00
Jordan Woyak
5299e902aa ControllerInterface/Wiimote: Provide fallback values for extensions with bad calibration data. 2020-07-11 19:55:14 -05:00