diff options
author | wwylele <wwylele@gmail.com> | 2017-01-21 10:53:03 +0100 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-03-01 22:30:57 +0100 |
commit | 38e800f70d122051e12ac9f22e23d84b97fec424 (patch) | |
tree | 0f52b5731a4fd8e9f2a39e8e75d1fa18ce8b9107 /src/citra/config.cpp | |
parent | HID: use AnalogDevice (diff) | |
download | yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.gz yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.bz2 yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.lz yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.xz yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.zst yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra/config.cpp | 25 |
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 @@ #include "common/logging/log.h" #include "config.h" #include "core/settings.h" +#include "input_common/main.h" Config::Config() { // 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) { return true; } -static const std::array<int, Settings::NativeInput::NUM_INPUTS> defaults = { - // directly mapped keys - SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_Q, SDL_SCANCODE_W, - SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_B, SDL_SCANCODE_T, - SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_I, SDL_SCANCODE_K, SDL_SCANCODE_J, - SDL_SCANCODE_L, - - // indirectly mapped keys - SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_D, +static const std::array<int, Settings::NativeButton::NumButtons> default_buttons = { + SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_T, + SDL_SCANCODE_G, SDL_SCANCODE_F, SDL_SCANCODE_H, SDL_SCANCODE_Q, SDL_SCANCODE_W, + SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_B, }; void Config::ReadValues() { // Controls - for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { - Settings::values.input_mappings[Settings::NativeInput::All[i]] = - sdl2_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[i]); + for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { + std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); + Settings::values.buttons[i] = + sdl2_config->Get("Controls", Settings::NativeButton::mapping[i], default_param); + if (Settings::values.buttons[i].empty()) + Settings::values.buttons[i] = default_param; } - Settings::values.pad_circle_modifier_scale = - (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5); // Core Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true); |