From 2c35e70cc0497d646f8f5ada6d58a5c53eb0fccf Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Fri, 16 Jun 2017 21:49:10 +0200 Subject: [PATCH] Use --unsupported option also for unsupported resolutions --- libgamestream/CMakeLists.txt | 2 +- libgamestream/client.c | 7 ++++--- libgamestream/client.h | 3 ++- src/config.c | 4 ++-- src/config.h | 2 +- src/main.c | 12 +++++------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libgamestream/CMakeLists.txt b/libgamestream/CMakeLists.txt index 22e2bae..3e5e521 100644 --- a/libgamestream/CMakeLists.txt +++ b/libgamestream/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SO_VERSION 1) +set(SO_VERSION 2) find_package(LibUUID REQUIRED) find_package(Threads REQUIRED) diff --git a/libgamestream/client.c b/libgamestream/client.c index eff1d64..4d17332 100644 --- a/libgamestream/client.c +++ b/libgamestream/client.c @@ -264,7 +264,7 @@ static int load_server_status(PSERVER_DATA server) { i++; } while (ret != GS_OK && i < 2); - if (ret == GS_OK) { + if (ret == GS_OK && !server->unsupported) { if (server->serverMajorVersion > MAX_SUPPORTED_GFE_VERSION) { gs_error = "Ensure you're running the latest version of Moonlight Embedded or downgrade GeForce Experience and try again"; ret = GS_UNSUPPORTED_VERSION; @@ -646,7 +646,7 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b mode = mode->next; } - if (!correct_mode) + if (!correct_mode && !server->unsupported) return GS_NOT_SUPPORTED_MODE; if (config->height >= 2160 && !server->supports4K) @@ -727,7 +727,7 @@ int gs_quit_app(PSERVER_DATA server) { return ret; } -int gs_init(PSERVER_DATA server, char *address, const char *keyDirectory, int log_level) { +int gs_init(PSERVER_DATA server, char *address, const char *keyDirectory, int log_level, bool unsupported) { mkdirtree(keyDirectory); if (load_unique_id(keyDirectory) != GS_OK) return GS_FAILED; @@ -739,5 +739,6 @@ int gs_init(PSERVER_DATA server, char *address, const char *keyDirectory, int lo LiInitializeServerInformation(&server->serverInfo); server->serverInfo.address = address; + server->unsupported = unsupported; return load_server_status(server); } diff --git a/libgamestream/client.h b/libgamestream/client.h index ae0971d..d9f956c 100644 --- a/libgamestream/client.h +++ b/libgamestream/client.h @@ -33,6 +33,7 @@ typedef struct _SERVER_DATA { char* gpuType; bool paired; bool supports4K; + bool unsupported; int currentGame; int serverMajorVersion; char* gsVersion; @@ -40,7 +41,7 @@ typedef struct _SERVER_DATA { SERVER_INFORMATION serverInfo; } SERVER_DATA, *PSERVER_DATA; -int gs_init(PSERVER_DATA server, char* address, const char *keyDirectory, int logLevel); +int gs_init(PSERVER_DATA server, char* address, const char *keyDirectory, int logLevel, bool unsupported); int gs_start_app(PSERVER_DATA server, PSTREAM_CONFIGURATION config, int appId, bool sops, bool localaudio); int gs_applist(PSERVER_DATA server, PAPP_LIST *app_list); int gs_unpair(PSERVER_DATA server); diff --git a/src/config.c b/src/config.c index db7aaa9..32a4d72 100644 --- a/src/config.c +++ b/src/config.c @@ -203,7 +203,7 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) { config->codec = CODEC_HEVC; break; case 'y': - config->unsupported_version = true; + config->unsupported = true; break; case 'z': config->debug_level = 1; @@ -307,7 +307,7 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) { config->sops = true; config->localaudio = false; config->fullscreen = true; - config->unsupported_version = false; + config->unsupported = false; config->codec = CODEC_UNSPECIFIED; config->inputsCount = 0; diff --git a/src/config.h b/src/config.h index f6271bf..2e90b4e 100644 --- a/src/config.h +++ b/src/config.h @@ -39,7 +39,7 @@ typedef struct _CONFIGURATION { bool sops; bool localaudio; bool fullscreen; - bool unsupported_version; + bool unsupported; char* inputs[MAX_INPUTS]; int inputsCount; enum codecs codec; diff --git a/src/main.c b/src/main.c index ebfdfe9..71df729 100644 --- a/src/main.c +++ b/src/main.c @@ -95,7 +95,7 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys if (ret == GS_NOT_SUPPORTED_4K) 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)\n", config->stream.width, config->stream.height, config->stream.fps); + 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 fprintf(stderr, "Errorcode starting app: %d\n", ret); exit(-1); @@ -161,7 +161,7 @@ static void help() { printf("\t-keydir \tLoad encryption keys from directory\n"); printf("\t-mapping \t\tUse as gamepad mappings configuration file\n"); printf("\t-platform \tSpecify system used for audio, video and input: pi/imx/aml/x11/x11_vdpau/sdl/fake (default auto)\n"); - printf("\t-unsupported\t\tTry streaming if GFE version is unsupported\n"); + printf("\t-unsupported\t\tTry streaming if GFE version or options are unsupported\n"); #if defined(HAVE_SDL) || defined(HAVE_X11) printf("\n WM options (SDL and X11 only)\n\n"); printf("\t-windowed\t\tDisplay screen in a window\n"); @@ -216,17 +216,15 @@ int main(int argc, char* argv[]) { printf("Connect to %s...\n", config.address); int ret; - if ((ret = gs_init(&server, config.address, config.key_dir, config.debug_level)) == GS_OUT_OF_MEMORY) { + if ((ret = gs_init(&server, config.address, config.key_dir, config.debug_level, config.unsupported)) == GS_OUT_OF_MEMORY) { fprintf(stderr, "Not enough memory\n"); exit(-1); } else if (ret == GS_INVALID) { fprintf(stderr, "Invalid data received from server: %s\n", config.address, gs_error); exit(-1); } else if (ret == GS_UNSUPPORTED_VERSION) { - if (!config.unsupported_version) { - fprintf(stderr, "Unsupported version: %s\n", gs_error); - exit(-1); - } + fprintf(stderr, "Unsupported version: %s\n", gs_error); + exit(-1); } else if (ret != GS_OK) { fprintf(stderr, "Can't connect to server %s\n", config.address); exit(-1);