summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-04-10 18:07:29 +0200
committerZach Hilman <zachhilman@gmail.com>2019-09-21 22:43:10 +0200
commit3a1899d143b6b50da6c1ed4fcc03390ef210df75 (patch)
treea7b0d364e6e601f8d10a98e01b467b6e8ba337e4
parentMerge pull request #2885 from Hexagon12/port-4944 (diff)
downloadyuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar.gz
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar.bz2
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar.lz
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar.xz
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.tar.zst
yuzu-3a1899d143b6b50da6c1ed4fcc03390ef210df75.zip
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/bis_factory.cpp41
-rw-r--r--src/core/file_sys/bis_factory.h20
2 files changed, 61 insertions, 0 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp
index e29f70b3a..70a04f6a0 100644
--- a/src/core/file_sys/bis_factory.cpp
+++ b/src/core/file_sys/bis_factory.cpp
@@ -39,4 +39,45 @@ VirtualDir BISFactory::GetModificationDumpRoot(u64 title_id) const {
return GetOrCreateDirectoryRelative(dump_root, fmt::format("/{:016X}", title_id));
}
+VirtualDir BISFactory::OpenPartition(BisPartitionId id) const {
+ switch (id) {
+ case BisPartitionId::CalibrationFile:
+ return GetOrCreateDirectoryRelative(nand_root, "/prodinfof");
+ case BisPartitionId::SafeMode:
+ return GetOrCreateDirectoryRelative(nand_root, "/safe");
+ case BisPartitionId::System:
+ return GetOrCreateDirectoryRelative(nand_root, "/system");
+ case BisPartitionId::User:
+ return GetOrCreateDirectoryRelative(nand_root, "/user");
+ default:
+ return nullptr;
+ }
+}
+
+VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id) const {
+ Core::Crypto::KeyManager keys;
+ Core::Crypto::PartitionDataManager pdm{
+ Core::System::GetInstance().GetFilesystem()->OpenDirectory(
+ FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), Mode::Read)};
+ keys.PopulateFromPartitionData(pdm);
+
+ switch (id) {
+ case BisPartitionId::CalibrationBinary:
+ return pdm.GetDecryptedProdInfo();
+ case BisPartitionId::BootConfigAndPackage2Part1:
+ case BisPartitionId::BootConfigAndPackage2Part2:
+ case BisPartitionId::BootConfigAndPackage2Part3:
+ case BisPartitionId::BootConfigAndPackage2Part4:
+ case BisPartitionId::BootConfigAndPackage2Part5:
+ case BisPartitionId::BootConfigAndPackage2Part6: {
+ const auto new_id = static_cast<u8>(id) -
+ static_cast<u8>(BisPartitionId::BootConfigAndPackage2Part1) +
+ static_cast<u8>(Core::Crypto::Package2Type::NormalMain);
+ return pdm.GetPackage2Raw(static_cast<Core::Crypto::Package2Type>(new_id));
+ }
+ default:
+ return nullptr;
+ }
+}
+
} // namespace FileSys
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h
index 453c11ad2..f8413d4ef 100644
--- a/src/core/file_sys/bis_factory.h
+++ b/src/core/file_sys/bis_factory.h
@@ -10,6 +10,23 @@
namespace FileSys {
+enum class BisPartitionId : u32 {
+ UserDataRoot = 20,
+ CalibrationBinary = 27,
+ CalibrationFile = 28,
+ BootConfigAndPackage2Part1 = 21,
+ BootConfigAndPackage2Part2 = 22,
+ BootConfigAndPackage2Part3 = 23,
+ BootConfigAndPackage2Part4 = 24,
+ BootConfigAndPackage2Part5 = 25,
+ BootConfigAndPackage2Part6 = 26,
+ SafeMode = 29,
+ System = 31,
+ SystemProperEncryption = 32,
+ SystemProperPartition = 33,
+ User = 30,
+};
+
class RegisteredCache;
/// File system interface to the Built-In Storage
@@ -26,6 +43,9 @@ public:
VirtualDir GetModificationLoadRoot(u64 title_id) const;
VirtualDir GetModificationDumpRoot(u64 title_id) const;
+ VirtualDir OpenPartition(BisPartitionId id) const;
+ VirtualFile OpenPartitionStorage(BisPartitionId id) const;
+
private:
VirtualDir nand_root;
VirtualDir load_root;