Loader: Display the type of the file being loaded.

This commit is contained in:
Emmanuel Gil Peyrot 2015-01-07 00:33:00 +00:00
parent 82ec17db7d
commit 2c24e539a2

View file

@ -72,12 +72,30 @@ static FileType GuessFromFilename(const std::string& filename) {
return FileType::Unknown; return FileType::Unknown;
} }
ResultStatus LoadFile(const std::string& filename) { static const char* GetFileTypeString(FileType type) {
LOG_INFO(Loader, "Loading file %s...", filename.c_str()); 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")); 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; return ResultStatus::Error;
}
FileType type = IdentifyFile(*file); FileType type = IdentifyFile(*file);
FileType filename_type = GuessFromFilename(filename); FileType filename_type = GuessFromFilename(filename);
@ -88,6 +106,8 @@ ResultStatus LoadFile(const std::string& filename) {
type = filename_type; type = filename_type;
} }
LOG_INFO(Loader, "Loading file %s as %s...", filename.c_str(), GetFileTypeString(type));
switch (type) { switch (type) {
//3DSX file format... //3DSX file format...