-fixed codedump on refreshing dml coverflow cache

-added detection of new GCReEx games on sd card
This commit is contained in:
fix94.1 2012-04-22 13:39:26 +00:00
parent 889a42adee
commit 82ce0f2dce
3 changed files with 25 additions and 15 deletions

View File

@ -124,14 +124,24 @@ bool GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgame
snprintf(folder, sizeof(folder), dmlgamedir, partition); snprintf(folder, sizeof(folder), dmlgamedir, partition);
snprintf(source, sizeof(source), "%s/%s/game.iso", folder, discid); snprintf(source, sizeof(source), "%s/%s/game.iso", folder, discid);
FILE *f = fopen(source, "r"); FILE *f = fopen(source, "rb");
if (f) if(f)
{ {
gprintf("Found on %s: %s\n", partition, source); gprintf("Found on %s: %s\n", partition, source);
fclose(f); fclose(f);
return true; 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; return false;
} }

View File

@ -79,7 +79,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
gprintf("Calling list to update filelist\n"); gprintf("Calling list to update filelist\n");
safe_vector<string> pathlist; safe_vector<string> 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); list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin);
path.append("/touch.db"); path.append("/touch.db");

View File

@ -18,7 +18,6 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
safe_vector<string> compares = stringToVector(containing, '|'); safe_vector<string> compares = stringToVector(containing, '|');
safe_vector<string> temp_pathlist; safe_vector<string> temp_pathlist;
bool foundDMLgame;
struct dirent *ent; struct dirent *ent;
/* Read primary entries */ /* Read primary entries */
@ -38,20 +37,18 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
} }
} }
else else
{
temp_pathlist.push_back(sfmt("%s/%s", directory.c_str(), ent->d_name)); temp_pathlist.push_back(sfmt("%s/%s", directory.c_str(), ent->d_name));
} }
}
closedir(dir_itr); closedir(dir_itr);
if(temp_pathlist.size() > 0) if(temp_pathlist.size() > 0)
{ {
bool FoundDMLgame;
for(safe_vector<string>::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++) for(safe_vector<string>::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++)
{ {
dir_itr = opendir((*templist).c_str()); dir_itr = opendir((*templist).c_str());
if (!dir_itr) continue; if (!dir_itr) continue;
if(dml) FoundDMLgame = false;
foundDMLgame = false;
/* Read secondary entries */ /* Read secondary entries */
while((ent = readdir(dir_itr)) != NULL) while((ent = readdir(dir_itr)) != NULL)
@ -60,21 +57,24 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
{ {
for(safe_vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++) for(safe_vector<string>::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()); //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)); pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name));
if(dml)
foundDMLgame = true;
break; 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; break;
} }
} }