From 918119ae1b67ac96d91945660d71b530475204bc Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 23 Apr 2019 08:34:19 -0400 Subject: settings: Add options for setting storage sizes --- src/core/settings.h | 29 +++++++++++++++++++++++++++++ src/yuzu/configuration/config.cpp | 20 +++++++++++++++++++- src/yuzu_cmd/config.cpp | 9 +++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/settings.h b/src/core/settings.h index d4b70ec4c..51363fc51 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -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; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 3f54f54fb..bcd0c0b1b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -459,6 +459,17 @@ void Config::ReadDataStorageValues() { QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir))) .toString() .toStdString()); + Settings::values.nand_total_size = static_cast( + ReadSetting(QStringLiteral("nand_total_size"), static_cast(Settings::NANDTotalSize::S29_1GB)) + .toULongLong()); + Settings::values.nand_user_size = static_cast( + ReadSetting(QStringLiteral("nand_user_size"), static_cast(Settings::NANDUserSize::S26GB)) + .toULongLong()); + Settings::values.nand_system_size = static_cast( + ReadSetting(QStringLiteral("nand_system_size"), static_cast(Settings::NANDSystemSize::S2_5GB)) + .toULongLong()); + Settings::values.sdmc_size = static_cast( + ReadSetting(QStringLiteral("sdmc_size"), static_cast(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(Settings::values.nand_total_size), + static_cast(Settings::NANDTotalSize::S29_1GB)); + WriteSetting(QStringLiteral("nand_user_size"), static_cast(Settings::values.nand_user_size), + static_cast(Settings::NANDUserSize::S26GB)); + WriteSetting(QStringLiteral("nand_system_size"), static_cast(Settings::values.nand_system_size), + static_cast(Settings::NANDSystemSize::S2_5GB)); + WriteSetting(QStringLiteral("sdmc_size"), static_cast(Settings::values.sdmc_size), + static_cast(Settings::SDMCSize::S16GB)); qt_config->endGroup(); } diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 5cadfd191..60e2b2d1b 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -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(sdl2_config->GetInteger( + "Data Storage", "nand_total_size", static_cast(Settings::NANDTotalSize::S29_1GB))); + Settings::values.nand_user_size = static_cast(sdl2_config->GetInteger( + "Data Storage", "nand_user_size", static_cast(Settings::NANDUserSize::S26GB))); + Settings::values.nand_system_size = static_cast( + sdl2_config->GetInteger("Data Storage", "nand_system_size", + static_cast(Settings::NANDSystemSize::S2_5GB))); + Settings::values.sdmc_size = static_cast(sdl2_config->GetInteger( + "Data Storage", "sdmc_size", static_cast(Settings::SDMCSize::S16GB))); // System Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); -- cgit v1.2.3