Bug fix for Qt GUI ROM hard reset function. Function was using last open file config variable to determine which ROM to reload. Changed this function to read currently loaded ROM file path from core as this will always be correct.

This commit is contained in:
mjbudd77 2021-02-26 06:16:35 -05:00
parent 1cf00640c4
commit 8e4282fb42
1 changed files with 20 additions and 5 deletions

View File

@ -431,12 +431,27 @@ int fceuWrapperSoftReset(void)
int fceuWrapperHardReset(void)
{
if ( isloaded )
if ( isloaded && GameInfo )
{
std::string lastFile;
CloseGame();
g_config->getOption ("SDL.LastOpenFile", &lastFile);
LoadGame (lastFile.c_str());
char romPath[2048];
romPath[0] = 0;
if ( GameInfo->archiveFilename )
{
strcpy( romPath, GameInfo->archiveFilename );
}
else if ( GameInfo->filename )
{
strcpy( romPath, GameInfo->filename );
}
if ( romPath[0] != 0 )
{
CloseGame();
//printf("Loading: '%s'\n", romPath );
LoadGame ( romPath );
}
}
return 0;
}