-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(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;
}

View File

@ -79,7 +79,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
gprintf("Calling list to update filelist\n");
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);
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> temp_pathlist;
bool foundDMLgame;
struct dirent *ent;
/* Read primary entries */
@ -38,20 +37,18 @@ void CList<T>::GetPaths(safe_vector<string> &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<string>::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<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
{
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());
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;
}
}