Fixed a long-standing bug with detailed GuiGameList detection after mapping input.

This commit is contained in:
Aloshi 2012-10-05 15:18:36 -05:00
parent aea93748d5
commit 62336ab2fb
5 changed files with 27 additions and 19 deletions

View file

@ -1,6 +1,7 @@
October 5 October 5
-GuiFastSelect is working, but ugly. -GuiFastSelect is working, but ugly.
-Began work on GuiBox for theming the fast select dialog. -Began work on GuiBox for theming the fast select dialog.
-Finally fixed detailed GuiGameList detection after input mapping.
September 30 September 30
-Began implementing GuiFastSelect, currently invoked by holding F2. Unfortunately, it doesn't do anything yet. -Began implementing GuiFastSelect, currently invoked by holding F2. Unfortunately, it doesn't do anything yet.

View file

@ -251,3 +251,24 @@ void GuiGameList::onInit()
{ {
mTheme->init(); mTheme->init();
} }
extern bool IGNOREGAMELIST; //defined in main.cpp (as a command line argument)
GuiGameList* GuiGameList::create()
{
bool detailed = false;
if(!IGNOREGAMELIST)
{
for(unsigned int i = 0; i < SystemData::sSystemVector.size(); i++)
{
if(SystemData::sSystemVector.at(i)->hasGamelist())
{
detailed = true;
break;
}
}
}
return new GuiGameList(detailed);
}

View file

@ -29,6 +29,8 @@ public:
void onInit(); void onInit();
void onDeinit(); void onDeinit();
static GuiGameList* create();
static const float sInfoWidth; static const float sInfoWidth;
private: private:
void updateList(); void updateList();

View file

@ -66,7 +66,7 @@ void GuiInputConfig::onInput(InputManager::InputButton button, bool keyDown)
InputManager::loadConfig(); InputManager::loadConfig();
delete this; delete this;
new GuiGameList(); GuiGameList::create();
} }
return; return;
} }

View file

@ -109,34 +109,18 @@ int main(int argc, char* argv[])
std::cerr << "Does at least one system have a game presesnt?\n"; std::cerr << "Does at least one system have a game presesnt?\n";
running = false; running = false;
}else{ }else{
bool useDetail = false;
//see if any systems had gamelists present, if so we'll use the detailed GuiGameList
if(!IGNOREGAMELIST)
{
for(unsigned int i = 0; i < SystemData::sSystemVector.size(); i++)
{
if(SystemData::sSystemVector.at(i)->hasGamelist())
{
useDetail = true;
break;
}
}
}
//choose which GUI to open depending on Input configuration //choose which GUI to open depending on Input configuration
if(fs::exists(InputManager::getConfigPath())) if(fs::exists(InputManager::getConfigPath()))
{ {
//an input config already exists - load it and proceed to the gamelist as usual. //an input config already exists - load it and proceed to the gamelist as usual.
InputManager::loadConfig(); InputManager::loadConfig();
new GuiGameList(useDetail); GuiGameList::create();
}else{ }else{
//if no input.cfg is present, but a joystick is connected, launch the input config GUI //if no input.cfg is present, but a joystick is connected, launch the input config GUI
if(SDL_NumJoysticks() > 0) if(SDL_NumJoysticks() > 0)
new GuiInputConfig(); new GuiInputConfig();
else else
new GuiGameList(useDetail); GuiGameList::create();
} }
} }