Optional disable sops

This commit is contained in:
Iwan Timmer
2015-05-10 23:50:53 +02:00
parent 460dde6031
commit 3f10389863
3 changed files with 18 additions and 11 deletions

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -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 <bitrate>\tSpecify the bitrate in Kbps\n");
printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n");
printf("\t-app <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 <device>\t\tUse <device> as input. Can be used multiple times\n");
printf("\t-mapping <file>\t\tUse <file> 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