[Core/MD] added detection of CHD image files when loading MSU-MD (CD Mode 1) or MD+ (MegaSD) ROM files

This commit is contained in:
ekeeke 2021-10-01 09:55:06 +02:00
parent 3cf83e7557
commit 83a225cd32
4 changed files with 21 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -748,6 +748,26 @@ int load_rom(char *filename)
/* 16-bit ROM cartridge (max. 8MB) with optional CD hardware add-on support enabled */
else if ((system_hw == SYSTEM_MD) && (cart.romsize <= 0x800000) && (config.add_on != HW_ADDON_NONE))
{
int len;
char fname[256];
/* automatically try to load associated .chd file if no .cue file CD image loaded yet */
if (!cdd.loaded)
{
len = strlen(filename);
while ((len && (filename[len] != '.')) || (len > 251)) len--;
strncpy(fname, filename, len);
strcpy(&fname[len], ".chd");
fname[len+4] = 0;
cdd_load(fname, (char *)cdc.ram);
}
/* automatically enable CD hardware emulation (Mode 1) in case : */
/* - loaded ROM has known CD hardware support */
/* or */
/* - CD hardware emulation is forced on */
/* or */
/* - MegaSD add-on emulation is disabled and normal CD image file is loaded */
if ((rominfo.peripherals & PCDROM) || (strstr(rominfo.domestic,"FLUX") != NULL) ||
(config.add_on == HW_ADDON_MEGACD) || ((config.add_on | cdd.loaded) == HW_ADDON_MEGACD))
{
@ -757,8 +777,7 @@ int load_rom(char *filename)
/* automatically try to load associated .iso file if no CD image loaded yet */
if (!cdd.loaded)
{
char fname[256];
int len = strlen(filename);
len = strlen(filename);
while ((len && (filename[len] != '.')) || (len > 251)) len--;
strncpy(fname, filename, len);
strcpy(&fname[len], ".iso");