summaryrefslogtreecommitdiff
path: root/src/citra/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra/config.cpp')
-rw-r--r--src/citra/config.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 1378567c1..2c1407a6f 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -2,7 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#define GLFW_INCLUDE_NONE
5#include <GLFW/glfw3.h> 6#include <GLFW/glfw3.h>
7#include <inih/cpp/INIReader.h>
6 8
7#include "citra/default_ini.h" 9#include "citra/default_ini.h"
8 10
@@ -10,7 +12,6 @@
10#include "common/logging/log.h" 12#include "common/logging/log.h"
11 13
12#include "core/settings.h" 14#include "core/settings.h"
13#include "core/core.h"
14 15
15#include "config.h" 16#include "config.h"
16 17
@@ -39,31 +40,21 @@ bool Config::LoadINI(INIReader* config, const char* location, const std::string&
39 return true; 40 return true;
40} 41}
41 42
43static 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
42void Config::ReadValues() { 52void Config::ReadValues() {
43 // Controls 53 // Controls
44 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) {
45 Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S); 55 Settings::values.input_mappings[Settings::NativeInput::All[i]] =
46 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]);
47 Settings::values.pad_y_key = glfw_config->GetInteger("Controls", "pad_y", GLFW_KEY_X); 57 }
48 Settings::values.pad_l_key = glfw_config->GetInteger("Controls", "pad_l", GLFW_KEY_Q);
49 Settings::values.pad_r_key = glfw_config->GetInteger("Controls", "pad_r", GLFW_KEY_W);
50 Settings::values.pad_zl_key = glfw_config->GetInteger("Controls", "pad_zl", GLFW_KEY_1);
51 Settings::values.pad_zr_key = glfw_config->GetInteger("Controls", "pad_zr", GLFW_KEY_2);
52 Settings::values.pad_start_key = glfw_config->GetInteger("Controls", "pad_start", GLFW_KEY_M);
53 Settings::values.pad_select_key = glfw_config->GetInteger("Controls", "pad_select", GLFW_KEY_N);
54 Settings::values.pad_home_key = glfw_config->GetInteger("Controls", "pad_home", GLFW_KEY_B);
55 Settings::values.pad_dup_key = glfw_config->GetInteger("Controls", "pad_dup", GLFW_KEY_T);
56 Settings::values.pad_ddown_key = glfw_config->GetInteger("Controls", "pad_ddown", GLFW_KEY_G);
57 Settings::values.pad_dleft_key = glfw_config->GetInteger("Controls", "pad_dleft", GLFW_KEY_F);
58 Settings::values.pad_dright_key = glfw_config->GetInteger("Controls", "pad_dright", GLFW_KEY_H);
59 Settings::values.pad_sup_key = glfw_config->GetInteger("Controls", "pad_sup", GLFW_KEY_UP);
60 Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
61 Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
62 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
63 Settings::values.pad_cup_key = glfw_config->GetInteger("Controls", "pad_cup", GLFW_KEY_I);
64 Settings::values.pad_cdown_key = glfw_config->GetInteger("Controls", "pad_cdown", GLFW_KEY_K);
65 Settings::values.pad_cleft_key = glfw_config->GetInteger("Controls", "pad_cleft", GLFW_KEY_J);
66 Settings::values.pad_cright_key = glfw_config->GetInteger("Controls", "pad_cright", GLFW_KEY_L);
67 58
68 // Core 59 // Core
69 Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); 60 Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0);