diff options
| -rw-r--r-- | src/input_common/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/input_common/drivers/keyboard.cpp | 35 | ||||
| -rw-r--r-- | src/input_common/drivers/keyboard.h (renamed from src/input_common/keyboard.h) | 29 | ||||
| -rw-r--r-- | src/input_common/keyboard.cpp | 121 | ||||
| -rw-r--r-- | src/input_common/main.cpp | 263 | ||||
| -rw-r--r-- | src/input_common/main.h | 89 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 62 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 83 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 18 |
11 files changed, 95 insertions, 614 deletions
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 90e7618ce..0fcf7a9d7 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | add_library(input_common STATIC | 1 | add_library(input_common STATIC |
| 2 | keyboard.cpp | 2 | drivers/keyboard.cpp |
| 3 | keyboard.h | 3 | drivers/keyboard.h |
| 4 | helpers/stick_from_buttons.cpp | 4 | helpers/stick_from_buttons.cpp |
| 5 | helpers/stick_from_buttons.h | 5 | helpers/stick_from_buttons.h |
| 6 | helpers/touch_from_buttons.cpp | 6 | helpers/touch_from_buttons.cpp |
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp new file mode 100644 index 000000000..b00a4b8d9 --- /dev/null +++ b/src/input_common/drivers/keyboard.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included | ||
| 4 | |||
| 5 | #include "common/param_package.h" | ||
| 6 | #include "input_common/drivers/keyboard.h" | ||
| 7 | |||
| 8 | namespace InputCommon { | ||
| 9 | |||
| 10 | Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) { | ||
| 11 | PreSetController(identifier); | ||
| 12 | } | ||
| 13 | |||
| 14 | void Keyboard::PressKey(int key_code) { | ||
| 15 | SetButton(identifier, key_code, true); | ||
| 16 | } | ||
| 17 | |||
| 18 | void Keyboard::ReleaseKey(int key_code) { | ||
| 19 | SetButton(identifier, key_code, false); | ||
| 20 | } | ||
| 21 | |||
| 22 | void Keyboard::ReleaseAllKeys() { | ||
| 23 | ResetButtonState(); | ||
| 24 | } | ||
| 25 | |||
| 26 | std::vector<Common::ParamPackage> Keyboard::GetInputDevices() const { | ||
| 27 | std::vector<Common::ParamPackage> devices; | ||
| 28 | devices.emplace_back(Common::ParamPackage{ | ||
| 29 | {"engine", "keyboard"}, | ||
| 30 | {"display", "Keyboard Only"}, | ||
| 31 | }); | ||
| 32 | return devices; | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace InputCommon | ||
diff --git a/src/input_common/keyboard.h b/src/input_common/drivers/keyboard.h index 861950472..a3e0d8a61 100644 --- a/src/input_common/keyboard.h +++ b/src/input_common/drivers/keyboard.h | |||
| @@ -1,30 +1,20 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | 1 | // Copyright 2021 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include "input_common/input_engine.h" |
| 8 | #include "core/frontend/input.h" | ||
| 9 | 8 | ||
| 10 | namespace InputCommon { | 9 | namespace InputCommon { |
| 11 | 10 | ||
| 12 | class KeyButtonList; | ||
| 13 | |||
| 14 | /** | 11 | /** |
| 15 | * A button device factory representing a keyboard. It receives keyboard events and forward them | 12 | * A button device factory representing a keyboard. It receives keyboard events and forward them |
| 16 | * to all button devices it created. | 13 | * to all button devices it created. |
| 17 | */ | 14 | */ |
| 18 | class Keyboard final : public Input::Factory<Input::ButtonDevice> { | 15 | class Keyboard final : public InputCommon::InputEngine { |
| 19 | public: | 16 | public: |
| 20 | Keyboard(); | 17 | explicit Keyboard(const std::string& input_engine_); |
| 21 | |||
| 22 | /** | ||
| 23 | * Creates a button device from a keyboard key | ||
| 24 | * @param params contains parameters for creating the device: | ||
| 25 | * - "code": the code of the key to bind with the button | ||
| 26 | */ | ||
| 27 | std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; | ||
| 28 | 18 | ||
| 29 | /** | 19 | /** |
| 30 | * Sets the status of all buttons bound with the key to pressed | 20 | * Sets the status of all buttons bound with the key to pressed |
| @@ -40,8 +30,15 @@ public: | |||
| 40 | 30 | ||
| 41 | void ReleaseAllKeys(); | 31 | void ReleaseAllKeys(); |
| 42 | 32 | ||
| 33 | /// Used for automapping features | ||
| 34 | std::vector<Common::ParamPackage> GetInputDevices() const override; | ||
| 35 | |||
| 43 | private: | 36 | private: |
| 44 | std::shared_ptr<KeyButtonList> key_button_list; | 37 | const PadIdentifier identifier = { |
| 38 | .guid = Common::UUID{""}, | ||
| 39 | .port = 0, | ||
| 40 | .pad = 0, | ||
| 41 | }; | ||
| 45 | }; | 42 | }; |
| 46 | 43 | ||
| 47 | } // namespace InputCommon | 44 | } // namespace InputCommon |
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp deleted file mode 100644 index 8261e76fd..000000000 --- a/src/input_common/keyboard.cpp +++ /dev/null | |||
| @@ -1,121 +0,0 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <atomic> | ||
| 6 | #include <list> | ||
| 7 | #include <mutex> | ||
| 8 | #include <utility> | ||
| 9 | #include "input_common/keyboard.h" | ||
| 10 | |||
| 11 | namespace InputCommon { | ||
| 12 | |||
| 13 | class KeyButton final : public Input::ButtonDevice { | ||
| 14 | public: | ||
| 15 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_, bool toggle_) | ||
| 16 | : key_button_list(std::move(key_button_list_)), toggle(toggle_) {} | ||
| 17 | |||
| 18 | ~KeyButton() override; | ||
| 19 | |||
| 20 | bool GetStatus() const override { | ||
| 21 | if (toggle) { | ||
| 22 | return toggled_status.load(std::memory_order_relaxed); | ||
| 23 | } | ||
| 24 | return status.load(); | ||
| 25 | } | ||
| 26 | |||
| 27 | void ToggleButton() { | ||
| 28 | if (lock) { | ||
| 29 | return; | ||
| 30 | } | ||
| 31 | lock = true; | ||
| 32 | const bool old_toggle_status = toggled_status.load(); | ||
| 33 | toggled_status.store(!old_toggle_status); | ||
| 34 | } | ||
| 35 | |||
| 36 | void UnlockButton() { | ||
| 37 | lock = false; | ||
| 38 | } | ||
| 39 | |||
| 40 | friend class KeyButtonList; | ||
| 41 | |||
| 42 | private: | ||
| 43 | std::shared_ptr<KeyButtonList> key_button_list; | ||
| 44 | std::atomic<bool> status{false}; | ||
| 45 | std::atomic<bool> toggled_status{false}; | ||
| 46 | bool lock{false}; | ||
| 47 | const bool toggle; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct KeyButtonPair { | ||
| 51 | int key_code; | ||
| 52 | KeyButton* key_button; | ||
| 53 | }; | ||
| 54 | |||
| 55 | class KeyButtonList { | ||
| 56 | public: | ||
| 57 | void AddKeyButton(int key_code, KeyButton* key_button) { | ||
| 58 | std::lock_guard guard{mutex}; | ||
| 59 | list.push_back(KeyButtonPair{key_code, key_button}); | ||
| 60 | } | ||
| 61 | |||
| 62 | void RemoveKeyButton(const KeyButton* key_button) { | ||
| 63 | std::lock_guard guard{mutex}; | ||
| 64 | list.remove_if( | ||
| 65 | [key_button](const KeyButtonPair& pair) { return pair.key_button == key_button; }); | ||
| 66 | } | ||
| 67 | |||
| 68 | void ChangeKeyStatus(int key_code, bool pressed) { | ||
| 69 | std::lock_guard guard{mutex}; | ||
| 70 | for (const KeyButtonPair& pair : list) { | ||
| 71 | if (pair.key_code == key_code) { | ||
| 72 | pair.key_button->status.store(pressed); | ||
| 73 | if (pressed) { | ||
| 74 | pair.key_button->ToggleButton(); | ||
| 75 | } else { | ||
| 76 | pair.key_button->UnlockButton(); | ||
| 77 | } | ||
| 78 | pair.key_button->TriggerOnChange(); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | void ChangeAllKeyStatus(bool pressed) { | ||
| 84 | std::lock_guard guard{mutex}; | ||
| 85 | for (const KeyButtonPair& pair : list) { | ||
| 86 | pair.key_button->status.store(pressed); | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | private: | ||
| 91 | std::mutex mutex; | ||
| 92 | std::list<KeyButtonPair> list; | ||
| 93 | }; | ||
| 94 | |||
| 95 | Keyboard::Keyboard() : key_button_list{std::make_shared<KeyButtonList>()} {} | ||
| 96 | |||
| 97 | KeyButton::~KeyButton() { | ||
| 98 | key_button_list->RemoveKeyButton(this); | ||
| 99 | } | ||
| 100 | |||
| 101 | std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage& params) { | ||
| 102 | const int key_code = params.Get("code", 0); | ||
| 103 | const bool toggle = params.Get("toggle", false); | ||
| 104 | std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list, toggle); | ||
| 105 | key_button_list->AddKeyButton(key_code, button.get()); | ||
| 106 | return button; | ||
| 107 | } | ||
| 108 | |||
| 109 | void Keyboard::PressKey(int key_code) { | ||
| 110 | key_button_list->ChangeKeyStatus(key_code, true); | ||
| 111 | } | ||
| 112 | |||
| 113 | void Keyboard::ReleaseKey(int key_code) { | ||
| 114 | key_button_list->ChangeKeyStatus(key_code, false); | ||
| 115 | } | ||
| 116 | |||
| 117 | void Keyboard::ReleaseAllKeys() { | ||
| 118 | key_button_list->ChangeAllKeyStatus(false); | ||
| 119 | } | ||
| 120 | |||
| 121 | } // namespace InputCommon | ||
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 7a5c29b40..da501b6cc 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -6,17 +6,7 @@ | |||
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | #include "common/param_package.h" | 7 | #include "common/param_package.h" |
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "input_common/gcadapter/gc_adapter.h" | ||
| 10 | #include "input_common/gcadapter/gc_poller.h" | ||
| 11 | #include "input_common/keyboard.h" | ||
| 12 | #include "input_common/main.h" | 9 | #include "input_common/main.h" |
| 13 | #include "input_common/motion_from_button.h" | ||
| 14 | #include "input_common/mouse/mouse_input.h" | ||
| 15 | #include "input_common/mouse/mouse_poller.h" | ||
| 16 | #include "input_common/tas/tas_input.h" | ||
| 17 | #include "input_common/tas/tas_poller.h" | ||
| 18 | #include "input_common/udp/client.h" | ||
| 19 | #include "input_common/udp/udp.h" | ||
| 20 | #ifdef HAVE_SDL2 | 10 | #ifdef HAVE_SDL2 |
| 21 | #include "input_common/sdl/sdl.h" | 11 | #include "input_common/sdl/sdl.h" |
| 22 | #endif | 12 | #endif |
| @@ -25,82 +15,9 @@ namespace InputCommon { | |||
| 25 | 15 | ||
| 26 | struct InputSubsystem::Impl { | 16 | struct InputSubsystem::Impl { |
| 27 | void Initialize() { | 17 | void Initialize() { |
| 28 | gcadapter = std::make_shared<GCAdapter::Adapter>(); | ||
| 29 | gcbuttons = std::make_shared<GCButtonFactory>(gcadapter); | ||
| 30 | Input::RegisterFactory<Input::ButtonDevice>("gcpad", gcbuttons); | ||
| 31 | gcanalog = std::make_shared<GCAnalogFactory>(gcadapter); | ||
| 32 | Input::RegisterFactory<Input::AnalogDevice>("gcpad", gcanalog); | ||
| 33 | gcvibration = std::make_shared<GCVibrationFactory>(gcadapter); | ||
| 34 | Input::RegisterFactory<Input::VibrationDevice>("gcpad", gcvibration); | ||
| 35 | |||
| 36 | keyboard = std::make_shared<Keyboard>(); | ||
| 37 | Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard); | ||
| 38 | Input::RegisterFactory<Input::MotionDevice>("keyboard", | ||
| 39 | std::make_shared<MotionFromButton>()); | ||
| 40 | |||
| 41 | #ifdef HAVE_SDL2 | ||
| 42 | sdl = SDL::Init(); | ||
| 43 | #endif | ||
| 44 | |||
| 45 | udp = std::make_shared<InputCommon::CemuhookUDP::Client>(); | ||
| 46 | udpmotion = std::make_shared<UDPMotionFactory>(udp); | ||
| 47 | Input::RegisterFactory<Input::MotionDevice>("cemuhookudp", udpmotion); | ||
| 48 | udptouch = std::make_shared<UDPTouchFactory>(udp); | ||
| 49 | Input::RegisterFactory<Input::TouchDevice>("cemuhookudp", udptouch); | ||
| 50 | |||
| 51 | mouse = std::make_shared<MouseInput::Mouse>(); | ||
| 52 | mousebuttons = std::make_shared<MouseButtonFactory>(mouse); | ||
| 53 | Input::RegisterFactory<Input::ButtonDevice>("mouse", mousebuttons); | ||
| 54 | mouseanalog = std::make_shared<MouseAnalogFactory>(mouse); | ||
| 55 | Input::RegisterFactory<Input::AnalogDevice>("mouse", mouseanalog); | ||
| 56 | mousemotion = std::make_shared<MouseMotionFactory>(mouse); | ||
| 57 | Input::RegisterFactory<Input::MotionDevice>("mouse", mousemotion); | ||
| 58 | mousetouch = std::make_shared<MouseTouchFactory>(mouse); | ||
| 59 | Input::RegisterFactory<Input::TouchDevice>("mouse", mousetouch); | ||
| 60 | |||
| 61 | tas = std::make_shared<TasInput::Tas>(); | ||
| 62 | tasbuttons = std::make_shared<TasButtonFactory>(tas); | ||
| 63 | Input::RegisterFactory<Input::ButtonDevice>("tas", tasbuttons); | ||
| 64 | tasanalog = std::make_shared<TasAnalogFactory>(tas); | ||
| 65 | Input::RegisterFactory<Input::AnalogDevice>("tas", tasanalog); | ||
| 66 | } | 18 | } |
| 67 | 19 | ||
| 68 | void Shutdown() { | 20 | void Shutdown() { |
| 69 | Input::UnregisterFactory<Input::ButtonDevice>("keyboard"); | ||
| 70 | Input::UnregisterFactory<Input::MotionDevice>("keyboard"); | ||
| 71 | keyboard.reset(); | ||
| 72 | #ifdef HAVE_SDL2 | ||
| 73 | sdl.reset(); | ||
| 74 | #endif | ||
| 75 | Input::UnregisterFactory<Input::ButtonDevice>("gcpad"); | ||
| 76 | Input::UnregisterFactory<Input::AnalogDevice>("gcpad"); | ||
| 77 | Input::UnregisterFactory<Input::VibrationDevice>("gcpad"); | ||
| 78 | |||
| 79 | gcbuttons.reset(); | ||
| 80 | gcanalog.reset(); | ||
| 81 | gcvibration.reset(); | ||
| 82 | |||
| 83 | Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp"); | ||
| 84 | Input::UnregisterFactory<Input::TouchDevice>("cemuhookudp"); | ||
| 85 | |||
| 86 | udpmotion.reset(); | ||
| 87 | udptouch.reset(); | ||
| 88 | |||
| 89 | Input::UnregisterFactory<Input::ButtonDevice>("mouse"); | ||
| 90 | Input::UnregisterFactory<Input::AnalogDevice>("mouse"); | ||
| 91 | Input::UnregisterFactory<Input::MotionDevice>("mouse"); | ||
| 92 | Input::UnregisterFactory<Input::TouchDevice>("mouse"); | ||
| 93 | |||
| 94 | mousebuttons.reset(); | ||
| 95 | mouseanalog.reset(); | ||
| 96 | mousemotion.reset(); | ||
| 97 | mousetouch.reset(); | ||
| 98 | |||
| 99 | Input::UnregisterFactory<Input::ButtonDevice>("tas"); | ||
| 100 | Input::UnregisterFactory<Input::AnalogDevice>("tas"); | ||
| 101 | |||
| 102 | tasbuttons.reset(); | ||
| 103 | tasanalog.reset(); | ||
| 104 | } | 21 | } |
| 105 | 22 | ||
| 106 | [[nodiscard]] std::vector<Common::ParamPackage> GetInputDevices() const { | 23 | [[nodiscard]] std::vector<Common::ParamPackage> GetInputDevices() const { |
| @@ -108,19 +25,7 @@ struct InputSubsystem::Impl { | |||
| 108 | Common::ParamPackage{{"display", "Any"}, {"class", "any"}}, | 25 | Common::ParamPackage{{"display", "Any"}, {"class", "any"}}, |
| 109 | Common::ParamPackage{{"display", "Keyboard/Mouse"}, {"class", "keyboard"}}, | 26 | Common::ParamPackage{{"display", "Keyboard/Mouse"}, {"class", "keyboard"}}, |
| 110 | }; | 27 | }; |
| 111 | if (Settings::values.tas_enable) { | 28 | return {}; |
| 112 | devices.emplace_back( | ||
| 113 | Common::ParamPackage{{"display", "TAS Controller"}, {"class", "tas"}}); | ||
| 114 | } | ||
| 115 | #ifdef HAVE_SDL2 | ||
| 116 | auto sdl_devices = sdl->GetInputDevices(); | ||
| 117 | devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end()); | ||
| 118 | #endif | ||
| 119 | auto udp_devices = udp->GetInputDevices(); | ||
| 120 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); | ||
| 121 | auto gcpad_devices = gcadapter->GetInputDevices(); | ||
| 122 | devices.insert(devices.end(), gcpad_devices.begin(), gcpad_devices.end()); | ||
| 123 | return devices; | ||
| 124 | } | 29 | } |
| 125 | 30 | ||
| 126 | [[nodiscard]] AnalogMapping GetAnalogMappingForDevice( | 31 | [[nodiscard]] AnalogMapping GetAnalogMappingForDevice( |
| @@ -128,17 +33,6 @@ struct InputSubsystem::Impl { | |||
| 128 | if (!params.Has("class") || params.Get("class", "") == "any") { | 33 | if (!params.Has("class") || params.Get("class", "") == "any") { |
| 129 | return {}; | 34 | return {}; |
| 130 | } | 35 | } |
| 131 | if (params.Get("class", "") == "gcpad") { | ||
| 132 | return gcadapter->GetAnalogMappingForDevice(params); | ||
| 133 | } | ||
| 134 | if (params.Get("class", "") == "tas") { | ||
| 135 | return tas->GetAnalogMappingForDevice(params); | ||
| 136 | } | ||
| 137 | #ifdef HAVE_SDL2 | ||
| 138 | if (params.Get("class", "") == "sdl") { | ||
| 139 | return sdl->GetAnalogMappingForDevice(params); | ||
| 140 | } | ||
| 141 | #endif | ||
| 142 | return {}; | 36 | return {}; |
| 143 | } | 37 | } |
| 144 | 38 | ||
| @@ -147,17 +41,6 @@ struct InputSubsystem::Impl { | |||
| 147 | if (!params.Has("class") || params.Get("class", "") == "any") { | 41 | if (!params.Has("class") || params.Get("class", "") == "any") { |
| 148 | return {}; | 42 | return {}; |
| 149 | } | 43 | } |
| 150 | if (params.Get("class", "") == "gcpad") { | ||
| 151 | return gcadapter->GetButtonMappingForDevice(params); | ||
| 152 | } | ||
| 153 | if (params.Get("class", "") == "tas") { | ||
| 154 | return tas->GetButtonMappingForDevice(params); | ||
| 155 | } | ||
| 156 | #ifdef HAVE_SDL2 | ||
| 157 | if (params.Get("class", "") == "sdl") { | ||
| 158 | return sdl->GetButtonMappingForDevice(params); | ||
| 159 | } | ||
| 160 | #endif | ||
| 161 | return {}; | 44 | return {}; |
| 162 | } | 45 | } |
| 163 | 46 | ||
| @@ -166,37 +49,9 @@ struct InputSubsystem::Impl { | |||
| 166 | if (!params.Has("class") || params.Get("class", "") == "any") { | 49 | if (!params.Has("class") || params.Get("class", "") == "any") { |
| 167 | return {}; | 50 | return {}; |
| 168 | } | 51 | } |
| 169 | if (params.Get("class", "") == "cemuhookudp") { | ||
| 170 | // TODO return the correct motion device | ||
| 171 | return {}; | ||
| 172 | } | ||
| 173 | #ifdef HAVE_SDL2 | ||
| 174 | if (params.Get("class", "") == "sdl") { | ||
| 175 | return sdl->GetMotionMappingForDevice(params); | ||
| 176 | } | ||
| 177 | #endif | ||
| 178 | return {}; | 52 | return {}; |
| 179 | } | 53 | } |
| 180 | 54 | ||
| 181 | std::shared_ptr<Keyboard> keyboard; | ||
| 182 | #ifdef HAVE_SDL2 | ||
| 183 | std::unique_ptr<SDL::State> sdl; | ||
| 184 | #endif | ||
| 185 | std::shared_ptr<GCButtonFactory> gcbuttons; | ||
| 186 | std::shared_ptr<GCAnalogFactory> gcanalog; | ||
| 187 | std::shared_ptr<GCVibrationFactory> gcvibration; | ||
| 188 | std::shared_ptr<UDPMotionFactory> udpmotion; | ||
| 189 | std::shared_ptr<UDPTouchFactory> udptouch; | ||
| 190 | std::shared_ptr<MouseButtonFactory> mousebuttons; | ||
| 191 | std::shared_ptr<MouseAnalogFactory> mouseanalog; | ||
| 192 | std::shared_ptr<MouseMotionFactory> mousemotion; | ||
| 193 | std::shared_ptr<MouseTouchFactory> mousetouch; | ||
| 194 | std::shared_ptr<TasButtonFactory> tasbuttons; | ||
| 195 | std::shared_ptr<TasAnalogFactory> tasanalog; | ||
| 196 | std::shared_ptr<CemuhookUDP::Client> udp; | ||
| 197 | std::shared_ptr<GCAdapter::Adapter> gcadapter; | ||
| 198 | std::shared_ptr<MouseInput::Mouse> mouse; | ||
| 199 | std::shared_ptr<TasInput::Tas> tas; | ||
| 200 | }; | 55 | }; |
| 201 | 56 | ||
| 202 | InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} | 57 | InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} |
| @@ -211,30 +66,6 @@ void InputSubsystem::Shutdown() { | |||
| 211 | impl->Shutdown(); | 66 | impl->Shutdown(); |
| 212 | } | 67 | } |
| 213 | 68 | ||
| 214 | Keyboard* InputSubsystem::GetKeyboard() { | ||
| 215 | return impl->keyboard.get(); | ||
| 216 | } | ||
| 217 | |||
| 218 | const Keyboard* InputSubsystem::GetKeyboard() const { | ||
| 219 | return impl->keyboard.get(); | ||
| 220 | } | ||
| 221 | |||
| 222 | MouseInput::Mouse* InputSubsystem::GetMouse() { | ||
| 223 | return impl->mouse.get(); | ||
| 224 | } | ||
| 225 | |||
| 226 | const MouseInput::Mouse* InputSubsystem::GetMouse() const { | ||
| 227 | return impl->mouse.get(); | ||
| 228 | } | ||
| 229 | |||
| 230 | TasInput::Tas* InputSubsystem::GetTas() { | ||
| 231 | return impl->tas.get(); | ||
| 232 | } | ||
| 233 | |||
| 234 | const TasInput::Tas* InputSubsystem::GetTas() const { | ||
| 235 | return impl->tas.get(); | ||
| 236 | } | ||
| 237 | |||
| 238 | std::vector<Common::ParamPackage> InputSubsystem::GetInputDevices() const { | 69 | std::vector<Common::ParamPackage> InputSubsystem::GetInputDevices() const { |
| 239 | return impl->GetInputDevices(); | 70 | return impl->GetInputDevices(); |
| 240 | } | 71 | } |
| @@ -251,100 +82,12 @@ MotionMapping InputSubsystem::GetMotionMappingForDevice(const Common::ParamPacka | |||
| 251 | return impl->GetMotionMappingForDevice(device); | 82 | return impl->GetMotionMappingForDevice(device); |
| 252 | } | 83 | } |
| 253 | 84 | ||
| 254 | GCAnalogFactory* InputSubsystem::GetGCAnalogs() { | ||
| 255 | return impl->gcanalog.get(); | ||
| 256 | } | ||
| 257 | |||
| 258 | const GCAnalogFactory* InputSubsystem::GetGCAnalogs() const { | ||
| 259 | return impl->gcanalog.get(); | ||
| 260 | } | ||
| 261 | |||
| 262 | GCButtonFactory* InputSubsystem::GetGCButtons() { | ||
| 263 | return impl->gcbuttons.get(); | ||
| 264 | } | ||
| 265 | |||
| 266 | const GCButtonFactory* InputSubsystem::GetGCButtons() const { | ||
| 267 | return impl->gcbuttons.get(); | ||
| 268 | } | ||
| 269 | |||
| 270 | UDPMotionFactory* InputSubsystem::GetUDPMotions() { | ||
| 271 | return impl->udpmotion.get(); | ||
| 272 | } | ||
| 273 | |||
| 274 | const UDPMotionFactory* InputSubsystem::GetUDPMotions() const { | ||
| 275 | return impl->udpmotion.get(); | ||
| 276 | } | ||
| 277 | |||
| 278 | UDPTouchFactory* InputSubsystem::GetUDPTouch() { | ||
| 279 | return impl->udptouch.get(); | ||
| 280 | } | ||
| 281 | |||
| 282 | const UDPTouchFactory* InputSubsystem::GetUDPTouch() const { | ||
| 283 | return impl->udptouch.get(); | ||
| 284 | } | ||
| 285 | |||
| 286 | MouseButtonFactory* InputSubsystem::GetMouseButtons() { | ||
| 287 | return impl->mousebuttons.get(); | ||
| 288 | } | ||
| 289 | |||
| 290 | const MouseButtonFactory* InputSubsystem::GetMouseButtons() const { | ||
| 291 | return impl->mousebuttons.get(); | ||
| 292 | } | ||
| 293 | |||
| 294 | MouseAnalogFactory* InputSubsystem::GetMouseAnalogs() { | ||
| 295 | return impl->mouseanalog.get(); | ||
| 296 | } | ||
| 297 | |||
| 298 | const MouseAnalogFactory* InputSubsystem::GetMouseAnalogs() const { | ||
| 299 | return impl->mouseanalog.get(); | ||
| 300 | } | ||
| 301 | |||
| 302 | MouseMotionFactory* InputSubsystem::GetMouseMotions() { | ||
| 303 | return impl->mousemotion.get(); | ||
| 304 | } | ||
| 305 | |||
| 306 | const MouseMotionFactory* InputSubsystem::GetMouseMotions() const { | ||
| 307 | return impl->mousemotion.get(); | ||
| 308 | } | ||
| 309 | |||
| 310 | MouseTouchFactory* InputSubsystem::GetMouseTouch() { | ||
| 311 | return impl->mousetouch.get(); | ||
| 312 | } | ||
| 313 | |||
| 314 | const MouseTouchFactory* InputSubsystem::GetMouseTouch() const { | ||
| 315 | return impl->mousetouch.get(); | ||
| 316 | } | ||
| 317 | |||
| 318 | TasButtonFactory* InputSubsystem::GetTasButtons() { | ||
| 319 | return impl->tasbuttons.get(); | ||
| 320 | } | ||
| 321 | |||
| 322 | const TasButtonFactory* InputSubsystem::GetTasButtons() const { | ||
| 323 | return impl->tasbuttons.get(); | ||
| 324 | } | ||
| 325 | |||
| 326 | TasAnalogFactory* InputSubsystem::GetTasAnalogs() { | ||
| 327 | return impl->tasanalog.get(); | ||
| 328 | } | ||
| 329 | |||
| 330 | const TasAnalogFactory* InputSubsystem::GetTasAnalogs() const { | ||
| 331 | return impl->tasanalog.get(); | ||
| 332 | } | ||
| 333 | |||
| 334 | void InputSubsystem::ReloadInputDevices() { | 85 | void InputSubsystem::ReloadInputDevices() { |
| 335 | if (!impl->udp) { | ||
| 336 | return; | ||
| 337 | } | ||
| 338 | impl->udp->ReloadSockets(); | ||
| 339 | } | 86 | } |
| 340 | 87 | ||
| 341 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers( | 88 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers([ |
| 342 | [[maybe_unused]] Polling::DeviceType type) const { | 89 | [maybe_unused]] Polling::DeviceType type) const { |
| 343 | #ifdef HAVE_SDL2 | ||
| 344 | return impl->sdl->GetPollers(type); | ||
| 345 | #else | ||
| 346 | return {}; | 90 | return {}; |
| 347 | #endif | ||
| 348 | } | 91 | } |
| 349 | 92 | ||
| 350 | std::string GenerateKeyboardParam(int key_code) { | 93 | std::string GenerateKeyboardParam(int key_code) { |
diff --git a/src/input_common/main.h b/src/input_common/main.h index eb247e164..b504ebe54 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h | |||
| @@ -63,18 +63,6 @@ public: | |||
| 63 | }; | 63 | }; |
| 64 | } // namespace Polling | 64 | } // namespace Polling |
| 65 | 65 | ||
| 66 | class GCAnalogFactory; | ||
| 67 | class GCButtonFactory; | ||
| 68 | class UDPMotionFactory; | ||
| 69 | class UDPTouchFactory; | ||
| 70 | class MouseButtonFactory; | ||
| 71 | class MouseAnalogFactory; | ||
| 72 | class MouseMotionFactory; | ||
| 73 | class MouseTouchFactory; | ||
| 74 | class TasButtonFactory; | ||
| 75 | class TasAnalogFactory; | ||
| 76 | class Keyboard; | ||
| 77 | |||
| 78 | /** | 66 | /** |
| 79 | * Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default | 67 | * Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default |
| 80 | * mapping for the device. This is currently only implemented for the SDL backend devices. | 68 | * mapping for the device. This is currently only implemented for the SDL backend devices. |
| @@ -100,23 +88,6 @@ public: | |||
| 100 | /// Unregisters all built-in input device factories and shuts them down. | 88 | /// Unregisters all built-in input device factories and shuts them down. |
| 101 | void Shutdown(); | 89 | void Shutdown(); |
| 102 | 90 | ||
| 103 | /// Retrieves the underlying keyboard device. | ||
| 104 | [[nodiscard]] Keyboard* GetKeyboard(); | ||
| 105 | |||
| 106 | /// Retrieves the underlying keyboard device. | ||
| 107 | [[nodiscard]] const Keyboard* GetKeyboard() const; | ||
| 108 | |||
| 109 | /// Retrieves the underlying mouse device. | ||
| 110 | [[nodiscard]] MouseInput::Mouse* GetMouse(); | ||
| 111 | |||
| 112 | /// Retrieves the underlying mouse device. | ||
| 113 | [[nodiscard]] const MouseInput::Mouse* GetMouse() const; | ||
| 114 | |||
| 115 | /// Retrieves the underlying tas device. | ||
| 116 | [[nodiscard]] TasInput::Tas* GetTas(); | ||
| 117 | |||
| 118 | /// Retrieves the underlying tas device. | ||
| 119 | [[nodiscard]] const TasInput::Tas* GetTas() const; | ||
| 120 | /** | 91 | /** |
| 121 | * Returns all available input devices that this Factory can create a new device with. | 92 | * Returns all available input devices that this Factory can create a new device with. |
| 122 | * Each returned ParamPackage should have a `display` field used for display, a class field for | 93 | * Each returned ParamPackage should have a `display` field used for display, a class field for |
| @@ -134,66 +105,6 @@ public: | |||
| 134 | /// Retrieves the motion mappings for the given device. | 105 | /// Retrieves the motion mappings for the given device. |
| 135 | [[nodiscard]] MotionMapping GetMotionMappingForDevice(const Common::ParamPackage& device) const; | 106 | [[nodiscard]] MotionMapping GetMotionMappingForDevice(const Common::ParamPackage& device) const; |
| 136 | 107 | ||
| 137 | /// Retrieves the underlying GameCube analog handler. | ||
| 138 | [[nodiscard]] GCAnalogFactory* GetGCAnalogs(); | ||
| 139 | |||
| 140 | /// Retrieves the underlying GameCube analog handler. | ||
| 141 | [[nodiscard]] const GCAnalogFactory* GetGCAnalogs() const; | ||
| 142 | |||
| 143 | /// Retrieves the underlying GameCube button handler. | ||
| 144 | [[nodiscard]] GCButtonFactory* GetGCButtons(); | ||
| 145 | |||
| 146 | /// Retrieves the underlying GameCube button handler. | ||
| 147 | [[nodiscard]] const GCButtonFactory* GetGCButtons() const; | ||
| 148 | |||
| 149 | /// Retrieves the underlying udp motion handler. | ||
| 150 | [[nodiscard]] UDPMotionFactory* GetUDPMotions(); | ||
| 151 | |||
| 152 | /// Retrieves the underlying udp motion handler. | ||
| 153 | [[nodiscard]] const UDPMotionFactory* GetUDPMotions() const; | ||
| 154 | |||
| 155 | /// Retrieves the underlying udp touch handler. | ||
| 156 | [[nodiscard]] UDPTouchFactory* GetUDPTouch(); | ||
| 157 | |||
| 158 | /// Retrieves the underlying udp touch handler. | ||
| 159 | [[nodiscard]] const UDPTouchFactory* GetUDPTouch() const; | ||
| 160 | |||
| 161 | /// Retrieves the underlying mouse button handler. | ||
| 162 | [[nodiscard]] MouseButtonFactory* GetMouseButtons(); | ||
| 163 | |||
| 164 | /// Retrieves the underlying mouse button handler. | ||
| 165 | [[nodiscard]] const MouseButtonFactory* GetMouseButtons() const; | ||
| 166 | |||
| 167 | /// Retrieves the underlying mouse analog handler. | ||
| 168 | [[nodiscard]] MouseAnalogFactory* GetMouseAnalogs(); | ||
| 169 | |||
| 170 | /// Retrieves the underlying mouse analog handler. | ||
| 171 | [[nodiscard]] const MouseAnalogFactory* GetMouseAnalogs() const; | ||
| 172 | |||
| 173 | /// Retrieves the underlying mouse motion handler. | ||
| 174 | [[nodiscard]] MouseMotionFactory* GetMouseMotions(); | ||
| 175 | |||
| 176 | /// Retrieves the underlying mouse motion handler. | ||
| 177 | [[nodiscard]] const MouseMotionFactory* GetMouseMotions() const; | ||
| 178 | |||
| 179 | /// Retrieves the underlying mouse touch handler. | ||
| 180 | [[nodiscard]] MouseTouchFactory* GetMouseTouch(); | ||
| 181 | |||
| 182 | /// Retrieves the underlying mouse touch handler. | ||
| 183 | [[nodiscard]] const MouseTouchFactory* GetMouseTouch() const; | ||
| 184 | |||
| 185 | /// Retrieves the underlying tas button handler. | ||
| 186 | [[nodiscard]] TasButtonFactory* GetTasButtons(); | ||
| 187 | |||
| 188 | /// Retrieves the underlying tas button handler. | ||
| 189 | [[nodiscard]] const TasButtonFactory* GetTasButtons() const; | ||
| 190 | |||
| 191 | /// Retrieves the underlying tas analogs handler. | ||
| 192 | [[nodiscard]] TasAnalogFactory* GetTasAnalogs(); | ||
| 193 | |||
| 194 | /// Retrieves the underlying tas analogs handler. | ||
| 195 | [[nodiscard]] const TasAnalogFactory* GetTasAnalogs() const; | ||
| 196 | |||
| 197 | /// Reloads the input devices | 108 | /// Reloads the input devices |
| 198 | void ReloadInputDevices(); | 109 | void ReloadInputDevices(); |
| 199 | 110 | ||
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index fd0a130a3..8a0ea90f9 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -34,8 +34,6 @@ | |||
| 34 | #include "core/frontend/framebuffer_layout.h" | 34 | #include "core/frontend/framebuffer_layout.h" |
| 35 | #include "input_common/keyboard.h" | 35 | #include "input_common/keyboard.h" |
| 36 | #include "input_common/main.h" | 36 | #include "input_common/main.h" |
| 37 | #include "input_common/mouse/mouse_input.h" | ||
| 38 | #include "input_common/tas/tas_input.h" | ||
| 39 | #include "video_core/renderer_base.h" | 37 | #include "video_core/renderer_base.h" |
| 40 | #include "video_core/video_core.h" | 38 | #include "video_core/video_core.h" |
| 41 | #include "yuzu/bootmanager.h" | 39 | #include "yuzu/bootmanager.h" |
| @@ -394,34 +392,34 @@ void GRenderWindow::closeEvent(QCloseEvent* event) { | |||
| 394 | 392 | ||
| 395 | void GRenderWindow::keyPressEvent(QKeyEvent* event) { | 393 | void GRenderWindow::keyPressEvent(QKeyEvent* event) { |
| 396 | if (!event->isAutoRepeat()) { | 394 | if (!event->isAutoRepeat()) { |
| 397 | input_subsystem->GetKeyboard()->PressKey(event->key()); | 395 | // input_subsystem->GetKeyboard()->PressKey(event->key()); |
| 398 | } | 396 | } |
| 399 | } | 397 | } |
| 400 | 398 | ||
| 401 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { | 399 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { |
| 402 | if (!event->isAutoRepeat()) { | 400 | if (!event->isAutoRepeat()) { |
| 403 | input_subsystem->GetKeyboard()->ReleaseKey(event->key()); | 401 | // input_subsystem->GetKeyboard()->ReleaseKey(event->key()); |
| 404 | } | 402 | } |
| 405 | } | 403 | } |
| 406 | 404 | ||
| 407 | MouseInput::MouseButton GRenderWindow::QtButtonToMouseButton(Qt::MouseButton button) { | 405 | //MouseInput::MouseButton GRenderWindow::QtButtonToMouseButton(Qt::MouseButton button) { |
| 408 | switch (button) { | 406 | // switch (button) { |
| 409 | case Qt::LeftButton: | 407 | // case Qt::LeftButton: |
| 410 | return MouseInput::MouseButton::Left; | 408 | // return MouseInput::MouseButton::Left; |
| 411 | case Qt::RightButton: | 409 | // case Qt::RightButton: |
| 412 | return MouseInput::MouseButton::Right; | 410 | // return MouseInput::MouseButton::Right; |
| 413 | case Qt::MiddleButton: | 411 | // case Qt::MiddleButton: |
| 414 | return MouseInput::MouseButton::Wheel; | 412 | // return MouseInput::MouseButton::Wheel; |
| 415 | case Qt::BackButton: | 413 | // case Qt::BackButton: |
| 416 | return MouseInput::MouseButton::Backward; | 414 | // return MouseInput::MouseButton::Backward; |
| 417 | case Qt::ForwardButton: | 415 | // case Qt::ForwardButton: |
| 418 | return MouseInput::MouseButton::Forward; | 416 | // return MouseInput::MouseButton::Forward; |
| 419 | case Qt::TaskButton: | 417 | // case Qt::TaskButton: |
| 420 | return MouseInput::MouseButton::Task; | 418 | // return MouseInput::MouseButton::Task; |
| 421 | default: | 419 | // default: |
| 422 | return MouseInput::MouseButton::Extra; | 420 | // return MouseInput::MouseButton::Extra; |
| 423 | } | 421 | // } |
| 424 | } | 422 | //} |
| 425 | 423 | ||
| 426 | void GRenderWindow::mousePressEvent(QMouseEvent* event) { | 424 | void GRenderWindow::mousePressEvent(QMouseEvent* event) { |
| 427 | // Touch input is handled in TouchBeginEvent | 425 | // Touch input is handled in TouchBeginEvent |
| @@ -432,8 +430,8 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) { | |||
| 432 | // coordinates and map them to the current render area | 430 | // coordinates and map them to the current render area |
| 433 | const auto pos = mapFromGlobal(QCursor::pos()); | 431 | const auto pos = mapFromGlobal(QCursor::pos()); |
| 434 | const auto [x, y] = ScaleTouch(pos); | 432 | const auto [x, y] = ScaleTouch(pos); |
| 435 | const auto button = QtButtonToMouseButton(event->button()); | 433 | //const auto button = QtButtonToMouseButton(event->button()); |
| 436 | input_subsystem->GetMouse()->PressButton(x, y, button); | 434 | //input_subsystem->GetMouse()->PressButton(x, y, button); |
| 437 | 435 | ||
| 438 | if (event->button() == Qt::LeftButton) { | 436 | if (event->button() == Qt::LeftButton) { |
| 439 | this->TouchPressed(x, y, 0); | 437 | this->TouchPressed(x, y, 0); |
| @@ -453,7 +451,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { | |||
| 453 | const auto [x, y] = ScaleTouch(pos); | 451 | const auto [x, y] = ScaleTouch(pos); |
| 454 | const int center_x = width() / 2; | 452 | const int center_x = width() / 2; |
| 455 | const int center_y = height() / 2; | 453 | const int center_y = height() / 2; |
| 456 | input_subsystem->GetMouse()->MouseMove(x, y, center_x, center_y); | 454 | //input_subsystem->GetMouse()->MouseMove(x, y, center_x, center_y); |
| 457 | this->TouchMoved(x, y, 0); | 455 | this->TouchMoved(x, y, 0); |
| 458 | 456 | ||
| 459 | if (Settings::values.mouse_panning) { | 457 | if (Settings::values.mouse_panning) { |
| @@ -469,8 +467,8 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { | |||
| 469 | return; | 467 | return; |
| 470 | } | 468 | } |
| 471 | 469 | ||
| 472 | const auto button = QtButtonToMouseButton(event->button()); | 470 | //const auto button = QtButtonToMouseButton(event->button()); |
| 473 | input_subsystem->GetMouse()->ReleaseButton(button); | 471 | //input_subsystem->GetMouse()->ReleaseButton(button); |
| 474 | 472 | ||
| 475 | if (event->button() == Qt::LeftButton) { | 473 | if (event->button() == Qt::LeftButton) { |
| 476 | this->TouchReleased(0); | 474 | this->TouchReleased(0); |
| @@ -558,8 +556,8 @@ bool GRenderWindow::event(QEvent* event) { | |||
| 558 | 556 | ||
| 559 | void GRenderWindow::focusOutEvent(QFocusEvent* event) { | 557 | void GRenderWindow::focusOutEvent(QFocusEvent* event) { |
| 560 | QWidget::focusOutEvent(event); | 558 | QWidget::focusOutEvent(event); |
| 561 | input_subsystem->GetKeyboard()->ReleaseAllKeys(); | 559 | //input_subsystem->GetKeyboard()->ReleaseAllKeys(); |
| 562 | input_subsystem->GetMouse()->ReleaseAllButtons(); | 560 | //input_subsystem->GetMouse()->ReleaseAllButtons(); |
| 563 | this->TouchReleased(0); | 561 | this->TouchReleased(0); |
| 564 | } | 562 | } |
| 565 | 563 | ||
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 061e3605f..f0784046b 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -165,7 +165,7 @@ public: | |||
| 165 | void keyReleaseEvent(QKeyEvent* event) override; | 165 | void keyReleaseEvent(QKeyEvent* event) override; |
| 166 | 166 | ||
| 167 | /// Converts a Qt mouse button into MouseInput mouse button | 167 | /// Converts a Qt mouse button into MouseInput mouse button |
| 168 | static MouseInput::MouseButton QtButtonToMouseButton(Qt::MouseButton button); | 168 | // static MouseInput::MouseButton QtButtonToMouseButton(Qt::MouseButton button); |
| 169 | 169 | ||
| 170 | void mousePressEvent(QMouseEvent* event) override; | 170 | void mousePressEvent(QMouseEvent* event) override; |
| 171 | void mouseMoveEvent(QMouseEvent* event) override; | 171 | void mouseMoveEvent(QMouseEvent* event) override; |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 3aab5d5f8..09f0b219b 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -16,10 +16,7 @@ | |||
| 16 | #include "core/hle/service/hid/controllers/npad.h" | 16 | #include "core/hle/service/hid/controllers/npad.h" |
| 17 | #include "core/hle/service/hid/hid.h" | 17 | #include "core/hle/service/hid/hid.h" |
| 18 | #include "core/hle/service/sm/sm.h" | 18 | #include "core/hle/service/sm/sm.h" |
| 19 | #include "input_common/gcadapter/gc_poller.h" | ||
| 20 | #include "input_common/main.h" | 19 | #include "input_common/main.h" |
| 21 | #include "input_common/mouse/mouse_poller.h" | ||
| 22 | #include "input_common/udp/udp.h" | ||
| 23 | #include "ui_configure_input_player.h" | 20 | #include "ui_configure_input_player.h" |
| 24 | #include "yuzu/bootmanager.h" | 21 | #include "yuzu/bootmanager.h" |
| 25 | #include "yuzu/configuration/config.h" | 22 | #include "yuzu/configuration/config.h" |
| @@ -564,55 +561,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 564 | 561 | ||
| 565 | connect(poll_timer.get(), &QTimer::timeout, [this] { | 562 | connect(poll_timer.get(), &QTimer::timeout, [this] { |
| 566 | Common::ParamPackage params; | 563 | Common::ParamPackage params; |
| 567 | if (input_subsystem->GetGCButtons()->IsPolling()) { | ||
| 568 | params = input_subsystem->GetGCButtons()->GetNextInput(); | ||
| 569 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 570 | SetPollingResult(params, false); | ||
| 571 | return; | ||
| 572 | } | ||
| 573 | } | ||
| 574 | if (input_subsystem->GetGCAnalogs()->IsPolling()) { | ||
| 575 | params = input_subsystem->GetGCAnalogs()->GetNextInput(); | ||
| 576 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 577 | SetPollingResult(params, false); | ||
| 578 | return; | ||
| 579 | } | ||
| 580 | } | ||
| 581 | if (input_subsystem->GetUDPMotions()->IsPolling()) { | ||
| 582 | params = input_subsystem->GetUDPMotions()->GetNextInput(); | ||
| 583 | if (params.Has("engine")) { | ||
| 584 | SetPollingResult(params, false); | ||
| 585 | return; | ||
| 586 | } | ||
| 587 | } | ||
| 588 | if (input_subsystem->GetMouseButtons()->IsPolling()) { | ||
| 589 | params = input_subsystem->GetMouseButtons()->GetNextInput(); | ||
| 590 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 591 | SetPollingResult(params, false); | ||
| 592 | return; | ||
| 593 | } | ||
| 594 | } | ||
| 595 | if (input_subsystem->GetMouseAnalogs()->IsPolling()) { | ||
| 596 | params = input_subsystem->GetMouseAnalogs()->GetNextInput(); | ||
| 597 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 598 | SetPollingResult(params, false); | ||
| 599 | return; | ||
| 600 | } | ||
| 601 | } | ||
| 602 | if (input_subsystem->GetMouseMotions()->IsPolling()) { | ||
| 603 | params = input_subsystem->GetMouseMotions()->GetNextInput(); | ||
| 604 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 605 | SetPollingResult(params, false); | ||
| 606 | return; | ||
| 607 | } | ||
| 608 | } | ||
| 609 | if (input_subsystem->GetMouseTouch()->IsPolling()) { | ||
| 610 | params = input_subsystem->GetMouseTouch()->GetNextInput(); | ||
| 611 | if (params.Has("engine") && IsInputAcceptable(params)) { | ||
| 612 | SetPollingResult(params, false); | ||
| 613 | return; | ||
| 614 | } | ||
| 615 | } | ||
| 616 | for (auto& poller : device_pollers) { | 564 | for (auto& poller : device_pollers) { |
| 617 | params = poller->GetNextInput(); | 565 | params = poller->GetNextInput(); |
| 618 | if (params.Has("engine") && IsInputAcceptable(params)) { | 566 | if (params.Has("engine") && IsInputAcceptable(params)) { |
| @@ -1353,25 +1301,6 @@ void ConfigureInputPlayer::HandleClick( | |||
| 1353 | QWidget::grabMouse(); | 1301 | QWidget::grabMouse(); |
| 1354 | QWidget::grabKeyboard(); | 1302 | QWidget::grabKeyboard(); |
| 1355 | 1303 | ||
| 1356 | if (type == InputCommon::Polling::DeviceType::Button) { | ||
| 1357 | input_subsystem->GetGCButtons()->BeginConfiguration(); | ||
| 1358 | } else { | ||
| 1359 | input_subsystem->GetGCAnalogs()->BeginConfiguration(); | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | if (type == InputCommon::Polling::DeviceType::Motion) { | ||
| 1363 | input_subsystem->GetUDPMotions()->BeginConfiguration(); | ||
| 1364 | } | ||
| 1365 | |||
| 1366 | if (type == InputCommon::Polling::DeviceType::Button) { | ||
| 1367 | input_subsystem->GetMouseButtons()->BeginConfiguration(); | ||
| 1368 | } else if (type == InputCommon::Polling::DeviceType::AnalogPreferred) { | ||
| 1369 | input_subsystem->GetMouseAnalogs()->BeginConfiguration(); | ||
| 1370 | } else if (type == InputCommon::Polling::DeviceType::Motion) { | ||
| 1371 | input_subsystem->GetMouseMotions()->BeginConfiguration(); | ||
| 1372 | } else { | ||
| 1373 | input_subsystem->GetMouseTouch()->BeginConfiguration(); | ||
| 1374 | } | ||
| 1375 | 1304 | ||
| 1376 | if (type == InputCommon::Polling::DeviceType::Button) { | 1305 | if (type == InputCommon::Polling::DeviceType::Button) { |
| 1377 | ui->controllerFrame->BeginMappingButton(button_id); | 1306 | ui->controllerFrame->BeginMappingButton(button_id); |
| @@ -1393,15 +1322,6 @@ void ConfigureInputPlayer::SetPollingResult(const Common::ParamPackage& params, | |||
| 1393 | QWidget::releaseMouse(); | 1322 | QWidget::releaseMouse(); |
| 1394 | QWidget::releaseKeyboard(); | 1323 | QWidget::releaseKeyboard(); |
| 1395 | 1324 | ||
| 1396 | input_subsystem->GetGCButtons()->EndConfiguration(); | ||
| 1397 | input_subsystem->GetGCAnalogs()->EndConfiguration(); | ||
| 1398 | |||
| 1399 | input_subsystem->GetUDPMotions()->EndConfiguration(); | ||
| 1400 | |||
| 1401 | input_subsystem->GetMouseButtons()->EndConfiguration(); | ||
| 1402 | input_subsystem->GetMouseAnalogs()->EndConfiguration(); | ||
| 1403 | input_subsystem->GetMouseMotions()->EndConfiguration(); | ||
| 1404 | input_subsystem->GetMouseTouch()->EndConfiguration(); | ||
| 1405 | 1325 | ||
| 1406 | if (!abort) { | 1326 | if (!abort) { |
| 1407 | (*input_setter)(params); | 1327 | (*input_setter)(params); |
| @@ -1435,8 +1355,7 @@ void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) { | |||
| 1435 | return; | 1355 | return; |
| 1436 | } | 1356 | } |
| 1437 | 1357 | ||
| 1438 | const auto button = GRenderWindow::QtButtonToMouseButton(event->button()); | 1358 | //const auto button = GRenderWindow::QtButtonToMouseButton(event->button()); |
| 1439 | input_subsystem->GetMouse()->PressButton(0, 0, button); | ||
| 1440 | } | 1359 | } |
| 1441 | 1360 | ||
| 1442 | void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) { | 1361 | void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) { |
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 5a844409b..0e190a3d5 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <QString> | 7 | #include <QString> |
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "input_common/main.h" | 9 | #include "input_common/main.h" |
| 10 | #include "input_common/tas/tas_input.h" | ||
| 11 | #include "yuzu/configuration/configure_input_player_widget.h" | 10 | #include "yuzu/configuration/configure_input_player_widget.h" |
| 12 | #include "yuzu/debugger/controller.h" | 11 | #include "yuzu/debugger/controller.h" |
| 13 | 12 | ||
| @@ -81,5 +80,5 @@ void ControllerDialog::InputController(ControllerInput input) { | |||
| 81 | buttons |= (btn ? 1U : 0U) << index; | 80 | buttons |= (btn ? 1U : 0U) << index; |
| 82 | index++; | 81 | index++; |
| 83 | } | 82 | } |
| 84 | input_subsystem->GetTas()->RecordInput(buttons, input.axis_values); | 83 | //input_subsystem->GetTas()->RecordInput(buttons, input.axis_values); |
| 85 | } | 84 | } |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 88e84e8f7..663760a1e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2969,15 +2969,15 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie | |||
| 2969 | } | 2969 | } |
| 2970 | 2970 | ||
| 2971 | QString GMainWindow::GetTasStateDescription() const { | 2971 | QString GMainWindow::GetTasStateDescription() const { |
| 2972 | auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); | 2972 | //auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); |
| 2973 | switch (tas_status) { | 2973 | //switch (tas_status) { |
| 2974 | case TasInput::TasState::Running: | 2974 | //case TasInput::TasState::Running: |
| 2975 | return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); | 2975 | // return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); |
| 2976 | case TasInput::TasState::Recording: | 2976 | //case TasInput::TasState::Recording: |
| 2977 | return tr("TAS state: Recording %1").arg(total_tas_frames); | 2977 | // return tr("TAS state: Recording %1").arg(total_tas_frames); |
| 2978 | case TasInput::TasState::Stopped: | 2978 | //case TasInput::TasState::Stopped: |
| 2979 | return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames); | 2979 | // return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames); |
| 2980 | default: | 2980 | //default: |
| 2981 | return tr("TAS State: Invalid"); | 2981 | return tr("TAS State: Invalid"); |
| 2982 | } | 2982 | } |
| 2983 | } | 2983 | } |