diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp index e1a260762..b5531ee2c 100755 --- a/src/input_common/analog_from_button.cpp +++ b/src/input_common/analog_from_button.cpp @@ -1,4 +1,4 @@ -// Copyright 2017 Citra Emulator Project +// Copyright Citra Emulator Project / Lime3DS Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -10,11 +10,12 @@ class Analog final : public Input::AnalogDevice { public: using Button = std::unique_ptr; - Analog(Button up_, Button down_, Button left_, Button right_, Button modifier_, - float modifier_scale_) + Analog(Button up_, Button down_, Button left_, Button right_, Button up_left_, Button up_right_, + Button down_left_, Button down_right_, Button modifier_, float modifier_scale_) : up(std::move(up_)), down(std::move(down_)), left(std::move(left_)), - right(std::move(right_)), modifier(std::move(modifier_)), - modifier_scale(modifier_scale_) {} + right(std::move(right_)), up_left(std::move(up_left_)), up_right(std::move(up_right_)), + down_left(std::move(down_left_)), down_right(std::move(down_right_)), + modifier(std::move(modifier_)), modifier_scale(modifier_scale_) {} std::tuple GetStatus() const override { constexpr float SQRT_HALF = 0.707106781f; @@ -28,6 +29,22 @@ public: ++y; if (down->GetStatus()) --y; + if (up_right->GetStatus()) { + ++x; + ++y; + } + if (up_left->GetStatus()) { + --x; + ++y; + } + if (down_right->GetStatus()) { + ++x; + --y; + } + if (down_left->GetStatus()) { + --x; + --y; + } float coef = modifier->GetStatus() ? modifier_scale : 1.0f; return std::make_tuple(x * coef * (y == 0 ? 1.0f : SQRT_HALF), @@ -39,6 +56,10 @@ private: Button down; Button left; Button right; + Button up_left; + Button up_right; + Button down_left; + Button down_right; Button modifier; float modifier_scale; }; @@ -49,10 +70,17 @@ std::unique_ptr AnalogFromButton::Create(const Common::Para auto down = Input::CreateDevice(params.Get("down", null_engine)); auto left = Input::CreateDevice(params.Get("left", null_engine)); auto right = Input::CreateDevice(params.Get("right", null_engine)); + auto up_left = Input::CreateDevice(params.Get("up_left", null_engine)); + auto up_right = Input::CreateDevice(params.Get("up_right", null_engine)); + auto down_left = Input::CreateDevice(params.Get("down_left", null_engine)); + auto down_right = + Input::CreateDevice(params.Get("down_right", null_engine)); auto modifier = Input::CreateDevice(params.Get("modifier", null_engine)); auto modifier_scale = params.Get("modifier_scale", 0.5f); return std::make_unique(std::move(up), std::move(down), std::move(left), - std::move(right), std::move(modifier), modifier_scale); + std::move(right), std::move(up_left), std::move(up_right), + std::move(down_left), std::move(down_right), + std::move(modifier), modifier_scale); } } // namespace InputCommon diff --git a/src/lime_qt/configuration/config.cpp b/src/lime_qt/configuration/config.cpp index 21abee0e1..01a3828fb 100644 --- a/src/lime_qt/configuration/config.cpp +++ b/src/lime_qt/configuration/config.cpp @@ -382,10 +382,11 @@ void QtConfig::ReadControlValues() { std::string default_param = InputCommon::GenerateAnalogParamFromKeys( default_analogs[i][0], default_analogs[i][1], default_analogs[i][2], default_analogs[i][3], default_analogs[i][4], 0.5f); - profile.analogs[i] = ReadSetting(QString::fromUtf8(Settings::NativeAnalog::mapping[i]), - QString::fromStdString(default_param)) - .toString() - .toStdString(); + profile.analogs[i] = + ReadSetting(QString::fromStdString(Settings::NativeAnalog::mapping[i]), + QString::fromStdString(default_param)) + .toString() + .toStdString(); if (profile.analogs[i].empty()) profile.analogs[i] = default_param; } diff --git a/src/lime_qt/configuration/configure_input.cpp b/src/lime_qt/configuration/configure_input.cpp index be06280a6..d2565ac07 100644 --- a/src/lime_qt/configuration/configure_input.cpp +++ b/src/lime_qt/configuration/configure_input.cpp @@ -1,4 +1,4 @@ -// Copyright 2016 Citra Emulator Project +// Copyright Citra Emulator Project / Lime3DS Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -25,6 +25,10 @@ const std::array "down", "left", "right", + "up_left", + "up_right", + "down_left", + "down_right", "modifier", }}; @@ -33,6 +37,10 @@ enum class AnalogSubButtons { down, left, right, + up_left, + up_right, + down_left, + down_right, modifier, }; @@ -172,6 +180,10 @@ ConfigureInput::ConfigureInput(Core::System& _system, QWidget* parent) ui->buttonCircleDown, ui->buttonCircleLeft, ui->buttonCircleRight, + ui->buttonCircleUpLeft, + ui->buttonCircleUpRight, + ui->buttonCircleDownLeft, + ui->buttonCircleDownRight, nullptr, }, { @@ -179,6 +191,10 @@ ConfigureInput::ConfigureInput(Core::System& _system, QWidget* parent) ui->buttonCStickDown, ui->buttonCStickLeft, ui->buttonCStickRight, + ui->buttonCStickUpLeft, + ui->buttonCStickUpRight, + ui->buttonCStickDownLeft, + ui->buttonCStickDownRight, nullptr, }, }}; @@ -469,12 +485,10 @@ void ConfigureInput::RestoreDefaults() { } for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) { - for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) { - Common::ParamPackage params{InputCommon::GenerateKeyboardParam( - QtConfig::default_analogs[analog_id][sub_button_id])}; - SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]); - } - analogs_param[analog_id].Set("modifier_scale", 0.5f); + analogs_param[analog_id] = Common::ParamPackage{InputCommon::GenerateAnalogParamFromKeys( + QtConfig::default_analogs[analog_id][0], QtConfig::default_analogs[analog_id][1], + QtConfig::default_analogs[analog_id][2], QtConfig::default_analogs[analog_id][3], + QtConfig::default_analogs[analog_id][4], 0.5f)}; } UpdateButtonLabels(); diff --git a/src/lime_qt/configuration/configure_input.h b/src/lime_qt/configuration/configure_input.h index 45a7a8329..f70b32240 100644 --- a/src/lime_qt/configuration/configure_input.h +++ b/src/lime_qt/configuration/configure_input.h @@ -1,4 +1,4 @@ -// Copyright 2016 Citra Emulator Project +// Copyright Citra Emulator Project / Lime3DS Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -62,7 +62,7 @@ private: std::array buttons_param; std::array analogs_param; - static constexpr int ANALOG_SUB_BUTTONS_NUM = 5; + static constexpr int ANALOG_SUB_BUTTONS_NUM = 9; /// Each button input is represented by a QPushButton. std::array button_map; diff --git a/src/lime_qt/configuration/configure_input.ui b/src/lime_qt/configuration/configure_input.ui index 7168b7190..67cc7688f 100644 --- a/src/lime_qt/configuration/configure_input.ui +++ b/src/lime_qt/configuration/configure_input.ui @@ -71,6 +71,93 @@ + + + + Shoulder Buttons + + + false + + + false + + + + + + + + ZR: + + + + + + + + + + + + + + + + + + L: + + + + + + + + + + + + + + + + + + ZL: + + + + + + + + + + + + + + + + + + R: + + + + + + + + + + + + + + + @@ -398,35 +485,27 @@ false - - + + + + + + + + + - + - Up: + Up Left: - - + + - - - - - - - - - - Right: - - - - - @@ -452,13 +531,6 @@ - - - - Set Analog Stick - - - @@ -477,7 +549,25 @@ - + + + + + + Up: + + + + + + + + + + + + + @@ -503,8 +593,114 @@ + + + + Set Analog Stick + + + + + + + + + Right: + + + + + + + + + + + + + + + + + + Up Right: + + + + + + + + + QLayout::SetDefaultConstraint + + + + + Qt::LeftToRight + + + Diagonals + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + + + + Down Right: + + + + + + + + + + + + + + + + + + Down Left: + + + + + + + + + + + + + + + + Qt::Horizontal + + + @@ -520,6 +716,24 @@ false + + + + + + Down: + + + + + + + + + + + + @@ -538,24 +752,6 @@ - - - - - - Left: - - - - - - - - - - - - @@ -574,24 +770,17 @@ - - - - Set Analog Stick - - - - - + + - + - Down: + Left: - + @@ -599,7 +788,100 @@ - + + + + + + Up Right: + + + + + + + + + + + + + + + + + + Down Left: + + + + + + + + + + + + + + + + + + Down Right: + + + + + + + + + + + + + + + + + + Up Left: + + + + + + + + + + + + + + + + + + Diagonals + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + QLayout::SetDefaultConstraint @@ -625,94 +907,21 @@ - - - - - - - - - Shoulder Buttons - - - false - - - false - - - - - + - ZR: - - - - - - - + Set Analog Stick - - - - - - ZL: - - - - - - - - - - - - - - - - - - L: - - - - - - - - - - - - - - - - - - R: - - - - - - - - - - - + + + + Qt::Horizontal + + @@ -842,11 +1051,11 @@ - - - Use Artic Controller when connected to Artic Base Server - - + + + Use Artic Controller when connected to Artic Base Server + + @@ -869,13 +1078,11 @@ buttonCircleRight buttonCircleUp buttonCircleDown - buttonCircleAnalog sliderCirclePadDeadzoneAndModifier buttonCStickLeft buttonCStickRight buttonCStickUp buttonCStickDown - buttonCStickAnalog sliderCStickDeadzoneAndModifier buttonL buttonR