Merge pull request #259 from mjbudd77/master

Added logic and necessary functions to SDL port for new Lua emu.exit(…
This commit is contained in:
mjbudd77 2020-12-12 07:46:28 -05:00 committed by GitHub
commit a5bb52949c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 3 deletions

View File

@ -80,9 +80,10 @@ consoleWin_t::consoleWin_t(QWidget *parent)
g_config->getOption( "SDL.VideoDriver", &use_SDL_video );
errorMsgValid = false;
viewport_GL = NULL;
viewport_SDL = NULL;
closeRequested = false;
errorMsgValid = false;
viewport_GL = NULL;
viewport_SDL = NULL;
if ( use_SDL_video )
{
@ -218,6 +219,11 @@ void consoleWin_t::closeEvent(QCloseEvent *event)
closeApp();
}
void consoleWin_t::requestClose(void)
{
closeRequested = true;
}
void consoleWin_t::keyPressEvent(QKeyEvent *event)
{
//printf("Key Press: 0x%x \n", event->key() );
@ -2054,6 +2060,12 @@ void consoleWin_t::updatePeriodic(void)
errorMsgValid = false;
}
if ( closeRequested )
{
closeApp();
closeRequested = false;
}
return;
}

View File

@ -71,6 +71,8 @@ class consoleWin_t : public QMainWindow
QMutex *mutex;
void requestClose(void);
void QueueErrorMsgWindow( const char *msg );
int showListSelectDialog( const char *title, std::vector <std::string> &l );
@ -149,6 +151,7 @@ class consoleWin_t : public QMainWindow
std::string errorMsg;
bool errorMsgValid;
bool closeRequested;
protected:
void closeEvent(QCloseEvent *event);

View File

@ -383,6 +383,14 @@ bool fceuWrapperGameLoaded(void)
return (isloaded ? true : false);
}
void fceuWrapperRequestAppExit(void)
{
if ( consoleWindow )
{
consoleWindow->requestClose();
}
}
static const char *DriverUsage =
"Option Value Description\n"
"--pal {0|1} Use PAL timing.\n"

View File

@ -36,4 +36,5 @@ int fceuWrapperSoftReset(void);
int fceuWrapperHardReset(void);
int fceuWrapperTogglePause(void);
bool fceuWrapperGameLoaded(void);
void fceuWrapperRequestAppExit(void);

View File

@ -533,6 +533,10 @@ void FCEUD_TraceInstruction() {
return;
}
void fceuWrapperRequestAppExit(void)
{
gtk_gui_run = false;
}
#ifdef _GTK
int noGui = 0;

View File

@ -57,6 +57,7 @@ extern TASEDITOR_LUA taseditor_lua;
#else
int LoadGame(const char *path, bool silent = false);
int reloadLastGame(void);
void fceuWrapperRequestAppExit(void);
#endif
#endif
@ -6205,8 +6206,17 @@ void FCEU_LuaFrameBoundary()
FCEU_LuaOnStop();
}
#if defined(__linux) || defined(__APPLE__)
if (exitScheduled)
{ // This function does not exit immediately,
// it requests for the application to exit when next convenient.
fceuWrapperRequestAppExit();
exitScheduled = FALSE;
}
#else
if (exitScheduled)
DoFCEUExit();
#endif
}
/**