diff options
Diffstat (limited to 'src/core/loader/loader.cpp')
| -rw-r--r-- | src/core/loader/loader.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index c4b4f5a5d..6b88169e1 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -26,12 +26,7 @@ const std::initializer_list<Kernel::AddressMapping> default_address_mappings = { | |||
| 26 | { 0x1F000000, 0x600000, false }, // entire VRAM | 26 | { 0x1F000000, 0x600000, false }, // entire VRAM |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | /** | 29 | FileType IdentifyFile(FileUtil::IOFile& file) { |
| 30 | * Identifies the type of a bootable file | ||
| 31 | * @param file open file | ||
| 32 | * @return FileType of file | ||
| 33 | */ | ||
| 34 | static FileType IdentifyFile(FileUtil::IOFile& file) { | ||
| 35 | FileType type; | 30 | FileType type; |
| 36 | 31 | ||
| 37 | #define CHECK_TYPE(loader) \ | 32 | #define CHECK_TYPE(loader) \ |
| @@ -48,12 +43,17 @@ static FileType IdentifyFile(FileUtil::IOFile& file) { | |||
| 48 | return FileType::Unknown; | 43 | return FileType::Unknown; |
| 49 | } | 44 | } |
| 50 | 45 | ||
| 51 | /** | 46 | FileType IdentifyFile(const std::string& file_name) { |
| 52 | * Guess the type of a bootable file from its extension | 47 | FileUtil::IOFile file(file_name, "rb"); |
| 53 | * @param extension_ String extension of bootable file | 48 | if (!file.IsOpen()) { |
| 54 | * @return FileType of file | 49 | LOG_ERROR(Loader, "Failed to load file %s", file_name.c_str()); |
| 55 | */ | 50 | return FileType::Unknown; |
| 56 | static FileType GuessFromExtension(const std::string& extension_) { | 51 | } |
| 52 | |||
| 53 | return IdentifyFile(file); | ||
| 54 | } | ||
| 55 | |||
| 56 | FileType GuessFromExtension(const std::string& extension_) { | ||
| 57 | std::string extension = Common::ToLower(extension_); | 57 | std::string extension = Common::ToLower(extension_); |
| 58 | 58 | ||
| 59 | if (extension == ".elf" || extension == ".axf") | 59 | if (extension == ".elf" || extension == ".axf") |
| @@ -71,7 +71,7 @@ static FileType GuessFromExtension(const std::string& extension_) { | |||
| 71 | return FileType::Unknown; | 71 | return FileType::Unknown; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static const char* GetFileTypeString(FileType type) { | 74 | const char* GetFileTypeString(FileType type) { |
| 75 | switch (type) { | 75 | switch (type) { |
| 76 | case FileType::CCI: | 76 | case FileType::CCI: |
| 77 | return "NCSD"; | 77 | return "NCSD"; |