mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Merge branch 'unstable'
This commit is contained in:
commit
396cf1bde9
|
@ -111,6 +111,7 @@ You can use `--help` or `-h` to view a list of command-line options. Briefly out
|
|||
--no-exit - do not display 'exit' in the ES menu.
|
||||
--debug - print additional output to the console, primarily about input.
|
||||
--windowed - run ES in a window, works best in conjunction with --resolution [w] [h].
|
||||
--vsync [0/1] - turn vsync on or off (default is on), only works in fullscreen.
|
||||
--scrape - run the interactive command-line metadata scraper.
|
||||
```
|
||||
|
||||
|
|
|
@ -61,14 +61,13 @@ SystemData::~SystemData()
|
|||
delete mRootFolder;
|
||||
}
|
||||
|
||||
std::string strreplace(std::string& str, std::string replace, std::string with)
|
||||
std::string strreplace(std::string str, const std::string& replace, const std::string& with)
|
||||
{
|
||||
size_t pos = str.find(replace);
|
||||
|
||||
if(pos != std::string::npos)
|
||||
return str.replace(pos, replace.length(), with.c_str(), with.length());
|
||||
else
|
||||
return str;
|
||||
size_t pos;
|
||||
while((pos = str.find(replace)) != std::string::npos)
|
||||
str = str.replace(pos, replace.length(), with.c_str(), with.length());
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string escapePath(const boost::filesystem::path& path)
|
||||
|
|
|
@ -57,6 +57,10 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
|
|||
}else if(strcmp(argv[i], "--windowed") == 0)
|
||||
{
|
||||
Settings::getInstance()->setBool("Windowed", true);
|
||||
}else if(strcmp(argv[i], "--vsync") == 0)
|
||||
{
|
||||
Settings::getInstance()->setBool("VSync", atoi(argv[i + 1]));
|
||||
i++; // skip vsync value
|
||||
}else if(strcmp(argv[i], "--scrape") == 0)
|
||||
{
|
||||
scrape_cmdline = true;
|
||||
|
@ -75,6 +79,7 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
|
|||
"--debug even more logging\n"
|
||||
"--scrape scrape using command line interface\n"
|
||||
"--windowed not fullscreen, should be used with --resolution\n"
|
||||
"--vsync [0/1] turn vsync on or off (default is on)\n"
|
||||
"--help, -h summon a sentient, angry tuba\n\n"
|
||||
"More information available in README.md.\n";
|
||||
return false; //exit after printing help
|
||||
|
|
|
@ -49,7 +49,6 @@ namespace Renderer
|
|||
#ifdef USE_OPENGL_ES
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
#endif
|
||||
//SDL_GL_SetSwapInterval(1); //0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for late swap tearing
|
||||
|
||||
SDL_DisplayMode dispMode;
|
||||
SDL_GetDesktopDisplayMode(0, &dispMode);
|
||||
|
@ -96,6 +95,19 @@ namespace Renderer
|
|||
|
||||
sdlContext = SDL_GL_CreateContext(sdlWindow);
|
||||
|
||||
// vsync
|
||||
if(Settings::getInstance()->getBool("VSync"))
|
||||
{
|
||||
// SDL_GL_SetSwapInterval(0) for immediate updates (no vsync, default),
|
||||
// 1 for updates synchronized with the vertical retrace,
|
||||
// or -1 for late swap tearing.
|
||||
// SDL_GL_SetSwapInterval returns 0 on success, -1 on error.
|
||||
// if vsync is requested, try late swap tearing; if that doesn't work, try normal vsync
|
||||
// if that doesn't work, report an error
|
||||
if(SDL_GL_SetSwapInterval(-1) != 0 && SDL_GL_SetSwapInterval(1) != 0)
|
||||
LOG(LogWarning) << "Tried to enable vsync, but failed! (" << SDL_GetError() << ")";
|
||||
}
|
||||
|
||||
//hide mouse cursor
|
||||
initialCursorState = SDL_ShowCursor(0) == 1;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ std::vector<const char*> settings_dont_save = boost::assign::list_of
|
|||
("ParseGamelistOnly")
|
||||
("ShowExit")
|
||||
("Windowed")
|
||||
("VSync")
|
||||
("IgnoreGamelist");
|
||||
|
||||
Settings::Settings()
|
||||
|
@ -41,6 +42,15 @@ void Settings::setDefaults()
|
|||
mBoolMap["DrawFramerate"] = false;
|
||||
mBoolMap["ShowExit"] = true;
|
||||
mBoolMap["Windowed"] = false;
|
||||
|
||||
#ifdef _RPI_
|
||||
// don't enable VSync by default on the Pi, since it already
|
||||
// has trouble trying to render things at 60fps in certain menus
|
||||
mBoolMap["VSync"] = false;
|
||||
#else
|
||||
mBoolMap["VSync"] = true;
|
||||
#endif
|
||||
|
||||
mBoolMap["EnableSounds"] = true;
|
||||
mBoolMap["ShowHelpPrompts"] = true;
|
||||
mBoolMap["ScrapeRatings"] = true;
|
||||
|
|
|
@ -111,7 +111,7 @@ void Sound::play()
|
|||
if(mSampleData == NULL)
|
||||
return;
|
||||
|
||||
if(Settings::getInstance()->getBool("EnableSounds"))
|
||||
if(!Settings::getInstance()->getBool("EnableSounds"))
|
||||
return;
|
||||
|
||||
SDL_LockAudio();
|
||||
|
|
Loading…
Reference in a new issue