Shortcut IdentifyFile (which is now used by GameInfoCache) by trusting the file extensions.

This commit is contained in:
Henrik Rydgard 2013-06-09 23:09:13 +02:00
parent e5050442be
commit 9e345132b9

View File

@ -34,6 +34,16 @@ EmuFileType Identify_File(std::string &filename)
return FILETYPE_ERROR;
}
std::string extension = filename.substr(filename.size() - 4);
if (!strcasecmp(extension.c_str(),".iso"))
{
return FILETYPE_PSP_ISO;
}
else if (!strcasecmp(extension.c_str(),".cso"))
{
return FILETYPE_PSP_ISO;
}
// First, check if it's a directory with an EBOOT.PBP in it.
FileInfo info;
if (!getFileInfo(filename.c_str(), &info)) {
@ -75,8 +85,6 @@ EmuFileType Identify_File(std::string &filename)
fclose(f);
std::string extension = filename.substr(filename.size() - 4);
if (id == 'FLE\x7F')
{
if (!strcasecmp(extension.c_str(), ".plf") || strstr(filename.c_str(),"BOOT.BIN") ||
@ -110,14 +118,6 @@ EmuFileType Identify_File(std::string &filename)
ERROR_LOG(LOADER, "A PBP with the wrong magic number?");
return FILETYPE_PSP_PBP;
}
else if (!strcasecmp(extension.c_str(),".iso"))
{
return FILETYPE_PSP_ISO;
}
else if (!strcasecmp(extension.c_str(),".cso"))
{
return FILETYPE_PSP_ISO;
}
else if (!strcasecmp(extension.c_str(),".bin"))
{
return FILETYPE_UNKNOWN_BIN;