Renamed all the internal "Settings" identifiers to be consistent in

capitalization style.  Probably should delete your old es_settings.cfg
file.
Removed --dimtime as an argument since you can set it internally now.
This commit is contained in:
Aloshi 2014-03-08 13:00:18 -06:00
parent b2165dd17b
commit 6db26742ff
12 changed files with 37 additions and 46 deletions

View file

@ -106,7 +106,6 @@ You can use `--help` to view a list of command-line options. Briefly outlined he
--draw-framerate - draw the framerate.
--no-exit - do not display 'exit' in the ES menu.
--debug - print additional output to the console, primarily about input.
--dimtime [seconds] - delay before dimming the screen and entering sleep mode. Default is 120, use 0 for never.
--windowed - run ES in a window.
--scrape - run the interactive command-line metadata scraper.
```

View file

@ -58,7 +58,7 @@ namespace Renderer
sdlWindow = SDL_CreateWindow("EmulationStation",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
display_width, display_height,
SDL_WINDOW_OPENGL | (Settings::getInstance()->getBool("WINDOWED") ? 0 : SDL_WINDOW_FULLSCREEN));
SDL_WINDOW_OPENGL | (Settings::getInstance()->getBool("Windowed") ? 0 : SDL_WINDOW_FULLSCREEN));
if(sdlWindow == NULL)
{

View file

@ -26,24 +26,21 @@ void Settings::setDefaults()
mBoolMap.clear();
mIntMap.clear();
mBoolMap["PARSEGAMELISTONLY"] = false;
mBoolMap["IGNOREGAMELIST"] = false;
mBoolMap["DRAWFRAMERATE"] = false;
mBoolMap["DONTSHOWEXIT"] = false;
mBoolMap["DEBUG"] = false;
mBoolMap["WINDOWED"] = false;
mBoolMap["DISABLESOUNDS"] = false;
mBoolMap["DISABLEHELP"] = false;
mBoolMap["DisableGamelistWrites"] = false;
mBoolMap["ParseGamelistOnly"] = false;
mBoolMap["DrawFramerate"] = false;
mBoolMap["ShowExit"] = true;
mBoolMap["Debug"] = false;
mBoolMap["Windowed"] = false;
mBoolMap["EnableSounds"] = true;
mBoolMap["ShowHelpPrompts"] = true;
mBoolMap["ScrapeRatings"] = true;
mIntMap["DIMTIME"] = 120*1000;
mIntMap["DimTime"] = 120*1000;
mIntMap["ScraperResizeWidth"] = 400;
mIntMap["ScraperResizeHeight"] = 0;
mIntMap["GameListSortIndex"] = 0;
mScraper = std::shared_ptr<Scraper>(new GamesDBScraper());
}

View file

@ -111,7 +111,7 @@ void Sound::play()
if(mSampleData == NULL)
return;
if(Settings::getInstance()->getBool("DISABLESOUNDS"))
if(Settings::getInstance()->getBool("EnableSounds"))
return;
SDL_LockAudio();

View file

@ -38,10 +38,10 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
mRootFolder = new FileData(FOLDER, mStartPath, this);
mRootFolder->metadata.set("name", mFullName);
if(!Settings::getInstance()->getBool("PARSEGAMELISTONLY"))
if(!Settings::getInstance()->getBool("ParseGamelistOnly"))
populateFolder(mRootFolder);
if(!Settings::getInstance()->getBool("IGNOREGAMELIST"))
if(!Settings::getInstance()->getBool("IgnoreGamelist"))
parseGamelist(this);
mRootFolder->sort(FileSorts::SortTypes.at(0));
@ -52,7 +52,7 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
SystemData::~SystemData()
{
//save changed game data back to xml
if(!Settings::getInstance()->getBool("IGNOREGAMELIST"))
if(!Settings::getInstance()->getBool("IgnoreGamelist"))
{
updateGamelist(this);
}

View file

@ -134,7 +134,7 @@ void Window::update(int deltaTime)
{
mAverageDeltaTime = mFrameTimeElapsed / mFrameCountElapsed;
if(Settings::getInstance()->getBool("DRAWFRAMERATE"))
if(Settings::getInstance()->getBool("DrawFramerate"))
{
std::stringstream ss;
ss << std::fixed << std::setprecision(1) << (1000.0f * (float)mFrameCountElapsed / (float)mFrameTimeElapsed) << "fps, ";
@ -165,7 +165,7 @@ void Window::render()
mHelp->render(transform);
if(Settings::getInstance()->getBool("DRAWFRAMERATE"))
if(Settings::getInstance()->getBool("DrawFramerate"))
{
Renderer::setMatrix(Eigen::Affine3f::Identity());
mDefaultFonts.at(1)->drawText(mFrameDataString, Eigen::Vector2f(50, 50), 0xFF00FFFF);

View file

@ -224,7 +224,7 @@ void updateGamelist(SystemData* system)
//We have the complete information for every game though, so we can simply remove a game
//we already have in the system from the XML, and then add it back from its GameData information...
if(Settings::getInstance()->getBool("DisableGamelistWrites") || Settings::getInstance()->getBool("IGNOREGAMELIST"))
if(Settings::getInstance()->getBool("IgnoreGamelist"))
return;
std::string xmlpath = system->getGamelistPath();

View file

@ -25,7 +25,7 @@ void HelpComponent::clearPrompts()
void HelpComponent::addPrompt(const char* icon, const char* text)
{
if(Settings::getInstance()->getBool("DISABLEHELP"))
if(!Settings::getInstance()->getBool("ShowHelpPrompts"))
return;
Prompt p;

View file

@ -42,7 +42,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
}
);
if(!Settings::getInstance()->getBool("DONTSHOWEXIT"))
if(Settings::getInstance()->getBool("ShowExit"))
{
addEntry("EXIT EMULATIONSTATION", 0x990000FF, false,
[] {

View file

@ -20,9 +20,9 @@ GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
// framerate
auto framerate = std::make_shared<SwitchComponent>(mWindow);
framerate->setState(s->getBool("DRAWFRAMERATE"));
framerate->setState(s->getBool("DrawFramerate"));
addSetting("Draw framerate:", framerate,
[framerate] { Settings::getInstance()->setBool("DRAWFRAMERATE", framerate->getState()); });
[framerate] { Settings::getInstance()->setBool("DrawFramerate", framerate->getState()); });
// volume
auto volume = std::make_shared<SliderComponent>(mWindow, 0.f, 100.f, 1.f, "%");
@ -32,9 +32,9 @@ GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
// disable sounds
auto sound_disable = std::make_shared<SwitchComponent>(mWindow);
sound_disable->setState(s->getBool("DISABLESOUNDS"));
addSetting("Disable sound:", sound_disable,
[sound_disable] { Settings::getInstance()->setBool("DISABLESOUNDS", sound_disable->getState()); });
sound_disable->setState(s->getBool("EnableSounds"));
addSetting("Enable sounds:", sound_disable,
[sound_disable] { Settings::getInstance()->setBool("EnableSounds", sound_disable->getState()); });
// scraper
auto scraper_list = std::make_shared< OptionListComponent< std::shared_ptr<Scraper> > >(mWindow, false);
@ -53,20 +53,20 @@ GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
// scrape ratings
auto scrape_ratings = std::make_shared<SwitchComponent>(mWindow);
scrape_ratings->setState(s->getBool("ScrapeRatings"));
addSetting("Scrape ratings?", scrape_ratings,
addSetting("Scrape ratings:", scrape_ratings,
[scrape_ratings] { Settings::getInstance()->setBool("ScrapeRatings", scrape_ratings->getState()); });
// dim time
auto dim_time = std::make_shared<SliderComponent>(mWindow, 0.f, 1200.f, 30.f, "s");
dim_time->setValue((float)(s->getInt("DIMTIME") / 1000));
dim_time->setValue((float)(s->getInt("DimTime") / 1000));
addSetting("Dim screen after:", dim_time,
[dim_time] { Settings::getInstance()->setInt("DIMTIME", (int)(dim_time->getValue() * 1000)); });
[dim_time] { Settings::getInstance()->setInt("DimTime", (int)(dim_time->getValue() * 1000)); });
// disable help
auto disable_help = std::make_shared<SwitchComponent>(mWindow);
disable_help->setState(s->getBool("DISABLEHELP"));
addSetting("Disable help:", disable_help,
[disable_help] { Settings::getInstance()->setBool("DISABLEHELP", disable_help->getState()); });
disable_help->setState(s->getBool("ShowHelpPrompts"));
addSetting("Show help:", disable_help,
[disable_help] { Settings::getInstance()->setBool("ShowHelpPrompts", disable_help->getState()); });
// save button
ComponentListRow row;

View file

@ -36,27 +36,23 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
i++; //skip the argument value
}else if(strcmp(argv[i], "--gamelist-only") == 0)
{
Settings::getInstance()->setBool("PARSEGAMELISTONLY", true);
Settings::getInstance()->setBool("ParseGamelistOnly", true);
}else if(strcmp(argv[i], "--ignore-gamelist") == 0)
{
Settings::getInstance()->setBool("IGNOREGAMELIST", true);
Settings::getInstance()->setBool("IgnoreGamelist", true);
}else if(strcmp(argv[i], "--draw-framerate") == 0)
{
Settings::getInstance()->setBool("DRAWFRAMERATE", true);
Settings::getInstance()->setBool("DrawFramerate", true);
}else if(strcmp(argv[i], "--no-exit") == 0)
{
Settings::getInstance()->setBool("DONTSHOWEXIT", true);
Settings::getInstance()->setBool("ShowExit", false);
}else if(strcmp(argv[i], "--debug") == 0)
{
Settings::getInstance()->setBool("DEBUG", true);
Settings::getInstance()->setBool("Debug", true);
Log::setReportingLevel(LogDebug);
}else if(strcmp(argv[i], "--dimtime") == 0)
{
Settings::getInstance()->setInt("DIMTIME", atoi(argv[i + 1]) * 1000);
i++; //skip the argument value
}else if(strcmp(argv[i], "--windowed") == 0)
{
Settings::getInstance()->setBool("WINDOWED", true);
Settings::getInstance()->setBool("Windowed", true);
}else if(strcmp(argv[i], "--scrape") == 0)
{
scrape_cmdline = true;
@ -71,7 +67,6 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
std::cout << "--draw-framerate display the framerate\n";
std::cout << "--no-exit don't show the exit option in the menu\n";
std::cout << "--debug even more logging\n";
std::cout << "--dimtime [seconds] time to wait before dimming the screen (default 120, use 0 for never)\n";
std::cout << "--scrape scrape using command line interface\n";
std::cout << "--windowed not fullscreen, should be used in conjunction with -w and -h\n";
std::cout << "--help summon a sentient, angry tuba\n\n";
@ -233,7 +228,7 @@ int main(int argc, char* argv[])
//sleeping entails setting a flag to start skipping frames
//and initially drawing a black semi-transparent rect to dim the screen
timeSinceLastEvent += deltaTime;
if(timeSinceLastEvent >= (unsigned int)Settings::getInstance()->getInt("DIMTIME") && Settings::getInstance()->getInt("DIMTIME") != 0 && window.getAllowSleep())
if(timeSinceLastEvent >= (unsigned int)Settings::getInstance()->getInt("DimTime") && Settings::getInstance()->getInt("DimTime") != 0 && window.getAllowSleep())
{
sleeping = true;
timeSinceLastEvent = 0;

View file

@ -29,7 +29,7 @@ bool IGameListView::input(InputConfig* config, Input input)
return true;
// Ctrl-R to reload a view when debugging
}else if(Settings::getInstance()->getBool("DEBUG") && config->getDeviceId() == DEVICE_KEYBOARD &&
}else if(Settings::getInstance()->getBool("Debug") && config->getDeviceId() == DEVICE_KEYBOARD &&
(SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r && input.value != 0)
{
LOG(LogDebug) << "reloading view";