diff options
| author | 2019-04-22 17:56:56 -0400 | |
|---|---|---|
| committer | 2019-09-21 16:43:10 -0400 | |
| commit | c6ff4a6f4d05eb380616be57e4088003e7aedfcb (patch) | |
| tree | a923240a1505dd0ebbf476f43fe7e653a07e3217 /src/core/file_sys | |
| parent | settings: Update LogSettings to show NAND/SDMC paths from FileUtil (diff) | |
| download | yuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.tar.gz yuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.tar.xz yuzu-c6ff4a6f4d05eb380616be57e4088003e7aedfcb.zip | |
yuzu: Port old usages of Filesystem namespace to FilesystemController
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 24 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 1 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 11 |
3 files changed, 25 insertions, 11 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index e3ebaca03..c1dd0c6d7 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -63,7 +63,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 63 | 63 | ||
| 64 | if (Settings::values.dump_exefs) { | 64 | if (Settings::values.dump_exefs) { |
| 65 | LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id); | 65 | LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id); |
| 66 | const auto dump_dir = Service::FileSystem::GetModificationDumpRoot(title_id); | 66 | const auto dump_dir = |
| 67 | Core::System::GetInstance().GetFileSystemController().GetModificationDumpRoot(title_id); | ||
| 67 | if (dump_dir != nullptr) { | 68 | if (dump_dir != nullptr) { |
| 68 | const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs"); | 69 | const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs"); |
| 69 | VfsRawCopyD(exefs, exefs_dir); | 70 | VfsRawCopyD(exefs, exefs_dir); |
| @@ -88,7 +89,8 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | // LayeredExeFS | 91 | // LayeredExeFS |
| 91 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 92 | const auto load_dir = |
| 93 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 92 | if (load_dir != nullptr && load_dir->GetSize() > 0) { | 94 | if (load_dir != nullptr && load_dir->GetSize() > 0) { |
| 93 | auto patch_dirs = load_dir->GetSubdirectories(); | 95 | auto patch_dirs = load_dir->GetSubdirectories(); |
| 94 | std::sort( | 96 | std::sort( |
| @@ -174,7 +176,8 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st | |||
| 174 | if (Settings::values.dump_nso) { | 176 | if (Settings::values.dump_nso) { |
| 175 | LOG_INFO(Loader, "Dumping NSO for name={}, build_id={}, title_id={:016X}", name, build_id, | 177 | LOG_INFO(Loader, "Dumping NSO for name={}, build_id={}, title_id={:016X}", name, build_id, |
| 176 | title_id); | 178 | title_id); |
| 177 | const auto dump_dir = Service::FileSystem::GetModificationDumpRoot(title_id); | 179 | const auto dump_dir = |
| 180 | Core::System::GetInstance().GetFileSystemController().GetModificationDumpRoot(title_id); | ||
| 178 | if (dump_dir != nullptr) { | 181 | if (dump_dir != nullptr) { |
| 179 | const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso"); | 182 | const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso"); |
| 180 | const auto file = nso_dir->CreateFile(fmt::format("{}-{}.nso", name, build_id)); | 183 | const auto file = nso_dir->CreateFile(fmt::format("{}-{}.nso", name, build_id)); |
| @@ -186,7 +189,8 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso, const std::st | |||
| 186 | 189 | ||
| 187 | LOG_INFO(Loader, "Patching NSO for name={}, build_id={}", name, build_id); | 190 | LOG_INFO(Loader, "Patching NSO for name={}, build_id={}", name, build_id); |
| 188 | 191 | ||
| 189 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 192 | const auto load_dir = |
| 193 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 190 | if (load_dir == nullptr) { | 194 | if (load_dir == nullptr) { |
| 191 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); | 195 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); |
| 192 | return nso; | 196 | return nso; |
| @@ -229,7 +233,8 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const { | |||
| 229 | 233 | ||
| 230 | LOG_INFO(Loader, "Querying NSO patch existence for build_id={}", build_id); | 234 | LOG_INFO(Loader, "Querying NSO patch existence for build_id={}", build_id); |
| 231 | 235 | ||
| 232 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 236 | const auto load_dir = |
| 237 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 233 | if (load_dir == nullptr) { | 238 | if (load_dir == nullptr) { |
| 234 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); | 239 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); |
| 235 | return false; | 240 | return false; |
| @@ -268,7 +273,8 @@ static std::optional<CheatList> ReadCheatFileFromFolder(const Core::System& syst | |||
| 268 | 273 | ||
| 269 | std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system, | 274 | std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system, |
| 270 | const std::array<u8, 32>& build_id_) const { | 275 | const std::array<u8, 32>& build_id_) const { |
| 271 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 276 | const auto load_dir = |
| 277 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 272 | if (load_dir == nullptr) { | 278 | if (load_dir == nullptr) { |
| 273 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); | 279 | LOG_ERROR(Loader, "Cannot load mods for invalid title_id={:016X}", title_id); |
| 274 | return {}; | 280 | return {}; |
| @@ -299,7 +305,8 @@ std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system, | |||
| 299 | } | 305 | } |
| 300 | 306 | ||
| 301 | static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType type) { | 307 | static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType type) { |
| 302 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 308 | const auto load_dir = |
| 309 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 303 | if ((type != ContentRecordType::Program && type != ContentRecordType::Data) || | 310 | if ((type != ContentRecordType::Program && type != ContentRecordType::Data) || |
| 304 | load_dir == nullptr || load_dir->GetSize() <= 0) { | 311 | load_dir == nullptr || load_dir->GetSize() <= 0) { |
| 305 | return; | 312 | return; |
| @@ -440,7 +447,8 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam | |||
| 440 | } | 447 | } |
| 441 | 448 | ||
| 442 | // General Mods (LayeredFS and IPS) | 449 | // General Mods (LayeredFS and IPS) |
| 443 | const auto mod_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 450 | const auto mod_dir = |
| 451 | Core::System::GetInstance().GetFileSystemController().GetModificationLoadRoot(title_id); | ||
| 444 | if (mod_dir != nullptr && mod_dir->GetSize() > 0) { | 452 | if (mod_dir != nullptr && mod_dir->GetSize() > 0) { |
| 445 | for (const auto& mod : mod_dir->GetSubdirectories()) { | 453 | for (const auto& mod : mod_dir->GetSubdirectories()) { |
| 446 | std::string types; | 454 | std::string types; |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index afa87be9c..d1ef1e72d 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <random> | ||
| 6 | #include <regex> | 7 | #include <regex> |
| 7 | #include <mbedtls/sha256.h> | 8 | #include <mbedtls/sha256.h> |
| 8 | #include "common/assert.h" | 9 | #include "common/assert.h" |
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index b2ccb2926..c3ee4a158 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/file_sys/card_image.h" | ||
| 10 | #include "core/file_sys/content_archive.h" | 11 | #include "core/file_sys/content_archive.h" |
| 11 | #include "core/file_sys/nca_metadata.h" | 12 | #include "core/file_sys/nca_metadata.h" |
| 12 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| @@ -51,13 +52,17 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, Conte | |||
| 51 | res = Core::System::GetInstance().GetContentProvider().GetEntry(title_id, type); | 52 | res = Core::System::GetInstance().GetContentProvider().GetEntry(title_id, type); |
| 52 | break; | 53 | break; |
| 53 | case StorageId::NandSystem: | 54 | case StorageId::NandSystem: |
| 54 | res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type); | 55 | res = |
| 56 | Core::System::GetInstance().GetFileSystemController().GetSystemNANDContents()->GetEntry( | ||
| 57 | title_id, type); | ||
| 55 | break; | 58 | break; |
| 56 | case StorageId::NandUser: | 59 | case StorageId::NandUser: |
| 57 | res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type); | 60 | res = Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->GetEntry( |
| 61 | title_id, type); | ||
| 58 | break; | 62 | break; |
| 59 | case StorageId::SdCard: | 63 | case StorageId::SdCard: |
| 60 | res = Service::FileSystem::GetSDMCContents()->GetEntry(title_id, type); | 64 | res = Core::System::GetInstance().GetFileSystemController().GetSDMCContents()->GetEntry( |
| 65 | title_id, type); | ||
| 61 | break; | 66 | break; |
| 62 | default: | 67 | default: |
| 63 | UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); | 68 | UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage)); |