mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-11 15:52:58 +00:00
bis_factory: Add getters for NAND partition sizes
This commit is contained in:
parent
8abbc619a1
commit
e47b57a90f
|
@ -3,8 +3,12 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include "common/file_util.h"
|
||||||
|
#include "core/core.h"
|
||||||
#include "core/file_sys/bis_factory.h"
|
#include "core/file_sys/bis_factory.h"
|
||||||
|
#include "core/file_sys/mode.h"
|
||||||
#include "core/file_sys/registered_cache.h"
|
#include "core/file_sys/registered_cache.h"
|
||||||
|
#include "core/settings.h"
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
|
@ -104,4 +108,32 @@ VirtualDir BISFactory::GetImageDirectory() const {
|
||||||
return GetOrCreateDirectoryRelative(nand_root, "/user/Album");
|
return GetOrCreateDirectoryRelative(nand_root, "/user/Album");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 BISFactory::GetSystemNANDFreeSpace() const {
|
||||||
|
const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system");
|
||||||
|
if (sys_dir == nullptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return GetSystemNANDTotalSpace() - sys_dir->GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 BISFactory::GetSystemNANDTotalSpace() const {
|
||||||
|
return static_cast<u64>(Settings::values.nand_system_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 BISFactory::GetUserNANDFreeSpace() const {
|
||||||
|
const auto usr_dir = GetOrCreateDirectoryRelative(nand_root, "/user");
|
||||||
|
if (usr_dir == nullptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return GetUserNANDTotalSpace() - usr_dir->GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 BISFactory::GetUserNANDTotalSpace() const {
|
||||||
|
return static_cast<u64>(Settings::values.nand_user_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 BISFactory::GetFullNANDTotalSpace() const {
|
||||||
|
return static_cast<u64>(Settings::values.nand_total_size);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -55,6 +55,12 @@ public:
|
||||||
|
|
||||||
VirtualDir GetImageDirectory() const;
|
VirtualDir GetImageDirectory() const;
|
||||||
|
|
||||||
|
u64 GetSystemNANDFreeSpace() const;
|
||||||
|
u64 GetSystemNANDTotalSpace() const;
|
||||||
|
u64 GetUserNANDFreeSpace() const;
|
||||||
|
u64 GetUserNANDTotalSpace() const;
|
||||||
|
u64 GetFullNANDTotalSpace() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VirtualDir nand_root;
|
VirtualDir nand_root;
|
||||||
VirtualDir load_root;
|
VirtualDir load_root;
|
||||||
|
|
Loading…
Reference in a new issue