diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-05-18 23:06:50 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-05-21 18:09:59 +0200 |
commit | 314ce5e505aca066ad4d0385be46d7e8de9f6dfb (patch) | |
tree | e71b47815cf82006ea78b9820b5df5f99f8380b9 /src/core/loader | |
parent | Loader: Add a GetFileType method to get the type of a loaded file (diff) | |
download | yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.gz yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.bz2 yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.lz yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.xz yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.zst yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.zip |
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/loader.cpp | 14 | ||||
-rw-r--r-- | src/core/loader/loader.h | 12 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index c82688026..9719d30d5 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -91,7 +91,15 @@ const char* GetFileTypeString(FileType type) { return "unknown"; } -std::unique_ptr<AppLoader> GetLoader(FileUtil::IOFile&& file, FileType type, +/** + * 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<AppLoader> a pointer to a loader object; nullptr for unsupported type + */ +static std::unique_ptr<AppLoader> GetFileLoader(FileUtil::IOFile&& file, FileType type, const std::string& filename, const std::string& filepath) { switch (type) { @@ -113,7 +121,7 @@ std::unique_ptr<AppLoader> GetLoader(FileUtil::IOFile&& file, FileType type, } } -std::unique_ptr<AppLoader> GetFileLoader(const std::string& filename) { +std::unique_ptr<AppLoader> GetLoader(const std::string& filename) { FileUtil::IOFile file(filename, "rb"); if (!file.IsOpen()) { LOG_ERROR(Loader, "Failed to load file %s", filename.c_str()); @@ -134,7 +142,7 @@ std::unique_ptr<AppLoader> GetFileLoader(const std::string& filename) { LOG_INFO(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type)); - return GetLoader(std::move(file), type, filename_filename, filename); + return GetFileLoader(std::move(file), type, filename_filename, filename); } } // namespace Loader diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 08bab84e5..39aedfeeb 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -203,20 +203,10 @@ protected: extern const std::initializer_list<Kernel::AddressMapping> default_address_mappings; /** - * 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<AppLoader> a pointer to a loader object; nullptr for unsupported type - */ -std::unique_ptr<AppLoader> GetLoader(FileUtil::IOFile&& file, FileType type, const std::string& filename, const std::string& filepath); - -/** * Identifies a bootable file and return a suitable loader * @param filename String filename of bootable file * @return best loader for this file */ -std::unique_ptr<AppLoader> GetFileLoader(const std::string& filename); +std::unique_ptr<AppLoader> GetLoader(const std::string& filename); } // namespace |