Correctly get EmuNAND titles

This commit is contained in:
wiidev 2023-01-01 17:00:10 +00:00
parent c23ea99704
commit b97f2305f9

View File

@ -558,7 +558,7 @@ bool Channels::ParseTitleDir(char *path, int language)
if (!dirent->d_name) if (!dirent->d_name)
continue; continue;
//these can't be booted anyways // These can't be booted anyways
if (*dirent->d_name == '.' || strcmp(dirent->d_name, "48414141") == 0 || strcmp(dirent->d_name, "48414641") == 0) if (*dirent->d_name == '.' || strcmp(dirent->d_name, "48414141") == 0 || strcmp(dirent->d_name, "48414641") == 0)
{ {
continue; continue;
@ -569,10 +569,13 @@ bool Channels::ParseTitleDir(char *path, int language)
if (stat(path, &st) != 0) if (stat(path, &st) != 0)
continue; continue;
// check if content in tmd exists // Check if content in tmd exists
if (!emuExists(path)) if (!emuExists(path))
continue; continue;
// Reset tmd location on path
snprintf(pathEndPtr, 1024 - (pathEndPtr - path), "/%s/content/title.tmd", dirent->d_name);
u32 tidLow = strtoul(dirent->d_name, NULL, 16); u32 tidLow = strtoul(dirent->d_name, NULL, 16);
char id[5]; char id[5];
memset(id, 0, sizeof(id)); memset(id, 0, sizeof(id));
@ -585,20 +588,10 @@ bool Channels::ParseTitleDir(char *path, int language)
strcpy(id, "JODI"); strcpy(id, "JODI");
std::string TitleName; std::string TitleName;
if(!GetEmuChanTitle(path, language, TitleName))
const char *title = GameTitles.GetTitle(id);
if (title && *title != '\0')
{
TitleName = title;
}
else if (GetEmuChanTitle(path, language, TitleName))
{
GameTitles.SetGameTitle(id, TitleName.c_str());
}
else
{
TitleName = id; TitleName = id;
}
TitleName.erase(0, TitleName.find_first_not_of(' '));
int s = EmuChannels.size(); int s = EmuChannels.size();
EmuChannels.resize(s + 1); EmuChannels.resize(s + 1);
@ -764,7 +757,7 @@ u8 *Channels::GetOpeningBnr(const u64 &title, u32 *outsize, const char *pathPref
break; break;
IMET *imet = (IMET *)(buffer + IMET_OFFSET); IMET *imet = (IMET *)(buffer + IMET_OFFSET);
if (imet->sig != 'IMET') if (imet->sig != IMET_SIGNATURE)
{ {
free(buffer); free(buffer);
break; break;