aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcmitu2020-09-19 15:53:43 +0100
committercmitu2020-09-20 05:13:35 +0100
commit2cc221eb6675f228e6ada72e3dc7d438babcfdc6 (patch)
tree315aab090c9cb44d551d008bab96e8d49b6378fe
parentd56340b165b4a7ef25bc3c7509d4f2315843bc31 (diff)
downloadpcsx_rearmed-2cc221eb6675f228e6ada72e3dc7d438babcfdc6.tar.gz
pcsx_rearmed-2cc221eb6675f228e6ada72e3dc7d438babcfdc6.tar.bz2
pcsx_rearmed-2cc221eb6675f228e6ada72e3dc7d438babcfdc6.zip
cdriso: parse .cd<X> files as .cue.
Enables the parsing of .cd<X> files as cuesheets. Useful to 'hide' individual `.cue` files from the frontend when using a multi-disc game configured in a playlist (`.m3u`) file.
-rw-r--r--libpcsxcore/cdriso.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index c8eacb8..25aa9de 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;
}