mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
[FS] Archive::OpenArchive returns Result<T, E> now
This commit is contained in:
parent
37fb660c7f
commit
0b0d6dcf4b
12 changed files with 25 additions and 24 deletions
|
@ -129,11 +129,11 @@ std::optional<Handle> FSService::openArchiveHandle(u32 archiveID, const FSPath&
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool opened = archive->openArchive(path);
|
||||
if (opened) {
|
||||
Rust::Result<ArchiveBase*, FSResult> res = archive->openArchive(path);
|
||||
if (res.isOk()) {
|
||||
auto handle = kernel.makeObject(KernelObjectType::Archive);
|
||||
auto& archiveObject = kernel.getObjects()[handle];
|
||||
archiveObject.data = new ArchiveSession(archive, path);
|
||||
archiveObject.data = new ArchiveSession(res.unwrap(), path);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
@ -334,10 +334,11 @@ void FSService::openFileDirectly(u32 messagePointer) {
|
|||
auto filePath = readPath(filePathType, filePathPointer, filePathSize);
|
||||
const FilePerms perms(openFlags);
|
||||
|
||||
archive = archive->openArchive(archivePath);
|
||||
if (archive == nullptr) [[unlikely]] {
|
||||
Rust::Result<ArchiveBase*, FSResult> res = archive->openArchive(archivePath);
|
||||
if (res.isErr()) [[unlikely]] {
|
||||
Helpers::panic("OpenFileDirectly: Failed to open archive with given path");
|
||||
}
|
||||
archive = res.unwrap();
|
||||
|
||||
std::optional<Handle> handle = openFileHandle(archive, filePath, archivePath, perms);
|
||||
mem.write32(messagePointer, IPC::responseHeader(0x803, 1, 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue