summaryrefslogtreecommitdiff
path: root/src/citra/config.cpp
diff options
context:
space:
mode:
authorGravatar wwylele2017-01-21 11:53:03 +0200
committerGravatar wwylele2017-03-01 23:30:57 +0200
commit38e800f70d122051e12ac9f22e23d84b97fec424 (patch)
tree0f52b5731a4fd8e9f2a39e8e75d1fa18ce8b9107 /src/citra/config.cpp
parentHID: use AnalogDevice (diff)
downloadyuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.gz
yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.xz
yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.zip
InputCommon: add Keyboard
Diffstat (limited to 'src/citra/config.cpp')
-rw-r--r--src/citra/config.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index fac1c9a0e..818824596 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -10,6 +10,7 @@
10#include "common/logging/log.h" 10#include "common/logging/log.h"
11#include "config.h" 11#include "config.h"
12#include "core/settings.h" 12#include "core/settings.h"
13#include "input_common/main.h"
13 14
14Config::Config() { 15Config::Config() {
15 // TODO: Don't hardcode the path; let the frontend decide where to put the config files. 16 // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
@@ -37,25 +38,21 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
37 return true; 38 return true;
38} 39}
39 40
40static const std::array<int, Settings::NativeInput::NUM_INPUTS> defaults = { 41static const std::array<int, Settings::NativeButton::NumButtons> default_buttons = {
41 // directly mapped keys 42 SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_T,
42 SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_Q, SDL_SCANCODE_W, 43 SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_Q, SDL_SCANCODE_W,
43 SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_B, SDL_SCANCODE_T, 44 SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_B,
44 SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_I, SDL_SCANCODE_K, SDL_SCANCODE_J,
45 SDL_SCANCODE_L,
46
47 // indirectly mapped keys
48 SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_D,
49}; 45};
50 46
51void Config::ReadValues() { 47void Config::ReadValues() {
52 // Controls 48 // Controls
53 for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { 49 for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
54 Settings::values.input_mappings[Settings::NativeInput::All[i]] = 50 std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
55 sdl2_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[i]); 51 Settings::values.buttons[i] =
52 sdl2_config->Get("Controls", Settings::NativeButton::mapping[i], default_param);
53 if (Settings::values.buttons[i].empty())
54 Settings::values.buttons[i] = default_param;
56 } 55 }
57 Settings::values.pad_circle_modifier_scale =
58 (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5);
59 56
60 // Core 57 // Core
61 Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true); 58 Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true);