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 void
InputCfg(const std::string &text) InputCfg(const std::string &text)
{ {
int nogui; #ifdef _GTK
g_config->getOption("SDL.NoGUI", &nogui); // enable noGui to prevent the gtk x11 hack from executing
if(nogui) 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) { if(text.find("gamepad") != std::string::npos) {
int device = (text[strlen("gamepad")] - '1'); int device = (text[strlen("gamepad")] - '1');
if(device<0 || device>3) { if(device<0 || device>3) {
@ -1641,7 +1646,7 @@ InputCfg(const std::string &text)
ConfigDevice(FCFGD_QUIZKING, 0); ConfigDevice(FCFGD_QUIZKING, 0);
} }
} else } 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 the game being run has a name, set it as the window name
if(gi->name) { if(gi)
SDL_WM_SetCaption((const char *)gi->name, (const char *)gi->name); {
} else { if(gi->name) {
SDL_WM_SetCaption(FCEU_NAME_AND_VERSION,"FCE Ultra"); 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 // create the surface for displaying graphical messages

View File

@ -581,8 +581,13 @@ int main(int argc, char *argv[])
g_config->save(); g_config->save();
std::string s; std::string s;
g_config->getOption("SDL.InputCfg", &s);
g_config->getOption("SDL.InputCfg", &s);
if(s.size() != 0)
{
InitVideo(GameInfo);
InputCfg(s);
}
// set the FAMICOM PAD 2 Mic thing // set the FAMICOM PAD 2 Mic thing
{ {
int t; int t;
@ -828,7 +833,7 @@ int main(int argc, char *argv[])
g_config->getOption("SDL.Frameskip", &frameskip); g_config->getOption("SDL.Frameskip", &frameskip);
// loop playing the game // loop playing the game
#ifdef _GTK #ifdef _GTK
if(noGui == false) if(noGui == 0)
{ {
while(1) while(1)
{ {