[Core/Misc] fixed ROM loading from memory

This properly addresses the loading issue in Retroarch with compressed files reported by https://github.com/libretro/Genesis-Plus-GX/pull/249
This commit is contained in:
ekeeke 2021-08-31 09:50:38 +02:00
parent 1e5c2c0ef3
commit 35ed78cc71

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD drive processor & CD-DA fader * CD drive processor & CD-DA fader
* *
* Copyright (C) 2012-2020 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2021 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -315,7 +315,11 @@ int cdd_load(char *filename, char *header)
/* open file */ /* open file */
fd = cdStreamOpen(filename); fd = cdStreamOpen(filename);
if (!fd) if (!fd)
return (-1); {
/* do not return an error as this could be a ROM loaded in memory */
/* which should be handled by load_archive function */
return (0);
}
#if defined(USE_LIBCHDR) #if defined(USE_LIBCHDR)
if (!memcmp("chd", &filename[strlen(filename) - 3], 3) || !memcmp("CHD", &filename[strlen(filename) - 3], 3)) if (!memcmp("chd", &filename[strlen(filename) - 3], 3) || !memcmp("CHD", &filename[strlen(filename) - 3], 3))