gtk: fixed noGUI option

gtk: fixed running with rom as argument
This commit is contained in:
punkrockguy318 2011-01-28 06:53:49 +00:00
parent 1df86cd42b
commit a1783f41ae
3 changed files with 28 additions and 18 deletions

View File

@ -214,12 +214,15 @@ InitConfig()
#endif
// prefixed with _ because they are internal (not cli options)
#ifdef _GTK
// prefixed with _ because they are internal (not cli options)
config->addOption("_lastopenfile", "SDL.LastOpenFile", "/");
config->addOption("_laststatefrom", "SDL.LastLoadStateFrom", "/");
config->addOption("_lastopennsf", "SDL.LastOpenNSF", "/");
config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", "/");
// option to disable gui (broken??)
config->addOption("nogui", "SDL.NoGUI", 0);
#endif
// fcm -> fm2 conversion
@ -231,8 +234,6 @@ InitConfig()
// enable new PPU core
config->addOption("newppu", "SDL.NewPPU", 0);
// option to disable gui
config->addOption("nogui", "SDL.NoGUI", 0);
// GamePad 0 - 3
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++) {

View File

@ -360,20 +360,25 @@ InitVideo(FCEUGI *gi)
#endif
#ifdef _GTK
while (gtk_events_pending())
gtk_main_iteration_do(FALSE);
char SDL_windowhack[128];
sprintf(SDL_windowhack, "SDL_WINDOWID=%u", (unsigned int)GDK_WINDOW_XWINDOW(gtk_widget_get_window(socket)));
SDL_putenv(SDL_windowhack);
// init SDL video
if (SDL_WasInit(SDL_INIT_VIDEO))
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if ( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 )
int noGui;
g_config->getOption("SDL.NoGUI", &noGui);
if(noGui == 0)
{
fprintf(stderr, "Couldn't init SDL video: %s\n", SDL_GetError());
gtk_main_quit();
while (gtk_events_pending())
gtk_main_iteration_do(FALSE);
char SDL_windowhack[128];
sprintf(SDL_windowhack, "SDL_WINDOWID=%u", (unsigned int)GDK_WINDOW_XWINDOW(gtk_widget_get_window(socket)));
SDL_putenv(SDL_windowhack);
// init SDL video
if (SDL_WasInit(SDL_INIT_VIDEO))
SDL_QuitSubSystem(SDL_INIT_VIDEO);
if ( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, "Couldn't init SDL video: %s\n", SDL_GetError());
gtk_main_quit();
}
}
#endif

View File

@ -735,10 +735,14 @@ int main(int argc, char *argv[])
#ifdef _GTK
int noGui;
g_config->getOption("SDL.NoGUI", &noGui);
if(noGui == false)
if(noGui == 0)
InitGTKSubsystem(argc, argv);
#endif
#ifdef _GTK
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
#endif
if(romIndex >= 0)
{
// load the specified game