From 3f10389863df9eafaab4935d3d649152364e93fe Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Sun, 10 May 2015 23:50:53 +0200 Subject: [PATCH] Optional disable sops --- src/client.c | 9 +++------ src/client.h | 5 ++++- src/main.c | 15 +++++++++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/client.c b/src/client.c index 21d33d3..8e349e9 100644 --- a/src/client.c +++ b/src/client.c @@ -205,7 +205,7 @@ cleanup: return !!result; } -static void client_pair(const char *address) { +void client_pair(const char *address) { char url[4096]; char pin[5]; @@ -317,7 +317,7 @@ int client_get_app_id(const char *address, char *name) { return -1; } -void client_start_app(STREAM_CONFIGURATION *config, const char *address, int appId) { +void client_start_app(STREAM_CONFIGURATION *config, const char *address, int appId, bool sops) { RAND_bytes(config->remoteInputAesKey, 16); memset(config->remoteInputAesIv, 0, 16); @@ -329,7 +329,7 @@ void client_start_app(STREAM_CONFIGURATION *config, const char *address, int app struct http_data *data = http_create_data(); if (currentGame == 0) - sprintf(url, "https://%s:47984/launch?uniqueid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=1&rikey=%s&rikeyid=%d&localAudioPlayMode=0", address, unique_id, appId, config->width, config->height, config->fps, rikey_hex, rikeyid); + sprintf(url, "https://%s:47984/launch?uniqueid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=0", address, unique_id, appId, config->width, config->height, config->fps, sops, rikey_hex, rikeyid); else sprintf(url, "https://%s:47984/resume?uniqueid=%s&rikey=%s&rikeyid=%d", address, unique_id, rikey_hex, rikeyid); @@ -343,7 +343,4 @@ void client_init(const char *address) { client_load_cert(); client_load_server_status(address); - if (!paired) { - client_pair(address); - } } diff --git a/src/client.h b/src/client.h index 4474d67..9364087 100644 --- a/src/client.h +++ b/src/client.h @@ -21,7 +21,10 @@ #include "limelight-common/Limelight.h" +#include "stdbool.h" + void client_init(const char* serverAddress); -void client_start_app(STREAM_CONFIGURATION *config, const char* serverAddress, int appId); +void client_start_app(STREAM_CONFIGURATION *config, const char* serverAddress, int appId, bool sops); struct app_list* client_applist(const char* serverAddress); int client_get_app_id(const char* serverAddress, char* name); +void client_pair(const char *address); diff --git a/src/main.c b/src/main.c index ab5f666..ae428a8 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -46,14 +47,14 @@ static void applist(const char* address) { } } -static void stream(STREAM_CONFIGURATION* config, const char* address, const char* app) { +static void stream(STREAM_CONFIGURATION* config, const char* address, const char* app, bool sops) { int appId = client_get_app_id(address, app); if (appId<0) { printf("Can't find app %s\n", app); exit(-1); } - client_start_app(config, address, appId); + client_start_app(config, address, appId, sops); struct in_addr addr; inet_aton(address, &addr); @@ -81,6 +82,7 @@ static void help() { printf("\t-bitrate \tSpecify the bitrate in Kbps\n"); printf("\t-packetsize \tSpecify the maximum packetsize in bytes\n"); printf("\t-app \t\tName of app to stream\n"); + printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n"); printf("\t-input \t\tUse as input. Can be used multiple times\n"); printf("\t-mapping \t\tUse as gamepad mapping configuration file (use before -input)\n"); exit(0); @@ -106,6 +108,7 @@ int main(int argc, char* argv[]) { {"app", required_argument, 0, 'i'}, {"input", required_argument, 0, 'j'}, {"mapping", required_argument, 0, 'k'}, + {"nosops", no_argument, 0, 'l'}, {0, 0, 0, 0}, }; @@ -114,8 +117,9 @@ int main(int argc, char* argv[]) { char* address = NULL; char* mapping = NULL; int option_index = 0; + bool sops = true; int c; - while ((c = getopt_long_only (argc, argv, "-abc:d:efg:h:i:j:", long_options, &option_index)) != -1) { + while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:l", long_options, &option_index)) != -1) { switch (c) { case 'a': config.width = 720; @@ -152,6 +156,9 @@ int main(int argc, char* argv[]) { case 'k': mapping = optarg; break; + case 'l': + sops = false; + break; case 1: if (action == NULL) action = optarg; @@ -177,7 +184,7 @@ int main(int argc, char* argv[]) { if (strcmp("applist", action) == 0) applist(address); else if (strcmp("stream", action) == 0) - stream(&config, address, app); + stream(&config, address, app, sops); else if (strcmp("pair", action) == 0) client_pair(address); else