mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 08:42:45 +01:00
yuzu/configuration: Fix index out of bounds for default_analogs
This commit is contained in:
parent
57d9ef5a89
commit
403e36fab2
3 changed files with 13 additions and 12 deletions
|
@ -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]),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue