From 7790de5fe3e2314a24e18730e3147c22f69e86b7 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 7 Mar 2010 23:48:50 +0000 Subject: [PATCH] GTK: fixed segfaults when fullscreen would be called with no rom loaded --- src/drivers/sdl/gui.cpp | 12 ++++++++---- src/drivers/sdl/sdl.cpp | 3 +-- src/drivers/sdl/sdl.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp index a6e78fc5..f7f03c84 100644 --- a/src/drivers/sdl/gui.cpp +++ b/src/drivers/sdl/gui.cpp @@ -938,21 +938,25 @@ void toggleSound(GtkWidget* check, gpointer data) void emuReset () { - ResetNES(); + if(isloaded) + ResetNES(); } void emuPause () { - FCEUI_SetEmulationPaused(1); + if(isloaded) + FCEUI_SetEmulationPaused(1); } void emuResume () { - FCEUI_SetEmulationPaused(0); + if(isloaded) + FCEUI_SetEmulationPaused(0); } void enableFullscreen () { - ToggleFS(); + if(isloaded) + ToggleFS(); } void recordMovie() { diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index b0db181a..f7ad824a 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -59,8 +59,7 @@ bool turbo = false; int CloseGame(void); -static int inited = 0; -static int isloaded = 0; +static int inited = 0; int eoptions=0; diff --git a/src/drivers/sdl/sdl.h b/src/drivers/sdl/sdl.h index 71ac2129..d1faaab7 100644 --- a/src/drivers/sdl/sdl.h +++ b/src/drivers/sdl/sdl.h @@ -7,6 +7,7 @@ #include "input.h" static void DoFun(int frameskip); +static int isloaded = 0; int LoadGame(const char *path); int CloseGame(void);