summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/configuration')
-rw-r--r--src/citra_qt/configuration/config.cpp318
-rw-r--r--src/citra_qt/configuration/config.h30
-rw-r--r--src/citra_qt/configuration/configure.ui136
-rw-r--r--src/citra_qt/configuration/configure_audio.cpp77
-rw-r--r--src/citra_qt/configuration/configure_audio.h30
-rw-r--r--src/citra_qt/configuration/configure_audio.ui73
-rw-r--r--src/citra_qt/configuration/configure_debug.cpp26
-rw-r--r--src/citra_qt/configuration/configure_debug.h28
-rw-r--r--src/citra_qt/configuration/configure_debug.ui102
-rw-r--r--src/citra_qt/configuration/configure_dialog.cpp27
-rw-r--r--src/citra_qt/configuration/configure_dialog.h28
-rw-r--r--src/citra_qt/configuration/configure_general.cpp37
-rw-r--r--src/citra_qt/configuration/configure_general.h28
-rw-r--r--src/citra_qt/configuration/configure_general.ui164
-rw-r--r--src/citra_qt/configuration/configure_graphics.cpp115
-rw-r--r--src/citra_qt/configuration/configure_graphics.h28
-rw-r--r--src/citra_qt/configuration/configure_graphics.ui202
-rw-r--r--src/citra_qt/configuration/configure_input.cpp205
-rw-r--r--src/citra_qt/configuration/configure_input.h69
-rw-r--r--src/citra_qt/configuration/configure_input.ui592
-rw-r--r--src/citra_qt/configuration/configure_system.cpp142
-rw-r--r--src/citra_qt/configuration/configure_system.h37
-rw-r--r--src/citra_qt/configuration/configure_system.ui255
23 files changed, 2749 insertions, 0 deletions
diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp
new file mode 100644
index 000000000..0b9b73f9e
--- /dev/null
+++ b/src/citra_qt/configuration/config.cpp
@@ -0,0 +1,318 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <QSettings>
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/ui_settings.h"
+#include "common/file_util.h"
+#include "input_common/main.h"
+
+Config::Config() {
+ // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
+ qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini";
+ FileUtil::CreateFullPath(qt_config_loc);
+ qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
+
+ Reload();
+}
+
+const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = {
+ Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H,
+ 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) {
+ std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
+ Settings::values.buttons[i] =
+ qt_config
+ ->value(Settings::NativeButton::mapping[i], QString::fromStdString(default_param))
+ .toString()
+ .toStdString();
+ 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");
+ Settings::values.use_cpu_jit = qt_config->value("use_cpu_jit", true).toBool();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Renderer");
+ Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
+ Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
+ Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
+ Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool();
+ Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool();
+
+ Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
+ Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
+ Settings::values.bg_blue = qt_config->value("bg_blue", 1.0).toFloat();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Layout");
+ Settings::values.layout_option =
+ static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
+ Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
+ Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
+ Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
+ Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
+ Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
+ Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
+ Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
+ Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
+ Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
+ Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Audio");
+ Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString();
+ Settings::values.enable_audio_stretching =
+ qt_config->value("enable_audio_stretching", true).toBool();
+ Settings::values.audio_device_id =
+ qt_config->value("output_device", "auto").toString().toStdString();
+ qt_config->endGroup();
+
+ using namespace Service::CAM;
+ qt_config->beginGroup("Camera");
+ Settings::values.camera_name[OuterRightCamera] =
+ qt_config->value("camera_outer_right_name", "blank").toString().toStdString();
+ Settings::values.camera_config[OuterRightCamera] =
+ qt_config->value("camera_outer_right_config", "").toString().toStdString();
+ Settings::values.camera_name[InnerCamera] =
+ qt_config->value("camera_inner_name", "blank").toString().toStdString();
+ Settings::values.camera_config[InnerCamera] =
+ qt_config->value("camera_inner_config", "").toString().toStdString();
+ Settings::values.camera_name[OuterLeftCamera] =
+ qt_config->value("camera_outer_left_name", "blank").toString().toStdString();
+ Settings::values.camera_config[OuterLeftCamera] =
+ qt_config->value("camera_outer_left_config", "").toString().toStdString();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Data Storage");
+ Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("System");
+ Settings::values.is_new_3ds = qt_config->value("is_new_3ds", false).toBool();
+ Settings::values.region_value =
+ qt_config->value("region_value", Settings::REGION_VALUE_AUTO_SELECT).toInt();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Miscellaneous");
+ Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Debugging");
+ Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool();
+ Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("UI");
+
+ qt_config->beginGroup("UILayout");
+ UISettings::values.geometry = qt_config->value("geometry").toByteArray();
+ UISettings::values.state = qt_config->value("state").toByteArray();
+ UISettings::values.renderwindow_geometry =
+ qt_config->value("geometryRenderWindow").toByteArray();
+ UISettings::values.gamelist_header_state =
+ qt_config->value("gameListHeaderState").toByteArray();
+ UISettings::values.microprofile_geometry =
+ qt_config->value("microProfileDialogGeometry").toByteArray();
+ UISettings::values.microprofile_visible =
+ qt_config->value("microProfileDialogVisible", false).toBool();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Paths");
+ UISettings::values.roms_path = qt_config->value("romsPath").toString();
+ UISettings::values.symbols_path = qt_config->value("symbolsPath").toString();
+ UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString();
+ UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool();
+ UISettings::values.recent_files = qt_config->value("recentFiles").toStringList();
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Shortcuts");
+ QStringList groups = qt_config->childGroups();
+ for (auto group : groups) {
+ qt_config->beginGroup(group);
+
+ QStringList hotkeys = qt_config->childGroups();
+ for (auto hotkey : hotkeys) {
+ qt_config->beginGroup(hotkey);
+ UISettings::values.shortcuts.emplace_back(UISettings::Shortcut(
+ group + "/" + hotkey,
+ UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(),
+ qt_config->value("Context").toInt())));
+ qt_config->endGroup();
+ }
+
+ qt_config->endGroup();
+ }
+ qt_config->endGroup();
+
+ UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
+ UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool();
+ UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool();
+ UISettings::values.confirm_before_closing = qt_config->value("confirmClose", true).toBool();
+ UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
+
+ qt_config->endGroup();
+}
+
+void Config::SaveValues() {
+ qt_config->beginGroup("Controls");
+ for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
+ 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");
+ qt_config->setValue("use_cpu_jit", Settings::values.use_cpu_jit);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Renderer");
+ qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
+ qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
+ qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
+ qt_config->setValue("use_vsync", Settings::values.use_vsync);
+ qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit);
+
+ // Cast to double because Qt's written float values are not human-readable
+ qt_config->setValue("bg_red", (double)Settings::values.bg_red);
+ qt_config->setValue("bg_green", (double)Settings::values.bg_green);
+ qt_config->setValue("bg_blue", (double)Settings::values.bg_blue);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Layout");
+ qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
+ qt_config->setValue("swap_screen", Settings::values.swap_screen);
+ qt_config->setValue("custom_layout", Settings::values.custom_layout);
+ qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
+ qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
+ qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
+ qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
+ qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
+ qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
+ qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
+ qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Audio");
+ qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id));
+ qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching);
+ qt_config->setValue("output_device", QString::fromStdString(Settings::values.audio_device_id));
+ qt_config->endGroup();
+
+ using namespace Service::CAM;
+ qt_config->beginGroup("Camera");
+ qt_config->setValue("camera_outer_right_name",
+ QString::fromStdString(Settings::values.camera_name[OuterRightCamera]));
+ qt_config->setValue("camera_outer_right_config",
+ QString::fromStdString(Settings::values.camera_config[OuterRightCamera]));
+ qt_config->setValue("camera_inner_name",
+ QString::fromStdString(Settings::values.camera_name[InnerCamera]));
+ qt_config->setValue("camera_inner_config",
+ QString::fromStdString(Settings::values.camera_config[InnerCamera]));
+ qt_config->setValue("camera_outer_left_name",
+ QString::fromStdString(Settings::values.camera_name[OuterLeftCamera]));
+ qt_config->setValue("camera_outer_left_config",
+ QString::fromStdString(Settings::values.camera_config[OuterLeftCamera]));
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Data Storage");
+ qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("System");
+ qt_config->setValue("is_new_3ds", Settings::values.is_new_3ds);
+ qt_config->setValue("region_value", Settings::values.region_value);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Miscellaneous");
+ qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Debugging");
+ qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub);
+ qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("UI");
+
+ qt_config->beginGroup("UILayout");
+ qt_config->setValue("geometry", UISettings::values.geometry);
+ qt_config->setValue("state", UISettings::values.state);
+ qt_config->setValue("geometryRenderWindow", UISettings::values.renderwindow_geometry);
+ qt_config->setValue("gameListHeaderState", UISettings::values.gamelist_header_state);
+ qt_config->setValue("microProfileDialogGeometry", UISettings::values.microprofile_geometry);
+ qt_config->setValue("microProfileDialogVisible", UISettings::values.microprofile_visible);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Paths");
+ qt_config->setValue("romsPath", UISettings::values.roms_path);
+ qt_config->setValue("symbolsPath", UISettings::values.symbols_path);
+ qt_config->setValue("gameListRootDir", UISettings::values.gamedir);
+ qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan);
+ qt_config->setValue("recentFiles", UISettings::values.recent_files);
+ qt_config->endGroup();
+
+ qt_config->beginGroup("Shortcuts");
+ for (auto shortcut : UISettings::values.shortcuts) {
+ qt_config->setValue(shortcut.first + "/KeySeq", shortcut.second.first);
+ qt_config->setValue(shortcut.first + "/Context", shortcut.second.second);
+ }
+ qt_config->endGroup();
+
+ qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode);
+ qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar);
+ qt_config->setValue("showStatusBar", UISettings::values.show_status_bar);
+ qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing);
+ qt_config->setValue("firstStart", UISettings::values.first_start);
+
+ qt_config->endGroup();
+}
+
+void Config::Reload() {
+ ReadValues();
+ Settings::Apply();
+}
+
+void Config::Save() {
+ SaveValues();
+}
+
+Config::~Config() {
+ Save();
+
+ delete qt_config;
+}
diff --git a/src/citra_qt/configuration/config.h b/src/citra_qt/configuration/config.h
new file mode 100644
index 000000000..cbf745ea2
--- /dev/null
+++ b/src/citra_qt/configuration/config.h
@@ -0,0 +1,30 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <string>
+#include <QVariant>
+#include "core/settings.h"
+
+class QSettings;
+
+class Config {
+ QSettings* qt_config;
+ std::string qt_config_loc;
+
+ void ReadValues();
+ void SaveValues();
+
+public:
+ Config();
+ ~Config();
+
+ 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;
+};
diff --git a/src/citra_qt/configuration/configure.ui b/src/citra_qt/configuration/configure.ui
new file mode 100644
index 000000000..85e206e42
--- /dev/null
+++ b/src/citra_qt/configuration/configure.ui
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureDialog</class>
+ <widget class="QDialog" name="ConfigureDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>441</width>
+ <height>501</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Citra Configuration</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="ConfigureGeneral" name="generalTab">
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureSystem" name="systemTab">
+ <attribute name="title">
+ <string>System</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureInput" name="inputTab">
+ <attribute name="title">
+ <string>Input</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureGraphics" name="graphicsTab">
+ <attribute name="title">
+ <string>Graphics</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureAudio" name="audioTab">
+ <attribute name="title">
+ <string>Audio</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureDebug" name="debugTab">
+ <attribute name="title">
+ <string>Debug</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ConfigureGeneral</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_general.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureSystem</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_system.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureAudio</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_audio.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureDebug</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_debug.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureInput</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_input.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureGraphics</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_graphics.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ConfigureDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>220</x>
+ <y>380</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>220</x>
+ <y>200</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ConfigureDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>220</x>
+ <y>380</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>220</x>
+ <y>200</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/citra_qt/configuration/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp
new file mode 100644
index 000000000..3fd1d127a
--- /dev/null
+++ b/src/citra_qt/configuration/configure_audio.cpp
@@ -0,0 +1,77 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <memory>
+#include "audio_core/audio_core.h"
+#include "audio_core/sink.h"
+#include "audio_core/sink_details.h"
+#include "citra_qt/configuration/configure_audio.h"
+#include "core/settings.h"
+#include "ui_configure_audio.h"
+
+ConfigureAudio::ConfigureAudio(QWidget* parent)
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) {
+ ui->setupUi(this);
+
+ ui->output_sink_combo_box->clear();
+ ui->output_sink_combo_box->addItem("auto");
+ for (const auto& sink_detail : AudioCore::g_sink_details) {
+ ui->output_sink_combo_box->addItem(sink_detail.id);
+ }
+
+ this->setConfiguration();
+ connect(ui->output_sink_combo_box, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(updateAudioDevices(int)));
+}
+
+ConfigureAudio::~ConfigureAudio() {}
+
+void ConfigureAudio::setConfiguration() {
+ int new_sink_index = 0;
+ for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
+ if (ui->output_sink_combo_box->itemText(index).toStdString() == Settings::values.sink_id) {
+ new_sink_index = index;
+ break;
+ }
+ }
+ ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
+
+ ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
+
+ // The device list cannot be pre-populated (nor listed) until the output sink is known.
+ updateAudioDevices(new_sink_index);
+
+ int new_device_index = -1;
+ for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
+ if (ui->audio_device_combo_box->itemText(index).toStdString() ==
+ Settings::values.audio_device_id) {
+ new_device_index = index;
+ break;
+ }
+ }
+ ui->audio_device_combo_box->setCurrentIndex(new_device_index);
+}
+
+void ConfigureAudio::applyConfiguration() {
+ Settings::values.sink_id =
+ ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
+ .toStdString();
+ Settings::values.enable_audio_stretching = ui->toggle_audio_stretching->isChecked();
+ Settings::values.audio_device_id =
+ ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
+ .toStdString();
+ Settings::Apply();
+}
+
+void ConfigureAudio::updateAudioDevices(int sink_index) {
+ ui->audio_device_combo_box->clear();
+ ui->audio_device_combo_box->addItem("auto");
+
+ std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
+ std::vector<std::string> device_list =
+ AudioCore::GetSinkDetails(sink_id).factory()->GetDeviceList();
+ for (const auto& device : device_list) {
+ ui->audio_device_combo_box->addItem(device.c_str());
+ }
+}
diff --git a/src/citra_qt/configuration/configure_audio.h b/src/citra_qt/configuration/configure_audio.h
new file mode 100644
index 000000000..8190e694f
--- /dev/null
+++ b/src/citra_qt/configuration/configure_audio.h
@@ -0,0 +1,30 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QWidget>
+
+namespace Ui {
+class ConfigureAudio;
+}
+
+class ConfigureAudio : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureAudio(QWidget* parent = nullptr);
+ ~ConfigureAudio();
+
+ void applyConfiguration();
+
+public slots:
+ void updateAudioDevices(int sink_index);
+
+private:
+ void setConfiguration();
+
+ std::unique_ptr<Ui::ConfigureAudio> ui;
+};
diff --git a/src/citra_qt/configuration/configure_audio.ui b/src/citra_qt/configuration/configure_audio.ui
new file mode 100644
index 000000000..dd870eb61
--- /dev/null
+++ b/src/citra_qt/configuration/configure_audio.ui
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<ui version="4.0">
+ <class>ConfigureAudio</class>
+ <widget class="QWidget" name="ConfigureAudio">
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox">
+ <property name="title">
+ <string>Audio</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel">
+ <property name="text">
+ <string>Output Engine:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="output_sink_combo_box">
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="toggle_audio_stretching">
+ <property name="text">
+ <string>Enable audio stretching</string>
+ </property>
+ <property name="toolTip">
+ <string>This post-processing effect adjusts audio speed to match emulation speed and helps prevent audio stutter. This however increases audio latency.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel">
+ <property name="text">
+ <string>Audio Device:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="audio_device_combo_box">
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources />
+ <connections />
+</ui>
diff --git a/src/citra_qt/configuration/configure_debug.cpp b/src/citra_qt/configuration/configure_debug.cpp
new file mode 100644
index 000000000..263f73f38
--- /dev/null
+++ b/src/citra_qt/configuration/configure_debug.cpp
@@ -0,0 +1,26 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "citra_qt/configuration/configure_debug.h"
+#include "core/settings.h"
+#include "ui_configure_debug.h"
+
+ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
+ ui->setupUi(this);
+ this->setConfiguration();
+}
+
+ConfigureDebug::~ConfigureDebug() {}
+
+void ConfigureDebug::setConfiguration() {
+ ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
+ ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub);
+ ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
+}
+
+void ConfigureDebug::applyConfiguration() {
+ Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
+ Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
+ Settings::Apply();
+}
diff --git a/src/citra_qt/configuration/configure_debug.h b/src/citra_qt/configuration/configure_debug.h
new file mode 100644
index 000000000..d167eb996
--- /dev/null
+++ b/src/citra_qt/configuration/configure_debug.h
@@ -0,0 +1,28 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QWidget>
+
+namespace Ui {
+class ConfigureDebug;
+}
+
+class ConfigureDebug : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureDebug(QWidget* parent = nullptr);
+ ~ConfigureDebug();
+
+ void applyConfiguration();
+
+private:
+ void setConfiguration();
+
+private:
+ std::unique_ptr<Ui::ConfigureDebug> ui;
+};
diff --git a/src/citra_qt/configuration/configure_debug.ui b/src/citra_qt/configuration/configure_debug.ui
new file mode 100644
index 000000000..bbbb0e3f4
--- /dev/null
+++ b/src/citra_qt/configuration/configure_debug.ui
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureDebug</class>
+ <widget class="QWidget" name="ConfigureDebug">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>GDB</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="toggle_gdbstub">
+ <property name="text">
+ <string>Enable GDB Stub</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="gdbport_spinbox">
+ <property name="maximum">
+ <number>65536</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>toggle_gdbstub</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>gdbport_spinbox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>84</x>
+ <y>157</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>342</x>
+ <y>158</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp
new file mode 100644
index 000000000..dfc8c03a7
--- /dev/null
+++ b/src/citra_qt/configuration/configure_dialog.cpp
@@ -0,0 +1,27 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/configuration/configure_dialog.h"
+#include "core/settings.h"
+#include "ui_configure.h"
+
+ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {
+ ui->setupUi(this);
+ this->setConfiguration();
+}
+
+ConfigureDialog::~ConfigureDialog() {}
+
+void ConfigureDialog::setConfiguration() {}
+
+void ConfigureDialog::applyConfiguration() {
+ ui->generalTab->applyConfiguration();
+ ui->systemTab->applyConfiguration();
+ ui->inputTab->applyConfiguration();
+ ui->graphicsTab->applyConfiguration();
+ ui->audioTab->applyConfiguration();
+ ui->debugTab->applyConfiguration();
+ Settings::Apply();
+}
diff --git a/src/citra_qt/configuration/configure_dialog.h b/src/citra_qt/configuration/configure_dialog.h
new file mode 100644
index 000000000..21fa1f501
--- /dev/null
+++ b/src/citra_qt/configuration/configure_dialog.h
@@ -0,0 +1,28 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QDialog>
+
+namespace Ui {
+class ConfigureDialog;
+}
+
+class ConfigureDialog : public QDialog {
+ Q_OBJECT
+
+public:
+ explicit ConfigureDialog(QWidget* parent);
+ ~ConfigureDialog();
+
+ void applyConfiguration();
+
+private:
+ void setConfiguration();
+
+private:
+ std::unique_ptr<Ui::ConfigureDialog> ui;
+};
diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
new file mode 100644
index 000000000..a21176c34
--- /dev/null
+++ b/src/citra_qt/configuration/configure_general.cpp
@@ -0,0 +1,37 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "citra_qt/configuration/configure_general.h"
+#include "citra_qt/ui_settings.h"
+#include "core/core.h"
+#include "core/settings.h"
+#include "ui_configure_general.h"
+
+ConfigureGeneral::ConfigureGeneral(QWidget* parent)
+ : QWidget(parent), ui(new Ui::ConfigureGeneral) {
+
+ ui->setupUi(this);
+ this->setConfiguration();
+
+ ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
+}
+
+ConfigureGeneral::~ConfigureGeneral() {}
+
+void ConfigureGeneral::setConfiguration() {
+ ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
+ ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
+ ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
+
+ // The first item is "auto-select" with actual value -1, so plus one here will do the trick
+ ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
+}
+
+void ConfigureGeneral::applyConfiguration() {
+ UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
+ UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
+ Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
+ Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
+ Settings::Apply();
+}
diff --git a/src/citra_qt/configuration/configure_general.h b/src/citra_qt/configuration/configure_general.h
new file mode 100644
index 000000000..447552d8c
--- /dev/null
+++ b/src/citra_qt/configuration/configure_general.h
@@ -0,0 +1,28 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QWidget>
+
+namespace Ui {
+class ConfigureGeneral;
+}
+
+class ConfigureGeneral : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureGeneral(QWidget* parent = nullptr);
+ ~ConfigureGeneral();
+
+ void applyConfiguration();
+
+private:
+ void setConfiguration();
+
+private:
+ std::unique_ptr<Ui::ConfigureGeneral> ui;
+};
diff --git a/src/citra_qt/configuration/configure_general.ui b/src/citra_qt/configuration/configure_general.ui
new file mode 100644
index 000000000..c739605a4
--- /dev/null
+++ b/src/citra_qt/configuration/configure_general.ui
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureGeneral</class>
+ <widget class="QWidget" name="ConfigureGeneral">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>300</width>
+ <height>377</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>General</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="toggle_deepscan">
+ <property name="text">
+ <string>Search sub-directories for games</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="toggle_check_exit">
+ <property name="text">
+ <string>Confirm exit while emulation is running</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Performance</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QCheckBox" name="toggle_cpu_jit">
+ <property name="text">
+ <string>Enable CPU JIT</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Emulation</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Region:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="region_combobox">
+ <item>
+ <property name="text">
+ <string>Auto-select</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">JPN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">USA</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">EUR</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">AUS</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">CHN</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">KOR</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">TWN</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Hotkeys</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="GHotkeysDialog" name="widget" native="true"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>GHotkeysDialog</class>
+ <extends>QWidget</extends>
+ <header>hotkeys.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/citra_qt/configuration/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp
new file mode 100644
index 000000000..b5a5ab1e1
--- /dev/null
+++ b/src/citra_qt/configuration/configure_graphics.cpp
@@ -0,0 +1,115 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "citra_qt/configuration/configure_graphics.h"
+#include "core/core.h"
+#include "core/settings.h"
+#include "ui_configure_graphics.h"
+
+ConfigureGraphics::ConfigureGraphics(QWidget* parent)
+ : QWidget(parent), ui(new Ui::ConfigureGraphics) {
+
+ ui->setupUi(this);
+ this->setConfiguration();
+
+ ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
+
+ ui->layoutBox->setEnabled(!Settings::values.custom_layout);
+}
+
+ConfigureGraphics::~ConfigureGraphics() {}
+
+enum class Resolution : int {
+ Auto,
+ Scale1x,
+ Scale2x,
+ Scale3x,
+ Scale4x,
+ Scale5x,
+ Scale6x,
+ Scale7x,
+ Scale8x,
+ Scale9x,
+ Scale10x,
+};
+
+float ToResolutionFactor(Resolution option) {
+ switch (option) {
+ case Resolution::Auto:
+ return 0.f;
+ case Resolution::Scale1x:
+ return 1.f;
+ case Resolution::Scale2x:
+ return 2.f;
+ case Resolution::Scale3x:
+ return 3.f;
+ case Resolution::Scale4x:
+ return 4.f;
+ case Resolution::Scale5x:
+ return 5.f;
+ case Resolution::Scale6x:
+ return 6.f;
+ case Resolution::Scale7x:
+ return 7.f;
+ case Resolution::Scale8x:
+ return 8.f;
+ case Resolution::Scale9x:
+ return 9.f;
+ case Resolution::Scale10x:
+ return 10.f;
+ }
+ return 0.f;
+}
+
+Resolution FromResolutionFactor(float factor) {
+ if (factor == 0.f) {
+ return Resolution::Auto;
+ } else if (factor == 1.f) {
+ return Resolution::Scale1x;
+ } else if (factor == 2.f) {
+ return Resolution::Scale2x;
+ } else if (factor == 3.f) {
+ return Resolution::Scale3x;
+ } else if (factor == 4.f) {
+ return Resolution::Scale4x;
+ } else if (factor == 5.f) {
+ return Resolution::Scale5x;
+ } else if (factor == 6.f) {
+ return Resolution::Scale6x;
+ } else if (factor == 7.f) {
+ return Resolution::Scale7x;
+ } else if (factor == 8.f) {
+ return Resolution::Scale8x;
+ } else if (factor == 9.f) {
+ return Resolution::Scale9x;
+ } else if (factor == 10.f) {
+ return Resolution::Scale10x;
+ }
+ return Resolution::Auto;
+}
+
+void ConfigureGraphics::setConfiguration() {
+ ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
+ ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer);
+ ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
+ ui->resolution_factor_combobox->setCurrentIndex(
+ static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
+ ui->toggle_vsync->setChecked(Settings::values.use_vsync);
+ ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
+ ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
+ ui->swap_screen->setChecked(Settings::values.swap_screen);
+}
+
+void ConfigureGraphics::applyConfiguration() {
+ Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
+ Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
+ Settings::values.resolution_factor =
+ ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
+ Settings::values.use_vsync = ui->toggle_vsync->isChecked();
+ Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
+ Settings::values.layout_option =
+ static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
+ Settings::values.swap_screen = ui->swap_screen->isChecked();
+ Settings::Apply();
+}
diff --git a/src/citra_qt/configuration/configure_graphics.h b/src/citra_qt/configuration/configure_graphics.h
new file mode 100644
index 000000000..5497a55f7
--- /dev/null
+++ b/src/citra_qt/configuration/configure_graphics.h
@@ -0,0 +1,28 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QWidget>
+
+namespace Ui {
+class ConfigureGraphics;
+}
+
+class ConfigureGraphics : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureGraphics(QWidget* parent = nullptr);
+ ~ConfigureGraphics();
+
+ void applyConfiguration();
+
+private:
+ void setConfiguration();
+
+private:
+ std::unique_ptr<Ui::ConfigureGraphics> ui;
+};
diff --git a/src/citra_qt/configuration/configure_graphics.ui b/src/citra_qt/configuration/configure_graphics.ui
new file mode 100644
index 000000000..228f2a869
--- /dev/null
+++ b/src/citra_qt/configuration/configure_graphics.ui
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureGraphics</class>
+ <widget class="QWidget" name="ConfigureGraphics">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Graphics</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="toggle_hw_renderer">
+ <property name="text">
+ <string>Enable hardware renderer</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="toggle_shader_jit">
+ <property name="text">
+ <string>Enable shader JIT</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="toggle_vsync">
+ <property name="text">
+ <string>Enable V-Sync</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="toggle_framelimit">
+ <property name="text">
+ <string>Limit framerate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Internal Resolution:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="resolution_factor_combobox">
+ <item>
+ <property name="text">
+ <string notr="true">Auto (Window Size)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">Native (400x240)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">2x Native (800x480)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">3x Native (1200x720)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">4x Native (1600x960)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">5x Native (2000x1200)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">6x Native (2400x1440)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">7x Native (2800x1680)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">8x Native (3200x1920)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">9x Native (3600x2160)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">10x Native (4000x2400)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="layoutBox">
+ <property name="title">
+ <string>Layout</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label1">
+ <property name="text">
+ <string>Screen Layout:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="layout_combobox">
+ <item>
+ <property name="text">
+ <string notr="true">Default</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">Single Screen</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">Large Screen</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="swap_screen">
+ <property name="text">
+ <string>Swap Screens</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>toggle_hw_renderer</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>resolution_factor_combobox</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/citra_qt/configuration/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp
new file mode 100644
index 000000000..daac9b63a
--- /dev/null
+++ b/src/citra_qt/configuration/configure_input.cpp
@@ -0,0 +1,205 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+#include <QTimer>
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/configuration/configure_input.h"
+#include "common/param_package.h"
+#include "input_common/main.h"
+
+const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM>
+ ConfigureInput::analog_sub_buttons{{
+ "up", "down", "left", "right", "modifier",
+ }};
+
+static QString getKeyName(int key_code) {
+ switch (key_code) {
+ case Qt::Key_Shift:
+ return QObject::tr("Shift");
+ case Qt::Key_Control:
+ return QObject::tr("Ctrl");
+ case Qt::Key_Alt:
+ return QObject::tr("Alt");
+ case Qt::Key_Meta:
+ return "";
+ default:
+ return QKeySequence(key_code).toString();
+ }
+}
+
+static void SetButtonKey(int key, Common::ParamPackage& button_param) {
+ button_param = Common::ParamPackage{InputCommon::GenerateKeyboardParam(key)};
+}
+
+static void SetAnalogKey(int key, Common::ParamPackage& analog_param,
+ const std::string& button_name) {
+ if (analog_param.Get("engine", "") != "analog_from_button") {
+ analog_param = {
+ {"engine", "analog_from_button"}, {"modifier_scale", "0.5"},
+ };
+ }
+ analog_param.Set(button_name, InputCommon::GenerateKeyboardParam(key));
+}
+
+ConfigureInput::ConfigureInput(QWidget* parent)
+ : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
+ timer(std::make_unique<QTimer>()) {
+
+ ui->setupUi(this);
+ setFocusPolicy(Qt::ClickFocus);
+
+ button_map = {
+ ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY, ui->buttonDpadUp,
+ ui->buttonDpadDown, ui->buttonDpadLeft, ui->buttonDpadRight, ui->buttonL, ui->buttonR,
+ ui->buttonStart, ui->buttonSelect, ui->buttonZL, ui->buttonZR, ui->buttonHome,
+ };
+
+ analog_map = {{
+ {
+ ui->buttonCircleUp, ui->buttonCircleDown, ui->buttonCircleLeft, ui->buttonCircleRight,
+ ui->buttonCircleMod,
+ },
+ {
+ ui->buttonCStickUp, ui->buttonCStickDown, ui->buttonCStickLeft, ui->buttonCStickRight,
+ nullptr,
+ },
+ }};
+
+ for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
+ if (button_map[button_id])
+ connect(button_map[button_id], &QPushButton::released, [=]() {
+ handleClick(button_map[button_id],
+ [=](int key) { SetButtonKey(key, buttons_param[button_id]); });
+ });
+ }
+
+ 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++) {
+ if (analog_map[analog_id][sub_button_id] != nullptr) {
+ connect(analog_map[analog_id][sub_button_id], &QPushButton::released, [=]() {
+ handleClick(analog_map[analog_id][sub_button_id], [=](int key) {
+ SetAnalogKey(key, analogs_param[analog_id],
+ analog_sub_buttons[sub_button_id]);
+ });
+ });
+ }
+ }
+ }
+
+ connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
+
+ timer->setSingleShot(true);
+ connect(timer.get(), &QTimer::timeout, [this]() {
+ releaseKeyboard();
+ releaseMouse();
+ key_setter = boost::none;
+ updateButtonLabels();
+ });
+
+ this->loadConfiguration();
+
+ // TODO(wwylele): enable these when the input emulation for them is implemented
+ ui->buttonZL->setEnabled(false);
+ ui->buttonZR->setEnabled(false);
+ ui->buttonHome->setEnabled(false);
+ ui->buttonCStickUp->setEnabled(false);
+ ui->buttonCStickDown->setEnabled(false);
+ ui->buttonCStickLeft->setEnabled(false);
+ ui->buttonCStickRight->setEnabled(false);
+}
+
+void ConfigureInput::applyConfiguration() {
+ std::transform(buttons_param.begin(), buttons_param.end(), Settings::values.buttons.begin(),
+ [](const Common::ParamPackage& param) { return param.Serialize(); });
+ std::transform(analogs_param.begin(), analogs_param.end(), Settings::values.analogs.begin(),
+ [](const Common::ParamPackage& param) { return param.Serialize(); });
+
+ Settings::Apply();
+}
+
+void ConfigureInput::loadConfiguration() {
+ std::transform(Settings::values.buttons.begin(), Settings::values.buttons.end(),
+ buttons_param.begin(),
+ [](const std::string& str) { return Common::ParamPackage(str); });
+ std::transform(Settings::values.analogs.begin(), Settings::values.analogs.end(),
+ analogs_param.begin(),
+ [](const std::string& str) { return Common::ParamPackage(str); });
+ updateButtonLabels();
+}
+
+void ConfigureInput::restoreDefaults() {
+ for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
+ SetButtonKey(Config::default_buttons[button_id], buttons_param[button_id]);
+ }
+
+ 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++) {
+ SetAnalogKey(Config::default_analogs[analog_id][sub_button_id],
+ analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
+ }
+ }
+ updateButtonLabels();
+ applyConfiguration();
+}
+
+void ConfigureInput::updateButtonLabels() {
+ QString non_keyboard(tr("[non-keyboard]"));
+
+ auto KeyToText = [&non_keyboard](const Common::ParamPackage& param) {
+ if (param.Get("engine", "") != "keyboard") {
+ return non_keyboard;
+ } else {
+ return getKeyName(param.Get("code", 0));
+ }
+ };
+
+ for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
+ button_map[button]->setText(KeyToText(buttons_param[button]));
+ }
+
+ for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
+ if (analogs_param[analog_id].Get("engine", "") != "analog_from_button") {
+ for (QPushButton* button : analog_map[analog_id]) {
+ if (button)
+ button->setText(non_keyboard);
+ }
+ } else {
+ for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
+ Common::ParamPackage param(
+ analogs_param[analog_id].Get(analog_sub_buttons[sub_button_id], ""));
+ if (analog_map[analog_id][sub_button_id])
+ analog_map[analog_id][sub_button_id]->setText(KeyToText(param));
+ }
+ }
+ }
+}
+
+void ConfigureInput::handleClick(QPushButton* button, std::function<void(int)> new_key_setter) {
+ button->setText(tr("[press key]"));
+ button->setFocus();
+
+ key_setter = new_key_setter;
+
+ grabKeyboard();
+ grabMouse();
+ timer->start(5000); // Cancel after 5 seconds
+}
+
+void ConfigureInput::keyPressEvent(QKeyEvent* event) {
+ releaseKeyboard();
+ releaseMouse();
+
+ if (!key_setter || !event)
+ return;
+
+ if (event->key() != Qt::Key_Escape)
+ (*key_setter)(event->key());
+
+ updateButtonLabels();
+ key_setter = boost::none;
+ timer->stop();
+}
diff --git a/src/citra_qt/configuration/configure_input.h b/src/citra_qt/configuration/configure_input.h
new file mode 100644
index 000000000..c950fbcb4
--- /dev/null
+++ b/src/citra_qt/configuration/configure_input.h
@@ -0,0 +1,69 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <functional>
+#include <memory>
+#include <string>
+#include <QKeyEvent>
+#include <QWidget>
+#include <boost/optional.hpp>
+#include "common/param_package.h"
+#include "core/settings.h"
+#include "ui_configure_input.h"
+
+class QPushButton;
+class QString;
+class QTimer;
+
+namespace Ui {
+class ConfigureInput;
+}
+
+class ConfigureInput : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureInput(QWidget* parent = nullptr);
+
+ /// Save all button configurations to settings file
+ void applyConfiguration();
+
+private:
+ std::unique_ptr<Ui::ConfigureInput> ui;
+
+ std::unique_ptr<QTimer> timer;
+
+ /// This will be the the setting function when an input is awaiting configuration.
+ boost::optional<std::function<void(int)>> key_setter;
+
+ std::array<Common::ParamPackage, Settings::NativeButton::NumButtons> buttons_param;
+ std::array<Common::ParamPackage, Settings::NativeAnalog::NumAnalogs> analogs_param;
+
+ static constexpr int ANALOG_SUB_BUTTONS_NUM = 5;
+
+ /// Each button input is represented by a QPushButton.
+ std::array<QPushButton*, Settings::NativeButton::NumButtons> button_map;
+
+ /// Each analog input is represented by five QPushButtons which represents up, down, left, right
+ /// and modifier
+ std::array<std::array<QPushButton*, ANALOG_SUB_BUTTONS_NUM>, Settings::NativeAnalog::NumAnalogs>
+ analog_map;
+
+ static const std::array<std::string, ANALOG_SUB_BUTTONS_NUM> analog_sub_buttons;
+
+ /// Load configuration settings.
+ void loadConfiguration();
+ /// Restore all buttons to their default values.
+ void restoreDefaults();
+ /// Update UI to reflect current configuration.
+ void updateButtonLabels();
+
+ /// Called when the button was pressed.
+ void handleClick(QPushButton* button, std::function<void(int)> new_key_setter);
+ /// Handle key press events.
+ void keyPressEvent(QKeyEvent* event) override;
+};
diff --git a/src/citra_qt/configuration/configure_input.ui b/src/citra_qt/configuration/configure_input.ui
new file mode 100644
index 000000000..2760787e5
--- /dev/null
+++ b/src/citra_qt/configuration/configure_input.ui
@@ -0,0 +1,592 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureInput</class>
+ <widget class="QWidget" name="ConfigureInput">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>370</width>
+ <height>534</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>ConfigureInput</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_7">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="faceButtons">
+ <property name="title">
+ <string>Face Buttons</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>A:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonA">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>B:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonB">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>X:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonX">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Y:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonY">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QGroupBox" name="faceButtons_2">
+ <property name="title">
+ <string>Directional Pad</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_12">
+ <item>
+ <widget class="QLabel" name="label_34">
+ <property name="text">
+ <string>Up:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonDpadUp">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_9">
+ <item>
+ <widget class="QLabel" name="label_35">
+ <property name="text">
+ <string>Down:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonDpadDown">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_10">
+ <item>
+ <widget class="QLabel" name="label_32">
+ <property name="text">
+ <string>Left:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonDpadLeft">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_11">
+ <item>
+ <widget class="QLabel" name="label_33">
+ <property name="text">
+ <string>Right:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonDpadRight">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="faceButtons_3">
+ <property name="title">
+ <string>Shoulder Buttons</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_13">
+ <item>
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>L:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonL">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_14">
+ <item>
+ <widget class="QLabel" name="label_19">
+ <property name="text">
+ <string>R:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonR">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_15">
+ <item>
+ <widget class="QLabel" name="label_20">
+ <property name="text">
+ <string>ZL:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonZL">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_16">
+ <item>
+ <widget class="QLabel" name="label_18">
+ <property name="text">
+ <string>ZR:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonZR">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QGroupBox" name="faceButtons_4">
+ <property name="title">
+ <string>Circle Pad</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_17">
+ <item>
+ <widget class="QLabel" name="label_21">
+ <property name="text">
+ <string>Left:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCircleLeft">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_18">
+ <item>
+ <widget class="QLabel" name="label_23">
+ <property name="text">
+ <string>Right:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCircleRight">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_19">
+ <item>
+ <widget class="QLabel" name="label_24">
+ <property name="text">
+ <string>Up:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCircleUp">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_20">
+ <item>
+ <widget class="QLabel" name="label_22">
+ <property name="text">
+ <string>Down:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCircleDown">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="faceButtons_5">
+ <property name="title">
+ <string>C-Stick</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_21">
+ <item>
+ <widget class="QLabel" name="label_25">
+ <property name="text">
+ <string>Left:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCStickLeft">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_22">
+ <item>
+ <widget class="QLabel" name="label_27">
+ <property name="text">
+ <string>Right:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCStickRight">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_23">
+ <item>
+ <widget class="QLabel" name="label_28">
+ <property name="text">
+ <string>Up:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCStickUp">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_24">
+ <item>
+ <widget class="QLabel" name="label_26">
+ <property name="text">
+ <string>Down:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCStickDown">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QGroupBox" name="faceButtons_6">
+ <property name="title">
+ <string>Misc.</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_25">
+ <item>
+ <widget class="QLabel" name="label_29">
+ <property name="text">
+ <string>Start:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonStart">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_26">
+ <item>
+ <widget class="QLabel" name="label_30">
+ <property name="text">
+ <string>Select:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonSelect">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_27">
+ <item>
+ <widget class="QLabel" name="label_31">
+ <property name="text">
+ <string>Home:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonHome">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_28">
+ <item>
+ <widget class="QLabel" name="label_36">
+ <property name="text">
+ <string>Circle Mod:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCircleMod">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonRestoreDefaults">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Restore Defaults</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp
new file mode 100644
index 000000000..a3a9015a4
--- /dev/null
+++ b/src/citra_qt/configuration/configure_system.cpp
@@ -0,0 +1,142 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "citra_qt/configuration/configure_system.h"
+#include "citra_qt/ui_settings.h"
+#include "core/core.h"
+#include "core/hle/service/cfg/cfg.h"
+#include "core/hle/service/fs/archive.h"
+#include "ui_configure_system.h"
+
+static const std::array<int, 12> days_in_month = {{
+ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
+}};
+
+ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
+ ui->setupUi(this);
+ connect(ui->combo_birthmonth, SIGNAL(currentIndexChanged(int)),
+ SLOT(updateBirthdayComboBox(int)));
+
+ this->setConfiguration();
+}
+
+ConfigureSystem::~ConfigureSystem() {}
+
+void ConfigureSystem::setConfiguration() {
+ enabled = !Core::System::GetInstance().IsPoweredOn();
+
+ if (!enabled) {
+ ReadSystemSettings();
+ ui->group_system_settings->setEnabled(false);
+ } else {
+ // This tab is enabled only when game is not running (i.e. all service are not initialized).
+ // Temporarily register archive types and load the config savegame file to memory.
+ Service::FS::RegisterArchiveTypes();
+ ResultCode result = Service::CFG::LoadConfigNANDSaveFile();
+ Service::FS::UnregisterArchiveTypes();
+
+ if (result.IsError()) {
+ ui->label_disable_info->setText(tr("Failed to load system settings data."));
+ ui->group_system_settings->setEnabled(false);
+ enabled = false;
+ return;
+ }
+
+ ReadSystemSettings();
+ ui->label_disable_info->hide();
+ }
+}
+
+void ConfigureSystem::ReadSystemSettings() {
+ // set username
+ username = Service::CFG::GetUsername();
+ // TODO(wwylele): Use this when we move to Qt 5.5
+ // ui->edit_username->setText(QString::fromStdU16String(username));
+ ui->edit_username->setText(
+ QString::fromUtf16(reinterpret_cast<const ushort*>(username.data())));
+
+ // set birthday
+ std::tie(birthmonth, birthday) = Service::CFG::GetBirthday();
+ ui->combo_birthmonth->setCurrentIndex(birthmonth - 1);
+ updateBirthdayComboBox(
+ birthmonth -
+ 1); // explicitly update it because the signal from setCurrentIndex is not reliable
+ ui->combo_birthday->setCurrentIndex(birthday - 1);
+
+ // set system language
+ language_index = Service::CFG::GetSystemLanguage();
+ ui->combo_language->setCurrentIndex(language_index);
+
+ // set sound output mode
+ sound_index = Service::CFG::GetSoundOutputMode();
+ ui->combo_sound->setCurrentIndex(sound_index);
+}
+
+void ConfigureSystem::applyConfiguration() {
+ if (!enabled)
+ return;
+
+ bool modified = false;
+
+ // apply username
+ // TODO(wwylele): Use this when we move to Qt 5.5
+ // std::u16string new_username = ui->edit_username->text().toStdU16String();
+ std::u16string new_username(
+ reinterpret_cast<const char16_t*>(ui->edit_username->text().utf16()));
+ if (new_username != username) {
+ Service::CFG::SetUsername(new_username);
+ modified = true;
+ }
+
+ // apply birthday
+ int new_birthmonth = ui->combo_birthmonth->currentIndex() + 1;
+ int new_birthday = ui->combo_birthday->currentIndex() + 1;
+ if (birthmonth != new_birthmonth || birthday != new_birthday) {
+ Service::CFG::SetBirthday(new_birthmonth, new_birthday);
+ modified = true;
+ }
+
+ // apply language
+ int new_language = ui->combo_language->currentIndex();
+ if (language_index != new_language) {
+ Service::CFG::SetSystemLanguage(static_cast<Service::CFG::SystemLanguage>(new_language));
+ modified = true;
+ }
+
+ // apply sound
+ int new_sound = ui->combo_sound->currentIndex();
+ if (sound_index != new_sound) {
+ Service::CFG::SetSoundOutputMode(static_cast<Service::CFG::SoundOutputMode>(new_sound));
+ modified = true;
+ }
+
+ // update the config savegame if any item is modified.
+ if (modified)
+ Service::CFG::UpdateConfigNANDSavegame();
+}
+
+void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) {
+ if (birthmonth_index < 0 || birthmonth_index >= 12)
+ return;
+
+ // store current day selection
+ int birthday_index = ui->combo_birthday->currentIndex();
+
+ // get number of days in the new selected month
+ int days = days_in_month[birthmonth_index];
+
+ // if the selected day is out of range,
+ // reset it to 1st
+ if (birthday_index < 0 || birthday_index >= days)
+ birthday_index = 0;
+
+ // update the day combo box
+ ui->combo_birthday->clear();
+ for (int i = 1; i <= days; ++i) {
+ ui->combo_birthday->addItem(QString::number(i));
+ }
+
+ // restore the day selection
+ ui->combo_birthday->setCurrentIndex(birthday_index);
+}
diff --git a/src/citra_qt/configuration/configure_system.h b/src/citra_qt/configuration/configure_system.h
new file mode 100644
index 000000000..db0ead13c
--- /dev/null
+++ b/src/citra_qt/configuration/configure_system.h
@@ -0,0 +1,37 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include <QWidget>
+
+namespace Ui {
+class ConfigureSystem;
+}
+
+class ConfigureSystem : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConfigureSystem(QWidget* parent = nullptr);
+ ~ConfigureSystem();
+
+ void applyConfiguration();
+ void setConfiguration();
+
+public slots:
+ void updateBirthdayComboBox(int birthmonth_index);
+
+private:
+ void ReadSystemSettings();
+
+ std::unique_ptr<Ui::ConfigureSystem> ui;
+ bool enabled;
+
+ std::u16string username;
+ int birthmonth, birthday;
+ int language_index;
+ int sound_index;
+};
diff --git a/src/citra_qt/configuration/configure_system.ui b/src/citra_qt/configuration/configure_system.ui
new file mode 100644
index 000000000..cc54fa37f
--- /dev/null
+++ b/src/citra_qt/configuration/configure_system.ui
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigureSystem</class>
+ <widget class="QWidget" name="ConfigureSystem">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>360</width>
+ <height>377</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="group_system_settings">
+ <property name="title">
+ <string>System Settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_username">
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="edit_username">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxLength">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_birthday">
+ <property name="text">
+ <string>Birthday</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_birthday2">
+ <item>
+ <widget class="QComboBox" name="combo_birthmonth">
+ <item>
+ <property name="text">
+ <string>January</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>February</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>March</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>April</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>May</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>June</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>July</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>August</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>September</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>October</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>November</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>December</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="combo_birthday"/>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_language">
+ <property name="text">
+ <string>Language</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="combo_language">
+ <property name="toolTip">
+ <string>Note: this can be overridden when region setting is auto-select</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>Japanese (日本語)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>English</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>French (français)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>German (Deutsch)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Italian (italiano)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Spanish (español)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Simplified Chinese (简体中文)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Korean (한국어)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dutch (Nederlands)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Portuguese (português)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Russian (Русский)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Traditional Chinese (正體中文)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_sound">
+ <property name="text">
+ <string>Sound output mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="combo_sound">
+ <item>
+ <property name="text">
+ <string>Mono</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Stereo</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Surround</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_disable_info">
+ <property name="text">
+ <string>System settings are available only when game is not running.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>