From 66374f271ae67a5bf8f852ef9bdd336ea0c5abf9 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 8 Oct 2011 19:38:15 +0000 Subject: [PATCH] sdl: fixed some issues with --nogui . "--nogui" no longer requires an argument and can be used like this "$ fceux --nogui rom.nes" --- changelog.txt | 1 + src/drivers/sdl/gui.h | 1 + src/drivers/sdl/sdl-video.cpp | 22 +++++++----- src/drivers/sdl/sdl.cpp | 67 ++++++++++++++++++++--------------- 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5984e253..c8c40cb8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,4 @@ +07-octo-2011 - prg318 - sdl: fixed some issues with --nogui . "--nogui" no longer requires an argument and can be used like this "$ fceux --nogui rom.nes" 07-octo-2011 - prg318 - gtk: support mouseclicks (ie zapper) 30-sept-2011 - AnS - logging all display messages to Message Log 30-sept-2011 - AnS - Tasedit: special method of inserting frames; progressbar updating when loading/saving large projects; moved "Follow cursor" checkbox from View menu to main TASEdit window diff --git a/src/drivers/sdl/gui.h b/src/drivers/sdl/gui.h index 2a82ad3c..7345c930 100644 --- a/src/drivers/sdl/gui.h +++ b/src/drivers/sdl/gui.h @@ -28,4 +28,5 @@ extern int GtkMouseData[3]; int InitGTKSubsystem(int argc, char** argv); void pushOutputToGTK(const char* str); void showGui(bool b); +extern int noGui; #endif diff --git a/src/drivers/sdl/sdl-video.cpp b/src/drivers/sdl/sdl-video.cpp index 7c22291c..a59947f2 100644 --- a/src/drivers/sdl/sdl-video.cpp +++ b/src/drivers/sdl/sdl-video.cpp @@ -376,8 +376,6 @@ InitVideo(FCEUGI *gi) #endif #if defined(_GTK) && defined(SDL_VIDEO_DRIVER_X11) - int noGui; - g_config->getOption("SDL.NoGUI", &noGui); if(noGui == 0) { while (gtk_events_pending()) @@ -407,9 +405,12 @@ InitVideo(FCEUGI *gi) } #ifdef _GTK - GtkRequisition req; - gtk_widget_size_request(GTK_WIDGET(MainWindow), &req); - gtk_window_resize(GTK_WINDOW(MainWindow), req.width, req.height); + if(noGui == 0) + { + GtkRequisition req; + gtk_widget_size_request(GTK_WIDGET(MainWindow), &req); + gtk_window_resize(GTK_WINDOW(MainWindow), req.width, req.height); + } #endif } s_curbpp = s_screen->format->BitsPerPixel; @@ -507,10 +508,13 @@ ToggleFS() // flip the fullscreen flag g_config->setOption("SDL.Fullscreen", !fullscreen); #ifdef _GTK - if(!fullscreen) - showGui(0); - else - showGui(1); + if(noGui == 0) + { + if(!fullscreen) + showGui(0); + else + showGui(1); + } #endif // try to initialize the video error = InitVideo(GameInfo); diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index a879c51d..88ef1077 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -118,7 +118,7 @@ Option Value Description\n\ --netkey s Use string 's' to create a unique session for the game loaded.\n\ --players x Set the number of local players.\n\ --rp2mic {0,1} Replace Port 2 Start with microphone (Famicom).\n\ ---nogui {0,1} Enable or disable the GTK GUI\n"; +--nogui Don't load the GTK GUI\n"; // these should be moved to the man file @@ -491,6 +491,13 @@ void FCEUD_TraceInstruction() { } +#ifdef _GTK + int noGui = 0; +#else + int noGui = 1; +#endif + + /** * The main loop for the SDL. */ @@ -545,6 +552,23 @@ int main(int argc, char *argv[]) return -1; } + // check for --help or -h and display usage; also check for --nogui + for(int i=0; iparse(argc, argv); // This is here so that a default fceux.cfg will be created on first @@ -690,26 +714,6 @@ int main(int argc, char *argv[]) return 0; } -#ifdef _GTK - int noGui = 0; -#else - int noGui = 1; -#endif - - // check for --help or -h and display usage; also check for --nogui - for(int i=0; i= 0) + if(romIndex >= 0) { // load the specified game error = LoadGame(argv[romIndex]);