diff options
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 54 |
1 files changed, 24 insertions, 30 deletions
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 @@ | |||
| 6 | #include "bootmanager.hxx" | 6 | #include "bootmanager.hxx" |
| 7 | 7 | ||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/loader/loader.h" | 9 | #include "core/settings.h" |
| 10 | #include "core/hw/hw.h" | ||
| 11 | 10 | ||
| 12 | #include "video_core/video_core.h" | 11 | #include "video_core/video_core.h" |
| 13 | 12 | ||
| 14 | #include "version.h" | 13 | #include "citra_qt/version.h" |
| 15 | 14 | ||
| 16 | #define APP_NAME "citra" | 15 | #define APP_NAME "citra" |
| 17 | #define APP_VERSION "0.1-" VERSION | 16 | #define APP_VERSION "0.1-" VERSION |
| @@ -102,40 +101,15 @@ private: | |||
| 102 | GRenderWindow* parent_; | 101 | GRenderWindow* parent_; |
| 103 | }; | 102 | }; |
| 104 | 103 | ||
| 105 | |||
| 106 | EmuThread& GRenderWindow::GetEmuThread() | 104 | EmuThread& GRenderWindow::GetEmuThread() |
| 107 | { | 105 | { |
| 108 | return emu_thread; | 106 | return emu_thread; |
| 109 | } | 107 | } |
| 110 | 108 | ||
| 111 | static const std::pair<int, HID_User::PadState> default_key_map[] = { | 109 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this), keyboard_id(0) |
| 112 | { Qt::Key_A, HID_User::PAD_A }, | ||
| 113 | { Qt::Key_B, HID_User::PAD_B }, | ||
| 114 | { Qt::Key_Backslash, HID_User::PAD_SELECT }, | ||
| 115 | { Qt::Key_Enter, HID_User::PAD_START }, | ||
| 116 | { Qt::Key_Right, HID_User::PAD_RIGHT }, | ||
| 117 | { Qt::Key_Left, HID_User::PAD_LEFT }, | ||
| 118 | { Qt::Key_Up, HID_User::PAD_UP }, | ||
| 119 | { Qt::Key_Down, HID_User::PAD_DOWN }, | ||
| 120 | { Qt::Key_R, HID_User::PAD_R }, | ||
| 121 | { Qt::Key_L, HID_User::PAD_L }, | ||
| 122 | { Qt::Key_X, HID_User::PAD_X }, | ||
| 123 | { Qt::Key_Y, HID_User::PAD_Y }, | ||
| 124 | { Qt::Key_H, HID_User::PAD_CIRCLE_RIGHT }, | ||
| 125 | { Qt::Key_F, HID_User::PAD_CIRCLE_LEFT }, | ||
| 126 | { Qt::Key_T, HID_User::PAD_CIRCLE_UP }, | ||
| 127 | { Qt::Key_G, HID_User::PAD_CIRCLE_DOWN }, | ||
| 128 | }; | ||
| 129 | |||
| 130 | GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this) | ||
| 131 | { | 110 | { |
| 132 | // Register a new ID for the default keyboard | ||
| 133 | keyboard_id = KeyMap::NewDeviceId(); | 111 | keyboard_id = KeyMap::NewDeviceId(); |
| 134 | 112 | ReloadSetKeymaps(); | |
| 135 | // Set default key mappings for keyboard | ||
| 136 | for (auto mapping : default_key_map) { | ||
| 137 | KeyMap::SetKeyMapping({mapping.first, keyboard_id}, mapping.second); | ||
| 138 | } | ||
| 139 | 113 | ||
| 140 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | 114 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose |
| 141 | QGLFormat fmt; | 115 | QGLFormat fmt; |
| @@ -245,3 +219,23 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) | |||
| 245 | HID_User::PadUpdateComplete(); | 219 | HID_User::PadUpdateComplete(); |
| 246 | } | 220 | } |
| 247 | 221 | ||
| 222 | void GRenderWindow::ReloadSetKeymaps() | ||
| 223 | { | ||
| 224 | KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, HID_User::PAD_A); | ||
| 225 | KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, HID_User::PAD_B); | ||
| 226 | KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, HID_User::PAD_SELECT); | ||
| 227 | KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, HID_User::PAD_START); | ||
| 228 | KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, HID_User::PAD_RIGHT); | ||
| 229 | KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, HID_User::PAD_LEFT); | ||
| 230 | KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, HID_User::PAD_UP); | ||
| 231 | KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, HID_User::PAD_DOWN); | ||
| 232 | KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, HID_User::PAD_R); | ||
| 233 | KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, HID_User::PAD_L); | ||
| 234 | KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, HID_User::PAD_X); | ||
| 235 | KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, HID_User::PAD_Y); | ||
| 236 | KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, HID_User::PAD_CIRCLE_RIGHT); | ||
| 237 | KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, HID_User::PAD_CIRCLE_LEFT); | ||
| 238 | KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP); | ||
| 239 | KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN); | ||
| 240 | } | ||
| 241 | |||