summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-09-26 22:15:51 -0400
committerGravatar Zach Hilman2018-09-30 21:01:35 -0400
commitaa0c82e40534f68ef6dd8d9d881a14ed298b19a0 (patch)
treed0765d7bb2728ab3e56a6005d7d57b223d3f492e
parentpatch_manager: Add DLC recognition to PatchManager (diff)
downloadyuzu-aa0c82e40534f68ef6dd8d9d881a14ed298b19a0.tar.gz
yuzu-aa0c82e40534f68ef6dd8d9d881a14ed298b19a0.tar.xz
yuzu-aa0c82e40534f68ef6dd8d9d881a14ed298b19a0.zip
romfs_factory: Read from all locations with StorageId None
Previous behavior was to assert. Seems to mirror expected game behavior.
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/romfs_factory.cpp51
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() {
39} 39}
40 40
41ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) { 41ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) {
42 std::shared_ptr<NCA> res;
43
42 switch (storage) { 44 switch (storage) {
43 case StorageId::NandSystem: { 45 case StorageId::None:
44 const auto res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); 46 res = Service::FileSystem::GetUnionContents()->GetEntry(title_id, type);
45 if (res == nullptr) { 47 break;
46 // TODO(DarkLordZach): Find the right error code to use here 48 case StorageId::NandSystem:
47 return ResultCode(-1); 49 res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type);
48 } 50 break;
49 const auto romfs = res->GetRomFS(); 51 case StorageId::NandUser:
50 if (romfs == nullptr) { 52 res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type);
51 // TODO(DarkLordZach): Find the right error code to use here 53 break;
52 return ResultCode(-1); 54 case StorageId::SdCard:
53 } 55 res = Service::FileSystem::GetSDMCContents()->GetEntry(title_id, type);
54 return MakeResult<VirtualFile>(romfs); 56 break;
55 }
56 case StorageId::NandUser: {
57 const auto res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type);
58 if (res == nullptr) {
59 // TODO(DarkLordZach): Find the right error code to use here
60 return ResultCode(-1);
61 }
62 const auto romfs = res->GetRomFS();
63 if (romfs == nullptr) {
64 // TODO(DarkLordZach): Find the right error code to use here
65 return ResultCode(-1);
66 }
67 return MakeResult<VirtualFile>(romfs);
68 }
69 default: 57 default:
70 UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); 58 UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage));
71 } 59 }
60
61 if (res == nullptr) {
62 // TODO(DarkLordZach): Find the right error code to use here
63 return ResultCode(-1);
64 }
65 const auto romfs = res->GetRomFS();
66 if (romfs == nullptr) {
67 // TODO(DarkLordZach): Find the right error code to use here
68 return ResultCode(-1);
69 }
70 return MakeResult<VirtualFile>(romfs);
72} 71}
73 72
74} // namespace FileSys 73} // namespace FileSys