settings: Save and load NAND/SD dirs from config

This commit is contained in:
Zach Hilman 2018-09-01 14:49:07 -04:00
parent 9cfe2414cb
commit b2268f1f8d
3 changed files with 26 additions and 0 deletions

View file

@ -127,6 +127,8 @@ struct Values {
// Data Storage // Data Storage
bool use_virtual_sd; bool use_virtual_sd;
std::string nand_dir;
std::string sdmc_dir;
// Renderer // Renderer
float resolution_factor; float resolution_factor;

View file

@ -102,6 +102,20 @@ void Config::ReadValues() {
qt_config->beginGroup("Data Storage"); qt_config->beginGroup("Data Storage");
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
FileUtil::GetUserPath(
FileUtil::UserPath::NANDDir,
qt_config
->value("nand_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)))
.toString()
.toStdString());
FileUtil::GetUserPath(
FileUtil::UserPath::SDMCDir,
qt_config
->value("sdmc_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)))
.toString()
.toStdString());
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("System"); qt_config->beginGroup("System");
@ -222,6 +236,10 @@ void Config::SaveValues() {
qt_config->beginGroup("Data Storage"); qt_config->beginGroup("Data Storage");
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
qt_config->setValue("nand_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
qt_config->setValue("sdmc_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("System"); qt_config->beginGroup("System");

View file

@ -114,6 +114,12 @@ void Config::ReadValues() {
// Data Storage // Data Storage
Settings::values.use_virtual_sd = Settings::values.use_virtual_sd =
sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true);
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir,
sdl2_config->Get("Data Storage", "nand_directory",
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir,
sdl2_config->Get("Data Storage", "nand_directory",
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
// System // System
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);