Added logic and necessary functions to SDL port for new Lua emu.exit() function.
This commit is contained in:
parent
3bab27ff76
commit
35720a78ce
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -36,4 +36,5 @@ int fceuWrapperSoftReset(void);
|
|||
int fceuWrapperHardReset(void);
|
||||
int fceuWrapperTogglePause(void);
|
||||
bool fceuWrapperGameLoaded(void);
|
||||
void fceuWrapperRequestAppExit(void);
|
||||
|
||||
|
|
|
@ -533,6 +533,10 @@ void FCEUD_TraceInstruction() {
|
|||
return;
|
||||
}
|
||||
|
||||
void fceuWrapperRequestAppExit(void)
|
||||
{
|
||||
gtk_gui_run = false;
|
||||
}
|
||||
|
||||
#ifdef _GTK
|
||||
int noGui = 0;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue