Skip to content

Commit

Permalink
Merge pull request #915 from sonninnos/less-strict-ext
Browse files Browse the repository at this point in the history
Use less strict extension matching
  • Loading branch information
DarthMew authored Oct 12, 2024
2 parents e0b7d67 + f3588ce commit 46a8887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4254,13 +4254,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);

Expand Down
6 changes: 3 additions & 3 deletions mednafen/cdrom/CDAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 46a8887

Please sign in to comment.