diff options
author | Ameer <aj662@drexel.edu> | 2020-07-02 22:51:16 +0200 |
---|---|---|
committer | Ameer <aj662@drexel.edu> | 2020-07-02 22:51:16 +0200 |
commit | 6e1639c7b004d13aba77549131ecee793fcc4065 (patch) | |
tree | 986eb64d29751cad2463e3e03f801e42b2089e05 /src | |
parent | Add LR triggers as axes, half press to initiate a press, add GC axis id in config, clarify some code blocks for better readability (diff) | |
download | yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar.gz yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar.bz2 yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar.lz yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar.xz yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.tar.zst yuzu-6e1639c7b004d13aba77549131ecee793fcc4065.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/input_common/keyboard.cpp | 3 | ||||
-rw-r--r-- | src/input_common/main.cpp | 2 | ||||
-rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 50 |
4 files changed, 27 insertions, 29 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index eb6c3112b..afb8e6612 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp @@ -49,9 +49,8 @@ public: void ChangeKeyStatus(int key_code, bool pressed) { std::lock_guard guard{mutex}; for (const KeyButtonPair& pair : list) { - if (pair.key_code == key_code) { + if (pair.key_code == key_code) pair.key_button->status.store(pressed); - } } } diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index f13420b38..fd0af1019 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -45,6 +45,7 @@ void Init() { #ifdef HAVE_SDL2 sdl = SDL::Init(); #endif + udp = CemuhookUDP::Init(); } @@ -111,6 +112,7 @@ std::vector<std::unique_ptr<DevicePoller>> GetPollers(DeviceType type) { #ifdef HAVE_SDL2 pollers = sdl->GetPollers(type); #endif + return pollers; } diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index 6b264f2a6..675b477fa 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -444,7 +444,6 @@ private: class SDLAnalogFactory final : public Input::Factory<Input::AnalogDevice> { public: explicit SDLAnalogFactory(SDLState& state_) : state(state_) {} - /** * Creates analog device from joystick axes * @param params contains parameters for creating the device: diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 49b8c8386..00433926d 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -281,25 +281,24 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i button->setContextMenuPolicy(Qt::CustomContextMenu); connect(button, &QPushButton::clicked, [=] { - HandleClick( - button_map[button_id], - [=](Common::ParamPackage params) { - // Workaround for ZL & ZR for analog triggers like on XBOX controllors. - // Analog triggers (from controllers like the XBOX controller) would not - // work due to a different range of their signals (from 0 to 255 on - // analog triggers instead of -32768 to 32768 on analog joysticks). The - // SDL driver misinterprets analog triggers as analog joysticks. - // TODO: reinterpret the signal range for analog triggers to map the - // values correctly. This is required for the correct emulation of the - // analog triggers of the GameCube controller. - if (button_id == Settings::NativeButton::ZL || - button_id == Settings::NativeButton::ZR) { - params.Set("direction", "+"); - params.Set("threshold", "0.5"); - } - buttons_param[button_id] = std::move(params); - }, - InputCommon::Polling::DeviceType::Button); + HandleClick(button_map[button_id], + [=](Common::ParamPackage params) { + // Workaround for ZL & ZR for analog triggers like on XBOX controllors. + // Analog triggers (from controllers like the XBOX controller) would not + // work due to a different range of their signals (from 0 to 255 on + // analog triggers instead of -32768 to 32768 on analog joysticks). The + // SDL driver misinterprets analog triggers as analog joysticks. + // TODO: reinterpret the signal range for analog triggers to map the + // values correctly. This is required for the correct emulation of the + // analog triggers of the GameCube controller. + if (button_id == Settings::NativeButton::ZL || + button_id == Settings::NativeButton::ZR) { + params.Set("direction", "+"); + params.Set("threshold", "0.5"); + } + buttons_param[button_id] = std::move(params); + }, + InputCommon::Polling::DeviceType::Button); }); connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { QMenu context_menu; @@ -325,13 +324,12 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i analog_button->setContextMenuPolicy(Qt::CustomContextMenu); connect(analog_button, &QPushButton::clicked, [=]() { - HandleClick( - analog_map_buttons[analog_id][sub_button_id], - [=](const Common::ParamPackage& params) { - SetAnalogButton(params, analogs_param[analog_id], - analog_sub_buttons[sub_button_id]); - }, - InputCommon::Polling::DeviceType::Button); + HandleClick(analog_map_buttons[analog_id][sub_button_id], + [=](const Common::ParamPackage& params) { + SetAnalogButton(params, analogs_param[analog_id], + analog_sub_buttons[sub_button_id]); + }, + InputCommon::Polling::DeviceType::Button); }); connect(analog_button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { |