summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2017-01-21 12:04:00 +0100
committerwwylele <wwylele@gmail.com>2017-03-01 22:30:57 +0100
commita6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a (patch)
tree2ed60e602d520f80f57f88f879c4f50363432c17 /src/citra_qt
parentInputCommon: add Keyboard (diff)
downloadyuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.gz
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.bz2
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.lz
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.xz
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.tar.zst
yuzu-a6bd7917cbc06f9b8f5a7ae24e75db776dc1cd6a.zip
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/config.cpp27
-rw-r--r--src/citra_qt/config.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 5855c7105..6ccfa1577 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -22,6 +22,15 @@ const std::array<int, Settings::NativeButton::NumButtons> Config::default_button
Qt::Key_Q, Qt::Key_W, Qt::Key_M, Qt::Key_N, Qt::Key_1, Qt::Key_2, Qt::Key_B,
};
+const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{
+ {
+ Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, Qt::Key_D,
+ },
+ {
+ Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L, Qt::Key_D,
+ },
+}};
+
void Config::ReadValues() {
qt_config->beginGroup("Controls");
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
@@ -34,6 +43,20 @@ void Config::ReadValues() {
if (Settings::values.buttons[i].empty())
Settings::values.buttons[i] = default_param;
}
+
+ for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
+ 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);
+ Settings::values.analogs[i] =
+ qt_config
+ ->value(Settings::NativeAnalog::mapping[i], QString::fromStdString(default_param))
+ .toString()
+ .toStdString();
+ if (Settings::values.analogs[i].empty())
+ Settings::values.analogs[i] = default_param;
+ }
+
qt_config->endGroup();
qt_config->beginGroup("Core");
@@ -158,6 +181,10 @@ void Config::SaveValues() {
qt_config->setValue(QString::fromStdString(Settings::NativeButton::mapping[i]),
QString::fromStdString(Settings::values.buttons[i]));
}
+ for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
+ qt_config->setValue(QString::fromStdString(Settings::NativeAnalog::mapping[i]),
+ QString::fromStdString(Settings::values.analogs[i]));
+ }
qt_config->endGroup();
qt_config->beginGroup("Core");
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
index d7bf99442..cbf745ea2 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/config.h
@@ -24,5 +24,7 @@ public:
void Reload();
void Save();
+
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
+ static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
};