From 314ce5e505aca066ad4d0385be46d7e8de9f6dfb Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 18 May 2016 22:06:50 +0100 Subject: CitraQt: Simplify the game list loader code --- src/core/loader/loader.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/core/loader/loader.cpp') 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 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 a pointer to a loader object; nullptr for unsupported type + */ +static std::unique_ptr GetFileLoader(FileUtil::IOFile&& file, FileType type, const std::string& filename, const std::string& filepath) { switch (type) { @@ -113,7 +121,7 @@ std::unique_ptr GetLoader(FileUtil::IOFile&& file, FileType type, } } -std::unique_ptr GetFileLoader(const std::string& filename) { +std::unique_ptr 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 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 -- cgit v1.2.3