mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 02:20:42 +00:00
Check for 4K support
This commit is contained in:
@@ -170,6 +170,8 @@ static int load_server_status(PSERVER_DATA server) {
|
||||
char *currentGameText = NULL;
|
||||
char *versionText = NULL;
|
||||
char *stateText = NULL;
|
||||
char *heightText = NULL;
|
||||
char *serverCodecModeSupportText = NULL;
|
||||
|
||||
uuid_t uuid;
|
||||
char uuid_str[37];
|
||||
@@ -203,8 +205,15 @@ static int load_server_status(PSERVER_DATA server) {
|
||||
if (xml_search(data->memory, data->size, "state", &stateText) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (xml_search(data->memory, data->size, "Height", &heightText) != GS_OK)
|
||||
goto cleanup;
|
||||
|
||||
if (xml_search(data->memory, data->size, "ServerCodecModeSupport", &serverCodecModeSupportText) != GS_OK)
|
||||
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;
|
||||
char *versionSep = strstr(versionText, ".");
|
||||
if (versionSep != NULL) {
|
||||
*versionSep = 0;
|
||||
@@ -231,6 +240,12 @@ static int load_server_status(PSERVER_DATA server) {
|
||||
if (versionText != NULL)
|
||||
free(versionText);
|
||||
|
||||
if (heightText != NULL)
|
||||
free(heightText);
|
||||
|
||||
if (serverCodecModeSupportText != NULL)
|
||||
free(serverCodecModeSupportText);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -445,6 +460,9 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
|
||||
uuid_t uuid;
|
||||
char uuid_str[37];
|
||||
|
||||
if (config->height >= 2160 && !server->supports4K)
|
||||
return GS_NOT_SUPPORTED_4K;
|
||||
|
||||
RAND_bytes(config->remoteInputAesKey, 16);
|
||||
memset(config->remoteInputAesIv, 0, 16);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
typedef struct _SERVER_DATA {
|
||||
const char* address;
|
||||
bool paired;
|
||||
bool supports4K;
|
||||
int currentGame;
|
||||
int serverMajorVersion;
|
||||
} SERVER_DATA, *PSERVER_DATA;
|
||||
|
||||
@@ -25,5 +25,6 @@
|
||||
#define GS_INVALID -3
|
||||
#define GS_WRONG_STATE -4
|
||||
#define GS_IO_ERROR -5
|
||||
#define GS_NOT_SUPPORTED_4K -6
|
||||
|
||||
const char* gs_error;
|
||||
|
||||
@@ -83,7 +83,14 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
gs_start_app(server, &config->stream, appId, config->sops, config->localaudio);
|
||||
int ret = gs_start_app(server, &config->stream, appId, config->sops, config->localaudio);
|
||||
if (ret < 0) {
|
||||
if (ret == GS_NOT_SUPPORTED_4K)
|
||||
fprintf(stderr, "Server doesn't support 4K\n");
|
||||
else
|
||||
fprintf(stderr, "Errorcode starting app: %d\n", ret);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int drFlags = 0;
|
||||
if (config->fullscreen)
|
||||
|
||||
Reference in New Issue
Block a user