diff options
author | LC <mathew1800@gmail.com> | 2020-08-29 07:00:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-29 07:00:21 +0200 |
commit | 01de4fa26a19095c059862ee047aec34603fdd77 (patch) | |
tree | 193479b28ea6c68adef1118d02f95df34e00fd89 | |
parent | Merge pull request #4600 from lioncash/prototype (diff) | |
parent | yuzu/configuration: Fix index out of bounds for default_analogs (diff) | |
download | yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar.gz yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar.bz2 yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar.lz yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar.xz yuzu-01de4fa26a19095c059862ee047aec34603fdd77.tar.zst yuzu-01de4fa26a19095c059862ee047aec34603fdd77.zip |
-rw-r--r-- | src/yuzu/configuration/config.cpp | 14 | ||||
-rw-r--r-- | src/yuzu/configuration/config.h | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 8 |
3 files changed, 13 insertions, 12 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 489877be9..588bbd677 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -51,8 +51,10 @@ const std::array<std::array<int, 4>, Settings::NativeAnalog::NumAnalogs> Config: }, }}; -const int Config::default_lstick_mod = Qt::Key_E; -const int Config::default_rstick_mod = Qt::Key_R; +const std::array<int, 2> Config::default_stick_mod = { + Qt::Key_E, + Qt::Key_R, +}; const std::array<int, Settings::NativeMouseButton::NumMouseButtons> Config::default_mouse_buttons = { @@ -285,7 +287,7 @@ void Config::ReadPlayerValues() { for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { const 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); + default_analogs[i][3], default_stick_mod[i], 0.5f); auto& player_analogs = player.analogs[i]; player_analogs = qt_config @@ -323,7 +325,7 @@ void Config::ReadDebugValues() { for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { const 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); + default_analogs[i][3], default_stick_mod[i], 0.5f); auto& debug_pad_analogs = Settings::values.debug_pad_analogs[i]; debug_pad_analogs = qt_config @@ -877,7 +879,7 @@ void Config::SavePlayerValues() { for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { const 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); + default_analogs[i][3], default_stick_mod[i], 0.5f); WriteSetting(QStringLiteral("player_%1_").arg(p) + QString::fromStdString(Settings::NativeAnalog::mapping[i]), QString::fromStdString(player.analogs[i]), @@ -898,7 +900,7 @@ void Config::SaveDebugValues() { for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) { const 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); + default_analogs[i][3], default_stick_mod[i], 0.5f); WriteSetting(QStringLiteral("debug_pad_") + QString::fromStdString(Settings::NativeAnalog::mapping[i]), QString::fromStdString(Settings::values.debug_pad_analogs[i]), diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 9eeaf9d1e..aa929d134 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -24,8 +24,7 @@ public: static const std::array<int, Settings::NativeButton::NumButtons> default_buttons; static const std::array<std::array<int, 4>, Settings::NativeAnalog::NumAnalogs> default_analogs; - static const int default_lstick_mod; - static const int default_rstick_mod; + static const std::array<int, 2> default_stick_mod; static const std::array<int, Settings::NativeMouseButton::NumMouseButtons> default_mouse_buttons; static const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> default_keyboard_keys; diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 80bf40acb..13ecb3dc5 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -305,8 +305,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i } // Handle clicks for the modifier buttons as well. - ConfigureButtonClick(ui->buttonLStickMod, &lstick_mod, Config::default_lstick_mod); - ConfigureButtonClick(ui->buttonRStickMod, &rstick_mod, Config::default_rstick_mod); + ConfigureButtonClick(ui->buttonLStickMod, &lstick_mod, Config::default_stick_mod[0]); + ConfigureButtonClick(ui->buttonRStickMod, &rstick_mod, Config::default_stick_mod[1]); 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) { @@ -532,9 +532,9 @@ void ConfigureInputPlayer::RestoreDefaults() { // Reset Modifier Buttons lstick_mod = - Common::ParamPackage(InputCommon::GenerateKeyboardParam(Config::default_lstick_mod)); + Common::ParamPackage(InputCommon::GenerateKeyboardParam(Config::default_stick_mod[0])); rstick_mod = - Common::ParamPackage(InputCommon::GenerateKeyboardParam(Config::default_rstick_mod)); + Common::ParamPackage(InputCommon::GenerateKeyboardParam(Config::default_stick_mod[1])); // Reset Analogs for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) { |