summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-07 01:33:00 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2015-01-15 22:23:08 +0100
commit2c24e539a23438c84653f00f08df455d9837a20f (patch)
tree29254661ba71284d6808e9536fb62ab042863c30 /src
parentLoader: Guess filetype from the magic, or fallback to the extension. (diff)
downloadyuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar.gz
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar.bz2
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar.lz
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar.xz
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.tar.zst
yuzu-2c24e539a23438c84653f00f08df455d9837a20f.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/loader/loader.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 01b415215..60460292d 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -72,12 +72,30 @@ static FileType GuessFromFilename(const std::string& filename) {
return FileType::Unknown;
}
-ResultStatus LoadFile(const std::string& filename) {
- LOG_INFO(Loader, "Loading file %s...", filename.c_str());
+static const char* GetFileTypeString(FileType type) {
+ switch (type) {
+ case FileType::CCI:
+ return "NCSD";
+ case FileType::CXI:
+ return "NCCH";
+ case FileType::ELF:
+ return "ELF";
+ case FileType::THREEDSX:
+ return "3DSX";
+ case FileType::BIN:
+ return "raw";
+ case FileType::Error:
+ case FileType::Unknown:
+ return "unknown";
+ }
+}
+ResultStatus LoadFile(const std::string& filename) {
std::unique_ptr<FileUtil::IOFile> file(new FileUtil::IOFile(filename, "rb"));
- if (!file->IsOpen())
+ if (!file->IsOpen()) {
+ LOG_ERROR(Loader, "Failed to load file %s", filename.c_str());
return ResultStatus::Error;
+ }
FileType type = IdentifyFile(*file);
FileType filename_type = GuessFromFilename(filename);
@@ -88,6 +106,8 @@ ResultStatus LoadFile(const std::string& filename) {
type = filename_type;
}
+ LOG_INFO(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type));
+
switch (type) {
//3DSX file format...