summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/config.cpp')
-rw-r--r--src/citra_qt/config.cpp62
1 files changed, 16 insertions, 46 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 5c056446e..e65b98b69 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -21,31 +21,21 @@ Config::Config() {
Reload();
}
+static const std::array<QVariant, Settings::NativeInput::NUM_INPUTS> defaults = {
+ Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X,
+ Qt::Key_Q, Qt::Key_W, Qt::Key_1, Qt::Key_2,
+ Qt::Key_M, Qt::Key_N, Qt::Key_B,
+ Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H,
+ Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right,
+ Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L
+};
+
void Config::ReadValues() {
qt_config->beginGroup("Controls");
- Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
- Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
- Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt();
- Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt();
- Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt();
- Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt();
- Settings::values.pad_zl_key = qt_config->value("pad_zl", Qt::Key_1).toInt();
- Settings::values.pad_zr_key = qt_config->value("pad_zr", Qt::Key_2).toInt();
- Settings::values.pad_start_key = qt_config->value("pad_start", Qt::Key_M).toInt();
- Settings::values.pad_select_key = qt_config->value("pad_select", Qt::Key_N).toInt();
- Settings::values.pad_home_key = qt_config->value("pad_home", Qt::Key_B).toInt();
- Settings::values.pad_dup_key = qt_config->value("pad_dup", Qt::Key_T).toInt();
- Settings::values.pad_ddown_key = qt_config->value("pad_ddown", Qt::Key_G).toInt();
- Settings::values.pad_dleft_key = qt_config->value("pad_dleft", Qt::Key_F).toInt();
- Settings::values.pad_dright_key = qt_config->value("pad_dright", Qt::Key_H).toInt();
- Settings::values.pad_sup_key = qt_config->value("pad_sup", Qt::Key_Up).toInt();
- Settings::values.pad_sdown_key = qt_config->value("pad_sdown", Qt::Key_Down).toInt();
- Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
- Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
- Settings::values.pad_cup_key = qt_config->value("pad_cup", Qt::Key_I).toInt();
- Settings::values.pad_cdown_key = qt_config->value("pad_cdown", Qt::Key_K).toInt();
- Settings::values.pad_cleft_key = qt_config->value("pad_cleft", Qt::Key_J).toInt();
- Settings::values.pad_cright_key = qt_config->value("pad_cright", Qt::Key_L).toInt();
+ for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
+ Settings::values.input_mappings[Settings::NativeInput::All[i]] =
+ qt_config->value(QString::fromStdString(Settings::NativeInput::Mapping[i]), defaults[i]).toInt();
+ }
qt_config->endGroup();
qt_config->beginGroup("Core");
@@ -75,29 +65,9 @@ void Config::ReadValues() {
void Config::SaveValues() {
qt_config->beginGroup("Controls");
- qt_config->setValue("pad_a", Settings::values.pad_a_key);
- qt_config->setValue("pad_b", Settings::values.pad_b_key);
- qt_config->setValue("pad_x", Settings::values.pad_x_key);
- qt_config->setValue("pad_y", Settings::values.pad_y_key);
- qt_config->setValue("pad_l", Settings::values.pad_l_key);
- qt_config->setValue("pad_r", Settings::values.pad_r_key);
- qt_config->setValue("pad_zl", Settings::values.pad_zl_key);
- qt_config->setValue("pad_zr", Settings::values.pad_zr_key);
- qt_config->setValue("pad_start", Settings::values.pad_start_key);
- qt_config->setValue("pad_select", Settings::values.pad_select_key);
- qt_config->setValue("pad_home", Settings::values.pad_home_key);
- qt_config->setValue("pad_dup", Settings::values.pad_dup_key);
- qt_config->setValue("pad_ddown", Settings::values.pad_ddown_key);
- qt_config->setValue("pad_dleft", Settings::values.pad_dleft_key);
- qt_config->setValue("pad_dright", Settings::values.pad_dright_key);
- qt_config->setValue("pad_sup", Settings::values.pad_sup_key);
- qt_config->setValue("pad_sdown", Settings::values.pad_sdown_key);
- qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
- qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
- qt_config->setValue("pad_cup", Settings::values.pad_cup_key);
- qt_config->setValue("pad_cdown", Settings::values.pad_cdown_key);
- qt_config->setValue("pad_cleft", Settings::values.pad_cleft_key);
- qt_config->setValue("pad_cright", Settings::values.pad_cright_key);
+ for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
+ qt_config->setValue(QString::fromStdString(Settings::NativeInput::Mapping[i]), Settings::NativeInput::All[i]);
+ }
qt_config->endGroup();
qt_config->beginGroup("Core");