settings: Add options for setting storage sizes
This commit is contained in:
parent
c6ff4a6f4d
commit
918119ae1b
|
@ -346,6 +346,31 @@ struct TouchscreenInput {
|
|||
u32 rotation_angle;
|
||||
};
|
||||
|
||||
enum class NANDTotalSize : u64 {
|
||||
S29_1GB = 0x747C00000ULL,
|
||||
};
|
||||
|
||||
enum class NANDUserSize : u64 {
|
||||
S26GB = 0x680000000ULL,
|
||||
};
|
||||
|
||||
enum class NANDSystemSize : u64 {
|
||||
S2_5GB = 0xA0000000,
|
||||
};
|
||||
|
||||
enum class SDMCSize : u64 {
|
||||
S1GB = 0x40000000,
|
||||
S2GB = 0x80000000,
|
||||
S4GB = 0x100000000ULL,
|
||||
S8GB = 0x200000000ULL,
|
||||
S16GB = 0x400000000ULL,
|
||||
S32GB = 0x800000000ULL,
|
||||
S64GB = 0x1000000000ULL,
|
||||
S128GB = 0x2000000000ULL,
|
||||
S256GB = 0x4000000000ULL,
|
||||
S1TB = 0x10000000000ULL,
|
||||
};
|
||||
|
||||
struct Values {
|
||||
// System
|
||||
bool use_docked_mode;
|
||||
|
@ -384,6 +409,10 @@ struct Values {
|
|||
bool use_virtual_sd;
|
||||
std::string nand_dir;
|
||||
std::string sdmc_dir;
|
||||
NANDTotalSize nand_total_size;
|
||||
NANDSystemSize nand_system_size;
|
||||
NANDUserSize nand_user_size;
|
||||
SDMCSize sdmc_size;
|
||||
|
||||
// Renderer
|
||||
float resolution_factor;
|
||||
|
|
|
@ -459,6 +459,17 @@ void Config::ReadDataStorageValues() {
|
|||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)))
|
||||
.toString()
|
||||
.toStdString());
|
||||
Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(
|
||||
ReadSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::NANDTotalSize::S29_1GB))
|
||||
.toULongLong());
|
||||
Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(
|
||||
ReadSetting(QStringLiteral("nand_user_size"), static_cast<u64>(Settings::NANDUserSize::S26GB))
|
||||
.toULongLong());
|
||||
Settings::values.nand_system_size = static_cast<Settings::NANDSystemSize>(
|
||||
ReadSetting(QStringLiteral("nand_system_size"), static_cast<u64>(Settings::NANDSystemSize::S2_5GB))
|
||||
.toULongLong());
|
||||
Settings::values.sdmc_size = static_cast<Settings::SDMCSize>(
|
||||
ReadSetting(QStringLiteral("sdmc_size"), static_cast<u64>(Settings::SDMCSize::S16GB)).toULongLong());
|
||||
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
@ -875,7 +886,14 @@ void Config::SaveDataStorageValues() {
|
|||
WriteSetting(QStringLiteral("sdmc_directory"),
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)),
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
|
||||
|
||||
WriteSetting(QStringLiteral("nand_total_size"), static_cast<u64>(Settings::values.nand_total_size),
|
||||
static_cast<u64>(Settings::NANDTotalSize::S29_1GB));
|
||||
WriteSetting(QStringLiteral("nand_user_size"), static_cast<u64>(Settings::values.nand_user_size),
|
||||
static_cast<u64>(Settings::NANDUserSize::S26GB));
|
||||
WriteSetting(QStringLiteral("nand_system_size"), static_cast<u64>(Settings::values.nand_system_size),
|
||||
static_cast<u64>(Settings::NANDSystemSize::S2_5GB));
|
||||
WriteSetting(QStringLiteral("sdmc_size"), static_cast<u64>(Settings::values.sdmc_size),
|
||||
static_cast<u64>(Settings::SDMCSize::S16GB));
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
|
|
|
@ -316,6 +316,15 @@ void Config::ReadValues() {
|
|||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir,
|
||||
sdl2_config->Get("Data Storage", "sdmc_directory",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
|
||||
Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(sdl2_config->GetInteger(
|
||||
"Data Storage", "nand_total_size", static_cast<long>(Settings::NANDTotalSize::S29_1GB)));
|
||||
Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(sdl2_config->GetInteger(
|
||||
"Data Storage", "nand_user_size", static_cast<long>(Settings::NANDUserSize::S26GB)));
|
||||
Settings::values.nand_system_size = static_cast<Settings::NANDSystemSize>(
|
||||
sdl2_config->GetInteger("Data Storage", "nand_system_size",
|
||||
static_cast<long>(Settings::NANDSystemSize::S2_5GB)));
|
||||
Settings::values.sdmc_size = static_cast<Settings::SDMCSize>(sdl2_config->GetInteger(
|
||||
"Data Storage", "sdmc_size", static_cast<long>(Settings::SDMCSize::S16GB)));
|
||||
|
||||
// System
|
||||
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);
|
||||
|
|
Loading…
Reference in a new issue