diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-21 02:17:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-21 02:17:57 +0200 |
commit | dd70ddad7edb7cfbdddaed0ac657544a613d46e2 (patch) | |
tree | 76145c48a1f92f64ef53ef8527df392b0fac10a6 /src/core/file_sys/romfs_factory.cpp | |
parent | Merge pull request #1127 from yuzu-emu/revert-838-port-3616 (diff) | |
parent | registration: Add Data_Unknown5 NCAContentType (diff) | |
download | yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar.gz yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar.bz2 yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar.lz yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar.xz yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.tar.zst yuzu-dd70ddad7edb7cfbdddaed0ac657544a613d46e2.zip |
Diffstat (limited to 'src/core/file_sys/romfs_factory.cpp')
-rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 54fbd3267..1b3824a61 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -6,7 +6,9 @@ #include <memory> #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<VirtualFile> RomFSFactory::Open(u64 title_id) { - // TODO(DarkLordZach): Use title id. +ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() { return MakeResult<VirtualFile>(file); } +ResultVal<VirtualFile> 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<VirtualFile>(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<VirtualFile>(romfs); + } + default: + UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); + } +} + } // namespace FileSys |