mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
romfs_factory: Read from all locations with StorageId None
Previous behavior was to assert. Seems to mirror expected game behavior.
This commit is contained in:
parent
32fc31fb13
commit
aa0c82e405
1 changed files with 25 additions and 26 deletions
|
@ -39,36 +39,35 @@ ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) {
|
ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) {
|
||||||
|
std::shared_ptr<NCA> res;
|
||||||
|
|
||||||
switch (storage) {
|
switch (storage) {
|
||||||
case StorageId::NandSystem: {
|
case StorageId::None:
|
||||||
const auto res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type);
|
res = Service::FileSystem::GetUnionContents()->GetEntry(title_id, type);
|
||||||
if (res == nullptr) {
|
break;
|
||||||
// TODO(DarkLordZach): Find the right error code to use here
|
case StorageId::NandSystem:
|
||||||
return ResultCode(-1);
|
res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type);
|
||||||
}
|
break;
|
||||||
const auto romfs = res->GetRomFS();
|
case StorageId::NandUser:
|
||||||
if (romfs == nullptr) {
|
res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type);
|
||||||
// TODO(DarkLordZach): Find the right error code to use here
|
break;
|
||||||
return ResultCode(-1);
|
case StorageId::SdCard:
|
||||||
}
|
res = Service::FileSystem::GetSDMCContents()->GetEntry(title_id, type);
|
||||||
return MakeResult<VirtualFile>(romfs);
|
break;
|
||||||
}
|
|
||||||
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:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage));
|
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
|
} // namespace FileSys
|
||||||
|
|
Loading…
Reference in a new issue