romfs_factory.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <algorithm>
  5. #include <memory>
  6. #include "common/common_types.h"
  7. #include "common/logging/log.h"
  8. #include "core/file_sys/romfs_factory.h"
  9. #include "core/file_sys/romfs_filesystem.h"
  10. namespace FileSys {
  11. RomFS_Factory::RomFS_Factory(Loader::AppLoader& app_loader) {
  12. // Load the RomFS from the app
  13. if (Loader::ResultStatus::Success != app_loader.ReadRomFS(romfs_file, data_offset, data_size)) {
  14. NGLOG_ERROR(Service_FS, "Unable to read RomFS!");
  15. }
  16. }
  17. ResultVal<std::unique_ptr<FileSystemBackend>> RomFS_Factory::Open(const Path& path) {
  18. auto archive = std::make_unique<RomFS_FileSystem>(romfs_file, data_offset, data_size);
  19. return MakeResult<std::unique_ptr<FileSystemBackend>>(std::move(archive));
  20. }
  21. ResultCode RomFS_Factory::Format(const Path& path) {
  22. NGLOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
  23. // TODO(bunnei): Find the right error code for this
  24. return ResultCode(-1);
  25. }
  26. ResultVal<ArchiveFormatInfo> RomFS_Factory::GetFormatInfo(const Path& path) const {
  27. NGLOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
  28. // TODO(bunnei): Find the right error code for this
  29. return ResultCode(-1);
  30. }
  31. } // namespace FileSys