diff options
Diffstat (limited to 'src/yuzu_cmd/config.cpp')
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 7773228c8..23448e747 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -16,9 +16,11 @@ | |||
| 16 | #include "yuzu_cmd/config.h" | 16 | #include "yuzu_cmd/config.h" |
| 17 | #include "yuzu_cmd/default_ini.h" | 17 | #include "yuzu_cmd/default_ini.h" |
| 18 | 18 | ||
| 19 | namespace FS = Common::FS; | ||
| 20 | |||
| 19 | Config::Config() { | 21 | Config::Config() { |
| 20 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 22 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. |
| 21 | sdl2_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "sdl2-config.ini"; | 23 | sdl2_config_loc = FS::GetUserPath(FS::UserPath::ConfigDir) + "sdl2-config.ini"; |
| 22 | sdl2_config = std::make_unique<INIReader>(sdl2_config_loc); | 24 | sdl2_config = std::make_unique<INIReader>(sdl2_config_loc); |
| 23 | 25 | ||
| 24 | Reload(); | 26 | Reload(); |
| @@ -31,8 +33,8 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) { | |||
| 31 | if (sdl2_config->ParseError() < 0) { | 33 | if (sdl2_config->ParseError() < 0) { |
| 32 | if (retry) { | 34 | if (retry) { |
| 33 | LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location); | 35 | LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location); |
| 34 | FileUtil::CreateFullPath(location); | 36 | FS::CreateFullPath(location); |
| 35 | FileUtil::WriteStringToFile(true, location, default_contents); | 37 | FS::WriteStringToFile(true, location, default_contents); |
| 36 | sdl2_config = std::make_unique<INIReader>(location); // Reopen file | 38 | sdl2_config = std::make_unique<INIReader>(location); // Reopen file |
| 37 | 39 | ||
| 38 | return LoadINI(default_contents, false); | 40 | return LoadINI(default_contents, false); |
| @@ -286,6 +288,10 @@ void Config::ReadValues() { | |||
| 286 | Settings::values.debug_pad_analogs[i] = default_param; | 288 | Settings::values.debug_pad_analogs[i] = default_param; |
| 287 | } | 289 | } |
| 288 | 290 | ||
| 291 | Settings::values.vibration_enabled = | ||
| 292 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true); | ||
| 293 | Settings::values.motion_enabled = | ||
| 294 | sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true); | ||
| 289 | Settings::values.touchscreen.enabled = | 295 | Settings::values.touchscreen.enabled = |
| 290 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); | 296 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); |
| 291 | Settings::values.touchscreen.device = | 297 | Settings::values.touchscreen.device = |
| @@ -315,21 +321,21 @@ void Config::ReadValues() { | |||
| 315 | // Data Storage | 321 | // Data Storage |
| 316 | Settings::values.use_virtual_sd = | 322 | Settings::values.use_virtual_sd = |
| 317 | sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); | 323 | sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); |
| 318 | FileUtil::GetUserPath(FileUtil::UserPath::NANDDir, | 324 | FS::GetUserPath( |
| 319 | sdl2_config->Get("Data Storage", "nand_directory", | 325 | FS::UserPath::NANDDir, |
| 320 | FileUtil::GetUserPath(FileUtil::UserPath::NANDDir))); | 326 | sdl2_config->Get("Data Storage", "nand_directory", FS::GetUserPath(FS::UserPath::NANDDir))); |
| 321 | FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir, | 327 | FS::GetUserPath( |
| 322 | sdl2_config->Get("Data Storage", "sdmc_directory", | 328 | FS::UserPath::SDMCDir, |
| 323 | FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); | 329 | sdl2_config->Get("Data Storage", "sdmc_directory", FS::GetUserPath(FS::UserPath::SDMCDir))); |
| 324 | FileUtil::GetUserPath(FileUtil::UserPath::LoadDir, | 330 | FS::GetUserPath( |
| 325 | sdl2_config->Get("Data Storage", "load_directory", | 331 | FS::UserPath::LoadDir, |
| 326 | FileUtil::GetUserPath(FileUtil::UserPath::LoadDir))); | 332 | sdl2_config->Get("Data Storage", "load_directory", FS::GetUserPath(FS::UserPath::LoadDir))); |
| 327 | FileUtil::GetUserPath(FileUtil::UserPath::DumpDir, | 333 | FS::GetUserPath( |
| 328 | sdl2_config->Get("Data Storage", "dump_directory", | 334 | FS::UserPath::DumpDir, |
| 329 | FileUtil::GetUserPath(FileUtil::UserPath::DumpDir))); | 335 | sdl2_config->Get("Data Storage", "dump_directory", FS::GetUserPath(FS::UserPath::DumpDir))); |
| 330 | FileUtil::GetUserPath(FileUtil::UserPath::CacheDir, | 336 | FS::GetUserPath(FS::UserPath::CacheDir, |
| 331 | sdl2_config->Get("Data Storage", "cache_directory", | 337 | sdl2_config->Get("Data Storage", "cache_directory", |
| 332 | FileUtil::GetUserPath(FileUtil::UserPath::CacheDir))); | 338 | FS::GetUserPath(FS::UserPath::CacheDir))); |
| 333 | Settings::values.gamecard_inserted = | 339 | Settings::values.gamecard_inserted = |
| 334 | sdl2_config->GetBoolean("Data Storage", "gamecard_inserted", false); | 340 | sdl2_config->GetBoolean("Data Storage", "gamecard_inserted", false); |
| 335 | Settings::values.gamecard_current_game = | 341 | Settings::values.gamecard_current_game = |
| @@ -394,6 +400,10 @@ void Config::ReadValues() { | |||
| 394 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "use_vsync", 1))); | 400 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "use_vsync", 1))); |
| 395 | Settings::values.use_assembly_shaders.SetValue( | 401 | Settings::values.use_assembly_shaders.SetValue( |
| 396 | sdl2_config->GetBoolean("Renderer", "use_assembly_shaders", false)); | 402 | sdl2_config->GetBoolean("Renderer", "use_assembly_shaders", false)); |
| 403 | Settings::values.use_asynchronous_shaders.SetValue( | ||
| 404 | sdl2_config->GetBoolean("Renderer", "use_asynchronous_shaders", false)); | ||
| 405 | Settings::values.use_asynchronous_shaders.SetValue( | ||
| 406 | sdl2_config->GetBoolean("Renderer", "use_asynchronous_shaders", false)); | ||
| 397 | Settings::values.use_fast_gpu_time.SetValue( | 407 | Settings::values.use_fast_gpu_time.SetValue( |
| 398 | sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true)); | 408 | sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true)); |
| 399 | 409 | ||