bis_factory: Use hardware default NAND partition sizes

Sets the total space of user and system partitions to their hardware defaults.
Furthermore, return the total space as free space for the user partition to prevent it from reaching zero.
Some games like Bioshock 2 check for the available free space prior to save creation, and we should not be limited by arbitrary limits.
This commit is contained in:
Morph 2020-07-09 12:29:12 -04:00
parent 47e26d7bc7
commit 0373ead96e

View file

@ -12,6 +12,10 @@
namespace FileSys { namespace FileSys {
constexpr u64 NAND_USER_SIZE = 0x680000000; // 26624 MiB
constexpr u64 NAND_SYSTEM_SIZE = 0xA0000000; // 2560 MiB
constexpr u64 NAND_TOTAL_SIZE = 0x747C00000; // 29820 MiB
BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_) BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_)
: nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)),
dump_root(std::move(dump_root_)), dump_root(std::move(dump_root_)),
@ -110,30 +114,27 @@ VirtualDir BISFactory::GetImageDirectory() const {
u64 BISFactory::GetSystemNANDFreeSpace() const { u64 BISFactory::GetSystemNANDFreeSpace() const {
const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system"); const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system");
if (sys_dir == nullptr) if (sys_dir == nullptr) {
return 0; return GetSystemNANDTotalSpace();
}
return GetSystemNANDTotalSpace() - sys_dir->GetSize(); return GetSystemNANDTotalSpace() - sys_dir->GetSize();
} }
u64 BISFactory::GetSystemNANDTotalSpace() const { u64 BISFactory::GetSystemNANDTotalSpace() const {
return static_cast<u64>(Settings::values.nand_system_size); return NAND_SYSTEM_SIZE;
} }
u64 BISFactory::GetUserNANDFreeSpace() const { u64 BISFactory::GetUserNANDFreeSpace() const {
const auto usr_dir = GetOrCreateDirectoryRelative(nand_root, "/user"); return GetUserNANDTotalSpace();
if (usr_dir == nullptr)
return 0;
return GetUserNANDTotalSpace() - usr_dir->GetSize();
} }
u64 BISFactory::GetUserNANDTotalSpace() const { u64 BISFactory::GetUserNANDTotalSpace() const {
return static_cast<u64>(Settings::values.nand_user_size); return NAND_USER_SIZE;
} }
u64 BISFactory::GetFullNANDTotalSpace() const { u64 BISFactory::GetFullNANDTotalSpace() const {
return static_cast<u64>(Settings::values.nand_total_size); return NAND_TOTAL_SIZE;
} }
VirtualDir BISFactory::GetBCATDirectory(u64 title_id) const { VirtualDir BISFactory::GetBCATDirectory(u64 title_id) const {