diff options
| author | bunnei <bunneidev@gmail.com> | 2018-10-01 15:56:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-01 15:56:39 -0400 |
| commit | bd14f397ce142f4552018554532ceb230e12bde5 (patch) | |
| tree | e5eeecea0c234828c669233cea09187da3c8ed74 /src/core/file_sys/romfs_factory.cpp | |
| parent | 393042c09c38246a134cb89c077b19a409f3566e (diff) | |
| parent | f72046099ac1bce64017e6940daba6ee2ce8e9fb (diff) | |
Merge pull request #1407 from DarkLordZach/dlc
aoc_u: Implement functions and add support for DLC loading
Diffstat (limited to 'src/core/file_sys/romfs_factory.cpp')
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index d027a8d59..4994c2532 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp @@ -39,36 +39,35 @@ ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() { } ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) { + std::shared_ptr<NCA> res; + 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); - } + case StorageId::None: + res = Service::FileSystem::GetUnionContents()->GetEntry(title_id, type); + break; + case StorageId::NandSystem: + res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); + break; + case StorageId::NandUser: + res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type); + break; + case StorageId::SdCard: + res = Service::FileSystem::GetSDMCContents()->GetEntry(title_id, type); + break; default: UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); } + + 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); } } // namespace FileSys |
