Merge pull request #1873 from lioncash/const
loaders: Make GetFileType() a const qualified member function
This commit is contained in:
commit
f85134021f
11 changed files with 25 additions and 19 deletions
|
@ -33,7 +33,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
* Returns the type of this file
|
* Returns the type of this file
|
||||||
* @return FileType corresponding to the loaded file
|
* @return FileType corresponding to the loaded file
|
||||||
*/
|
*/
|
||||||
virtual FileType GetFileType() = 0;
|
virtual FileType GetFileType() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the application and return the created Process instance
|
* Load the application and return the created Process instance
|
||||||
|
|
|
@ -37,7 +37,7 @@ FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
|
||||||
return IdentifyTypeImpl(nax);
|
return IdentifyTypeImpl(nax);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileType AppLoader_NAX::GetFileType() {
|
FileType AppLoader_NAX::GetFileType() const {
|
||||||
return IdentifyTypeImpl(*nax);
|
return IdentifyTypeImpl(*nax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override;
|
FileType GetFileType() const override;
|
||||||
|
|
||||||
ResultStatus Load(Kernel::Process& process) override;
|
ResultStatus Load(Kernel::Process& process) override;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
||||||
|
|
||||||
FileType GetFileType() override {
|
FileType GetFileType() const override {
|
||||||
return IdentifyType(file);
|
return IdentifyType(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,14 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
|
||||||
compatibility = it->second.first;
|
compatibility = it->second.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto file_type = loader.GetFileType();
|
||||||
|
const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type));
|
||||||
|
|
||||||
QList<QStandardItem*> list{
|
QList<QStandardItem*> list{
|
||||||
new GameListItemPath(
|
new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name),
|
||||||
FormatGameName(path), icon, QString::fromStdString(name),
|
file_type_string, program_id),
|
||||||
QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id),
|
|
||||||
new GameListItemCompat(compatibility),
|
new GameListItemCompat(compatibility),
|
||||||
new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))),
|
new GameListItem(file_type_string),
|
||||||
new GameListItemSize(FileUtil::GetSize(path)),
|
new GameListItemSize(FileUtil::GetSize(path)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,12 +198,16 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
|
||||||
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
||||||
if (!is_dir &&
|
if (!is_dir &&
|
||||||
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
||||||
std::unique_ptr<Loader::AppLoader> loader =
|
auto loader = Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read));
|
||||||
Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read));
|
if (!loader) {
|
||||||
if (!loader || ((loader->GetFileType() == Loader::FileType::Unknown ||
|
|
||||||
loader->GetFileType() == Loader::FileType::Error) &&
|
|
||||||
!UISettings::values.show_unknown))
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto file_type = loader->GetFileType();
|
||||||
|
if ((file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) &&
|
||||||
|
!UISettings::values.show_unknown) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<u8> icon;
|
std::vector<u8> icon;
|
||||||
const auto res1 = loader->ReadIcon(icon);
|
const auto res1 = loader->ReadIcon(icon);
|
||||||
|
|
Loading…
Reference in a new issue