mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-21 07:50:56 +01:00
Loader: Display the type of the file being loaded.
This commit is contained in:
parent
82ec17db7d
commit
2c24e539a2
1 changed files with 23 additions and 3 deletions
|
@ -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...
|
||||
|
|
Loading…
Reference in a new issue