bis_factory.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <fmt/format.h>
  5. #include "core/file_sys/bis_factory.h"
  6. #include "core/file_sys/registered_cache.h"
  7. namespace FileSys {
  8. BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_)
  9. : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)),
  10. sysnand_cache(std::make_shared<RegisteredCache>(
  11. GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))),
  12. usrnand_cache(std::make_shared<RegisteredCache>(
  13. GetOrCreateDirectoryRelative(nand_root, "/user/Contents/registered"))) {}
  14. BISFactory::~BISFactory() = default;
  15. std::shared_ptr<RegisteredCache> BISFactory::GetSystemNANDContents() const {
  16. return sysnand_cache;
  17. }
  18. std::shared_ptr<RegisteredCache> BISFactory::GetUserNANDContents() const {
  19. return usrnand_cache;
  20. }
  21. VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const {
  22. // LayeredFS doesn't work on updates and title id-less homebrew
  23. if (title_id == 0 || (title_id & 0x800) > 0)
  24. return nullptr;
  25. return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id));
  26. }
  27. } // namespace FileSys