Check protocol version

This commit is contained in:
Iwan Timmer 2016-04-01 19:13:16 +02:00
parent 9b98371afc
commit b30cf20f8c
4 changed files with 18 additions and 1 deletions

View File

@ -268,6 +268,16 @@ static int load_server_status(PSERVER_DATA server) {
i++; i++;
} while (ret != GS_OK && i < 2); } while (ret != GS_OK && i < 2);
if (ret == GS_OK) {
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;
} else if (server->serverMajorVersion < MIN_SUPPORTED_GFE_VERSION) {
gs_error = "Moonlight Embedded requires a newer version of GeForce Experience. Please upgrade GFE on your PC and try again.";
ret = GS_UNSUPPORTED_VERSION;
}
}
return ret; return ret;
} }

View File

@ -25,6 +25,9 @@
#include <stdbool.h> #include <stdbool.h>
#define MIN_SUPPORTED_GFE_VERSION 3
#define MAX_SUPPORTED_GFE_VERSION 7
typedef struct _SERVER_DATA { typedef struct _SERVER_DATA {
const char* address; const char* address;
char* gpuType; char* gpuType;

View File

@ -1,7 +1,7 @@
/* /*
* This file is part of Moonlight Embedded. * This file is part of Moonlight Embedded.
* *
* Copyright (C) 2015 Iwan Timmer * Copyright (C) 2015, 2016 Iwan Timmer
* *
* Moonlight is free software; you can redistribute it and/or modify * Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,5 +26,6 @@
#define GS_WRONG_STATE -4 #define GS_WRONG_STATE -4
#define GS_IO_ERROR -5 #define GS_IO_ERROR -5
#define GS_NOT_SUPPORTED_4K -6 #define GS_NOT_SUPPORTED_4K -6
#define GS_UNSUPPORTED_VERSION -7
const char* gs_error; const char* gs_error;

View File

@ -226,6 +226,9 @@ int main(int argc, char* argv[]) {
} else if (ret == GS_INVALID) { } else if (ret == GS_INVALID) {
fprintf(stderr, "Invalid data received from server: %s\n", config.address, gs_error); fprintf(stderr, "Invalid data received from server: %s\n", config.address, gs_error);
exit(-1); exit(-1);
} else if (ret == GS_UNSUPPORTED_VERSION) {
fprintf(stderr, "Unsupported version: %s\n", gs_error);
exit(-1);
} else if (ret != GS_OK) { } else if (ret != GS_OK) {
fprintf(stderr, "Can't connect to server %s\n", config.address); fprintf(stderr, "Can't connect to server %s\n", config.address);
exit(-1); exit(-1);