diff --git a/.gitmodules b/.gitmodules index ce5b94c7..6dd72bcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "common"] path = third_party/moonlight-common-c - url = https://github.com/xyzz/moonlight-common-c.git + url = https://github.com/moonlight-stream/moonlight-common-c.git [submodule "third_party/enet"] path = third_party/enet - url = https://github.com/xyzz/vita-enet.git + url = https://github.com/cgutman/enet.git diff --git a/README.md b/README.md index 0e52b96f..e3b50854 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a vita port. ## OpenSSL -https://github.com/xyzz/vita-openssl branch `vita-1_0_2` +https://github.com/d3m3vilurr/vita-openssl branch `vita-1_0_2` ``` ./Configure no-threads --prefix=$VITASDK/arm-vita-eabi/ vita-cross @@ -17,12 +17,12 @@ make install ## curl -https://github.com/xyzz/vita-curl branch `vita` +https://github.com/d3m3vilurr/vita-curl branch `vita` ``` ./buildconf -./configure --host=arm-vita-eabi --with-ssl=$VITASDK/arm-vita-eabi/ --disable-shared --disable-ftp --disable-ldap --disable-imap --disable-ipv6 --disable-rtsp --disable-dict --disable-file --disable-gopher --disable-pop3 --disable-smtp --disable-telnet --disable-tftp --enable-https --disable-smb --disable-smbs --prefix=$VITASDK/arm-vita-eabi/ +cp lib/config-vita.h lib/curl_config.h make -j8 make install ``` diff --git a/libgamestream/client.c b/libgamestream/client.c index 3fddcaa8..971519c0 100644 --- a/libgamestream/client.c +++ b/libgamestream/client.c @@ -184,7 +184,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; @@ -199,7 +198,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) { @@ -218,7 +217,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) @@ -233,17 +232,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 @@ -262,9 +262,6 @@ static int load_server_status(PSERVER_DATA server) { if (currentGameText != NULL) free(currentGameText); - if (versionText != NULL) - free(versionText); - if (heightText != NULL) free(heightText); @@ -384,7 +381,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); @@ -415,7 +412,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; @@ -473,7 +470,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; @@ -527,7 +524,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; @@ -576,7 +573,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; @@ -593,7 +590,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; @@ -633,7 +630,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) @@ -672,9 +669,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; @@ -710,7 +707,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; @@ -730,7 +727,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; @@ -739,5 +736,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); } diff --git a/libgamestream/client.h b/libgamestream/client.h index 9a8fc915..f8b821da 100644 --- a/libgamestream/client.h +++ b/libgamestream/client.h @@ -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); diff --git a/src/gui/ui_connect.c b/src/gui/ui_connect.c index c2e8671b..c31cf720 100644 --- a/src/gui/ui_connect.c +++ b/src/gui/ui_connect.c @@ -72,14 +72,13 @@ void ui_connect_stream(PSERVER_DATA server, int appId) { drFlags |= FORCE_HARDWARE_ACCELERATION; ret = LiStartConnection( - server->address, + &server->serverInfo, &config.stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, - drFlags, - server->serverMajorVersion + drFlags ); if (ret == 0) { @@ -185,16 +184,13 @@ int ui_connect_loop(int id, void *context) { int ui_connect(char *address) { if (!server_connected) { - server.address = malloc(sizeof(char)*256); - strcpy(server.address, address); - - flash_message("Connecting to:\n %s...", server.address); - int ret = gs_init(&server, config.key_dir); + flash_message("Connecting to:\n %s...", address); + int ret = gs_init(&server, address, config.key_dir); if (ret == GS_OUT_OF_MEMORY) { display_error("Not enough memory"); return 0; } else if (ret == GS_INVALID) { - display_error("Invalid data received from server: %s\n", config.address, gs_error); + display_error("Invalid data received from server: %s\n", address, gs_error); return 0; } else if (ret == GS_UNSUPPORTED_VERSION) { if (!config.unsupported_version) { @@ -202,7 +198,7 @@ int ui_connect(char *address) { return 0; } } else if (ret != GS_OK) { - display_error("Can't connect to server\n%s", config.address); + display_error("Can't connect to server\n%s", address); return 0; } diff --git a/src/platform.c b/src/platform.c index 83e817b1..538fcfde 100644 --- a/src/platform.c +++ b/src/platform.c @@ -131,10 +131,6 @@ bool platform_supports_hevc(enum platform system) { } #ifdef __vita__ -int shutdown(int s, int how) { - return sceNetShutdown(s, how); -} - int chmod(const char *path, mode_t mode) { return 0; } @@ -154,4 +150,4 @@ uid_t getgid(void) { uid_t getegid(void) { return 1; } -#endif \ No newline at end of file +#endif diff --git a/third_party/enet b/third_party/enet index 6ccbde78..e33ca1dc 160000 --- a/third_party/enet +++ b/third_party/enet @@ -1 +1 @@ -Subproject commit 6ccbde781f7b5b10af4e095fef85e62bfa661471 +Subproject commit e33ca1dc47635882bfcadd192dbc54ea8584cbc5 diff --git a/third_party/moonlight-common-c b/third_party/moonlight-common-c index 7b2576bf..bd825776 160000 --- a/third_party/moonlight-common-c +++ b/third_party/moonlight-common-c @@ -1 +1 @@ -Subproject commit 7b2576bf27f910b693082ef5e00d659a9aa33cea +Subproject commit bd825776b3d40ea834bac2352e4359bb3145b367