fixed bug introduced in previous revision (CD swap in Mode 1)

This commit is contained in:
EkeEke 2012-10-25 01:13:53 +02:00
parent 8d535fcc54
commit 8b3f89addf

View File

@ -246,7 +246,7 @@ int ParseDirectory(void)
****************************************************************************/ ****************************************************************************/
int LoadFile(int selection) int LoadFile(int selection)
{ {
int size = 0, reload, filetype; int size, cd_mode1, filetype;
char filename[MAXPATHLEN]; char filename[MAXPATHLEN];
/* file path */ /* file path */
@ -270,33 +270,33 @@ int LoadFile(int selection)
/* open message box */ /* open message box */
GUI_MsgBoxOpen("Information", "Loading game...", 1); GUI_MsgBoxOpen("Information", "Loading game...", 1);
/* by default, update loaded game informations */ /* no cartridge or CD game loaded */
reload = 1; size = cd_mode1 = 0;
/* check if virtual CD tray was open */ /* check if virtual CD tray was open */
if ((system_hw == SYSTEM_MCD) && (cdd.status == CD_OPEN)) if ((system_hw == SYSTEM_MCD) && (cdd.status == CD_OPEN))
{ {
/* swap CD image file without changing region, system,... */ /* swap CD image file in (without changing region, system,...) */
size = cdd_load(filename, (char *)(cdc.ram)); size = cdd_load(filename, (char *)(cdc.ram));
/* Mode 1 cartridge loaded ? */ /* check if a cartridge is currently loaded */
if (scd.cartridge.boot) if (scd.cartridge.boot)
{ {
/* loaded ROM file infos should not be modified */ /* CD Mode 1 */
reload = 0; cd_mode1 = size;
} }
else else
{ {
/* update CD header informations */ /* update game informations from CD image file header */
getrominfo((char *)(cdc.ram)); getrominfo((char *)(cdc.ram));
} }
} }
/* no CD image file swapped */ /* no CD image file loaded */
if (!size) if (!size)
{ {
/* close CD tray to force system reset */ /* close CD tray to force system reset */
cdd.status = CD_STOP; cdd.status = NO_DISC;
/* load game file */ /* load game file */
size = load_rom(filename); size = load_rom(filename);
@ -304,13 +304,18 @@ int LoadFile(int selection)
if (size > 0) if (size > 0)
{ {
/* check if loaded game has changed */ /* do not update game basename if a CD was loaded with a cartridge (Mode 1) */
if (reload) if (cd_mode1)
{
/* add CD image file to history list */
filetype = 1;
}
else
{ {
/* auto-save previous game state */ /* auto-save previous game state */
slot_autosave(config.s_default,config.s_device); slot_autosave(config.s_default,config.s_device);
/* update pathname for screenshot, save & cheat files */ /* update game basename (for screenshot, save & cheat files) */
if (romtype & SYSTEM_SMS) if (romtype & SYSTEM_SMS)
{ {
/* Master System ROM file */ /* Master System ROM file */