diff options
| author | 2018-10-29 16:08:03 -0400 | |
|---|---|---|
| committer | 2018-10-29 16:08:03 -0400 | |
| commit | 9078bb9854cff3f77ac28a15dffff06bb31b3755 (patch) | |
| tree | e8d98a8f4ee6709aad4900a7885682ef49c64270 /src | |
| parent | Merge pull request #1613 from ReinUsesLisp/gl-utils (diff) | |
| download | yuzu-9078bb9854cff3f77ac28a15dffff06bb31b3755.tar.gz yuzu-9078bb9854cff3f77ac28a15dffff06bb31b3755.tar.xz yuzu-9078bb9854cff3f77ac28a15dffff06bb31b3755.zip | |
bis_factory: Add getter for mod dump root for a title ID
Equates to yuzu_dir/dump/<title id>/
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/bis_factory.cpp | 9 | ||||
| -rw-r--r-- | src/core/file_sys/bis_factory.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 1 |
4 files changed, 33 insertions, 6 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 76a2b7e86..e29f70b3a 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -8,8 +8,9 @@ | |||
| 8 | 8 | ||
| 9 | namespace FileSys { | 9 | namespace FileSys { |
| 10 | 10 | ||
| 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_) | 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_) |
| 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), | 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), |
| 13 | dump_root(std::move(dump_root_)), | ||
| 13 | sysnand_cache(std::make_unique<RegisteredCache>( | 14 | sysnand_cache(std::make_unique<RegisteredCache>( |
| 14 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), | 15 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), |
| 15 | usrnand_cache(std::make_unique<RegisteredCache>( | 16 | usrnand_cache(std::make_unique<RegisteredCache>( |
| @@ -32,4 +33,10 @@ VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const { | |||
| 32 | return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id)); | 33 | return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id)); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 36 | VirtualDir BISFactory::GetModificationDumpRoot(u64 title_id) const { | ||
| 37 | if (title_id == 0) | ||
| 38 | return nullptr; | ||
| 39 | return GetOrCreateDirectoryRelative(dump_root, fmt::format("/{:016X}", title_id)); | ||
| 40 | } | ||
| 41 | |||
| 35 | } // namespace FileSys | 42 | } // namespace FileSys |
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h index 364d309bd..453c11ad2 100644 --- a/src/core/file_sys/bis_factory.h +++ b/src/core/file_sys/bis_factory.h | |||
| @@ -17,17 +17,19 @@ class RegisteredCache; | |||
| 17 | /// registered caches. | 17 | /// registered caches. |
| 18 | class BISFactory { | 18 | class BISFactory { |
| 19 | public: | 19 | public: |
| 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root); | 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root, VirtualDir dump_root); |
| 21 | ~BISFactory(); | 21 | ~BISFactory(); |
| 22 | 22 | ||
| 23 | RegisteredCache* GetSystemNANDContents() const; | 23 | RegisteredCache* GetSystemNANDContents() const; |
| 24 | RegisteredCache* GetUserNANDContents() const; | 24 | RegisteredCache* GetUserNANDContents() const; |
| 25 | 25 | ||
| 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; | 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; |
| 27 | VirtualDir GetModificationDumpRoot(u64 title_id) const; | ||
| 27 | 28 | ||
| 28 | private: | 29 | private: |
| 29 | VirtualDir nand_root; | 30 | VirtualDir nand_root; |
| 30 | VirtualDir load_root; | 31 | VirtualDir load_root; |
| 32 | VirtualDir dump_root; | ||
| 31 | 33 | ||
| 32 | std::unique_ptr<RegisteredCache> sysnand_cache; | 34 | std::unique_ptr<RegisteredCache> sysnand_cache; |
| 33 | std::unique_ptr<RegisteredCache> usrnand_cache; | 35 | std::unique_ptr<RegisteredCache> usrnand_cache; |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index e32a7c48e..234a8687b 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -360,6 +360,15 @@ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) { | |||
| 360 | return bis_factory->GetModificationLoadRoot(title_id); | 360 | return bis_factory->GetModificationLoadRoot(title_id); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) { | ||
| 364 | LOG_TRACE(Service_FS, "Opening mod dump root for tid={:016X}", title_id); | ||
| 365 | |||
| 366 | if (bis_factory == nullptr) | ||
| 367 | return nullptr; | ||
| 368 | |||
| 369 | return bis_factory->GetModificationDumpRoot(title_id); | ||
| 370 | } | ||
| 371 | |||
| 363 | void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { | 372 | void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { |
| 364 | if (overwrite) { | 373 | if (overwrite) { |
| 365 | bis_factory = nullptr; | 374 | bis_factory = nullptr; |
| @@ -373,13 +382,21 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { | |||
| 373 | FileSys::Mode::ReadWrite); | 382 | FileSys::Mode::ReadWrite); |
| 374 | auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), | 383 | auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), |
| 375 | FileSys::Mode::ReadWrite); | 384 | FileSys::Mode::ReadWrite); |
| 385 | auto dump_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir), | ||
| 386 | FileSys::Mode::ReadWrite); | ||
| 376 | 387 | ||
| 377 | if (bis_factory == nullptr) | 388 | if (bis_factory == nullptr) { |
| 378 | bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory, load_directory); | 389 | bis_factory = |
| 379 | if (save_data_factory == nullptr) | 390 | std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory); |
| 391 | } | ||
| 392 | |||
| 393 | if (save_data_factory == nullptr) { | ||
| 380 | save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory)); | 394 | save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory)); |
| 381 | if (sdmc_factory == nullptr) | 395 | } |
| 396 | |||
| 397 | if (sdmc_factory == nullptr) { | ||
| 382 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); | 398 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); |
| 399 | } | ||
| 383 | } | 400 | } |
| 384 | 401 | ||
| 385 | void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) { | 402 | void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) { |
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 6ca5c5636..b18652a68 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -54,6 +54,7 @@ FileSys::RegisteredCache* GetUserNANDContents(); | |||
| 54 | FileSys::RegisteredCache* GetSDMCContents(); | 54 | FileSys::RegisteredCache* GetSDMCContents(); |
| 55 | 55 | ||
| 56 | FileSys::VirtualDir GetModificationLoadRoot(u64 title_id); | 56 | FileSys::VirtualDir GetModificationLoadRoot(u64 title_id); |
| 57 | FileSys::VirtualDir GetModificationDumpRoot(u64 title_id); | ||
| 57 | 58 | ||
| 58 | // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function | 59 | // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function |
| 59 | // above is called. | 60 | // above is called. |