diff options
Diffstat (limited to 'src/citra/config.cpp')
| -rw-r--r-- | src/citra/config.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index f45d09fc2..2bf0dff35 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 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 | #include <GLFW/glfw3.h> | 5 | #include <GLFW/glfw3.h> |
| @@ -22,21 +22,22 @@ Config::Config() { | |||
| 22 | bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) { | 22 | bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) { |
| 23 | if (config->ParseError() < 0) { | 23 | if (config->ParseError() < 0) { |
| 24 | if (retry) { | 24 | if (retry) { |
| 25 | ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location); | 25 | LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location); |
| 26 | FileUtil::CreateFullPath(location); | 26 | FileUtil::CreateFullPath(location); |
| 27 | FileUtil::WriteStringToFile(true, default_contents, location); | 27 | FileUtil::WriteStringToFile(true, default_contents, location); |
| 28 | *config = INIReader(location); // Reopen file | 28 | *config = INIReader(location); // Reopen file |
| 29 | 29 | ||
| 30 | return LoadINI(config, location, default_contents, false); | 30 | return LoadINI(config, location, default_contents, false); |
| 31 | } | 31 | } |
| 32 | ERROR_LOG(CONFIG, "Failed."); | 32 | LOG_ERROR(Config, "Failed."); |
| 33 | return false; | 33 | return false; |
| 34 | } | 34 | } |
| 35 | INFO_LOG(CONFIG, "Successfully loaded %s", location); | 35 | LOG_INFO(Config, "Successfully loaded %s", location); |
| 36 | return true; | 36 | return true; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void Config::ReadControls() { | 39 | void Config::ReadValues() { |
| 40 | // Controls | ||
| 40 | Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A); | 41 | Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A); |
| 41 | Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S); | 42 | Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S); |
| 42 | Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z); | 43 | Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z); |
| @@ -54,27 +55,22 @@ void Config::ReadControls() { | |||
| 54 | Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN); | 55 | Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN); |
| 55 | Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT); | 56 | Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT); |
| 56 | Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); | 57 | Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); |
| 57 | } | ||
| 58 | 58 | ||
| 59 | void Config::ReadCore() { | 59 | // Core |
| 60 | Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter); | 60 | Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter); |
| 61 | Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60); | 61 | Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30); |
| 62 | } | 62 | Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); |
| 63 | 63 | ||
| 64 | void Config::ReadData() { | 64 | // Data Storage |
| 65 | Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); | 65 | Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); |
| 66 | } | ||
| 67 | 66 | ||
| 68 | void Config::ReadMiscellaneous() { | 67 | // Miscellaneous |
| 69 | Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true); | 68 | Settings::values.log_filter = glfw_config->Get("Miscellaneous", "log_filter", "*:Info"); |
| 70 | } | 69 | } |
| 71 | 70 | ||
| 72 | void Config::Reload() { | 71 | void Config::Reload() { |
| 73 | LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); | 72 | LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); |
| 74 | ReadControls(); | 73 | ReadValues(); |
| 75 | ReadCore(); | ||
| 76 | ReadData(); | ||
| 77 | ReadMiscellaneous(); | ||
| 78 | } | 74 | } |
| 79 | 75 | ||
| 80 | Config::~Config() { | 76 | Config::~Config() { |