Merge pull request #4922 from Steveice10/master

Filter non-executable files out of the game list.
This commit is contained in:
James Rowe 2019-09-16 23:51:44 -06:00 committed by GitHub
commit 4b05078def
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;