Filter non-executable files out of the game list.

This commit is contained in:
Steveice10 2019-09-07 01:52:18 -07:00
parent 4bc22aa350
commit 5cf684c951
4 changed files with 26 additions and 0 deletions

View File

@ -49,6 +49,11 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
if (!loader) if (!loader)
return true; return true;
bool executable = false;
loader->IsExecutable(executable);
if (!executable)
return true;
u64 program_id = 0; u64 program_id = 0;
loader->ReadProgramId(program_id); loader->ReadProgramId(program_id);

View File

@ -112,6 +112,16 @@ public:
return std::make_pair(2, ResultStatus::Success); return std::make_pair(2, ResultStatus::Success);
} }
/**
* Get whether this application is executable.
* @param out_executable Reference to store the executable flag into.
* @return ResultStatus result of function
*/
virtual ResultStatus IsExecutable(bool& out_executable) {
out_executable = true;
return ResultStatus::Success;
}
/** /**
* Get the code (typically .code section) of the application * Get the code (typically .code section) of the application
* @param buffer Reference to buffer to store data * @param buffer Reference to buffer to store data

View File

@ -198,6 +198,15 @@ ResultStatus AppLoader_NCCH::Load(std::shared_ptr<Kernel::Process>& process) {
return ResultStatus::Success; return ResultStatus::Success;
} }
ResultStatus AppLoader_NCCH::IsExecutable(bool& out_executable) {
Loader::ResultStatus result = overlay_ncch->Load();
if (result != Loader::ResultStatus::Success)
return result;
out_executable = overlay_ncch->ncch_header.is_executable != 0;
return ResultStatus::Success;
}
ResultStatus AppLoader_NCCH::ReadCode(std::vector<u8>& buffer) { ResultStatus AppLoader_NCCH::ReadCode(std::vector<u8>& buffer) {
return overlay_ncch->LoadSectionExeFS(".code", buffer); return overlay_ncch->LoadSectionExeFS(".code", buffer);
} }

View File

@ -41,6 +41,8 @@ public:
*/ */
std::pair<std::optional<u32>, ResultStatus> LoadKernelSystemMode() override; std::pair<std::optional<u32>, ResultStatus> LoadKernelSystemMode() override;
ResultStatus IsExecutable(bool& out_executable) override;
ResultStatus ReadCode(std::vector<u8>& buffer) override; ResultStatus ReadCode(std::vector<u8>& buffer) override;
ResultStatus ReadIcon(std::vector<u8>& buffer) override; ResultStatus ReadIcon(std::vector<u8>& buffer) override;