diff options
author | Autechre | 2020-10-11 00:50:54 +0200 |
---|---|---|
committer | GitHub | 2020-10-11 00:50:54 +0200 |
commit | 03f41c38234fece3e1b4efefb9f4efb381e24b46 (patch) | |
tree | 7e3e93e34fe484235b1995b19b2126833b31f883 | |
parent | 6a4504d66a1451e4c2c3d40dcd7be99cc8b9edb6 (diff) | |
parent | 2cc221eb6675f228e6ada72e3dc7d438babcfdc6 (diff) | |
download | pcsx_rearmed-03f41c38234fece3e1b4efefb9f4efb381e24b46.tar.gz pcsx_rearmed-03f41c38234fece3e1b4efefb9f4efb381e24b46.tar.bz2 pcsx_rearmed-03f41c38234fece3e1b4efefb9f4efb381e24b46.zip |
Merge pull request #449 from cmitu/cdX-as-cue
cdriso: parse .cd<X> files as .cue
-rw-r--r-- | libpcsxcore/cdriso.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 6c6d835..677da00 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -477,7 +477,10 @@ static int parsecue(const char *isofile) { strncpy(cuename, isofile, sizeof(cuename)); cuename[MAXPATHLEN - 1] = '\0'; if (strlen(cuename) >= 4) { - strcpy(cuename + strlen(cuename) - 4, ".cue"); + // If 'isofile' is a '.cd<X>' file, use it as a .cue file + // and don't try to search the additional .cue file + if (strncasecmp(cuename + strlen(cuename) - 4, ".cd", 3) != 0 ) + strcpy(cuename + strlen(cuename) - 4, ".cue"); } else { return -1; @@ -604,9 +607,9 @@ static int parsecue(const char *isofile) { file_len = ftell(ti[numtracks + 1].handle) / 2352; if (numtracks == 0 && strlen(isofile) >= 4 && - strcmp(isofile + strlen(isofile) - 4, ".cue") == 0) - { - // user selected .cue as image file, use it's data track instead + (strcmp(isofile + strlen(isofile) - 4, ".cue") == 0 || + strncasecmp(isofile + strlen(isofile) - 4, ".cd", 3) == 0)) { + // user selected .cue/.cdX as image file, use it's data track instead fclose(cdHandle); cdHandle = fopen(filepath, "rb"); } @@ -615,6 +618,10 @@ static int parsecue(const char *isofile) { fclose(fi); + // if there are no tracks detected, then it's not a cue file + if (!numtracks) + return -1; + return 0; } |