Add two video settings:

-pos=<x>,<y>            Position [Default: centered]
-borderless             Windowed mode with no border

These 2 settings are usefull when setting up a multiplayer game on one machine.

Example for 4 windows in fullHD:

start "Master" /D"Master_P4" Supermodel.exe -input-system=sdl ..\ROMS\dayto2pe.zip -res=960,540 -borderless -pos=0,0
start "Slave1" /D"Slave1_P4" Supermodel.exe -input-system=sdl ..\ROMS\dayto2pe.zip -res=960,540 -borderless -pos=960,0
start "Slave2" /D"Slave2_P4" Supermodel.exe -input-system=sdl ..\ROMS\dayto2pe.zip -res=960,540 -borderless -pos=0,540
start "Slave3" /D"Slave3_P4" Supermodel.exe -input-system=sdl ..\ROMS\dayto2pe.zip -res=960,540 -borderless -pos=960,540
This commit is contained in:
joachim 2023-03-02 14:07:06 +01:00 committed by trzy
parent 5fa190490d
commit c97e3acce7

View file

@ -1086,8 +1086,16 @@ int Supermodel(const Game &game, ROMSet *rom_set, IEmulator *Model3, CInputs *In
sprintf(baseTitleStr, "Supermodel - %s", game.title.c_str()); sprintf(baseTitleStr, "Supermodel - %s", game.title.c_str());
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["Xpos"].ValueAs<std::string>() != "NA" &&
s_runtime_config["Ypos"].ValueAs<std::string>() != "NA" )
SDL_SetWindowPosition(s_window, s_runtime_config["Xpos"].ValueAs<unsigned>(), s_runtime_config["Ypos"].ValueAs<unsigned>());
else
SDL_SetWindowPosition(s_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); SDL_SetWindowPosition(s_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
if (s_runtime_config["BorderLess"].ValueAs<bool>())
SDL_SetWindowBordered(s_window, SDL_FALSE);
SetFullScreenRefreshRate(); SetFullScreenRefreshRate();
bool stretch = s_runtime_config["Stretch"].ValueAs<bool>(); bool stretch = s_runtime_config["Stretch"].ValueAs<bool>();
@ -1629,7 +1637,11 @@ 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("XPos", "NA");
config.Set("YPos", "NA");
config.Set("FullScreen", false); config.Set("FullScreen", false);
config.Set("BorderLess", false);
config.Set("WideScreen", false); config.Set("WideScreen", false);
config.Set("Stretch", false); config.Set("Stretch", false);
config.Set("WideBackground", false); config.Set("WideBackground", false);
@ -1708,7 +1720,9 @@ static void Help(void)
puts(""); puts("");
puts("Video Options:"); puts("Video Options:");
puts(" -res=<x>,<y> Resolution [Default: 496,384]"); puts(" -res=<x>,<y> Resolution [Default: 496,384]");
puts(" -pos=<x>,<y> Position [Default: centered]");
puts(" -window Windowed mode [Default]"); puts(" -window Windowed mode [Default]");
puts(" -borderless Windowed mode with no border");
puts(" -fullscreen Full screen mode"); puts(" -fullscreen Full screen mode");
puts(" -wide-screen Expand 3D field of view to screen width"); puts(" -wide-screen Expand 3D field of view to screen width");
puts(" -wide-bg When wide-screen mode is enabled, also expand the 2D"); puts(" -wide-bg When wide-screen mode is enabled, also expand the 2D");
@ -1830,6 +1844,7 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv)
{ "-no-gpu-thread", { "GPUMultiThreaded", false } }, { "-no-gpu-thread", { "GPUMultiThreaded", false } },
{ "-window", { "FullScreen", false } }, { "-window", { "FullScreen", false } },
{ "-fullscreen", { "FullScreen", true } }, { "-fullscreen", { "FullScreen", true } },
{ "-borderless", { "BorderLess", true } },
{ "-no-wide-screen", { "WideScreen", false } }, { "-no-wide-screen", { "WideScreen", false } },
{ "-wide-screen", { "WideScreen", true } }, { "-wide-screen", { "WideScreen", true } },
{ "-stretch", { "Stretch", true } }, { "-stretch", { "Stretch", true } },
@ -1936,6 +1951,31 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv)
} }
} }
} }
else if (arg == "-pos" || arg.find("-pos=") == 0)
{
std::vector<std::string> parts = Util::Format(arg).Split('=');
if (parts.size() != 2)
{
ErrorLog("'-pos' requires both a X and Y (e.g., '-pos=10,0').");
cmd_line.error = true;
}
else
{
unsigned x, y;
if (2 == sscanf(&argv[i][4], "=%u,%u", &x, &y))
{
std::string xres = Util::Format() << x;
std::string yres = Util::Format() << y;
cmd_line.config.Set("Xpos", xres);
cmd_line.config.Set("Ypos", yres);
}
else
{
ErrorLog("'-pos' requires both a X and Y (e.g., '-pos=10,0').");
cmd_line.error = true;
}
}
}
else if (arg == "-true-hz") else if (arg == "-true-hz")
cmd_line.config.Set("RefreshRate", 57.524f); cmd_line.config.Set("RefreshRate", 57.524f);
else if (arg == "-print-gl-info") else if (arg == "-print-gl-info")