summaryrefslogtreecommitdiffstats
path: root/src/core/loader/loader.cpp
diff options
context:
space:
mode:
authorarchshift <gh@archshift.com>2015-09-01 03:28:37 +0200
committerarchshift <gh@archshift.com>2015-10-01 06:04:47 +0200
commitbba12520c432a5b5975a76f014ed3c80e3411bb6 (patch)
tree01d39ed607550bc36b025958b8b860f5cb36870d /src/core/loader/loader.cpp
parentMerge pull request #1123 from yuriks/gsp-flush (diff)
downloadyuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar.gz
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar.bz2
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar.lz
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar.xz
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.tar.zst
yuzu-bba12520c432a5b5975a76f014ed3c80e3411bb6.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/loader.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 74eb6e871..b1902dcca 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 = {
{ 0x1F000000, 0x600000, false }, // entire VRAM
};
-/**
- * Identifies the type of a bootable file
- * @param file open file
- * @return FileType of file
- */
-static FileType IdentifyFile(FileUtil::IOFile& file) {
+FileType IdentifyFile(FileUtil::IOFile& file) {
FileType type;
#define CHECK_TYPE(loader) \
@@ -48,12 +43,17 @@ static FileType IdentifyFile(FileUtil::IOFile& file) {
return FileType::Unknown;
}
-/**
- * Guess the type of a bootable file from its extension
- * @param extension_ String extension of bootable file
- * @return FileType of file
- */
-static FileType GuessFromExtension(const std::string& extension_) {
+FileType IdentifyFile(const std::string& file_name) {
+ FileUtil::IOFile file(file_name, "rb");
+ if (!file.IsOpen()) {
+ LOG_ERROR(Loader, "Failed to load file %s", file_name.c_str());
+ return FileType::Unknown;
+ }
+
+ return IdentifyFile(file);
+}
+
+FileType GuessFromExtension(const std::string& extension_) {
std::string extension = Common::ToLower(extension_);
if (extension == ".elf" || extension == ".axf")
@@ -71,7 +71,7 @@ static FileType GuessFromExtension(const std::string& extension_) {
return FileType::Unknown;
}
-static const char* GetFileTypeString(FileType type) {
+const char* GetFileTypeString(FileType type) {
switch (type) {
case FileType::CCI:
return "NCSD";