From 7f856d328405fdffdc3ddef493dd1fd23765821f Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Tue, 17 Mar 2020 22:37:18 +0100 Subject: [PATCH] Warn about unsupported resolutions in combination with SOPS When using unsupported resolutions SOPS will default to 720p60 --- libgamestream/client.c | 10 ++++++++-- libgamestream/errors.h | 1 + src/main.c | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libgamestream/client.c b/libgamestream/client.c index dbb4566..86cbc86 100644 --- a/libgamestream/client.c +++ b/libgamestream/client.c @@ -658,15 +658,21 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b PDISPLAY_MODE mode = server->modes; bool correct_mode = false; + bool supported_resolution = false; while (mode != NULL) { - if (mode->width == config->width && mode->height == config->height && mode->refresh == config->fps) - correct_mode = true; + if (mode->width == config->width && mode->height == config->height) { + supported_resolution = true; + if (mode->refresh == config->fps) + correct_mode = true; + } mode = mode->next; } if (!correct_mode && !server->unsupported) return GS_NOT_SUPPORTED_MODE; + else if (sops && !supported_resolution) + return GS_NOT_SUPPORTED_SOPS_RESOLUTION; if (config->height >= 2160 && !server->supports4K) return GS_NOT_SUPPORTED_4K; diff --git a/libgamestream/errors.h b/libgamestream/errors.h index 6de44a9..5c7b5f5 100644 --- a/libgamestream/errors.h +++ b/libgamestream/errors.h @@ -29,5 +29,6 @@ #define GS_UNSUPPORTED_VERSION -7 #define GS_NOT_SUPPORTED_MODE -8 #define GS_ERROR -9 +#define GS_NOT_SUPPORTED_SOPS_RESOLUTION -10 extern const char* gs_error; diff --git a/src/main.c b/src/main.c index 1c6633e..31e581e 100644 --- a/src/main.c +++ b/src/main.c @@ -105,6 +105,8 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys fprintf(stderr, "Server doesn't support 4K\n"); else if (ret == GS_NOT_SUPPORTED_MODE) fprintf(stderr, "Server doesn't support %dx%d (%d fps) or try --unsupported option\n", config->stream.width, config->stream.height, config->stream.fps); + else if (ret == GS_NOT_SUPPORTED_SOPS_RESOLUTION) + fprintf(stderr, "SOPS isn't supported for the resolution %dx%d, use supported resolution or add --nosops option\n", config->stream.width, config->stream.height); else if (ret == GS_ERROR) fprintf(stderr, "Gamestream error: %s\n", gs_error); else