nca.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <string>
  6. #include "common/common_types.h"
  7. #include "core/file_sys/partition_filesystem.h"
  8. #include "core/file_sys/program_metadata.h"
  9. #include "core/hle/kernel/kernel.h"
  10. #include "core/loader/loader.h"
  11. namespace Loader {
  12. class Nca;
  13. /// Loads an NCA file
  14. class AppLoader_NCA final : public AppLoader {
  15. public:
  16. AppLoader_NCA(FileUtil::IOFile&& file, std::string filepath);
  17. /**
  18. * Returns the type of the file
  19. * @param file FileUtil::IOFile open file
  20. * @param filepath Path of the file that we are opening.
  21. * @return FileType found, or FileType::Error if this loader doesn't know it
  22. */
  23. static FileType IdentifyType(FileUtil::IOFile& file, const std::string& filepath);
  24. FileType GetFileType() override {
  25. return IdentifyType(file, filepath);
  26. }
  27. ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
  28. ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
  29. u64& size) override;
  30. ~AppLoader_NCA();
  31. private:
  32. std::string filepath;
  33. FileSys::ProgramMetadata metadata;
  34. std::unique_ptr<Nca> nca;
  35. };
  36. } // namespace Loader