diff --git a/source/gc/gc.c b/source/gc/gc.c index 55519b2f..decc9949 100644 --- a/source/gc/gc.c +++ b/source/gc/gc.c @@ -124,14 +124,24 @@ bool GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgame snprintf(folder, sizeof(folder), dmlgamedir, partition); snprintf(source, sizeof(source), "%s/%s/game.iso", folder, discid); - FILE *f = fopen(source, "r"); - if (f) + FILE *f = fopen(source, "rb"); + if(f) { gprintf("Found on %s: %s\n", partition, source); fclose(f); return true; } - gprintf("Not found on %s: %s\n", partition, source); + else + { + snprintf(source, sizeof(source), "%s/%s/sys/boot.bin", folder, discid); + f = fopen(source, "rb"); + if(f) + { + gprintf("Found on %s: %s\n", partition, source); + fclose(f); + return true; + } + } return false; } diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp index 9016607f..6d237ef4 100644 --- a/source/list/cachedlist.cpp +++ b/source/list/cachedlist.cpp @@ -79,7 +79,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage) gprintf("Calling list to update filelist\n"); safe_vector pathlist; - list.GetPaths(pathlist, containing, path, m_wbfsFS, update_dml); + list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL))); list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin); path.append("/touch.db"); diff --git a/source/list/list.cpp b/source/list/list.cpp index 2961a2b4..c9e97259 100644 --- a/source/list/list.cpp +++ b/source/list/list.cpp @@ -18,7 +18,6 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string safe_vector compares = stringToVector(containing, '|'); safe_vector temp_pathlist; - bool foundDMLgame; struct dirent *ent; /* Read primary entries */ @@ -38,20 +37,18 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string } } else - { temp_pathlist.push_back(sfmt("%s/%s", directory.c_str(), ent->d_name)); - } } closedir(dir_itr); if(temp_pathlist.size() > 0) { + bool FoundDMLgame; for(safe_vector::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++) { dir_itr = opendir((*templist).c_str()); if (!dir_itr) continue; - if(dml) - foundDMLgame = false; + FoundDMLgame = false; /* Read secondary entries */ while((ent = readdir(dir_itr)) != NULL) @@ -60,21 +57,24 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string { for(safe_vector::iterator compare = compares.begin(); compare != compares.end(); compare++) { - if (strcasestr(ent->d_name, (*compare).c_str()) != NULL) + if(dml && strcasestr(ent->d_name, (*compare).c_str()) != NULL) { + FoundDMLgame = true; //gprintf("Pushing %s to the list.\n", sfmt("%s/%s", (*templist).c_str(), ent->d_name).c_str()); pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name)); - if(dml) - foundDMLgame = true; break; } } } - else if(dml && foundDMLgame == false) + else if(dml && !FoundDMLgame && strncasecmp(ent->d_name, "sys", 3) == 0) { - if(strcasestr(ent->d_name, "sys") != NULL) + FILE *f; + f = fopen(fmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name), "rb"); + if(f) { - temp_pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name)); + fclose(f); + //gprintf("Pushing %s to the list.\n", sfmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name).c_str()); + pathlist.push_back(sfmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name)); break; } }