mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-28 14:26:33 -05:00
bis_factory: Add getter for mod dump root for a title ID
Equates to yuzu_dir/dump/<title id>/
This commit is contained in:
parent
0270906dbf
commit
9078bb9854
4 changed files with 33 additions and 6 deletions
|
@ -8,8 +8,9 @@
|
||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_)
|
BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_)
|
||||||
: nand_root(std::move(nand_root_)), load_root(std::move(load_root_)),
|
: nand_root(std::move(nand_root_)), load_root(std::move(load_root_)),
|
||||||
|
dump_root(std::move(dump_root_)),
|
||||||
sysnand_cache(std::make_unique<RegisteredCache>(
|
sysnand_cache(std::make_unique<RegisteredCache>(
|
||||||
GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))),
|
GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))),
|
||||||
usrnand_cache(std::make_unique<RegisteredCache>(
|
usrnand_cache(std::make_unique<RegisteredCache>(
|
||||||
|
@ -32,4 +33,10 @@ VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const {
|
||||||
return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id));
|
return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VirtualDir BISFactory::GetModificationDumpRoot(u64 title_id) const {
|
||||||
|
if (title_id == 0)
|
||||||
|
return nullptr;
|
||||||
|
return GetOrCreateDirectoryRelative(dump_root, fmt::format("/{:016X}", title_id));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -17,17 +17,19 @@ class RegisteredCache;
|
||||||
/// registered caches.
|
/// registered caches.
|
||||||
class BISFactory {
|
class BISFactory {
|
||||||
public:
|
public:
|
||||||
explicit BISFactory(VirtualDir nand_root, VirtualDir load_root);
|
explicit BISFactory(VirtualDir nand_root, VirtualDir load_root, VirtualDir dump_root);
|
||||||
~BISFactory();
|
~BISFactory();
|
||||||
|
|
||||||
RegisteredCache* GetSystemNANDContents() const;
|
RegisteredCache* GetSystemNANDContents() const;
|
||||||
RegisteredCache* GetUserNANDContents() const;
|
RegisteredCache* GetUserNANDContents() const;
|
||||||
|
|
||||||
VirtualDir GetModificationLoadRoot(u64 title_id) const;
|
VirtualDir GetModificationLoadRoot(u64 title_id) const;
|
||||||
|
VirtualDir GetModificationDumpRoot(u64 title_id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VirtualDir nand_root;
|
VirtualDir nand_root;
|
||||||
VirtualDir load_root;
|
VirtualDir load_root;
|
||||||
|
VirtualDir dump_root;
|
||||||
|
|
||||||
std::unique_ptr<RegisteredCache> sysnand_cache;
|
std::unique_ptr<RegisteredCache> sysnand_cache;
|
||||||
std::unique_ptr<RegisteredCache> usrnand_cache;
|
std::unique_ptr<RegisteredCache> usrnand_cache;
|
||||||
|
|
|
@ -360,6 +360,15 @@ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) {
|
||||||
return bis_factory->GetModificationLoadRoot(title_id);
|
return bis_factory->GetModificationLoadRoot(title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) {
|
||||||
|
LOG_TRACE(Service_FS, "Opening mod dump root for tid={:016X}", title_id);
|
||||||
|
|
||||||
|
if (bis_factory == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return bis_factory->GetModificationDumpRoot(title_id);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
|
void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
bis_factory = nullptr;
|
bis_factory = nullptr;
|
||||||
|
@ -373,14 +382,22 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
|
||||||
FileSys::Mode::ReadWrite);
|
FileSys::Mode::ReadWrite);
|
||||||
auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
||||||
FileSys::Mode::ReadWrite);
|
FileSys::Mode::ReadWrite);
|
||||||
|
auto dump_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir),
|
||||||
|
FileSys::Mode::ReadWrite);
|
||||||
|
|
||||||
if (bis_factory == nullptr)
|
if (bis_factory == nullptr) {
|
||||||
bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory, load_directory);
|
bis_factory =
|
||||||
if (save_data_factory == nullptr)
|
std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (save_data_factory == nullptr) {
|
||||||
save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
|
save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
|
||||||
if (sdmc_factory == nullptr)
|
}
|
||||||
|
|
||||||
|
if (sdmc_factory == nullptr) {
|
||||||
sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
|
sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) {
|
void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) {
|
||||||
romfs_factory = nullptr;
|
romfs_factory = nullptr;
|
||||||
|
|
|
@ -54,6 +54,7 @@ FileSys::RegisteredCache* GetUserNANDContents();
|
||||||
FileSys::RegisteredCache* GetSDMCContents();
|
FileSys::RegisteredCache* GetSDMCContents();
|
||||||
|
|
||||||
FileSys::VirtualDir GetModificationLoadRoot(u64 title_id);
|
FileSys::VirtualDir GetModificationLoadRoot(u64 title_id);
|
||||||
|
FileSys::VirtualDir GetModificationDumpRoot(u64 title_id);
|
||||||
|
|
||||||
// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
|
// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
|
||||||
// above is called.
|
// above is called.
|
||||||
|
|
Loading…
Reference in a new issue