From 8e4282fb4293fa08e3fab4a26a6a23328d17d051 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Fri, 26 Feb 2021 06:16:35 -0500 Subject: [PATCH] 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. --- src/drivers/Qt/fceuWrapper.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index d1045cd9..223cf689 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -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; }