diff options
| author | 2016-05-18 22:06:50 +0100 | |
|---|---|---|
| committer | 2016-05-21 17:09:59 +0100 | |
| commit | 314ce5e505aca066ad4d0385be46d7e8de9f6dfb (patch) | |
| tree | e71b47815cf82006ea78b9820b5df5f99f8380b9 /src/citra_qt/game_list.cpp | |
| parent | Loader: Add a GetFileType method to get the type of a loaded file (diff) | |
| download | yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.gz yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.tar.xz yuzu-314ce5e505aca066ad4d0385be46d7e8de9f6dfb.zip | |
CitraQt: Simplify the game list loader code
Diffstat (limited to 'src/citra_qt/game_list.cpp')
| -rw-r--r-- | src/citra_qt/game_list.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index d4ac9c96e..570647539 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp | |||
| @@ -132,30 +132,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool d | |||
| 132 | if (deep_scan && FileUtil::IsDirectory(physical_name)) { | 132 | if (deep_scan && FileUtil::IsDirectory(physical_name)) { |
| 133 | AddFstEntriesToGameList(physical_name, true); | 133 | AddFstEntriesToGameList(physical_name, true); |
| 134 | } else { | 134 | } else { |
| 135 | std::string filename_filename, filename_extension; | 135 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); |
| 136 | Common::SplitPath(physical_name, nullptr, &filename_filename, &filename_extension); | 136 | if (!loader) |
| 137 | |||
| 138 | Loader::FileType guessed_filetype = Loader::GuessFromExtension(filename_extension); | ||
| 139 | if (guessed_filetype == Loader::FileType::Unknown) | ||
| 140 | return true; | ||
| 141 | Loader::FileType filetype = Loader::IdentifyFile(physical_name); | ||
| 142 | if (filetype == Loader::FileType::Unknown) { | ||
| 143 | LOG_WARNING(Frontend, "File %s is of indeterminate type and is possibly corrupted.", physical_name.c_str()); | ||
| 144 | return true; | 137 | return true; |
| 145 | } | ||
| 146 | if (guessed_filetype != filetype) { | ||
| 147 | LOG_WARNING(Frontend, "Filetype and extension of file %s do not match.", physical_name.c_str()); | ||
| 148 | } | ||
| 149 | 138 | ||
| 150 | std::vector<u8> smdh; | 139 | std::vector<u8> smdh; |
| 151 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(FileUtil::IOFile(physical_name, "rb"), filetype, filename_filename, physical_name); | 140 | loader->ReadIcon(smdh); |
| 152 | |||
| 153 | if (loader) | ||
| 154 | loader->ReadIcon(smdh); | ||
| 155 | 141 | ||
| 156 | emit EntryReady({ | 142 | emit EntryReady({ |
| 157 | new GameListItemPath(QString::fromStdString(physical_name), smdh), | 143 | new GameListItemPath(QString::fromStdString(physical_name), smdh), |
| 158 | new GameListItem(QString::fromStdString(Loader::GetFileTypeString(filetype))), | 144 | new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), |
| 159 | new GameListItemSize(FileUtil::GetSize(physical_name)), | 145 | new GameListItemSize(FileUtil::GetSize(physical_name)), |
| 160 | }); | 146 | }); |
| 161 | } | 147 | } |