From 86f6b6b7b2d930e8203114332b04a5c49a780b06 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 10 Aug 2023 21:34:43 -0400 Subject: vfs: expand support for NCA reading --- src/core/hle/service/am/applets/applet_web_browser.cpp | 2 +- src/core/hle/service/filesystem/filesystem.cpp | 5 +++++ src/core/hle/service/filesystem/filesystem.h | 3 +++ src/core/hle/service/filesystem/fsp_srv.cpp | 7 ++++--- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp index 2accf7898..1c9a1dc29 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/applets/applet_web_browser.cpp @@ -139,7 +139,7 @@ FileSys::VirtualFile GetOfflineRomFS(Core::System& system, u64 title_id, const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; - return pm.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), nca_type); + return pm.PatchRomFS(nca.get(), nca->GetRomFS(), nca_type); } } diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index ac465d5a9..4c1ea1a5b 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -373,6 +373,11 @@ FileSys::VirtualFile FileSystemController::OpenRomFS(u64 title_id, FileSys::Stor return romfs_factory->Open(title_id, storage_id, type); } +std::shared_ptr FileSystemController::OpenBaseNca( + u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const { + return romfs_factory->GetEntry(title_id, storage_id, type); +} + Result FileSystemController::CreateSaveData(FileSys::VirtualDir* out_save_data, FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& save_struct) const { diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index fd991f976..e7e7c4c28 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h @@ -15,6 +15,7 @@ class System; namespace FileSys { class BISFactory; +class NCA; class RegisteredCache; class RegisteredCacheUnion; class PlaceholderCache; @@ -70,6 +71,8 @@ public: FileSys::ContentRecordType type) const; FileSys::VirtualFile OpenRomFS(u64 title_id, FileSys::StorageId storage_id, FileSys::ContentRecordType type) const; + std::shared_ptr OpenBaseNca(u64 title_id, FileSys::StorageId storage_id, + FileSys::ContentRecordType type) const; Result CreateSaveData(FileSys::VirtualDir* out_save_data, FileSys::SaveDataSpaceId space, const FileSys::SaveDataAttribute& save_struct) const; diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 423a814cb..eaaf8cdd9 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -310,8 +310,8 @@ private: class IFileSystem final : public ServiceFramework { public: explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_) - : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move( - size_)} { + : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, + size{std::move(size_)} { static const FunctionInfo functions[] = { {0, &IFileSystem::CreateFile, "CreateFile"}, {1, &IFileSystem::DeleteFile, "DeleteFile"}, @@ -1029,8 +1029,9 @@ void FSP_SRV::OpenDataStorageByDataId(HLERequestContext& ctx) { const FileSys::PatchManager pm{title_id, fsc, content_provider}; + auto base = fsc.OpenBaseNca(title_id, storage_id, FileSys::ContentRecordType::Data); auto storage = std::make_shared( - system, pm.PatchRomFS(std::move(data), 0, FileSys::ContentRecordType::Data)); + system, pm.PatchRomFS(base.get(), std::move(data), FileSys::ContentRecordType::Data)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); -- cgit v1.2.3 From 50eee9b2185c59c32fb82cf464230a058edd10ea Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 12 Aug 2023 15:18:55 -0400 Subject: fssystem: rework for yuzu style --- src/core/hle/service/filesystem/fsp_srv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index eaaf8cdd9..6e4d26b1e 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -310,8 +310,8 @@ private: class IFileSystem final : public ServiceFramework { public: explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_) - : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, - size{std::move(size_)} { + : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move( + size_)} { static const FunctionInfo functions[] = { {0, &IFileSystem::CreateFile, "CreateFile"}, {1, &IFileSystem::DeleteFile, "DeleteFile"}, -- cgit v1.2.3