MCPcopy Create free account
hub / github.com/amwatson/CitraVR / GetFileLoader

Function GetFileLoader

src/core/loader/loader.cpp:93–114  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

91 * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type
92 */
93static 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
116std::unique_ptr<AppLoader> GetLoader(const std::string& filename) {
117 FileUtil::IOFile file(filename, "rb");

Callers 1

GetLoaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected