From 0e2ef804dda37e37ed5ce40228d686b343443800 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 17 Dec 2024 20:32:13 +0100 Subject: [PATCH 1/2] Add new command line option: -display The new command line option -display lets the user select the display on which Descent 3 should be displayed. This is useful in multi-monitor setups where the game now can be run on any of the given monitors. --- renderer/HardwareOpenGL.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index 0fbff8f45..40f48f027 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -424,7 +424,21 @@ int opengl_Setup(oeApplication *app, const int *width, const int *height) { } if (!GSDLWindow) { - GSDLWindow = SDL_CreateWindow("Descent 3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, winw, winh, flags); + int display = 0; + if (int display_arg = FindArg("-display"); display_arg != 0) { + if (const char * arg_index_str = GetArg (display_arg + 1); arg_index_str == nullptr) { + LOG_WARNING << "No parameter for -display given"; + } else { + int arg_index = atoi(arg_index_str); + int display_count = SDL_GetNumVideoDisplays(); + if ((arg_index < 0) || (arg_index >= display_count)) { + LOG_WARNING.printf( "Parameter for -display must be in the range 0..%i", display_count-1 ); + } else { + display = arg_index; + } + } + } + GSDLWindow = SDL_CreateWindow("Descent 3", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), SDL_WINDOWPOS_UNDEFINED_DISPLAY(display), winw, winh, flags); if (!GSDLWindow) { LOG_ERROR.printf("OpenGL: SDL window creation failed: %s", SDL_GetError()); return 0; From bc12e2bf9fa745dab2abdc0ca703a5379d22977a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 17 Dec 2024 20:40:35 +0100 Subject: [PATCH 2/2] Add documentation for the -display command line argument in USAGE.md --- USAGE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/USAGE.md b/USAGE.md index 59a778c5e..cdd6bbe1c 100644 --- a/USAGE.md +++ b/USAGE.md @@ -87,6 +87,7 @@ Here brief usage of command line options, supported by game. | Option | Type | Default | Platform | Description | |----------------------|---------|-------------------------------------|----------|-------------------------------------------------------------------| | `-dedicated`, `-d` | boolean | Off | all | Run game in dedicated mode | +| `-display` | integer | 0 | all | Run game on the selected display | | `-fullscreen`, `-f` | boolean | On | all | Run game in fullscreen mode | | `-logfile` | boolean | Off | all | Enable file logging to Descent3.log | | `-loglevel ` | string | INFO (on Release), DEBUG (on Debug) | all | Set log level (NONE, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) |