diff options
Diffstat (limited to 'src/core/loader/nca.h')
| -rw-r--r-- | src/core/loader/nca.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h new file mode 100644 index 000000000..3b6c451d0 --- /dev/null +++ b/src/core/loader/nca.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "core/file_sys/partition_filesystem.h" | ||
| 10 | #include "core/file_sys/program_metadata.h" | ||
| 11 | #include "core/hle/kernel/kernel.h" | ||
| 12 | #include "core/loader/loader.h" | ||
| 13 | |||
| 14 | namespace Loader { | ||
| 15 | |||
| 16 | class Nca; | ||
| 17 | |||
| 18 | /// Loads an NCA file | ||
| 19 | class AppLoader_NCA final : public AppLoader { | ||
| 20 | public: | ||
| 21 | AppLoader_NCA(FileUtil::IOFile&& file, std::string filepath); | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Returns the type of the file | ||
| 25 | * @param file FileUtil::IOFile open file | ||
| 26 | * @param filepath Path of the file that we are opening. | ||
| 27 | * @return FileType found, or FileType::Error if this loader doesn't know it | ||
| 28 | */ | ||
| 29 | static FileType IdentifyType(FileUtil::IOFile& file, const std::string& filepath); | ||
| 30 | |||
| 31 | FileType GetFileType() override { | ||
| 32 | return IdentifyType(file, filepath); | ||
| 33 | } | ||
| 34 | |||
| 35 | ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override; | ||
| 36 | |||
| 37 | ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, | ||
| 38 | u64& size) override; | ||
| 39 | |||
| 40 | ~AppLoader_NCA(); | ||
| 41 | |||
| 42 | private: | ||
| 43 | std::string filepath; | ||
| 44 | FileSys::ProgramMetadata metadata; | ||
| 45 | |||
| 46 | std::unique_ptr<Nca> nca; | ||
| 47 | }; | ||
| 48 | |||
| 49 | } // namespace Loader | ||