* Fix games with custom touch control sometimes not showing touch icon

* Create game-bar with screenshot button

* Disable Game bar when opening the Guide

* Remove SCREENSHOT_BUTTON_POSITION pref

* Make the touch control action functional

* Show game bar when the game starts

* Fix 720p/High not working (#387)

* Update icons

* Update game bar's animations

* Reset states of Game bar actions before playing

* Don't show Touch control action on non-touch-supported devices

* Clean up

* Update translations

* Update actions' texts

* Clean up
This commit is contained in:
redphx
2024-05-10 18:35:40 +07:00
committed by GitHub
parent b66ca192b2
commit b2e932cc4c
23 changed files with 533 additions and 315 deletions

View File

@@ -27,6 +27,8 @@ export enum BxEvent {
XCLOUD_SERVERS_READY = 'bx-servers-ready',
DATA_CHANNEL_CREATED = 'bx-data-channel-created',
GAME_BAR_ACTION_ACTIVATED = 'bx-game-bar-action-activated',
}
export namespace BxEvent {

View File

@@ -1,3 +1,4 @@
import { GameBar } from "@modules/game-bar/game-bar";
import { BxEvent } from "@utils/bx-event";
import { STATES } from "@utils/global";
import { getPref, PrefKey } from "@utils/preferences";
@@ -15,25 +16,12 @@ enum InputType {
export const BxExposed = {
onPollingModeChanged: (mode: 'All' | 'None') => {
if (!STATES.isPlaying) {
return false;
GameBar.disable();
return;
}
const $screenshotBtn = document.querySelector('.bx-screenshot-button');
const $touchControllerBar = document.getElementById('bx-touch-controller-bar');
if (mode !== 'None') {
// Hide screenshot button
$screenshotBtn && $screenshotBtn.classList.add('bx-gone');
// Hide touch controller bar
$touchControllerBar && $touchControllerBar.classList.add('bx-gone');
} else {
// Show screenshot button
$screenshotBtn && $screenshotBtn.classList.remove('bx-gone');
// Show touch controller bar
$touchControllerBar && $touchControllerBar.classList.remove('bx-gone');
}
// Toggle Game bar
mode !== 'None' ? GameBar.disable() : GameBar.enable();
},
getTitleInfo: () => STATES.currentStream.titleInfo,

View File

@@ -1,3 +1,5 @@
import iconCadetRight from "@assets/svg/caret-right.svg" with { type: "text" };
import iconCamera from "@assets/svg/camera.svg" with { type: "text" };
import iconController from "@assets/svg/controller.svg" with { type: "text" };
import iconCopy from "@assets/svg/copy.svg" with { type: "text" };
import iconCursorText from "@assets/svg/cursor-text.svg" with { type: "text" };
@@ -11,6 +13,8 @@ import iconRemotePlay from "@assets/svg/remote-play.svg" with { type: "text" };
import iconStreamSettings from "@assets/svg/stream-settings.svg" with { type: "text" };
import iconStreamStats from "@assets/svg/stream-stats.svg" with { type: "text" };
import iconTrash from "@assets/svg/trash.svg" with { type: "text" };
import iconTouchControlEnable from "@assets/svg/touch-control-enable.svg" with { type: "text" };
import iconTouchControlDisable from "@assets/svg/touch-control-disable.svg" with { type: "text" };
export const BxIcon = {
STREAM_SETTINGS: iconStreamSettings,
@@ -28,5 +32,10 @@ export const BxIcon = {
REMOTE_PLAY: iconRemotePlay,
CARET_RIGHT: iconCadetRight,
SCREENSHOT: iconCamera,
TOUCH_CONTROL_ENABLE: iconTouchControlEnable,
TOUCH_CONTROL_DISABLE: iconTouchControlDisable,
// HAND_TAP = '<path d="M6.537 8.906c0-4.216 3.469-7.685 7.685-7.685s7.685 3.469 7.685 7.685M7.719 30.778l-4.333-7.389C3.133 22.944 3 22.44 3 21.928a2.97 2.97 0 0 1 2.956-2.956 2.96 2.96 0 0 1 2.55 1.461l2.761 4.433V8.906a2.97 2.97 0 0 1 2.956-2.956 2.97 2.97 0 0 1 2.956 2.956v8.276a2.97 2.97 0 0 1 2.956-2.956 2.97 2.97 0 0 1 2.956 2.956v2.365a2.97 2.97 0 0 1 2.956-2.956A2.97 2.97 0 0 1 29 19.547v5.32c0 3.547-1.182 5.911-1.182 5.911"/>',
} as const;

View File

@@ -438,6 +438,9 @@ class XcloudInterceptor {
overrides.inputConfiguration = overrides.inputConfiguration || {};
overrides.inputConfiguration.enableVibration = true;
overrides.videoConfiguration = overrides.videoConfiguration || {};
overrides.videoConfiguration.setCodecPreferences = true;
// Enable touch controller
if (TouchController.isEnabled()) {
overrides.inputConfiguration.enableTouchInput = true;
@@ -570,7 +573,9 @@ export function interceptHttpRequests() {
const newCustomList = customList.map(item => ({ id: item }));
obj.push(...newCustomList);
} catch (e) {}
} catch (e) {
console.log(e);
}
}
response.json = () => Promise.resolve(obj);

View File

@@ -46,7 +46,6 @@ export enum PrefKey {
MKB_ABSOLUTE_MOUSE = 'mkb_absolute_mouse',
MKB_DEFAULT_PRESET_ID = 'mkb_default_preset_id',
SCREENSHOT_BUTTON_POSITION = 'screenshot_button_position',
SCREENSHOT_APPLY_FILTERS = 'screenshot_apply_filters',
BLOCK_TRACKING = 'block_tracking',
@@ -227,15 +226,6 @@ export class Preferences {
default: false,
},
[PrefKey.SCREENSHOT_BUTTON_POSITION]: {
label: t('screenshot-button-position'),
default: 'bottom-left',
options: {
'bottom-left': t('bottom-left'),
'bottom-right': t('bottom-right'),
'none': t('disable'),
},
},
[PrefKey.SCREENSHOT_APPLY_FILTERS]: {
label: t('screenshot-apply-filters'),
default: false,

View File

@@ -23,7 +23,7 @@ const Texts = {
"Activate",
"Activo",
,
,
"Abilita",
"設定する",
"활성화",
"Aktywuj",
@@ -40,7 +40,7 @@ const Texts = {
"Activated",
"Activado",
,
,
"In uso",
"設定中",
"활성화 됨",
"Aktywowane",
@@ -57,7 +57,7 @@ const Texts = {
"Active",
"Activo",
,
,
"Attivo",
"有効",
"활성화",
"Aktywny",
@@ -91,7 +91,7 @@ const Texts = {
"Apply",
"Aplicar",
,
,
"Applica",
"適用",
,
"Zastosuj",
@@ -303,7 +303,7 @@ const Texts = {
"Яркость",
"Aydınlık",
"Яскравість",
ộ sáng",
ộ sáng",
"亮度",
],
"browser-unsupported-feature": [
@@ -414,7 +414,7 @@ const Texts = {
"Clear",
"Borrar",
,
,
"Pulisci",
"消去",
"비우기",
"Wyczyść",
@@ -448,7 +448,7 @@ const Texts = {
"Combine audio & video streams",
"Combinar flujos de audio y vídeo",
,
,
"Combinare i flussi audio e video",
"音声を映像ストリーミングと統合",
,
"Połącz strumienie audio i wideo",
@@ -465,7 +465,7 @@ const Texts = {
"May fix the laggy audio problem",
"Puede arreglar el problema de audio con retraso",
,
,
"Potrebbe risolvere il problema dell'audio irregolare",
"音声の遅延を改善できる可能性があります",
,
"Może rozwiązać problem z zacinającym dźwiękiem",
@@ -499,7 +499,7 @@ const Texts = {
"Do you want to delete this preset?",
"¿Desea eliminar este preajuste?",
"Voulez-vous supprimer ce préréglage?",
,
"Vuoi eliminare questo profilo?",
"このプリセットを削除しますか?",
"이 프리셋을 삭제하시겠습니까?",
"Czy na pewno chcesz usunąć ten szablon?",
@@ -533,7 +533,7 @@ const Texts = {
"Connected",
"Conectado",
,
,
"Connesso",
"接続済み",
,
"Połączony",
@@ -618,7 +618,7 @@ const Texts = {
"Controller vibration",
"Vibración del mando",
,
,
"Vibrazione del controller",
"コントローラーの振動",
"컨트롤러 진동",
"Wibracje kontrolera",
@@ -635,7 +635,7 @@ const Texts = {
"Copy",
"Copiar",
,
,
"Duplica",
"コピー",
"복사",
"Kopiuj",
@@ -669,7 +669,7 @@ const Texts = {
"Deadzone counterweight",
"Contrapeso de la zona muerta",
,
,
"Compensazione della zona morta",
"デッドゾーンのカウンターウエイト",
,
"Przeciwwaga martwej strefy",
@@ -737,7 +737,7 @@ const Texts = {
"Device vibration",
"Vibración del dispositivo",
,
,
"Vibrazione del dispositivo",
"デバイスの振動",
"기기 진동",
"Wibracje urządzenia",
@@ -754,7 +754,7 @@ const Texts = {
"On when not using gamepad",
"Activado cuando no se utiliza el mando",
,
,
"Abilita quando non si usa un gamepad",
"ゲームパッド未使用時にオン",
"게임패드를 사용하지 않을 때",
"Włączone, gdy nie używasz kontrolera",
@@ -839,7 +839,7 @@ const Texts = {
"Disabled",
"Desactivado",
,
,
"Disattivato",
"無効",
"비활성화됨",
"Wyłączony",
@@ -856,7 +856,7 @@ const Texts = {
"Disconnected",
"Desconectado",
,
,
"Disconnesso",
"切断",
,
"Rozłączony",
@@ -907,7 +907,7 @@ const Texts = {
"Enable local co-op support",
"Habilitar soporte co-op local",
,
,
"Abilita supporto cooperativo locale",
"ローカルマルチプレイのサポートを有効化",
,
"Włącz lokalny co-op",
@@ -924,7 +924,7 @@ const Texts = {
"Only works if the game doesn't require a different profile",
"Solo funciona si el juego no requiere un perfil diferente",
,
,
"Funziona quando il gioco non richiede un profilo differente",
"別アカウントでのサインインを必要としないゲームのみ動作します",
,
"Działa tylko wtedy, gdy gra nie wymaga innego profilu",
@@ -1026,7 +1026,7 @@ const Texts = {
"Enabled",
"Activado",
,
,
"Attivato",
"有効",
"활성화됨",
"Włączony",
@@ -1043,7 +1043,7 @@ const Texts = {
"Experimental",
"Experimental",
,
,
"Sperimentale",
"実験的機能",
,
"Eksperymentalne",
@@ -1060,7 +1060,7 @@ const Texts = {
"Export",
"Exportar",
,
,
"Esporta",
"エクスポート(書出し)",
"내보내기",
"Eksportuj",
@@ -1094,7 +1094,7 @@ const Texts = {
"Allows playing STW mode on mobile",
"Permitir jugar al modo STW en el móvil",
,
,
"Consente di riprodurre la modalità Salva il Mondo sul cellulare",
"モバイル版で「世界を救え」をプレイできるようになります",
,
"Zezwól na granie w tryb STW na urządzeniu mobilnym",
@@ -1111,7 +1111,7 @@ const Texts = {
"Fortnite: force console version",
"Fortnite: forzar versión de consola",
,
"Fortnite: Foza la versione console",
"Fortnite: forza la versione console",
"Fortnite: 強制的にコンソール版を起動する",
,
"Fortnite: wymuś wersję konsolową",
@@ -1145,7 +1145,7 @@ const Texts = {
"Help",
"Ayuda",
,
,
"Guida",
"ヘルプ",
,
"Pomoc",
@@ -1179,7 +1179,7 @@ const Texts = {
"Hide web page's scrollbar",
"Oculta la barra de desplazamiento de la página",
,
,
"Nascondi la barra di scorrimento della pagina web",
"Webページのスクロールバーを隠す",
,
"Ukryj pasek przewijania strony",
@@ -1207,13 +1207,30 @@ const Texts = {
"Ẩn biểu tượng của menu Hệ thống",
"隐藏系统菜单图标",
],
"hide-touch-controller": [
"Touch-Controller ausblenden",
,
"Hide touch controller",
"Ocultar controles táctiles",
,
,
"タッチコントローラーを隠す",
,
,
,
"Скрыть сенсорный контроллер",
,
"Приховати сенсорний контролер",
"Ẩn bộ điều khiển cảm ứng",
,
],
"horizontal-sensitivity": [
"Horizontale Empfindlichkeit",
"Sensitifitas horizontal",
"Horizontal sensitivity",
"Sensibilidad horizontal",
,
,
"Sensibilità orizzontale",
"左右方向の感度",
,
"Czułość pozioma",
@@ -1230,7 +1247,7 @@ const Texts = {
"Import",
"Importar",
,
,
"Importa",
"インポート(読込み)",
"가져오기",
"Importuj",
@@ -1247,7 +1264,7 @@ const Texts = {
"Install Better xCloud app for Android",
"Instale la aplicación Better xCloud para Android",
,
,
"Installa l'applicazione Better xCloud per Android",
"Android用のBetter xCloudをインストール",
,
"Zainstaluj aplikację Better xCloud na Androida",
@@ -1264,7 +1281,7 @@ const Texts = {
"Keyboard shortcuts",
"Atajos del teclado",
,
,
"Scorciatoie da tastiera",
"キーボードショートカット",
,
"Skróty klawiszowe",
@@ -1332,7 +1349,7 @@ const Texts = {
"Left stick",
"Joystick izquierdo",
,
,
"Levetta sinistra",
"左スティック",
"왼쪽 스틱",
"Lewy drążek analogowy",
@@ -1366,7 +1383,7 @@ const Texts = {
"Local co-op",
"Co-op local",
,
,
"Cooperativa locale",
"ローカルマルチプレイ",
,
"Lokalna kooperacja",
@@ -1383,7 +1400,7 @@ const Texts = {
"Map mouse to",
"Mapear ratón a",
,
,
"Usa il mouse come",
"マウスの割り当て",
,
"Przypisz myszkę do",
@@ -1553,7 +1570,7 @@ const Texts = {
"Name",
"Nombre",
,
,
"Nome",
"名前",
"이름",
"Nazwa",
@@ -1570,7 +1587,7 @@ const Texts = {
"New",
"Nuevo",
,
,
"Nuovo",
"新しい",
"새로 만들기",
"Nowy",
@@ -1808,7 +1825,7 @@ const Texts = {
"Preset",
"Preajuste",
,
,
"Profilo",
"プリセット",
"프리셋",
"Szablon",
@@ -1825,7 +1842,7 @@ const Texts = {
"Press Esc to cancel",
"Presione Esc para cancelar",
,
,
"Premi Esc per annullare",
"Escを押してキャンセル",
"ESC를 눌러 취소",
"Naciśnij Esc, aby anulować",
@@ -1842,7 +1859,7 @@ const Texts = {
(e: any) => `Press ${e.key} to toggle the Mouse and Keyboard feature`,
(e: any) => `Pulsa ${e.key} para activar la función de ratón y teclado`,
,
,
(e: any) => `Premi ${e.key} per attivare o disattivare la funzione Mouse e Tastiera`,
(e: any) => `${e.key} キーでマウスとキーボードの機能を切り替える`,
(e: any) => `${e.key} 키를 눌러 마우스와 키보드 기능을 활성화 하십시오`,
(e: any) => `Naciśnij ${e.key}, aby przełączyć funkcję myszy i klawiatury`,
@@ -1859,7 +1876,7 @@ const Texts = {
"Press a key or do a mouse click to bind...",
"Presione una tecla o haga un clic del ratón para enlazar...",
,
,
"Premi un tasto o fai un clic del mouse per associare...",
"キーを押すかマウスをクリックして割り当て...",
"정지하려면 아무키나 마우스를 클릭해주세요...",
"Naciśnij klawisz lub kliknij myszą, aby przypisać...",
@@ -1876,7 +1893,7 @@ const Texts = {
"Preset's name:",
"Nombre del preajuste:",
,
,
"Nome del profilo:",
"プリセット名:",
"프리셋 이름:",
"Nazwa szablonu:",
@@ -1961,7 +1978,7 @@ const Texts = {
"Rename",
"Renombrar",
,
,
"Rinomina",
"名前変更",
"이름 바꾸기",
"Zmień nazwę",
@@ -1978,7 +1995,7 @@ const Texts = {
"Right-click on a key to unbind it",
"Clic derecho en una tecla para desvincularla",
,
,
"Clic col tasto destro su una assegnazione per dissociarla",
"右クリックで割り当て解除",
"할당 해제하려면 키를 오른쪽 클릭하세요",
"Kliknij prawym przyciskiem myszy na klawisz, aby anulować przypisanie",
@@ -1995,7 +2012,7 @@ const Texts = {
"Right stick",
"Joystick derecho",
,
,
"Levetta destra",
"右スティック",
"오른쪽 스틱",
"Prawy drążek analogowy",
@@ -2114,7 +2131,7 @@ const Texts = {
"Save",
"Guardar",
,
,
"Conferma",
"保存",
"저장",
"Zapisz",
@@ -2131,7 +2148,7 @@ const Texts = {
"Applies video filters to screenshots",
"Aplica filtros de vídeo a las capturas de pantalla",
,
,
"Applica filtri video agli screenshot",
"スクリーンショットにビデオフィルターを適用",
,
"Stosuje filtry wideo do zrzutów ekranu",
@@ -2165,7 +2182,7 @@ const Texts = {
"Separate Touch controller & Controller #1",
"Separar controlador táctil y controlador #1",
,
,
"Controller su schermo e Controller #1 separati",
"タッチコントローラーとコントローラー#1を分ける",
,
"Oddziel Kontroler dotykowy i Kontroler #1",
@@ -2182,7 +2199,7 @@ const Texts = {
"Touch controller is Player 1, Controller #1 is Player 2",
"El controlador táctil es Jugador 1, Controlador #1 es Jugador 2",
,
,
"Il Giocatore 1 userà il Controller su schermo, il Giocatore 2 userà il Controller #1",
"タッチコントローラーがプレイヤー1、コントローラー#1がプレイヤー2に割り当てられます",
,
"Kontroler dotykowy to Gracz 1, Kontroler #1 to Gracz 2",
@@ -2250,7 +2267,7 @@ const Texts = {
"Shortcut keys",
"Teclas de atajo",
,
,
"Tasti di scelta rapida",
"ショートカットキー",
,
"Skróty klawiszowe",
@@ -2295,6 +2312,23 @@ const Texts = {
"Hiển thị thông số khi vào game",
"开始游戏时显示统计信息",
],
"show-touch-controller": [
"Touch-Controller anzeigen",
,
"Show touch controller",
"Mostrar controles táctiles",
,
,
"タッチコントローラーを表示",
,
,
,
"Показать сенсорный контроллер",
,
"Показати сенсорний контролер",
"Hiện bộ điều khiển cảm ứng",
,
],
"show-wait-time": [
"Geschätzte Wartezeit anzeigen",
"Tampilkan waktu antrian",
@@ -2556,7 +2590,7 @@ const Texts = {
"Stick decay minimum",
"Disminuir mínimamente el analógico",
,
,
"Tempo minimo di rilascio dello stick",
"スティックの減衰の最小値",
,
"Minimalne opóźnienie drążka",
@@ -2573,7 +2607,7 @@ const Texts = {
"Stick decay strength",
"Intensidad de decaimiento del analógico",
,
,
"Velocità di rilascio dello stick",
"スティックの減衰の強さ",
,
"Siła opóźnienia drążka",
@@ -2624,7 +2658,7 @@ const Texts = {
"Support Better xCloud",
"Apoyar a Better xCloud",
,
,
"Sostieni Better xCloud",
"Better xCloudをサポート",
,
"Wesprzyj Better xCloud",
@@ -2652,6 +2686,23 @@ const Texts = {
"Hoán đổi nút",
"交换按钮",
],
"take-screenshot": [
"Screenshot aufnehmen",
,
"Take screenshot",
"Capturar pantalla",
,
,
"スクリーンショットを撮影",
,
,
,
"Сделать снимок экрана",
,
"Зробити знімок екрану",
"Lưu ảnh màn hình",
,
],
"target-resolution": [
"Festgelegte Auflösung",
"Resolusi",
@@ -2709,7 +2760,7 @@ const Texts = {
"Off when controller found",
"Desactivar cuando se encuentra el controlador",
,
,
"Disabilitata quando un controllor viene rilevato",
"コントローラー接続時に無効化",
,
"Wyłącz, gdy kontroler zostanie znaleziony",
@@ -2756,11 +2807,11 @@ const Texts = {
],
"tc-default-opacity": [
"Standard Deckkraft",
,
"Opasitas bawaan",
"Default opacity",
"Opacidad por defecto",
,
,
"Opacità predefinita",
"既定の透過度",
,
"Domyślna przezroczystość",
@@ -2894,14 +2945,14 @@ const Texts = {
(e: any) => `Touch-Steuerungslayout von ${e.name}`,
,
(e: any) => `Touch control layout by ${e.name}`,
(e: any) => `Disposición del control táctil por ${e.nombre}`,
,
,
,
(e: any) => `Configurazione dei comandi su schermo creata da ${e.name}`,
(e: any) => `タッチ操作レイアウト作成者: ${e.name}`,
,
(e: any) => `Układ sterowania dotykowego stworzony przez ${e.name}`,
,
,
(e: any) => `Сенсорная раскладка по ${e.name}`,
(e: any) => `${e.name} kişisinin dokunmatik kontrolcü tuş şeması`,
(e: any) => `Розташування сенсорного керування від ${e.name}`,
(e: any) => `Bố cục điều khiển cảm ứng tạo bởi ${e.name}`,
@@ -3015,7 +3066,7 @@ const Texts = {
"Use mouse's absolute position",
"Usar la posición absoluta del ratón",
,
,
"Usa la posizione assoluta del mouse",
"マウスの絶対座標を使用",
"마우스 절대위치 사용",
"Użyj pozycji bezwzględnej myszy",
@@ -3066,7 +3117,7 @@ const Texts = {
"Vibration intensity",
"Intensidad de la vibración",
,
,
"Intensità della vibrazione",
"振動の強さ",
"진동 세기",
"Siła wibracji",
@@ -3083,7 +3134,7 @@ const Texts = {
"Vibration",
"Vibración",
,
,
"Vibrazione",
"振動",
,
"Wibracje",