* Get a loader for a file with a specific type * @param file The file to load * @param type The type of the file * @param filename the file name (without path) * @param filepath the file full path (with name) * @return std::unique_ptr a pointer to a loader object; nullptr for unsupported type */
| 91 | * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type |
| 92 | */ |
| 93 | static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileUtil::IOFile&& file, |
| 94 | FileType type, const std::string& filename, |
| 95 | const std::string& filepath) { |
| 96 | switch (type) { |
| 97 | |
| 98 | // 3DSX file format. |
| 99 | case FileType::THREEDSX: |
| 100 | return std::make_unique<AppLoader_THREEDSX>(system, std::move(file), filename, filepath); |
| 101 | |
| 102 | // Standard ELF file format. |
| 103 | case FileType::ELF: |
| 104 | return std::make_unique<AppLoader_ELF>(system, std::move(file), filename); |
| 105 | |
| 106 | // NCCH/NCSD container formats. |
| 107 | case FileType::CXI: |
| 108 | case FileType::CCI: |
| 109 | return std::make_unique<AppLoader_NCCH>(system, std::move(file), filepath); |
| 110 | |
| 111 | default: |
| 112 | return nullptr; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | std::unique_ptr<AppLoader> GetLoader(const std::string& filename) { |
| 117 | FileUtil::IOFile file(filename, "rb"); |