mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-03-06 14:27:44 +00:00
Fixed window position config storage and command line parsing
This commit is contained in:
parent
83144f80b7
commit
ae5af4c036
|
@ -1087,14 +1087,9 @@ int Supermodel(const Game &game, ROMSet *rom_set, IEmulator *Model3, CInputs *In
|
||||||
SDL_SetWindowTitle(s_window, baseTitleStr);
|
SDL_SetWindowTitle(s_window, baseTitleStr);
|
||||||
SDL_SetWindowSize(s_window, totalXRes, totalYRes);
|
SDL_SetWindowSize(s_window, totalXRes, totalYRes);
|
||||||
|
|
||||||
if (!s_runtime_config["WindowXPosition"].Empty() && !s_runtime_config["WindowYPosition"].Empty())
|
int xpos = s_runtime_config["WindowXPosition"].Exists() ? s_runtime_config["WindowXPosition"].ValueAs<int>() : SDL_WINDOWPOS_CENTERED;
|
||||||
{
|
int ypos = s_runtime_config["WindowYPosition"].Exists() ? s_runtime_config["WindowYPosition"].ValueAs<int>() : SDL_WINDOWPOS_CENTERED;
|
||||||
SDL_SetWindowPosition(s_window, s_runtime_config["WindowXPosition"].ValueAs<unsigned>(), s_runtime_config["WindowYPosition"].ValueAs<unsigned>());
|
SDL_SetWindowPosition(s_window, xpos, ypos);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_SetWindowPosition(s_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s_runtime_config["BorderlessWindow"].ValueAs<bool>())
|
if (s_runtime_config["BorderlessWindow"].ValueAs<bool>())
|
||||||
{
|
{
|
||||||
|
@ -1642,8 +1637,8 @@ static Util::Config::Node DefaultConfig()
|
||||||
config.Set("QuadRendering", false);
|
config.Set("QuadRendering", false);
|
||||||
config.Set("XResolution", "496");
|
config.Set("XResolution", "496");
|
||||||
config.Set("YResolution", "384");
|
config.Set("YResolution", "384");
|
||||||
config.Set("WindowXPosition", "NA");
|
config.SetEmpty("WindowXPosition");
|
||||||
config.Set("WindowYPosition", "NA");
|
config.SetEmpty("WindowYPosition");
|
||||||
config.Set("FullScreen", false);
|
config.Set("FullScreen", false);
|
||||||
config.Set("BorderlessWindow", false);
|
config.Set("BorderlessWindow", false);
|
||||||
|
|
||||||
|
@ -1966,13 +1961,11 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
int xpos, ypos;
|
||||||
if (2 == sscanf(&argv[i][4], "=%u,%u", &x, &y))
|
if (2 == sscanf(&argv[i][11], "=%d,%d", &xpos, &ypos))
|
||||||
{
|
{
|
||||||
std::string xres = Util::Format() << x;
|
cmd_line.config.Set("WindowXPosition", xpos);
|
||||||
std::string yres = Util::Format() << y;
|
cmd_line.config.Set("WindowYPosition", ypos);
|
||||||
cmd_line.config.Set("WindowXPosition", xres);
|
|
||||||
cmd_line.config.Set("WindowYPosition", yres);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue