BREAKING: SUNSHINE_CLIENT_FPS is now float (for better integration with Special-K)

This commit is contained in:
Yukino Song
2025-05-07 03:57:54 +08:00
parent 9c4e0a0f5e
commit 91467d50b6
19 changed files with 56 additions and 34 deletions

View File

@@ -325,7 +325,13 @@ namespace proc {
return 503;
}
std::string fps_str;
char fps_buf[8];
snprintf(fps_buf, sizeof(fps_buf), "%.3f", (float)launch_session->fps / 1000.0f);
fps_str = fps_buf;
// Add Stream-specific environment variables
// Sunshine Compatibility
_env["SUNSHINE_APP_ID"] = _app.id;
_env["SUNSHINE_APP_NAME"] = _app.name;
_env["SUNSHINE_CLIENT_UID"] = launch_session->unique_id;
@@ -335,11 +341,27 @@ namespace proc {
_env["SUNSHINE_CLIENT_RENDER_WIDTH"] = std::to_string(launch_session->width);
_env["SUNSHINE_CLIENT_RENDER_HEIGHT"] = std::to_string(launch_session->height);
_env["SUNSHINE_CLIENT_SCALE_FACTOR"] = std::to_string(scale_factor);
_env["SUNSHINE_CLIENT_FPS"] = std::to_string(launch_session->fps);
_env["SUNSHINE_CLIENT_FPS"] = fps_str;
_env["SUNSHINE_CLIENT_HDR"] = launch_session->enable_hdr ? "true" : "false";
_env["SUNSHINE_CLIENT_GCMAP"] = std::to_string(launch_session->gcmap);
_env["SUNSHINE_CLIENT_HOST_AUDIO"] = launch_session->host_audio ? "true" : "false";
_env["SUNSHINE_CLIENT_ENABLE_SOPS"] = launch_session->enable_sops ? "true" : "false";
_env["APOLLO_APP_ID"] = _app.id;
_env["APOLLO_APP_NAME"] = _app.name;
_env["APOLLO_CLIENT_UID"] = launch_session->unique_id;
_env["APOLLO_CLIENT_NAME"] = launch_session->device_name;
_env["APOLLO_CLIENT_WIDTH"] = std::to_string(render_width);
_env["APOLLO_CLIENT_HEIGHT"] = std::to_string(render_height);
_env["APOLLO_CLIENT_RENDER_WIDTH"] = std::to_string(launch_session->width);
_env["APOLLO_CLIENT_RENDER_HEIGHT"] = std::to_string(launch_session->height);
_env["APOLLO_CLIENT_SCALE_FACTOR"] = std::to_string(scale_factor);
_env["APOLLO_CLIENT_FPS"] = fps_str;
_env["APOLLO_CLIENT_HDR"] = launch_session->enable_hdr ? "true" : "false";
_env["APOLLO_CLIENT_GCMAP"] = std::to_string(launch_session->gcmap);
_env["APOLLO_CLIENT_HOST_AUDIO"] = launch_session->host_audio ? "true" : "false";
_env["APOLLO_CLIENT_ENABLE_SOPS"] = launch_session->enable_sops ? "true" : "false";
int channelCount = launch_session->surround_info & (65535);
switch (channelCount) {
case 2:

View File

@@ -333,62 +333,62 @@
<td><b></b></td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_APP_ID</td>
<td style="font-family: monospace">APOLLO_APP_ID</td>
<td>{{ $t('apps.env_app_id') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_APP_NAME</td>
<td style="font-family: monospace">APOLLO_APP_NAME</td>
<td>{{ $t('apps.env_app_name') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_UID</td>
<td style="font-family: monospace">APOLLO_CLIENT_UID</td>
<td>{{ $t('apps.env_client_uid') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_NAME</td>
<td style="font-family: monospace">APOLLO_CLIENT_NAME</td>
<td>{{ $t('apps.env_client_name') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_WIDTH</td>
<td style="font-family: monospace">APOLLO_CLIENT_WIDTH</td>
<td>{{ $t('apps.env_client_width') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_HEIGHT</td>
<td style="font-family: monospace">APOLLO_CLIENT_HEIGHT</td>
<td>{{ $t('apps.env_client_height') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_FPS</td>
<td style="font-family: monospace">APOLLO_CLIENT_FPS</td>
<td>{{ $t('apps.env_client_fps') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_HDR</td>
<td style="font-family: monospace">APOLLO_CLIENT_HDR</td>
<td>{{ $t('apps.env_client_hdr') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_GCMAP</td>
<td style="font-family: monospace">APOLLO_CLIENT_GCMAP</td>
<td>{{ $t('apps.env_client_gcmap') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_HOST_AUDIO</td>
<td style="font-family: monospace">APOLLO_CLIENT_HOST_AUDIO</td>
<td>{{ $t('apps.env_client_host_audio') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_ENABLE_SOPS</td>
<td style="font-family: monospace">APOLLO_CLIENT_ENABLE_SOPS</td>
<td>{{ $t('apps.env_client_enable_sops') }}</td>
</tr>
<tr>
<td style="font-family: monospace">SUNSHINE_CLIENT_AUDIO_CONFIGURATION</td>
<td style="font-family: monospace">APOLLO_CLIENT_AUDIO_CONFIGURATION</td>
<td>{{ $t('apps.env_client_audio_config') }}</td>
</tr>
</table>
<div class="form-text" v-if="platform === 'windows'"><b>{{ $t('apps.env_qres_example') }}</b>
<pre>cmd /C &lt;{{ $t('apps.env_qres_path') }}&gt;\QRes.exe /X:%SUNSHINE_CLIENT_WIDTH% /Y:%SUNSHINE_CLIENT_HEIGHT% /R:%SUNSHINE_CLIENT_FPS%</pre>
<pre>cmd /C &lt;{{ $t('apps.env_qres_path') }}&gt;\QRes.exe /X:%APOLLO_CLIENT_WIDTH% /Y:%APOLLO_CLIENT_HEIGHT% /R:%APOLLO_CLIENT_FPS%</pre>
</div>
<div class="form-text" v-else-if="platform === 'linux'"><b>{{ $t('apps.env_xrandr_example') }}</b>
<pre>sh -c "xrandr --output HDMI-1 --mode \"${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}\" --rate ${SUNSHINE_CLIENT_FPS}"</pre>
<pre>sh -c "xrandr --output HDMI-1 --mode \"${APOLLO_CLIENT_WIDTH}x${APOLLO_CLIENT_HEIGHT}\" --rate ${APOLLO_CLIENT_FPS}"</pre>
</div>
<div class="form-text" v-else-if="platform === 'macos'"><b>{{ $t('apps.env_displayplacer_example') }}</b>
<pre>sh -c "displayplacer "id:&lt;screenId&gt; res:${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT} hz:${SUNSHINE_CLIENT_FPS} scaling:on origin:(0,0) degree:0""</pre>
<pre>sh -c "displayplacer "id:&lt;screenId&gt; res:${APOLLO_CLIENT_WIDTH}x${APOLLO_CLIENT_HEIGHT} hz:${APOLLO_CLIENT_FPS} scaling:on origin:(0,0) degree:0""</pre>
</div>
<div class="form-text"><a
href="https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2app__examples.html"

View File

@@ -51,7 +51,7 @@
"env_app_name": "App-Name",
"env_client_audio_config": "Die vom Client angeforderte Audio-Konfiguration (2.0/5.1/7.1)",
"env_client_enable_sops": "Der Client hat die Option angefordert, das Spiel für ein optimales Streaming zu optimieren (true/false)",
"env_client_fps": "Das vom Client angeforderte FPS * 1000 (int)",
"env_client_fps": "Das vom Client angeforderte FPS (float)",
"env_client_gcmap": "Die angeforderte Gamepadmaske im Bitset/Bitfield Format (int)",
"env_client_hdr": "HDR ist vom Client aktiviert (true/false)",
"env_client_height": "Die vom Client angeforderte Höhe (int)",

View File

@@ -60,7 +60,7 @@
"env_app_name": "App Name",
"env_client_audio_config": "The Audio Configuration requested by the client (2.0/5.1/7.1)",
"env_client_enable_sops": "The client has requested the option to optimize the game for optimal streaming (true/false)",
"env_client_fps": "The FPS requested by the client * 1000 (int)",
"env_client_fps": "The FPS requested by the client (float)",
"env_client_gcmap": "The requested gamepad mask, in a bitset/bitfield format (int)",
"env_client_hdr": "HDR is enabled by the client (true/false)",
"env_client_height": "The Height requested by the client (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "App Name",
"env_client_audio_config": "The Audio Configuration requested by the client (2.0/5.1/7.1)",
"env_client_enable_sops": "The client has requested the option to optimize the game for optimal streaming (true/false)",
"env_client_fps": "The FPS requested by the client * 1000 (int)",
"env_client_fps": "The FPS requested by the client (float)",
"env_client_gcmap": "The requested gamepad mask, in a bitset/bitfield format (int)",
"env_client_hdr": "HDR is enabled by the client (true/false)",
"env_client_height": "The Height requested by the client (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "App Name",
"env_client_audio_config": "The Audio Configuration requested by the client (2.0/5.1/7.1)",
"env_client_enable_sops": "The client has requested the option to optimize the game for optimal streaming (true/false)",
"env_client_fps": "The FPS requested by the client * 1000 (int)",
"env_client_fps": "The FPS requested by the client (float)",
"env_client_gcmap": "The requested gamepad mask, in a bitset/bitfield format (int)",
"env_client_hdr": "HDR is enabled by the client (true/false)",
"env_client_height": "The Height requested by the client (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Nombre de la aplicación",
"env_client_audio_config": "La configuración de audio solicitada por el cliente (2.0/5.1/7.1)",
"env_client_enable_sops": "El cliente ha solicitado la opción de optimizar el juego para una transmisión óptima (verdadero/falso)",
"env_client_fps": "El FPS solicitado por el cliente * 1000 (int)",
"env_client_fps": "El FPS solicitado por el cliente (float)",
"env_client_gcmap": "La máscara de gamepad solicitada, en formato bitset/bitfield (int)",
"env_client_hdr": "HDR está activado por el cliente (verdadero/falso)",
"env_client_height": "La altura solicitada por el cliente (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Nom de l'application",
"env_client_audio_config": "La configuration audio demandée par le client (2.0/5.1/7.1)",
"env_client_enable_sops": "Le client a activé l'option pour optimiser le jeu pour une diffusion optimale (true/false)",
"env_client_fps": "FPS demandé par le client (entier)",
"env_client_fps": "FPS demandé par le client (float)",
"env_client_gcmap": "Le masque de manette demandé, au format bitset/bitfield (entier)",
"env_client_hdr": "Le HDR est activé par le client (true/false)",
"env_client_height": "La hauteur demandée par le client (entier)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Nome app",
"env_client_audio_config": "La configurazione audio richiesta dal client (2.0/5.1/7.1)",
"env_client_enable_sops": "Se il client ha richiesto l'opzione \"Ottimizza le impostazioni del gioco per lo streaming\" (TRUE o FALSE)",
"env_client_fps": "FPS richiesti dal client * 1000 (int)",
"env_client_fps": "FPS richiesti dal client (float)",
"env_client_gcmap": "La maschera del gamepad richiesta, in formato bitset/bitfield (int)",
"env_client_hdr": "Se L'HDR è abilitato dal client (TRUE o FALSE)",
"env_client_height": "L'altezza richiesta dal client (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "アプリ名",
"env_client_audio_config": "クライアントから要求されたオーディオ設定 (2.0/5.1/7.1)",
"env_client_enable_sops": "クライアントは最適なストリーミングのためにゲームを最適化するオプションを要求しています (true/false)",
"env_client_fps": "クライアントから要求された FPS (整数)",
"env_client_fps": "クライアントから要求された FPS (float)",
"env_client_gcmap": "要求されたゲームパッドマスク、ビットセット/ビットフィールド形式にて指定 (int)",
"env_client_hdr": "HDR はクライアントによって有効になっています (true/false)",
"env_client_height": "クライアントから要求された高さ (整数)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "앱 이름",
"env_client_audio_config": "클라이언트가 요청한 오디오 구성(2.0/5.1/7.1)",
"env_client_enable_sops": "클라이언트가 최적의 스트리밍을 위해 게임 최적화 옵션을 요청했습니다(참/거짓).",
"env_client_fps": "클라이언트가 요청한 FPS * 1000 (int)",
"env_client_fps": "클라이언트가 요청한 FPS (float)",
"env_client_gcmap": "요청된 게임패드 마스크, 비트셋/비트필드 형식(int)",
"env_client_hdr": "클라이언트가 HDR을 활성화합니다(참/거짓).",
"env_client_height": "클라이언트가 요청한 높이(int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Nazwa aplikacji",
"env_client_audio_config": "Konfiguracja audio wymagana przez klienta (2.0/5.1/7.1)",
"env_client_enable_sops": "Klient zażądał opcji optymalizacji gry pod kątem optymalnego strumienia (prawda/fałsz)",
"env_client_fps": "FPS żądane przez klienta (liczba całkowita)",
"env_client_fps": "FPS żądane przez klienta (float)",
"env_client_gcmap": "Żądana maska kontrolera w formacie zestawu bitów/pola bitów (liczba całkowita)",
"env_client_hdr": "HDR jest włączony przez klienta (prawda/fałsz)",
"env_client_height": "Wysokość żądana przez klienta (liczba całkowita)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Nome do aplicativo",
"env_client_audio_config": "A configuração de áudio solicitada pelo cliente (2.0/5.1/7.1)",
"env_client_enable_sops": "O cliente solicitou a opção de otimizar o jogo para uma transmissão ideal (verdadeiro/falso)",
"env_client_fps": "O FPS solicitado pelo cliente * 1000 (int)",
"env_client_fps": "O FPS solicitado pelo cliente (float)",
"env_client_gcmap": "A máscara de gamepad solicitada, em formato bitset/bitfield (int)",
"env_client_hdr": "O HDR está ativado pelo cliente (verdadeiro/falso)",
"env_client_height": "A altura solicitada pelo cliente (int)",

View File

@@ -60,7 +60,7 @@
"env_app_name": "Nome do Aplicativo",
"env_client_audio_config": "A Configuração de Áudio solicitada pelo cliente (2.0/5.1/7.1)",
"env_client_enable_sops": "O cliente solicitou a opção de otimizar o jogo para otimizar a transmissão (verdadeiro/falso)",
"env_client_fps": "O FPS solicitado pelo cliente * 1000 (inteiro)",
"env_client_fps": "O FPS solicitado pelo cliente (float)",
"env_client_gcmap": "A máscara de gamepad solicitada, em um formato de campo de bits (inteiro)",
"env_client_hdr": "O cliente solicita a ativação do HDR (verdadeiro/falso)",
"env_client_height": "A Altura da tela solicitada pelo cliente (inteiro)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Название приложения",
"env_client_audio_config": "Запрошенная клиентом конфигурация аудио (2.0/5.1/7.1)",
"env_client_enable_sops": "Клиент запросил оптимизацию настроек игры для потокового вещания (истина/ложь)",
"env_client_fps": "Частота кадров, запрошенная клиентом (целое)",
"env_client_fps": "Частота кадров, запрошенная клиентом (float)",
"env_client_gcmap": "Запрашиваемая маска геймпада, в формате bitset/bitfield (целое)",
"env_client_hdr": "HDR включен клиентом (истина/ложь)",
"env_client_height": "Высота, запрошенная клиентом (целое)",

View File

@@ -60,7 +60,7 @@
"env_app_name": "Appens namn",
"env_client_audio_config": "Ljudkonfigurationen begärd av klienten (2.0/5.1/7.1)",
"env_client_enable_sops": "Klienten har begärt möjligheten att optimera spelet för optimal steaming\n(sant/falskt)",
"env_client_fps": "FPS begärd av klienten * 1000 (int)",
"env_client_fps": "FPS begärd av klienten (float)",
"env_client_gcmap": "Den begärda gamepad masken, i bitset/bitfield format (int)",
"env_client_hdr": "HDR är aktiverat av klienten (true/false)",
"env_client_height": "Höjd som begärts av klienten (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Uygulama Adı",
"env_client_audio_config": "İstemci tarafından talep edilen Ses Yapılandırması (2.0/5.1/7.1)",
"env_client_enable_sops": "İstemci, oyunu optimum akış için optimize etme seçeneğini talep etti (doğru/yanlış)",
"env_client_fps": "İstemci tarafından talep edilen FPS * 1000 (int)",
"env_client_fps": "İstemci tarafından talep edilen FPS (float)",
"env_client_gcmap": "İstenen kontrolcü maskesi, bit kümesi/bit alanı biçiminde (int)",
"env_client_hdr": "HDR istemci tarafından etkinleştirildi (true/false)",
"env_client_height": "İstemci tarafından talep edilen Yükseklik (int)",

View File

@@ -51,7 +51,7 @@
"env_app_name": "Назва програми",
"env_client_audio_config": "Конфігурація аудіо, яку запитує клієнт (2.0/5.1/7.1)",
"env_client_enable_sops": "Клієнт запросив опцію для оптимізації гри та оптимальної якості стримінгу (так/ні)",
"env_client_fps": "FPS, який запитує клієнт (ціле число)",
"env_client_fps": "FPS, який запитує клієнт (float)",
"env_client_gcmap": "Запитувана маска геймпада у форматі бітового набору/бітового поля (ціле число)",
"env_client_hdr": "HDR увімкнено клієнтом (так/ні)",
"env_client_height": "Висота, яку запитує клієнт (ціле число)",

View File

@@ -60,9 +60,9 @@
"env_app_name": "应用名称",
"env_client_audio_config": "客户端请求的音频配置 (2.0/5.1/7.1)",
"env_client_enable_sops": "客户端请求自动更改游戏设置以实现最佳串流效果 (true/false)",
"env_client_fps": "客户端请求的帧率 * 1000 (int)",
"env_client_fps": "客户端请求的帧率 (float)",
"env_client_gcmap": "客户端请求的游戏手柄掩码,采用 bitset/bitfield 格式 (int)",
"env_client_hdr": "HDR 已被客户端启用 (true/false)",
"env_client_hdr": "客户端请求的 HDR 状态 (true/false)",
"env_client_height": "客户端请求的分辨率的高度 (int)",
"env_client_host_audio": "客户端请求在主机播放声音 (true/false)",
"env_client_width": "客户端请求的分辨率的宽度 (int)",