diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/romfs.cpp | 19 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/nca.cpp | 6 |
4 files changed, 16 insertions, 15 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 0bca05587..cc7af2ea3 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -429,10 +429,6 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs | |||
| 429 | LOG_DEBUG(Loader, "{}", log_string); | 429 | LOG_DEBUG(Loader, "{}", log_string); |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | if (base_romfs == nullptr) { | ||
| 433 | return base_romfs; | ||
| 434 | } | ||
| 435 | |||
| 436 | auto romfs = base_romfs; | 432 | auto romfs = base_romfs; |
| 437 | 433 | ||
| 438 | // Game Updates | 434 | // Game Updates |
diff --git a/src/core/file_sys/romfs.cpp b/src/core/file_sys/romfs.cpp index 1eb1f439a..6de2103a0 100644 --- a/src/core/file_sys/romfs.cpp +++ b/src/core/file_sys/romfs.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | 5 | ||
| 6 | #include "common/assert.h" | ||
| 6 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 7 | #include "common/string_util.h" | 8 | #include "common/string_util.h" |
| 8 | #include "common/swap.h" | 9 | #include "common/swap.h" |
| @@ -101,24 +102,30 @@ void ProcessDirectory(const VirtualFile& file, std::size_t dir_offset, std::size | |||
| 101 | } // Anonymous namespace | 102 | } // Anonymous namespace |
| 102 | 103 | ||
| 103 | VirtualDir ExtractRomFS(VirtualFile file) { | 104 | VirtualDir ExtractRomFS(VirtualFile file) { |
| 105 | auto root_container = std::make_shared<VectorVfsDirectory>(); | ||
| 106 | if (!file) { | ||
| 107 | return root_container; | ||
| 108 | } | ||
| 109 | |||
| 104 | RomFSHeader header{}; | 110 | RomFSHeader header{}; |
| 105 | if (file->ReadObject(&header) != sizeof(RomFSHeader)) | 111 | if (file->ReadObject(&header) != sizeof(RomFSHeader)) { |
| 106 | return nullptr; | 112 | return root_container; |
| 113 | } | ||
| 107 | 114 | ||
| 108 | if (header.header_size != sizeof(RomFSHeader)) | 115 | if (header.header_size != sizeof(RomFSHeader)) { |
| 109 | return nullptr; | 116 | return root_container; |
| 117 | } | ||
| 110 | 118 | ||
| 111 | const u64 file_offset = header.file_meta.offset; | 119 | const u64 file_offset = header.file_meta.offset; |
| 112 | const u64 dir_offset = header.directory_meta.offset; | 120 | const u64 dir_offset = header.directory_meta.offset; |
| 113 | 121 | ||
| 114 | auto root_container = std::make_shared<VectorVfsDirectory>(); | ||
| 115 | |||
| 116 | ProcessDirectory(file, dir_offset, file_offset, header.data_offset, 0, root_container); | 122 | ProcessDirectory(file, dir_offset, file_offset, header.data_offset, 0, root_container); |
| 117 | 123 | ||
| 118 | if (auto root = root_container->GetSubdirectory(""); root) { | 124 | if (auto root = root_container->GetSubdirectory(""); root) { |
| 119 | return std::make_shared<CachedVfsDirectory>(std::move(root)); | 125 | return std::make_shared<CachedVfsDirectory>(std::move(root)); |
| 120 | } | 126 | } |
| 121 | 127 | ||
| 128 | ASSERT(false); | ||
| 122 | return nullptr; | 129 | return nullptr; |
| 123 | } | 130 | } |
| 124 | 131 | ||
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 1bc07dae5..35e149905 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -22,7 +22,7 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader, ContentProvider& provi | |||
| 22 | : content_provider{provider}, filesystem_controller{controller} { | 22 | : content_provider{provider}, filesystem_controller{controller} { |
| 23 | // Load the RomFS from the app | 23 | // Load the RomFS from the app |
| 24 | if (app_loader.ReadRomFS(file) != Loader::ResultStatus::Success) { | 24 | if (app_loader.ReadRomFS(file) != Loader::ResultStatus::Success) { |
| 25 | LOG_ERROR(Service_FS, "Unable to read RomFS!"); | 25 | LOG_WARNING(Service_FS, "Unable to read base RomFS"); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | updatable = app_loader.IsRomFSUpdatable(); | 28 | updatable = app_loader.IsRomFSUpdatable(); |
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 4feb6968a..814407535 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp | |||
| @@ -74,10 +74,8 @@ AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::KProcess& process, Core::S | |||
| 74 | return load_result; | 74 | return load_result; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | if (nca->GetRomFS() != nullptr && nca->GetRomFS()->GetSize() > 0) { | 77 | system.GetFileSystemController().RegisterRomFS(std::make_unique<FileSys::RomFSFactory>( |
| 78 | system.GetFileSystemController().RegisterRomFS(std::make_unique<FileSys::RomFSFactory>( | 78 | *this, system.GetContentProvider(), system.GetFileSystemController())); |
| 79 | *this, system.GetContentProvider(), system.GetFileSystemController())); | ||
| 80 | } | ||
| 81 | 79 | ||
| 82 | is_loaded = true; | 80 | is_loaded = true; |
| 83 | return load_result; | 81 | return load_result; |