From 27da7bc9daf951bce69970881bdbc8719378ca39 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 18 Aug 2018 21:28:17 -0400 Subject: filesystem: Add support for loading of system archives --- src/core/file_sys/romfs_factory.cpp | 38 +++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/romfs_factory.cpp') diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 54fbd3267..7ba4042ca 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -6,7 +6,9 @@ #include #include "common/common_types.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/file_sys/romfs_factory.h" +#include "core/hle/kernel/process.h" namespace FileSys { @@ -17,9 +19,41 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader) { } } -ResultVal RomFSFactory::Open(u64 title_id) { - // TODO(DarkLordZach): Use title id. +ResultVal RomFSFactory::OpenCurrentProcess() { return MakeResult(file); } +ResultVal RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) { + switch (storage) { + case StorageId::NandSystem: { + const auto res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); + if (res == nullptr) { + // TODO(DarkLordZach): Find the right error code to use here + return ResultCode(-1); + } + const auto romfs = res->GetRomFS(); + if (romfs == nullptr) { + // TODO(DarkLordZach): Find the right error code to use here + return ResultCode(-1); + } + return MakeResult(romfs); + } + case StorageId::NandUser: { + const auto res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type); + if (res == nullptr) { + // TODO(DarkLordZach): Find the right error code to use here + return ResultCode(-1); + } + const auto romfs = res->GetRomFS(); + if (romfs == nullptr) { + // TODO(DarkLordZach): Find the right error code to use here + return ResultCode(-1); + } + return MakeResult(romfs); + } + default: + UNIMPLEMENTED_MSG("Unimplmented storage_id={:02X}", static_cast(storage)); + } +} + } // namespace FileSys -- cgit v1.2.3 From e8cb6f5c9be4480baa1f870d9cabcb0eab57397b Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 20 Aug 2018 17:34:18 -0400 Subject: registration: Add Data_Unknown5 NCAContentType --- src/core/file_sys/romfs_factory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/romfs_factory.cpp') diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 7ba4042ca..1b3824a61 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -52,7 +52,7 @@ ResultVal RomFSFactory::Open(u64 title_id, StorageId storage, Conte return MakeResult(romfs); } default: - UNIMPLEMENTED_MSG("Unimplmented storage_id={:02X}", static_cast(storage)); + UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast(storage)); } } -- cgit v1.2.3