sdl: fixed some issues with --nogui . "--nogui" no longer requires an argument and can be used like this "$ fceux --nogui rom.nes"

This commit is contained in:
punkrockguy318 2011-10-08 19:38:15 +00:00
parent 72d063e247
commit 66374f271a
4 changed files with 53 additions and 38 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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; i<argc;i++)
{
if(strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
{
ShowUsage(argv[0]);
SDL_Quit();
return 0;
}
#ifdef _GTK
else if(strcmp(argv[i], "--nogui") == 0)
{
noGui = 1;
argv[i] = "";
}
#endif
}
int romIndex = g_config->parse(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<argc;i++)
{
if(strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
{
ShowUsage(argv[0]);
SDL_Quit();
return 0;
}
#ifdef _GTK
else if(strcmp(argv[i], "--nogui") == 0)
noGui = 1;
#endif
}
// if we're not compiling w/ the gui, exit if a rom isn't specified
#ifndef _GTK
@ -753,19 +757,24 @@ int main(int argc, char *argv[])
// load the hotkeys from the config life
setHotKeys();
#ifdef _GTK
gtk_init(&argc, &argv);
#ifdef _GTK
if(noGui == 0)
{
gtk_init(&argc, &argv);
InitGTKSubsystem(argc, argv);
}
#endif
#ifdef _GTK
if(noGui == 0)
{
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
}
#endif
#ifdef _GTK
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
#endif
if(romIndex >= 0)
if(romIndex >= 0)
{
// load the specified game
error = LoadGame(argv[romIndex]);