Added logic and necessary functions to SDL port for new Lua emu.exit() function.
This commit is contained in:
parent
3bab27ff76
commit
35720a78ce
|
@ -80,6 +80,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
|
|
||||||
g_config->getOption( "SDL.VideoDriver", &use_SDL_video );
|
g_config->getOption( "SDL.VideoDriver", &use_SDL_video );
|
||||||
|
|
||||||
|
closeRequested = false;
|
||||||
errorMsgValid = false;
|
errorMsgValid = false;
|
||||||
viewport_GL = NULL;
|
viewport_GL = NULL;
|
||||||
viewport_SDL = NULL;
|
viewport_SDL = NULL;
|
||||||
|
@ -218,6 +219,11 @@ void consoleWin_t::closeEvent(QCloseEvent *event)
|
||||||
closeApp();
|
closeApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::requestClose(void)
|
||||||
|
{
|
||||||
|
closeRequested = true;
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::keyPressEvent(QKeyEvent *event)
|
void consoleWin_t::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
//printf("Key Press: 0x%x \n", event->key() );
|
//printf("Key Press: 0x%x \n", event->key() );
|
||||||
|
@ -2054,6 +2060,12 @@ void consoleWin_t::updatePeriodic(void)
|
||||||
errorMsgValid = false;
|
errorMsgValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( closeRequested )
|
||||||
|
{
|
||||||
|
closeApp();
|
||||||
|
closeRequested = false;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ class consoleWin_t : public QMainWindow
|
||||||
|
|
||||||
QMutex *mutex;
|
QMutex *mutex;
|
||||||
|
|
||||||
|
void requestClose(void);
|
||||||
|
|
||||||
void QueueErrorMsgWindow( const char *msg );
|
void QueueErrorMsgWindow( const char *msg );
|
||||||
|
|
||||||
int showListSelectDialog( const char *title, std::vector <std::string> &l );
|
int showListSelectDialog( const char *title, std::vector <std::string> &l );
|
||||||
|
@ -149,6 +151,7 @@ class consoleWin_t : public QMainWindow
|
||||||
|
|
||||||
std::string errorMsg;
|
std::string errorMsg;
|
||||||
bool errorMsgValid;
|
bool errorMsgValid;
|
||||||
|
bool closeRequested;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
|
@ -383,6 +383,14 @@ bool fceuWrapperGameLoaded(void)
|
||||||
return (isloaded ? true : false);
|
return (isloaded ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fceuWrapperRequestAppExit(void)
|
||||||
|
{
|
||||||
|
if ( consoleWindow )
|
||||||
|
{
|
||||||
|
consoleWindow->requestClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const char *DriverUsage =
|
static const char *DriverUsage =
|
||||||
"Option Value Description\n"
|
"Option Value Description\n"
|
||||||
"--pal {0|1} Use PAL timing.\n"
|
"--pal {0|1} Use PAL timing.\n"
|
||||||
|
|
|
@ -36,4 +36,5 @@ int fceuWrapperSoftReset(void);
|
||||||
int fceuWrapperHardReset(void);
|
int fceuWrapperHardReset(void);
|
||||||
int fceuWrapperTogglePause(void);
|
int fceuWrapperTogglePause(void);
|
||||||
bool fceuWrapperGameLoaded(void);
|
bool fceuWrapperGameLoaded(void);
|
||||||
|
void fceuWrapperRequestAppExit(void);
|
||||||
|
|
||||||
|
|
|
@ -533,6 +533,10 @@ void FCEUD_TraceInstruction() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fceuWrapperRequestAppExit(void)
|
||||||
|
{
|
||||||
|
gtk_gui_run = false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _GTK
|
#ifdef _GTK
|
||||||
int noGui = 0;
|
int noGui = 0;
|
||||||
|
|
|
@ -57,6 +57,7 @@ extern TASEDITOR_LUA taseditor_lua;
|
||||||
#else
|
#else
|
||||||
int LoadGame(const char *path, bool silent = false);
|
int LoadGame(const char *path, bool silent = false);
|
||||||
int reloadLastGame(void);
|
int reloadLastGame(void);
|
||||||
|
void fceuWrapperRequestAppExit(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6205,8 +6206,17 @@ void FCEU_LuaFrameBoundary()
|
||||||
FCEU_LuaOnStop();
|
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)
|
if (exitScheduled)
|
||||||
DoFCEUExit();
|
DoFCEUExit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue