summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/romfs_factory.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-08-19 03:28:17 +0200
committerZach Hilman <zachhilman@gmail.com>2018-08-19 03:28:23 +0200
commit27da7bc9daf951bce69970881bdbc8719378ca39 (patch)
tree67fb66ecb4ab97f2036712eb5b75216f75e730bf /src/core/file_sys/romfs_factory.cpp
parentMerge pull request #838 from FearlessTobi/port-3616 (diff)
downloadyuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar.gz
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar.bz2
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar.lz
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar.xz
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.tar.zst
yuzu-27da7bc9daf951bce69970881bdbc8719378ca39.zip
Diffstat (limited to 'src/core/file_sys/romfs_factory.cpp')
-rw-r--r--src/core/file_sys/romfs_factory.cpp38
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..7ba4042ca 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("Unimplmented storage_id={:02X}", static_cast<u8>(storage));
+ }
+}
+
} // namespace FileSys