mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 18:05:06 +01:00
fixed backup RAM file saving when using disc swap with Mode 1 cartridge
This commit is contained in:
parent
2a9498211f
commit
8d535fcc54
@ -246,7 +246,7 @@ int ParseDirectory(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int LoadFile(int selection)
|
int LoadFile(int selection)
|
||||||
{
|
{
|
||||||
int size = 0, filetype;
|
int size = 0, reload, filetype;
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
|
|
||||||
/* file path */
|
/* file path */
|
||||||
@ -270,20 +270,29 @@ 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 */
|
||||||
|
reload = 1;
|
||||||
|
|
||||||
/* 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 */
|
/* swap CD image file without changing region, system,... */
|
||||||
size = cdd_load(filename, (char *)(cdc.ram));
|
size = cdd_load(filename, (char *)(cdc.ram));
|
||||||
|
|
||||||
/* update CD header informations */
|
/* Mode 1 cartridge loaded ? */
|
||||||
if (!scd.cartridge.boot)
|
if (scd.cartridge.boot)
|
||||||
{
|
{
|
||||||
|
/* loaded ROM file infos should not be modified */
|
||||||
|
reload = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* update CD header informations */
|
||||||
getrominfo((char *)(cdc.ram));
|
getrominfo((char *)(cdc.ram));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no CD image file loaded */
|
/* no CD image file swapped */
|
||||||
if (!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
/* close CD tray to force system reset */
|
/* close CD tray to force system reset */
|
||||||
@ -295,45 +304,49 @@ int LoadFile(int selection)
|
|||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
/* auto-save previous game state */
|
/* check if loaded game has changed */
|
||||||
slot_autosave(config.s_default,config.s_device);
|
if (reload)
|
||||||
|
{
|
||||||
|
/* auto-save previous game state */
|
||||||
|
slot_autosave(config.s_default,config.s_device);
|
||||||
|
|
||||||
/* update pathname for screenshot, save & cheat files */
|
/* update pathname for screenshot, save & cheat files */
|
||||||
if (romtype & SYSTEM_SMS)
|
if (romtype & SYSTEM_SMS)
|
||||||
{
|
{
|
||||||
/* Master System ROM file */
|
/* Master System ROM file */
|
||||||
filetype = 2;
|
filetype = 2;
|
||||||
sprintf(rom_filename,"ms/%s",filelist[selection].filename);
|
sprintf(rom_filename,"ms/%s",filelist[selection].filename);
|
||||||
}
|
}
|
||||||
else if (romtype & SYSTEM_GG)
|
else if (romtype & SYSTEM_GG)
|
||||||
{
|
{
|
||||||
/* Game Gear ROM file */
|
/* Game Gear ROM file */
|
||||||
filetype = 3;
|
filetype = 3;
|
||||||
sprintf(rom_filename,"gg/%s",filelist[selection].filename);
|
sprintf(rom_filename,"gg/%s",filelist[selection].filename);
|
||||||
}
|
}
|
||||||
else if (romtype == SYSTEM_SG)
|
else if (romtype == SYSTEM_SG)
|
||||||
{
|
{
|
||||||
/* SG-1000 ROM file */
|
/* SG-1000 ROM file */
|
||||||
filetype = 4;
|
filetype = 4;
|
||||||
sprintf(rom_filename,"sg/%s",filelist[selection].filename);
|
sprintf(rom_filename,"sg/%s",filelist[selection].filename);
|
||||||
}
|
}
|
||||||
else if (romtype == SYSTEM_MCD)
|
else if (romtype == SYSTEM_MCD)
|
||||||
{
|
{
|
||||||
/* CD image file */
|
/* CD image file */
|
||||||
filetype = 1;
|
filetype = 1;
|
||||||
sprintf(rom_filename,"cd/%s",filelist[selection].filename);
|
sprintf(rom_filename,"cd/%s",filelist[selection].filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* by default, Genesis ROM file */
|
/* by default, Genesis ROM file */
|
||||||
filetype = 0;
|
filetype = 0;
|
||||||
sprintf(rom_filename,"md/%s",filelist[selection].filename);
|
sprintf(rom_filename,"md/%s",filelist[selection].filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove file extension */
|
/* remove file extension */
|
||||||
int i = strlen(rom_filename) - 1;
|
int i = strlen(rom_filename) - 1;
|
||||||
while ((i > 0) && (rom_filename[i] != '.')) i--;
|
while ((i > 0) && (rom_filename[i] != '.')) i--;
|
||||||
if (i > 0) rom_filename[i] = 0;
|
if (i > 0) rom_filename[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* add/move the file to the top of the history. */
|
/* add/move the file to the top of the history. */
|
||||||
history_add_file(filepath, filelist[selection].filename, filetype);
|
history_add_file(filepath, filelist[selection].filename, filetype);
|
||||||
|
Loading…
Reference in New Issue
Block a user