settings: Add options for managing gamecard emulation

This commit is contained in:
Zach Hilman 2019-04-23 08:35:12 -04:00
parent 918119ae1b
commit 2590b5a9ea
4 changed files with 67 additions and 2 deletions

View file

@ -407,8 +407,9 @@ struct Values {
// Data Storage // Data Storage
bool use_virtual_sd; bool use_virtual_sd;
std::string nand_dir; bool gamecard_inserted;
std::string sdmc_dir; bool gamecard_current_game;
std::string gamecard_path;
NANDTotalSize nand_total_size; NANDTotalSize nand_total_size;
NANDSystemSize nand_system_size; NANDSystemSize nand_system_size;
NANDUserSize nand_user_size; NANDUserSize nand_user_size;

View file

@ -459,6 +459,30 @@ void Config::ReadDataStorageValues() {
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))) QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)))
.toString() .toString()
.toStdString()); .toStdString());
FileUtil::GetUserPath(
FileUtil::UserPath::LoadDir,
qt_config
->value("load_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir)))
.toString()
.toStdString());
FileUtil::GetUserPath(
FileUtil::UserPath::DumpDir,
qt_config
->value("dump_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir)))
.toString()
.toStdString());
FileUtil::GetUserPath(
FileUtil::UserPath::CacheDir,
qt_config
->value("cache_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir)))
.toString()
.toStdString());
Settings::values.gamecard_inserted = ReadSetting("gamecard_inserted", false).toBool();
Settings::values.gamecard_current_game = ReadSetting("gamecard_current_game", false).toBool();
Settings::values.gamecard_path = ReadSetting("gamecard_path", "").toString().toStdString();
Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>( Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(
ReadSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::NANDTotalSize::S29_1GB)) ReadSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::NANDTotalSize::S29_1GB))
.toULongLong()); .toULongLong());
@ -886,6 +910,18 @@ void Config::SaveDataStorageValues() {
WriteSetting(QStringLiteral("sdmc_directory"), WriteSetting(QStringLiteral("sdmc_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)), QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
WriteSetting(QStringLiteral("load_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir)),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir)));
WriteSetting(QStringLiteral("dump_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir)),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir)));
WriteSetting(QStringLiteral("cache_directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir)),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::CacheDir)));
WriteSetting(QStringLiteral("gamecard_inserted"), Settings::values.gamecard_inserted, false);
WriteSetting(QStringLiteral("gamecard_current_game"), Settings::values.gamecard_current_game, false);
WriteSetting(QStringLiteral("gamecard_path"), QString::fromStdString(Settings::values.gamecard_path), "");
WriteSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::values.nand_total_size), WriteSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::values.nand_total_size),
static_cast<u64>(Settings::NANDTotalSize::S29_1GB)); static_cast<u64>(Settings::NANDTotalSize::S29_1GB));
WriteSetting(QStringLiteral("nand_user_size"), static_cast<u64>(Settings::values.nand_user_size), WriteSetting(QStringLiteral("nand_user_size"), static_cast<u64>(Settings::values.nand_user_size),

View file

@ -316,6 +316,20 @@ void Config::ReadValues() {
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir, FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir,
sdl2_config->Get("Data Storage", "sdmc_directory", sdl2_config->Get("Data Storage", "sdmc_directory",
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))); FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir,
sdl2_config->Get("Data Storage", "load_directory",
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir)));
FileUtil::GetUserPath(FileUtil::UserPath::DumpDir,
sdl2_config->Get("Data Storage", "dump_directory",
FileUtil::GetUserPath(FileUtil::UserPath::DumpDir)));
FileUtil::GetUserPath(FileUtil::UserPath::CacheDir,
sdl2_config->Get("Data Storage", "cache_directory",
FileUtil::GetUserPath(FileUtil::UserPath::CacheDir)));
Settings::values.gamecard_inserted =
sdl2_config->GetBoolean("Data Storage", "gamecard_inserted", false);
Settings::values.gamecard_current_game =
sdl2_config->GetBoolean("Data Storage", "gamecard_current_game", false);
Settings::values.gamecard_path = sdl2_config->Get("Data Storage", "gamecard_path", "");
Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(sdl2_config->GetInteger( Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(sdl2_config->GetInteger(
"Data Storage", "nand_total_size", static_cast<long>(Settings::NANDTotalSize::S29_1GB))); "Data Storage", "nand_total_size", static_cast<long>(Settings::NANDTotalSize::S29_1GB)));
Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(sdl2_config->GetInteger( Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(sdl2_config->GetInteger(

View file

@ -173,6 +173,20 @@ volume =
# 1 (default): Yes, 0: No # 1 (default): Yes, 0: No
use_virtual_sd = use_virtual_sd =
# Whether or not to enable gamecard emulation
# 1: Yes, 0 (default): No
gamecard_inserted =
# Whether or not the gamecard should be emulated as the current game
# If 'gamecard_inserted' is 0 this setting is irrelevant
# 1: Yes, 0 (default): No
gamecard_current_game =
# Path to an XCI file to use as the gamecard
# If 'gamecard_inserted' is 0 this setting is irrelevant
# If 'gamecard_current_game' is 1 this setting is irrelevant
gamecard_path =
[System] [System]
# Whether the system is docked # Whether the system is docked
# 1: Yes, 0 (default): No # 1: Yes, 0 (default): No