Use less strict extension matching

This commit is contained in:
sonninnos 2024-09-27 02:12:20 +03:00
parent 261e52b7dd
commit f3588ceadb
2 changed files with 10 additions and 10 deletions

View File

@ -4242,13 +4242,13 @@ static bool MDFNI_LoadGame(const char *name)
RFILE *GameFile = NULL;
size_t name_len = strlen(name);
if(name_len > 4 && (
!strcasecmp(name + name_len - 4, ".cue") ||
!strcasecmp(name + name_len - 4, ".ccd") ||
!strcasecmp(name + name_len - 4, ".toc") ||
!strcasecmp(name + name_len - 4, ".m3u") ||
!strcasecmp(name + name_len - 4, ".chd") ||
!strcasecmp(name + name_len - 4, ".pbp")
if(name_len > 3 && (
!strcasecmp(name + name_len - 3, "cue") ||
!strcasecmp(name + name_len - 3, "ccd") ||
!strcasecmp(name + name_len - 3, "toc") ||
!strcasecmp(name + name_len - 3, "m3u") ||
!strcasecmp(name + name_len - 3, "chd") ||
!strcasecmp(name + name_len - 3, "pbp")
))
return MDFNI_LoadCD(name);

View File

@ -48,14 +48,14 @@ CDAccess::~CDAccess()
CDAccess *cdaccess_open_image(bool *success, const char *path, bool image_memcache)
{
size_t path_len = strlen(path);
if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".ccd"))
if (path_len >= 3 && !strcasecmp(path + path_len - 3, "ccd"))
return new CDAccess_CCD(success, path, image_memcache);
#ifdef HAVE_PBP
else if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".pbp"))
else if (path_len >= 3 && !strcasecmp(path + path_len - 3, "pbp"))
return new CDAccess_PBP(path, image_memcache);
#endif
#ifdef HAVE_CHD
else if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".chd"))
else if (path_len >= 3 && !strcasecmp(path + path_len - 3, "chd"))
return new CDAccess_CHD(path, image_memcache);
#endif
return new CDAccess_Image(success, path, image_memcache);