Merge tag 'v2.2.2' into raspbian/jessie

This commit is contained in:
Iwan Timmer
2016-10-06 17:23:35 +02:00
9 changed files with 75 additions and 38 deletions

View File

@@ -5,7 +5,7 @@ include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
set(MOONLIGHT_MAJOR_VERSION 2)
set(MOONLIGHT_MINOR_VERSION 2)
set(MOONLIGHT_PATCH_VERSION 0)
set(MOONLIGHT_PATCH_VERSION 2)
set(MOONLIGHT_VERSION ${MOONLIGHT_MAJOR_VERSION}.${MOONLIGHT_MINOR_VERSION}.${MOONLIGHT_PATCH_VERSION})
aux_source_directory(./src SRC_LIST)

View File

@@ -24,6 +24,14 @@ More information about installing and runnning Moonlight Embedded is available o
* Connect to the GFE Server with Moonlight Embedded
* Play games!
## Donations
Donations are welcome and will be used to buy new test hardware.
- Bitcoin [1DgheY9CkQhzwgtjaoYpGSudaMzck1swDp](bitcoin:1DgheY9CkQhzwgtjaoYpGSudaMzck1swDp)
- [PayPal](https://www.paypal.me/itimmer)
- [Flattr](https://flattr.com/submit/auto?fid=lz111v&url=https%3A%2F%2Fgithub.com%2Firtimmer%2Fmoonlight-embedded)
## Bugs
Please check the fora, wiki and old bug reports before submitting a new bug report.

View File

@@ -178,7 +178,6 @@ static int load_server_status(PSERVER_DATA server) {
do {
char *pairedText = NULL;
char *currentGameText = NULL;
char *versionText = NULL;
char *stateText = NULL;
char *heightText = NULL;
char *serverCodecModeSupportText = NULL;
@@ -193,7 +192,7 @@ static int load_server_status(PSERVER_DATA server) {
// make another request over HTTP if the HTTPS request fails. We can't just use HTTP
// for everything because it doesn't accurately tell us if we're paired.
sprintf(url, "%s://%s:%d/serverinfo?uniqueid=%s&uuid=%s",
i == 0 ? "https" : "http", server->address, i == 0 ? 47984 : 47989, unique_id, uuid_str);
i == 0 ? "https" : "http", server->serverInfo.address, i == 0 ? 47984 : 47989, unique_id, uuid_str);
PHTTP_DATA data = http_create_data();
if (data == NULL) {
@@ -212,7 +211,7 @@ static int load_server_status(PSERVER_DATA server) {
if (xml_search(data->memory, data->size, "PairStatus", &pairedText) != GS_OK)
goto cleanup;
if (xml_search(data->memory, data->size, "appversion", &versionText) != GS_OK)
if (xml_search(data->memory, data->size, "appversion", (char**) &server->serverInfo.serverInfoAppVersion) != GS_OK)
goto cleanup;
if (xml_search(data->memory, data->size, "state", &stateText) != GS_OK)
@@ -227,17 +226,18 @@ static int load_server_status(PSERVER_DATA server) {
if (xml_search(data->memory, data->size, "gputype", &server->gpuType) != GS_OK)
goto cleanup;
if (xml_search(data->memory, data->size, "GfeVersion", &server->gfeVersion) != GS_OK)
if (xml_search(data->memory, data->size, "GfeVersion", (char**) &server->serverInfo.serverInfoGfeVersion) != GS_OK)
goto cleanup;
// These fields are present on all version of GFE that this client supports
if (!strlen(currentGameText) || !strlen(pairedText) || !strlen(versionText) || !strlen(stateText))
if (!strlen(currentGameText) || !strlen(pairedText) || !strlen(server->serverInfo.serverInfoAppVersion) || !strlen(stateText))
goto cleanup;
server->paired = pairedText != NULL && strcmp(pairedText, "1") == 0;
server->currentGame = currentGameText == NULL ? 0 : atoi(currentGameText);
server->supports4K = heightText != NULL && serverCodecModeSupportText != NULL && atoi(heightText) >= 2160;
server->serverMajorVersion = atoi(versionText);
server->serverMajorVersion = atoi(server->serverInfo.serverInfoAppVersion);
if (strstr(stateText, "_SERVER_AVAILABLE")) {
// After GFE 2.8, current game remains set even after streaming
// has ended. We emulate the old behavior by forcing it to zero
@@ -256,9 +256,6 @@ static int load_server_status(PSERVER_DATA server) {
if (currentGameText != NULL)
free(currentGameText);
if (versionText != NULL)
free(versionText);
if (heightText != NULL)
free(heightText);
@@ -374,7 +371,7 @@ int gs_unpair(PSERVER_DATA server) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "http://%s:47989/unpair?uniqueid=%s&uuid=%s", server->address, unique_id, uuid_str);
sprintf(url, "http://%s:47989/unpair?uniqueid=%s&uuid=%s", server->serverInfo.address, unique_id, uuid_str);
ret = http_request(url, data);
http_free_data(data);
@@ -405,7 +402,7 @@ int gs_pair(PSERVER_DATA server, char* pin) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&phrase=getservercert&salt=%s&clientcert=%s", server->address, unique_id, uuid_str, salt_hex, cert_hex);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&phrase=getservercert&salt=%s&clientcert=%s", server->serverInfo.address, unique_id, uuid_str, salt_hex, cert_hex);
PHTTP_DATA data = http_create_data();
if (data == NULL)
return GS_OUT_OF_MEMORY;
@@ -463,7 +460,7 @@ int gs_pair(PSERVER_DATA server, char* pin) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&clientchallenge=%s", server->address, unique_id, uuid_str, challenge_hex);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&clientchallenge=%s", server->serverInfo.address, unique_id, uuid_str, challenge_hex);
if ((ret = http_request(url, data)) != GS_OK)
goto cleanup;
@@ -517,7 +514,7 @@ int gs_pair(PSERVER_DATA server, char* pin) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&serverchallengeresp=%s", server->address, unique_id, uuid_str, challenge_response_hex);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&serverchallengeresp=%s", server->serverInfo.address, unique_id, uuid_str, challenge_response_hex);
if ((ret = http_request(url, data)) != GS_OK)
goto cleanup;
@@ -566,7 +563,7 @@ int gs_pair(PSERVER_DATA server, char* pin) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&clientpairingsecret=%s", server->address, unique_id, uuid_str, client_pairing_secret_hex);
sprintf(url, "http://%s:47989/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&clientpairingsecret=%s", server->serverInfo.address, unique_id, uuid_str, client_pairing_secret_hex);
if ((ret = http_request(url, data)) != GS_OK)
goto cleanup;
@@ -583,7 +580,7 @@ int gs_pair(PSERVER_DATA server, char* pin) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "https://%s:47984/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&phrase=pairchallenge", server->address, unique_id, uuid_str);
sprintf(url, "https://%s:47984/pair?uniqueid=%s&uuid=%s&devicename=roth&updateState=1&phrase=pairchallenge", server->serverInfo.address, unique_id, uuid_str);
if ((ret = http_request(url, data)) != GS_OK)
goto cleanup;
@@ -623,7 +620,7 @@ int gs_applist(PSERVER_DATA server, PAPP_LIST *list) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "https://%s:47984/applist?uniqueid=%s&uuid=%s", server->address, unique_id, uuid_str);
sprintf(url, "https://%s:47984/applist?uniqueid=%s&uuid=%s", server->serverInfo.address, unique_id, uuid_str);
if (http_request(url, data) != GS_OK)
ret = GS_IO_ERROR;
else if (xml_applist(data->memory, data->size, list) != GS_OK)
@@ -660,9 +657,9 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
if (server->currentGame == 0) {
int channelCounnt = config->audioConfiguration == AUDIO_CONFIGURATION_STEREO ? CHANNEL_COUNT_STEREO : CHANNEL_COUNT_51_SURROUND;
int mask = config->audioConfiguration == AUDIO_CONFIGURATION_STEREO ? CHANNEL_MASK_STEREO : CHANNEL_MASK_51_SURROUND;
sprintf(url, "https://%s:47984/launch?uniqueid=%s&uuid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=%d&surroundAudioInfo=%d", server->address, unique_id, uuid_str, appId, config->width, config->height, config->fps, sops, rikey_hex, rikeyid, localaudio, (mask << 16) + channelCounnt);
sprintf(url, "https://%s:47984/launch?uniqueid=%s&uuid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=%d&surroundAudioInfo=%d", server->serverInfo.address, unique_id, uuid_str, appId, config->width, config->height, config->fps, sops, rikey_hex, rikeyid, localaudio, (mask << 16) + channelCounnt);
} else
sprintf(url, "https://%s:47984/resume?uniqueid=%s&uuid=%s&rikey=%s&rikeyid=%d", server->address, unique_id, uuid_str, rikey_hex, rikeyid);
sprintf(url, "https://%s:47984/resume?uniqueid=%s&uuid=%s&rikey=%s&rikeyid=%d", server->serverInfo.address, unique_id, uuid_str, rikey_hex, rikeyid);
if ((ret = http_request(url, data)) == GS_OK)
server->currentGame = appId;
@@ -697,7 +694,7 @@ int gs_quit_app(PSERVER_DATA server) {
uuid_generate_random(uuid);
uuid_unparse(uuid, uuid_str);
sprintf(url, "https://%s:47984/cancel?uniqueid=%s&uuid=%s", server->address, unique_id, uuid_str);
sprintf(url, "https://%s:47984/cancel?uniqueid=%s&uuid=%s", server->serverInfo.address, unique_id, uuid_str);
if ((ret = http_request(url, data)) != GS_OK)
goto cleanup;
@@ -717,7 +714,7 @@ int gs_quit_app(PSERVER_DATA server) {
return ret;
}
int gs_init(PSERVER_DATA server, const char *keyDirectory) {
int gs_init(PSERVER_DATA server, char *address, const char *keyDirectory) {
mkdirtree(keyDirectory);
if (load_unique_id(keyDirectory) != GS_OK)
return GS_FAILED;
@@ -726,5 +723,8 @@ int gs_init(PSERVER_DATA server, const char *keyDirectory) {
return GS_FAILED;
http_init(keyDirectory);
LiInitializeServerInformation(&server->serverInfo);
server->serverInfo.address = address;
return load_server_status(server);
}

View File

@@ -31,14 +31,14 @@
typedef struct _SERVER_DATA {
const char* address;
char* gpuType;
char* gfeVersion;
bool paired;
bool supports4K;
int currentGame;
int serverMajorVersion;
SERVER_INFORMATION serverInfo;
} SERVER_DATA, *PSERVER_DATA;
int gs_init(PSERVER_DATA server, const char *keyDirectory);
int gs_init(PSERVER_DATA server, char* address, const char *keyDirectory);
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);

View File

@@ -0,0 +1,30 @@
abs_x = 0
abs_y = 1
abs_z = -1
reverse_x = false
reverse_y = true
abs_rx = 2
abs_ry = 5
abs_rz = -1
reverse_rx = false
reverse_ry = true
abs_dpad_x = 16
abs_dpad_y = 17
reverse_dpad_x = false
reverse_dpad_y = false
btn_east = 306
btn_south = 305
btn_north = 307
btn_west = 304
btn_select = 312
btn_start = 313
btn_thumbl = 314
btn_thumbr = 315
btn_tl = 308
btn_tr = 309
btn_tl2 = 310
btn_tr2 = 311
btn_dpad_up = -1
btn_dpad_down = -1
btn_dpad_left = -1
btn_dpad_right = -1

View File

@@ -1,16 +1,16 @@
abs_x = 0
abs_y = 1
abs_z = -1
abs_z = 50
abs_rx = 2
abs_ry = 3
abs_rz = -1
abs_ry = 5
abs_rz = 51
abs_deadzone = 0
abs_dpad_x = -1
abs_dpad_y = -1
reverse_x = false
reverse_y = false
reverse_y = true
reverse_rx = false
reverse_ry = false
reverse_ry = true
reverse_dpad_x = false
reverse_dpad_y = false
btn_west = 303
@@ -19,7 +19,7 @@ btn_north = 300
btn_east = 301
btn_select = 288
btn_start = 291
btn_mode = 304
btn_mode = 704
btn_thumbl = 289
btn_thumbr = 290
btn_tl = 298
@@ -29,4 +29,4 @@ btn_tr2 = 297
btn_dpad_up = 292
btn_dpad_down = 294
btn_dpad_left = 295
btn_dpad_right = 293
btn_dpad_right = 293

View File

@@ -100,7 +100,7 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
drFlags |= FORCE_HARDWARE_ACCELERATION;
printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate);
LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags, server->serverMajorVersion);
LiStartConnection(&server->serverInfo, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags);
if (IS_EMBEDDED(system)) {
evdev_start();
@@ -217,11 +217,10 @@ int main(int argc, char* argv[]) {
config_file_parse(host_config_file, &config);
SERVER_DATA server;
server.address = config.address;
printf("Connect to %s...\n", server.address);
printf("Connect to %s...\n", config.address);
int ret;
if ((ret = gs_init(&server, config.key_dir)) == GS_OUT_OF_MEMORY) {
if ((ret = gs_init(&server, config.address, config.key_dir)) == GS_OUT_OF_MEMORY) {
fprintf(stderr, "Not enough memory\n");
exit(-1);
} else if (ret == GS_INVALID) {
@@ -237,7 +236,7 @@ int main(int argc, char* argv[]) {
exit(-1);
}
printf("NVIDIA %s, GFE %s (protocol version %d)\n", server.gpuType, server.gfeVersion, server.serverMajorVersion);
printf("NVIDIA %s, GFE %s (protocol version %d)\n", server.gpuType, server.serverInfo.serverInfoGfeVersion, server.serverMajorVersion);
if (strcmp("list", config.action) == 0) {
pair_check(&server);

View File

@@ -77,7 +77,7 @@ void aml_setup(int videoFormat, int width, int height, int redrawRate, void* con
uname(&name);
int ret = sscanf(name.release, "%d.%d", &major, &minor);
if (!(major > 3 || (major == 3 && minor >= 14)) && width == 1920 && height == 1080)
codecParam.am_sysinfo.param = UCODE_IP_ONLY_PARAM;
codecParam.am_sysinfo.param = (void*) UCODE_IP_ONLY_PARAM;
}
break;
case VIDEO_FORMAT_H265:
@@ -92,7 +92,7 @@ void aml_setup(int videoFormat, int width, int height, int redrawRate, void* con
codecParam.am_sysinfo.width = width;
codecParam.am_sysinfo.height = height;
codecParam.am_sysinfo.rate = 96000 / redrawRate;
codecParam.am_sysinfo.param |= SYNC_OUTSIDE;
codecParam.am_sysinfo.param = (void*) ((size_t) codecParam.am_sysinfo.param | SYNC_OUTSIDE);
int api = codec_init(&codecParam);
if (api != 0) {