GameList: Use MCP_TitleListByAppType to request specific app catergories

This commit is contained in:
rw-r-r-0644 2020-05-02 21:50:46 +02:00
parent 96fa65a5ff
commit 36c92744b7
No known key found for this signature in database
GPG Key ID: 9F89C03279187405
2 changed files with 34 additions and 16 deletions

View File

@ -77,21 +77,39 @@ int32_t GameList::readGameList() {
}
std::vector<struct MCPTitleListType> titles(titleCount);
uint32_t realTitleCount;
uint32_t realTitleCount = 0;
MCPError err = MCP_TitleList(mcp, &realTitleCount, titles.data(), titles.size() * sizeof(decltype(titles)::value_type));
static const std::vector<MCPAppType> menuAppTypes {
MCP_APP_TYPE_GAME,
MCP_APP_TYPE_GAME_WII,
MCP_APP_TYPE_SYSTEM_APPS,
MCP_APP_TYPE_SYSTEM_SETTINGS,
MCP_APP_TYPE_FRIEND_LIST,
MCP_APP_TYPE_MIIVERSE,
MCP_APP_TYPE_ESHOP,
MCP_APP_TYPE_BROWSER,
MCP_APP_TYPE_DOWNLOAD_MANAGEMENT,
MCP_APP_TYPE_ACCOUNT_APPS,
};
for (auto appType : menuAppTypes) {
uint32_t titleCountByType = 0;
MCPError err = MCP_TitleListByAppType(mcp, appType, &titleCountByType, titles.data() + realTitleCount,
(titles.size() - realTitleCount) * sizeof(decltype(titles)::value_type));
if (err < 0) {
MCP_Close(mcp);
return 0;
}
realTitleCount += titleCountByType;
}
if (realTitleCount != titles.size()) {
titles.resize(realTitleCount);
}
for (auto title_candidate : titles) {
if(true || (title_candidate.titleId & 0xFFFFFFFF00000000L) == 0x0005000000000000L) {
gameInfo* newGameInfo = new gameInfo;
newGameInfo->titleId = title_candidate.titleId;
newGameInfo->appType = title_candidate.appType;
newGameInfo->gamePath = title_candidate.path;
newGameInfo->name = "<unknown>";
newGameInfo->imageData = NULL;
@ -101,7 +119,6 @@ int32_t GameList::readGameList() {
titleAdded(newGameInfo);
cnt++;
}
}
AsyncExecutor::execute([this] {
lock();

View File

@ -11,6 +11,7 @@
typedef struct _gameInfo {
uint64_t titleId;
MCPAppType appType;
std::string name;
std::string gamePath;
GuiImageData * imageData;