DolphinQt: Add MotionPlus support to TAS input

Will manually controlling both an accelerometer and a gyroscope at the
same time be reasonable to do? No idea. Was this easy to implement
thanks to the input override system? Yes.

Fixes https://bugs.dolphin-emu.org/issues/12443.
This commit is contained in:
JosJuice
2022-10-04 21:24:33 +02:00
parent 2f5d2465b9
commit 4d34f86121
12 changed files with 163 additions and 101 deletions

View File

@ -12,15 +12,15 @@ class TASControlState
public:
// Call this from the CPU thread to get the current value. (This function can also safely be
// called from the UI thread, but you're effectively just getting the value the UI control has.)
u16 GetValue() const;
int GetValue() const;
// Call this from the CPU thread when the controller state changes.
// If the return value is true, queue up a call to ApplyControllerChangeValue on the UI thread.
bool OnControllerValueChanged(u16 new_value);
bool OnControllerValueChanged(int new_value);
// Call this from the UI thread when the user changes the value using the UI.
void OnUIValueChanged(u16 new_value);
void OnUIValueChanged(int new_value);
// Call this from the UI thread after OnControllerValueChanged returns true,
// and set the state of the UI control to the return value.
u16 ApplyControllerValueChange();
int ApplyControllerValueChange();
private:
// A description of how threading is handled: The UI thread can update its copy of the state
@ -34,8 +34,8 @@ private:
struct State
{
u16 version = 0;
u16 value = 0;
int version = 0;
int value = 0;
};
std::atomic<State> m_ui_thread_state;