diff options
| author | 2015-07-28 13:17:12 +0200 | |
|---|---|---|
| committer | 2015-07-28 13:17:12 +0200 | |
| commit | 62adb4ee7b69449aa2c9ac2a519b49b9d54f15fe (patch) | |
| tree | 2abf715b8693863fd730852aa8cc485e034d0572 /src | |
| parent | Merge pull request #1001 from lioncash/arm (diff) | |
| parent | Move input values into an array (diff) | |
| download | yuzu-62adb4ee7b69449aa2c9ac2a519b49b9d54f15fe.tar.gz yuzu-62adb4ee7b69449aa2c9ac2a519b49b9d54f15fe.tar.xz yuzu-62adb4ee7b69449aa2c9ac2a519b49b9d54f15fe.zip | |
Merge pull request #873 from jroweboy/input_array
Move input values into an array.
Diffstat (limited to '')
| -rw-r--r-- | src/citra/config.cpp | 36 | ||||
| -rw-r--r-- | src/citra/emu_window/emu_window_glfw.cpp | 29 | ||||
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 29 | ||||
| -rw-r--r-- | src/citra_qt/config.cpp | 62 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 5 | ||||
| -rw-r--r-- | src/core/settings.h | 54 |
7 files changed, 80 insertions, 145 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 506cb7939..2c1407a6f 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -40,31 +40,21 @@ bool Config::LoadINI(INIReader* config, const char* location, const std::string& | |||
| 40 | return true; | 40 | return true; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | static const std::array<int, Settings::NativeInput::NUM_INPUTS> defaults = { | ||
| 44 | GLFW_KEY_A, GLFW_KEY_S, GLFW_KEY_Z, GLFW_KEY_X, | ||
| 45 | GLFW_KEY_Q, GLFW_KEY_W, GLFW_KEY_1, GLFW_KEY_2, | ||
| 46 | GLFW_KEY_M, GLFW_KEY_N, GLFW_KEY_B, | ||
| 47 | GLFW_KEY_T, GLFW_KEY_G, GLFW_KEY_F, GLFW_KEY_H, | ||
| 48 | GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_LEFT, GLFW_KEY_RIGHT, | ||
| 49 | GLFW_KEY_I, GLFW_KEY_K, GLFW_KEY_J, GLFW_KEY_L | ||
| 50 | }; | ||
| 51 | |||
| 43 | void Config::ReadValues() { | 52 | void Config::ReadValues() { |
| 44 | // Controls | 53 | // Controls |
| 45 | Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A); | 54 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 46 | Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S); | 55 | Settings::values.input_mappings[Settings::NativeInput::All[i]] = |
| 47 | Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z); | 56 | glfw_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[i]); |
| 48 | Settings::values.pad_y_key = glfw_config->GetInteger("Controls", "pad_y", GLFW_KEY_X); | 57 | } |
| 49 | Settings::values.pad_l_key = glfw_config->GetInteger("Controls", "pad_l", GLFW_KEY_Q); | ||
| 50 | Settings::values.pad_r_key = glfw_config->GetInteger("Controls", "pad_r", GLFW_KEY_W); | ||
| 51 | Settings::values.pad_zl_key = glfw_config->GetInteger("Controls", "pad_zl", GLFW_KEY_1); | ||
| 52 | Settings::values.pad_zr_key = glfw_config->GetInteger("Controls", "pad_zr", GLFW_KEY_2); | ||
| 53 | Settings::values.pad_start_key = glfw_config->GetInteger("Controls", "pad_start", GLFW_KEY_M); | ||
| 54 | Settings::values.pad_select_key = glfw_config->GetInteger("Controls", "pad_select", GLFW_KEY_N); | ||
| 55 | Settings::values.pad_home_key = glfw_config->GetInteger("Controls", "pad_home", GLFW_KEY_B); | ||
| 56 | Settings::values.pad_dup_key = glfw_config->GetInteger("Controls", "pad_dup", GLFW_KEY_T); | ||
| 57 | Settings::values.pad_ddown_key = glfw_config->GetInteger("Controls", "pad_ddown", GLFW_KEY_G); | ||
| 58 | Settings::values.pad_dleft_key = glfw_config->GetInteger("Controls", "pad_dleft", GLFW_KEY_F); | ||
| 59 | Settings::values.pad_dright_key = glfw_config->GetInteger("Controls", "pad_dright", GLFW_KEY_H); | ||
| 60 | Settings::values.pad_sup_key = glfw_config->GetInteger("Controls", "pad_sup", GLFW_KEY_UP); | ||
| 61 | Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN); | ||
| 62 | Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT); | ||
| 63 | Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); | ||
| 64 | Settings::values.pad_cup_key = glfw_config->GetInteger("Controls", "pad_cup", GLFW_KEY_I); | ||
| 65 | Settings::values.pad_cdown_key = glfw_config->GetInteger("Controls", "pad_cdown", GLFW_KEY_K); | ||
| 66 | Settings::values.pad_cleft_key = glfw_config->GetInteger("Controls", "pad_cleft", GLFW_KEY_J); | ||
| 67 | Settings::values.pad_cright_key = glfw_config->GetInteger("Controls", "pad_cright", GLFW_KEY_L); | ||
| 68 | 58 | ||
| 69 | // Core | 59 | // Core |
| 70 | Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); | 60 | Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); |
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index 42fb683a9..6d6656b5a 100644 --- a/src/citra/emu_window/emu_window_glfw.cpp +++ b/src/citra/emu_window/emu_window_glfw.cpp | |||
| @@ -150,32 +150,9 @@ void EmuWindow_GLFW::DoneCurrent() { | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | void EmuWindow_GLFW::ReloadSetKeymaps() { | 152 | void EmuWindow_GLFW::ReloadSetKeymaps() { |
| 153 | KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, Service::HID::PAD_A); | 153 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 154 | KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, Service::HID::PAD_B); | 154 | KeyMap::SetKeyMapping({Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, Service::HID::pad_mapping[i]); |
| 155 | KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, Service::HID::PAD_SELECT); | 155 | } |
| 156 | KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, Service::HID::PAD_START); | ||
| 157 | KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, Service::HID::PAD_RIGHT); | ||
| 158 | KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, Service::HID::PAD_LEFT); | ||
| 159 | KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, Service::HID::PAD_UP); | ||
| 160 | KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, Service::HID::PAD_DOWN); | ||
| 161 | KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, Service::HID::PAD_R); | ||
| 162 | KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, Service::HID::PAD_L); | ||
| 163 | KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, Service::HID::PAD_X); | ||
| 164 | KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, Service::HID::PAD_Y); | ||
| 165 | |||
| 166 | KeyMap::SetKeyMapping({Settings::values.pad_zl_key, keyboard_id}, Service::HID::PAD_ZL); | ||
| 167 | KeyMap::SetKeyMapping({Settings::values.pad_zr_key, keyboard_id}, Service::HID::PAD_ZR); | ||
| 168 | |||
| 169 | // KeyMap::SetKeyMapping({Settings::values.pad_touch_key, keyboard_id}, Service::HID::PAD_TOUCH); | ||
| 170 | |||
| 171 | KeyMap::SetKeyMapping({Settings::values.pad_cright_key, keyboard_id}, Service::HID::PAD_C_RIGHT); | ||
| 172 | KeyMap::SetKeyMapping({Settings::values.pad_cleft_key, keyboard_id}, Service::HID::PAD_C_LEFT); | ||
| 173 | KeyMap::SetKeyMapping({Settings::values.pad_cup_key, keyboard_id}, Service::HID::PAD_C_UP); | ||
| 174 | KeyMap::SetKeyMapping({Settings::values.pad_cdown_key, keyboard_id}, Service::HID::PAD_C_DOWN); | ||
| 175 | KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, Service::HID::PAD_CIRCLE_RIGHT); | ||
| 176 | KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, Service::HID::PAD_CIRCLE_LEFT); | ||
| 177 | KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, Service::HID::PAD_CIRCLE_UP); | ||
| 178 | KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, Service::HID::PAD_CIRCLE_DOWN); | ||
| 179 | } | 156 | } |
| 180 | 157 | ||
| 181 | void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { | 158 | void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { |
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index fa7bce466..b12bd858b 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -248,32 +248,9 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) | |||
| 248 | 248 | ||
| 249 | void GRenderWindow::ReloadSetKeymaps() | 249 | void GRenderWindow::ReloadSetKeymaps() |
| 250 | { | 250 | { |
| 251 | KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, Service::HID::PAD_A); | 251 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 252 | KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, Service::HID::PAD_B); | 252 | KeyMap::SetKeyMapping({Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, Service::HID::pad_mapping[i]); |
| 253 | KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, Service::HID::PAD_SELECT); | 253 | } |
| 254 | KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, Service::HID::PAD_START); | ||
| 255 | KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, Service::HID::PAD_RIGHT); | ||
| 256 | KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, Service::HID::PAD_LEFT); | ||
| 257 | KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, Service::HID::PAD_UP); | ||
| 258 | KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, Service::HID::PAD_DOWN); | ||
| 259 | KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, Service::HID::PAD_R); | ||
| 260 | KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, Service::HID::PAD_L); | ||
| 261 | KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, Service::HID::PAD_X); | ||
| 262 | KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, Service::HID::PAD_Y); | ||
| 263 | |||
| 264 | KeyMap::SetKeyMapping({Settings::values.pad_zl_key, keyboard_id}, Service::HID::PAD_ZL); | ||
| 265 | KeyMap::SetKeyMapping({Settings::values.pad_zr_key, keyboard_id}, Service::HID::PAD_ZR); | ||
| 266 | |||
| 267 | // KeyMap::SetKeyMapping({Settings::values.pad_touch_key, keyboard_id}, Service::HID::PAD_TOUCH); | ||
| 268 | |||
| 269 | KeyMap::SetKeyMapping({Settings::values.pad_cright_key, keyboard_id}, Service::HID::PAD_C_RIGHT); | ||
| 270 | KeyMap::SetKeyMapping({Settings::values.pad_cleft_key, keyboard_id}, Service::HID::PAD_C_LEFT); | ||
| 271 | KeyMap::SetKeyMapping({Settings::values.pad_cup_key, keyboard_id}, Service::HID::PAD_C_UP); | ||
| 272 | KeyMap::SetKeyMapping({Settings::values.pad_cdown_key, keyboard_id}, Service::HID::PAD_C_DOWN); | ||
| 273 | KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, Service::HID::PAD_CIRCLE_RIGHT); | ||
| 274 | KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, Service::HID::PAD_CIRCLE_LEFT); | ||
| 275 | KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, Service::HID::PAD_CIRCLE_UP); | ||
| 276 | KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, Service::HID::PAD_CIRCLE_DOWN); | ||
| 277 | } | 254 | } |
| 278 | 255 | ||
| 279 | void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) | 256 | void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 5c056446e..e65b98b69 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -21,31 +21,21 @@ Config::Config() { | |||
| 21 | Reload(); | 21 | Reload(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | static const std::array<QVariant, Settings::NativeInput::NUM_INPUTS> defaults = { | ||
| 25 | Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, | ||
| 26 | Qt::Key_Q, Qt::Key_W, Qt::Key_1, Qt::Key_2, | ||
| 27 | Qt::Key_M, Qt::Key_N, Qt::Key_B, | ||
| 28 | Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H, | ||
| 29 | Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, | ||
| 30 | Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L | ||
| 31 | }; | ||
| 32 | |||
| 24 | void Config::ReadValues() { | 33 | void Config::ReadValues() { |
| 25 | qt_config->beginGroup("Controls"); | 34 | qt_config->beginGroup("Controls"); |
| 26 | Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt(); | 35 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 27 | Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt(); | 36 | Settings::values.input_mappings[Settings::NativeInput::All[i]] = |
| 28 | Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt(); | 37 | qt_config->value(QString::fromStdString(Settings::NativeInput::Mapping[i]), defaults[i]).toInt(); |
| 29 | Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt(); | 38 | } |
| 30 | Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt(); | ||
| 31 | Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt(); | ||
| 32 | Settings::values.pad_zl_key = qt_config->value("pad_zl", Qt::Key_1).toInt(); | ||
| 33 | Settings::values.pad_zr_key = qt_config->value("pad_zr", Qt::Key_2).toInt(); | ||
| 34 | Settings::values.pad_start_key = qt_config->value("pad_start", Qt::Key_M).toInt(); | ||
| 35 | Settings::values.pad_select_key = qt_config->value("pad_select", Qt::Key_N).toInt(); | ||
| 36 | Settings::values.pad_home_key = qt_config->value("pad_home", Qt::Key_B).toInt(); | ||
| 37 | Settings::values.pad_dup_key = qt_config->value("pad_dup", Qt::Key_T).toInt(); | ||
| 38 | Settings::values.pad_ddown_key = qt_config->value("pad_ddown", Qt::Key_G).toInt(); | ||
| 39 | Settings::values.pad_dleft_key = qt_config->value("pad_dleft", Qt::Key_F).toInt(); | ||
| 40 | Settings::values.pad_dright_key = qt_config->value("pad_dright", Qt::Key_H).toInt(); | ||
| 41 | Settings::values.pad_sup_key = qt_config->value("pad_sup", Qt::Key_Up).toInt(); | ||
| 42 | Settings::values.pad_sdown_key = qt_config->value("pad_sdown", Qt::Key_Down).toInt(); | ||
| 43 | Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt(); | ||
| 44 | Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt(); | ||
| 45 | Settings::values.pad_cup_key = qt_config->value("pad_cup", Qt::Key_I).toInt(); | ||
| 46 | Settings::values.pad_cdown_key = qt_config->value("pad_cdown", Qt::Key_K).toInt(); | ||
| 47 | Settings::values.pad_cleft_key = qt_config->value("pad_cleft", Qt::Key_J).toInt(); | ||
| 48 | Settings::values.pad_cright_key = qt_config->value("pad_cright", Qt::Key_L).toInt(); | ||
| 49 | qt_config->endGroup(); | 39 | qt_config->endGroup(); |
| 50 | 40 | ||
| 51 | qt_config->beginGroup("Core"); | 41 | qt_config->beginGroup("Core"); |
| @@ -75,29 +65,9 @@ void Config::ReadValues() { | |||
| 75 | 65 | ||
| 76 | void Config::SaveValues() { | 66 | void Config::SaveValues() { |
| 77 | qt_config->beginGroup("Controls"); | 67 | qt_config->beginGroup("Controls"); |
| 78 | qt_config->setValue("pad_a", Settings::values.pad_a_key); | 68 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 79 | qt_config->setValue("pad_b", Settings::values.pad_b_key); | 69 | qt_config->setValue(QString::fromStdString(Settings::NativeInput::Mapping[i]), Settings::NativeInput::All[i]); |
| 80 | qt_config->setValue("pad_x", Settings::values.pad_x_key); | 70 | } |
| 81 | qt_config->setValue("pad_y", Settings::values.pad_y_key); | ||
| 82 | qt_config->setValue("pad_l", Settings::values.pad_l_key); | ||
| 83 | qt_config->setValue("pad_r", Settings::values.pad_r_key); | ||
| 84 | qt_config->setValue("pad_zl", Settings::values.pad_zl_key); | ||
| 85 | qt_config->setValue("pad_zr", Settings::values.pad_zr_key); | ||
| 86 | qt_config->setValue("pad_start", Settings::values.pad_start_key); | ||
| 87 | qt_config->setValue("pad_select", Settings::values.pad_select_key); | ||
| 88 | qt_config->setValue("pad_home", Settings::values.pad_home_key); | ||
| 89 | qt_config->setValue("pad_dup", Settings::values.pad_dup_key); | ||
| 90 | qt_config->setValue("pad_ddown", Settings::values.pad_ddown_key); | ||
| 91 | qt_config->setValue("pad_dleft", Settings::values.pad_dleft_key); | ||
| 92 | qt_config->setValue("pad_dright", Settings::values.pad_dright_key); | ||
| 93 | qt_config->setValue("pad_sup", Settings::values.pad_sup_key); | ||
| 94 | qt_config->setValue("pad_sdown", Settings::values.pad_sdown_key); | ||
| 95 | qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key); | ||
| 96 | qt_config->setValue("pad_sright", Settings::values.pad_sright_key); | ||
| 97 | qt_config->setValue("pad_cup", Settings::values.pad_cup_key); | ||
| 98 | qt_config->setValue("pad_cdown", Settings::values.pad_cdown_key); | ||
| 99 | qt_config->setValue("pad_cleft", Settings::values.pad_cleft_key); | ||
| 100 | qt_config->setValue("pad_cright", Settings::values.pad_cright_key); | ||
| 101 | qt_config->endGroup(); | 71 | qt_config->endGroup(); |
| 102 | 72 | ||
| 103 | qt_config->beginGroup("Core"); | 73 | qt_config->beginGroup("Core"); |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 70caa7d80..c35b13b25 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -35,6 +35,16 @@ static Kernel::SharedPtr<Kernel::Event> event_debug_pad; | |||
| 35 | static u32 next_pad_index; | 35 | static u32 next_pad_index; |
| 36 | static u32 next_touch_index; | 36 | static u32 next_touch_index; |
| 37 | 37 | ||
| 38 | const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping = { | ||
| 39 | Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y, | ||
| 40 | Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR, | ||
| 41 | Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE, | ||
| 42 | Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT, | ||
| 43 | Service::HID::PAD_CIRCLE_UP, Service::HID::PAD_CIRCLE_DOWN, Service::HID::PAD_CIRCLE_LEFT, Service::HID::PAD_CIRCLE_RIGHT, | ||
| 44 | Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT | ||
| 45 | }; | ||
| 46 | |||
| 47 | |||
| 38 | // TODO(peachum): | 48 | // TODO(peachum): |
| 39 | // Add a method for setting analog input from joystick device for the circle Pad. | 49 | // Add a method for setting analog input from joystick device for the circle Pad. |
| 40 | // | 50 | // |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index d50d479f8..517f4f2ae 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #ifndef _MSC_VER | 9 | #ifndef _MSC_VER |
| 10 | #include <cstddef> | 10 | #include <cstddef> |
| 11 | #endif | 11 | #endif |
| 12 | 12 | #include "core/settings.h" | |
| 13 | #include "common/bit_field.h" | 13 | #include "common/bit_field.h" |
| 14 | #include "common/common_funcs.h" | 14 | #include "common/common_funcs.h" |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| @@ -157,6 +157,9 @@ const PadState PAD_CIRCLE_LEFT = {{1u << 29}}; | |||
| 157 | const PadState PAD_CIRCLE_UP = {{1u << 30}}; | 157 | const PadState PAD_CIRCLE_UP = {{1u << 30}}; |
| 158 | const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; | 158 | const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; |
| 159 | 159 | ||
| 160 | |||
| 161 | extern const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping; | ||
| 162 | |||
| 160 | /** | 163 | /** |
| 161 | * HID::GetIPCHandles service function | 164 | * HID::GetIPCHandles service function |
| 162 | * Inputs: | 165 | * Inputs: |
diff --git a/src/core/settings.h b/src/core/settings.h index 5a70d157a..2775ee257 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -5,34 +5,42 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include <array> | ||
| 8 | 9 | ||
| 9 | namespace Settings { | 10 | namespace Settings { |
| 10 | 11 | ||
| 12 | namespace NativeInput { | ||
| 13 | enum Values { | ||
| 14 | A, B, X, Y, | ||
| 15 | L, R, ZL, ZR, | ||
| 16 | START, SELECT, HOME, | ||
| 17 | DUP, DDOWN, DLEFT, DRIGHT, | ||
| 18 | SUP, SDOWN, SLEFT, SRIGHT, | ||
| 19 | CUP, CDOWN, CLEFT, CRIGHT, | ||
| 20 | NUM_INPUTS | ||
| 21 | }; | ||
| 22 | static const std::array<const char*, NUM_INPUTS> Mapping = { | ||
| 23 | "pad_a", "pad_b", "pad_x", "pad_y", | ||
| 24 | "pad_l", "pad_r", "pad_zl", "pad_zr", | ||
| 25 | "pad_start", "pad_select", "pad_home", | ||
| 26 | "pad_dup", "pad_ddown", "pad_dleft", "pad_dright", | ||
| 27 | "pad_sup", "pad_sdown", "pad_sleft", "pad_sright", | ||
| 28 | "pad_cup", "pad_cdown", "pad_cleft", "pad_cright" | ||
| 29 | }; | ||
| 30 | static const std::array<Values, NUM_INPUTS> All = { | ||
| 31 | A, B, X, Y, | ||
| 32 | L, R, ZL, ZR, | ||
| 33 | START, SELECT, HOME, | ||
| 34 | DUP, DDOWN, DLEFT, DRIGHT, | ||
| 35 | SUP, SDOWN, SLEFT, SRIGHT, | ||
| 36 | CUP, CDOWN, CLEFT, CRIGHT | ||
| 37 | }; | ||
| 38 | } | ||
| 39 | |||
| 40 | |||
| 11 | struct Values { | 41 | struct Values { |
| 12 | // Controls | 42 | // Controls |
| 13 | int pad_a_key; | 43 | std::array<int, NativeInput::NUM_INPUTS> input_mappings; |
| 14 | int pad_b_key; | ||
| 15 | int pad_x_key; | ||
| 16 | int pad_y_key; | ||
| 17 | int pad_l_key; | ||
| 18 | int pad_r_key; | ||
| 19 | int pad_zl_key; | ||
| 20 | int pad_zr_key; | ||
| 21 | int pad_start_key; | ||
| 22 | int pad_select_key; | ||
| 23 | int pad_home_key; | ||
| 24 | int pad_dup_key; | ||
| 25 | int pad_ddown_key; | ||
| 26 | int pad_dleft_key; | ||
| 27 | int pad_dright_key; | ||
| 28 | int pad_sup_key; | ||
| 29 | int pad_sdown_key; | ||
| 30 | int pad_sleft_key; | ||
| 31 | int pad_sright_key; | ||
| 32 | int pad_cup_key; | ||
| 33 | int pad_cdown_key; | ||
| 34 | int pad_cleft_key; | ||
| 35 | int pad_cright_key; | ||
| 36 | 44 | ||
| 37 | // Core | 45 | // Core |
| 38 | int frame_skip; | 46 | int frame_skip; |