sdl: fix "--inputcfg" for GTK builds

This commit is contained in:
punkrockguy318 2011-10-18 04:28:03 +00:00
parent 2f992d1d0e
commit 1f1bf193a4
3 changed files with 25 additions and 12 deletions

View File

@ -1617,10 +1617,15 @@ ConfigDevice(int which,
void
InputCfg(const std::string &text)
{
int nogui;
g_config->getOption("SDL.NoGUI", &nogui);
if(nogui)
{
#ifdef _GTK
// enable noGui to prevent the gtk x11 hack from executing
noGui = 1;
// this is only called at the begininng of execution; make sure the video subsystem is initialized
InitVideo(GameInfo);
#endif
if(noGui)
{
if(text.find("gamepad") != std::string::npos) {
int device = (text[strlen("gamepad")] - '1');
if(device<0 || device>3) {
@ -1641,7 +1646,7 @@ InputCfg(const std::string &text)
ConfigDevice(FCFGD_QUIZKING, 0);
}
} else
printf("Please run \"fceux --nogui 1\" before using --inputcfg\n");
printf("Please run \"fceux --nogui\" before using --inputcfg\n");
}

View File

@ -441,10 +441,13 @@ InitVideo(FCEUGI *gi)
}
// if the game being run has a name, set it as the window name
if(gi->name) {
SDL_WM_SetCaption((const char *)gi->name, (const char *)gi->name);
} else {
SDL_WM_SetCaption(FCEU_NAME_AND_VERSION,"FCE Ultra");
if(gi)
{
if(gi->name) {
SDL_WM_SetCaption((const char *)gi->name, (const char *)gi->name);
} else {
SDL_WM_SetCaption(FCEU_NAME_AND_VERSION,"FCE Ultra");
}
}
// create the surface for displaying graphical messages

View File

@ -581,8 +581,13 @@ int main(int argc, char *argv[])
g_config->save();
std::string s;
g_config->getOption("SDL.InputCfg", &s);
if(s.size() != 0)
{
InitVideo(GameInfo);
InputCfg(s);
}
// set the FAMICOM PAD 2 Mic thing
{
int t;
@ -713,7 +718,7 @@ int main(int argc, char *argv[])
SDL_Quit();
return 0;
}
// if we're not compiling w/ the gui, exit if a rom isn't specified
#ifndef _GTK
@ -828,7 +833,7 @@ int main(int argc, char *argv[])
g_config->getOption("SDL.Frameskip", &frameskip);
// loop playing the game
#ifdef _GTK
if(noGui == false)
if(noGui == 0)
{
while(1)
{