From e6594f9f53df456db42ab2091a7b1397070ff9c8 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 12 Sep 2014 17:06:13 -0700 Subject: Added configuration file system. Uses QSettings on citra-qt, and inih on citra-cli. --- src/citra_qt/bootmanager.cpp | 54 ++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index cf4d8b32b..5dce9e570 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -6,12 +6,11 @@ #include "bootmanager.hxx" #include "core/core.h" -#include "core/loader/loader.h" -#include "core/hw/hw.h" +#include "core/settings.h" #include "video_core/video_core.h" -#include "version.h" +#include "citra_qt/version.h" #define APP_NAME "citra" #define APP_VERSION "0.1-" VERSION @@ -102,40 +101,15 @@ private: GRenderWindow* parent_; }; - EmuThread& GRenderWindow::GetEmuThread() { return emu_thread; } -static const std::pair default_key_map[] = { - { Qt::Key_A, HID_User::PAD_A }, - { Qt::Key_B, HID_User::PAD_B }, - { Qt::Key_Backslash, HID_User::PAD_SELECT }, - { Qt::Key_Enter, HID_User::PAD_START }, - { Qt::Key_Right, HID_User::PAD_RIGHT }, - { Qt::Key_Left, HID_User::PAD_LEFT }, - { Qt::Key_Up, HID_User::PAD_UP }, - { Qt::Key_Down, HID_User::PAD_DOWN }, - { Qt::Key_R, HID_User::PAD_R }, - { Qt::Key_L, HID_User::PAD_L }, - { Qt::Key_X, HID_User::PAD_X }, - { Qt::Key_Y, HID_User::PAD_Y }, - { Qt::Key_H, HID_User::PAD_CIRCLE_RIGHT }, - { Qt::Key_F, HID_User::PAD_CIRCLE_LEFT }, - { Qt::Key_T, HID_User::PAD_CIRCLE_UP }, - { Qt::Key_G, HID_User::PAD_CIRCLE_DOWN }, -}; - -GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) +GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this), keyboard_id(0) { - // Register a new ID for the default keyboard keyboard_id = KeyMap::NewDeviceId(); - - // Set default key mappings for keyboard - for (auto mapping : default_key_map) { - KeyMap::SetKeyMapping({mapping.first, keyboard_id}, mapping.second); - } + ReloadSetKeymaps(); // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose QGLFormat fmt; @@ -245,3 +219,23 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) HID_User::PadUpdateComplete(); } +void GRenderWindow::ReloadSetKeymaps() +{ + KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, HID_User::PAD_A); + KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, HID_User::PAD_B); + KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, HID_User::PAD_SELECT); + KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, HID_User::PAD_START); + KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, HID_User::PAD_RIGHT); + KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, HID_User::PAD_LEFT); + KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, HID_User::PAD_UP); + KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, HID_User::PAD_DOWN); + KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, HID_User::PAD_R); + KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, HID_User::PAD_L); + KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, HID_User::PAD_X); + KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, HID_User::PAD_Y); + KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, HID_User::PAD_CIRCLE_RIGHT); + KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, HID_User::PAD_CIRCLE_LEFT); + KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP); + KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN); +} + -- cgit v1.2.3