settings: Save and load NAND/SD dirs from config

This commit is contained in:
Daniel Méndez 2021-04-08 00:20:52 +02:00
parent b3cab3c450
commit 49c0766b73
3 changed files with 18 additions and 0 deletions

View File

@ -201,6 +201,10 @@ 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);
Settings::values.nand_dir =
sdl2_config->Get("Data Storage", "nand_directory", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir));
Settings::values.sdmc_dir =
sdl2_config->Get("Data Storage", "sdmc_directory", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir));
// System // System
Settings::values.is_new_3ds = sdl2_config->GetBoolean("System", "is_new_3ds", true); Settings::values.is_new_3ds = sdl2_config->GetBoolean("System", "is_new_3ds", true);

View File

@ -302,6 +302,14 @@ void Config::ReadDataStorageValues() {
qt_config->beginGroup(QStringLiteral("Data Storage")); qt_config->beginGroup(QStringLiteral("Data Storage"));
Settings::values.use_virtual_sd = ReadSetting(QStringLiteral("use_virtual_sd"), true).toBool(); Settings::values.use_virtual_sd = ReadSetting(QStringLiteral("use_virtual_sd"), true).toBool();
std::string nan_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
Settings::values.nand_dir = ReadSetting(QStringLiteral("nand_directory"), QString::fromStdString(nan_dir))
.toString()
.toStdString();
std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
Settings::values.sdmc_dir = ReadSetting(QStringLiteral("sdmc_directory"), QString::fromStdString(sdmc_dir))
.toString()
.toStdString();
qt_config->endGroup(); qt_config->endGroup();
} }
@ -852,6 +860,10 @@ void Config::SaveDataStorageValues() {
qt_config->beginGroup(QStringLiteral("Data Storage")); qt_config->beginGroup(QStringLiteral("Data Storage"));
WriteSetting(QStringLiteral("use_virtual_sd"), Settings::values.use_virtual_sd, true); WriteSetting(QStringLiteral("use_virtual_sd"), Settings::values.use_virtual_sd, true);
WriteSetting(QStringLiteral("nand_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
WriteSetting(QStringLiteral("sdmc_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
qt_config->endGroup(); qt_config->endGroup();
} }

View File

@ -140,6 +140,8 @@ struct Values {
// Data Storage // Data Storage
bool use_virtual_sd; bool use_virtual_sd;
std::string nand_dir;
std::string sdmc_dir;
// System // System
int region_value; int region_value;