mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-01 10:56:42 +02:00
Squashed commit of the following:
commit 2faed50e5c2165647e389d794de673038d56241e Author: redphx <96280+redphx@users.noreply.github.com> Date: Fri May 24 18:09:25 2024 +0700 Make shortcuts work with controller commit b8f6c503ba7969de3a232644d3f6b53532a4b7bb Author: redphx <96280+redphx@users.noreply.github.com> Date: Fri May 24 17:01:15 2024 +0700 Update translations commit 6f6c0899e5a09cd5534e06a9e272bf78c74536dc Author: redphx <96280+redphx@users.noreply.github.com> Date: Fri May 24 17:00:50 2024 +0700 Preload PrompFont commit 1bf0f2b9dae77890d35091bed970b942c4d61fbc Author: redphx <96280+redphx@users.noreply.github.com> Date: Fri May 24 07:08:05 2024 +0700 Render Controller shortcuts settings commit 2f24965c73a941be2ebc8a3509dc540a47b4e38d Author: redphx <96280+redphx@users.noreply.github.com> Date: Thu May 23 17:21:55 2024 +0700 Fix not able to capture screenshot after switching games commit 6ac791e2dfb17215ee82d449047d0cd11d185c42 Author: redphx <96280+redphx@users.noreply.github.com> Date: Thu May 23 17:11:19 2024 +0700 Hijack the Home button
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ControllerShortcut } from "@/modules/controller-shortcut";
|
||||
import { GameBar } from "@modules/game-bar/game-bar";
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
import { STATES } from "@utils/global";
|
||||
@@ -111,5 +112,8 @@ export const BxExposed = {
|
||||
|
||||
const gainNode = audioCtx.createGain(); // call monkey-patched createGain() in BxAudioContext
|
||||
source.connect(gainNode).connect(audioCtx.destination);
|
||||
}
|
||||
},
|
||||
|
||||
handleControllerShortcut: ControllerShortcut.handle,
|
||||
resetControllerShortcut: ControllerShortcut.reset,
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import iconCommand from "@assets/svg/command.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" };
|
||||
@@ -24,6 +25,7 @@ import iconMicrophoneMuted from "@assets/svg/microphone-slash.svg" with { type:
|
||||
export const BxIcon = {
|
||||
STREAM_SETTINGS: iconStreamSettings,
|
||||
STREAM_STATS: iconStreamStats,
|
||||
COMMAND: iconCommand,
|
||||
CONTROLLER: iconController,
|
||||
DISPLAY: iconDisplay,
|
||||
MOUSE: iconMouse,
|
||||
|
32
src/utils/prompt-font.ts
Normal file
32
src/utils/prompt-font.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export enum PrompFont {
|
||||
A = '⇓',
|
||||
B = '⇒',
|
||||
X = '⇐',
|
||||
Y = '⇑',
|
||||
|
||||
LB = '↘',
|
||||
RB = '↙',
|
||||
LT = '↖',
|
||||
RT = '↗',
|
||||
|
||||
SELECT = '⇺',
|
||||
START = '⇻',
|
||||
HOME = '',
|
||||
|
||||
UP = '≻',
|
||||
DOWN = '≽',
|
||||
LEFT = '≺',
|
||||
RIGHT = '≼',
|
||||
|
||||
L3 = '↺',
|
||||
LS_UP = '↾',
|
||||
LS_DOWN = '⇂',
|
||||
LS_LEFT = '↼',
|
||||
LS_RIGHT = '⇀',
|
||||
|
||||
R3 = '↻',
|
||||
RS_UP = '↿',
|
||||
RS_DOWN = '⇃',
|
||||
RS_LEFT = '↽',
|
||||
RS_RIGHT = '⇁',
|
||||
}
|
@@ -3,21 +3,24 @@ import { CE } from "./html";
|
||||
|
||||
|
||||
export class Screenshot {
|
||||
static setup() {
|
||||
const currentStream = STATES.currentStream;
|
||||
if (!currentStream.$screenshotCanvas) {
|
||||
currentStream.$screenshotCanvas = CE<HTMLCanvasElement>('canvas', {'class': 'bx-gone'});
|
||||
static #$canvas: HTMLCanvasElement;
|
||||
static #canvasContext: CanvasRenderingContext2D;
|
||||
|
||||
currentStream.screenshotCanvasContext = currentStream.$screenshotCanvas.getContext('2d', {
|
||||
alpha: false,
|
||||
willReadFrequently: false,
|
||||
});
|
||||
static setup() {
|
||||
if (Screenshot.#$canvas) {
|
||||
return;
|
||||
}
|
||||
// document.documentElement.appendChild(currentStream.$screenshotCanvas!);
|
||||
|
||||
Screenshot.#$canvas = CE<HTMLCanvasElement>('canvas', {'class': 'bx-gone'});
|
||||
|
||||
Screenshot.#canvasContext = Screenshot.#$canvas.getContext('2d', {
|
||||
alpha: false,
|
||||
willReadFrequently: false,
|
||||
})!;
|
||||
}
|
||||
|
||||
static updateCanvasSize(width: number, height: number) {
|
||||
const $canvas = STATES.currentStream.$screenshotCanvas;
|
||||
const $canvas = Screenshot.#$canvas;
|
||||
if ($canvas) {
|
||||
$canvas.width = width;
|
||||
$canvas.height = height;
|
||||
@@ -25,7 +28,7 @@ export class Screenshot {
|
||||
}
|
||||
|
||||
static updateCanvasFilters(filters: string) {
|
||||
STATES.currentStream.screenshotCanvasContext && (STATES.currentStream.screenshotCanvasContext.filter = filters);
|
||||
Screenshot.#canvasContext.filter = filters;
|
||||
}
|
||||
|
||||
private static onAnimationEnd(e: Event) {
|
||||
@@ -35,7 +38,7 @@ export class Screenshot {
|
||||
static takeScreenshot(callback?: any) {
|
||||
const currentStream = STATES.currentStream;
|
||||
const $video = currentStream.$video;
|
||||
const $canvas = currentStream.$screenshotCanvas;
|
||||
const $canvas = Screenshot.#$canvas;
|
||||
if (!$video || !$canvas) {
|
||||
return;
|
||||
}
|
||||
@@ -43,7 +46,7 @@ export class Screenshot {
|
||||
$video.parentElement?.addEventListener('animationend', this.onAnimationEnd);
|
||||
$video.parentElement?.classList.add('bx-taking-screenshot');
|
||||
|
||||
const canvasContext = currentStream.screenshotCanvasContext!;
|
||||
const canvasContext = Screenshot.#canvasContext;
|
||||
canvasContext.drawImage($video, 0, 0, $canvas.width, $canvas.height);
|
||||
|
||||
// Get data URL and pass to parent app
|
||||
|
@@ -13,6 +13,7 @@ export const SUPPORTED_LANGUAGES = {
|
||||
'pl-PL': 'polski',
|
||||
'pt-BR': 'português (Brasil)',
|
||||
'ru-RU': 'русский',
|
||||
'th-TH': 'ภาษาไทย',
|
||||
'tr-TR': 'Türkçe',
|
||||
'uk-UA': 'українська',
|
||||
'vi-VN': 'Tiếng Việt',
|
||||
@@ -62,8 +63,10 @@ const Texts = {
|
||||
"copy": "Copy",
|
||||
"custom": "Custom",
|
||||
"deadzone-counterweight": "Deadzone counterweight",
|
||||
"decrease": "Decrease",
|
||||
"default": "Default",
|
||||
"delete": "Delete",
|
||||
"device": "Device",
|
||||
"device-unsupported-touch": "Your device doesn't have touch support",
|
||||
"device-vibration": "Device vibration",
|
||||
"device-vibration-not-using-gamepad": "On when not using gamepad",
|
||||
@@ -93,12 +96,14 @@ const Texts = {
|
||||
"game-bar": "Game Bar",
|
||||
"getting-consoles-list": "Getting the list of consoles...",
|
||||
"help": "Help",
|
||||
"hide": "Hide",
|
||||
"hide-idle-cursor": "Hide mouse cursor on idle",
|
||||
"hide-scrollbar": "Hide web page's scrollbar",
|
||||
"hide-system-menu-icon": "Hide System menu's icon",
|
||||
"hide-touch-controller": "Hide touch controller",
|
||||
"horizontal-sensitivity": "Horizontal sensitivity",
|
||||
"import": "Import",
|
||||
"increase": "Increase",
|
||||
"install-android": "Install Better xCloud app for Android",
|
||||
"keyboard-shortcuts": "Keyboard shortcuts",
|
||||
"language": "Language",
|
||||
@@ -109,13 +114,13 @@ const Texts = {
|
||||
"local-co-op": "Local co-op",
|
||||
"map-mouse-to": "Map mouse to",
|
||||
"may-not-work-properly": "May not work properly!",
|
||||
"menu-stream-settings": "Stream settings",
|
||||
"menu-stream-stats": "Stream stats",
|
||||
"menu": "Menu",
|
||||
"microphone": "Microphone",
|
||||
"mkb-adjust-ingame-settings": "You may also need to adjust the in-game sensitivity & deadzone settings",
|
||||
"mkb-click-to-activate": "Click to activate",
|
||||
"mkb-disclaimer": "Using this feature when playing online could be viewed as cheating",
|
||||
"mouse-and-keyboard": "Mouse & Keyboard",
|
||||
"mute-unmute-sound": "Mute/unmute sound",
|
||||
"muted": "Muted",
|
||||
"name": "Name",
|
||||
"new": "New",
|
||||
@@ -146,6 +151,7 @@ const Texts = {
|
||||
(e: any) => `Naciśnij ${e.key}, aby przełączyć funkcję myszy i klawiatury`,
|
||||
(e: any) => `Pressione ${e.key} para ativar/desativar a função de Mouse e Teclado`,
|
||||
(e: any) => `Нажмите ${e.key} для переключения функции мыши и клавиатуры`,
|
||||
,
|
||||
(e: any) => `Klavye ve fare özelliğini açmak için ${e.key} tuşuna basın`,
|
||||
(e: any) => `Натисніть ${e.key}, щоб увімкнути або вимкнути функцію миші та клавіатури`,
|
||||
(e: any) => `Nhấn ${e.key} để bật/tắt tính năng Chuột và Bàn phím`,
|
||||
@@ -167,6 +173,7 @@ const Texts = {
|
||||
"safari-failed-message": "Failed to run Better xCloud. Retrying, please wait...",
|
||||
"saturation": "Saturation",
|
||||
"save": "Save",
|
||||
"screen": "Screen",
|
||||
"screenshot-apply-filters": "Applies video filters to screenshots",
|
||||
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
||||
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
||||
@@ -174,7 +181,9 @@ const Texts = {
|
||||
"settings-reload": "Reload page to reflect changes",
|
||||
"settings-reloading": "Reloading...",
|
||||
"shortcut-keys": "Shortcut keys",
|
||||
"show": "Show",
|
||||
"show-game-art": "Show game art",
|
||||
"show-hide": "Show/hide",
|
||||
"show-stats-on-startup": "Show stats when starting the game",
|
||||
"show-touch-controller": "Show touch controller",
|
||||
"show-wait-time": "Show the estimated wait time",
|
||||
@@ -195,6 +204,8 @@ const Texts = {
|
||||
"stick-decay-minimum": "Stick decay minimum",
|
||||
"stick-decay-strength": "Stick decay strength",
|
||||
"stream": "Stream",
|
||||
"stream-settings": "Stream settings",
|
||||
"stream-stats": "Stream stats",
|
||||
"stretch": "Stretch",
|
||||
"stretch-note": "Don't use with native touch games",
|
||||
"support-better-xcloud": "Support Better xCloud",
|
||||
@@ -210,6 +221,9 @@ const Texts = {
|
||||
"tc-muted-colors": "Muted colors",
|
||||
"tc-standard-layout-style": "Standard layout's button style",
|
||||
"text-size": "Text size",
|
||||
"toggle": "Toggle",
|
||||
"toggle-microphone": "Toggle microphone",
|
||||
"toggle-stream-stats": "Toggle stream stats",
|
||||
"top-center": "Top-center",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right",
|
||||
@@ -226,6 +240,7 @@ const Texts = {
|
||||
(e: any) => `Układ sterowania dotykowego stworzony przez ${e.name}`,
|
||||
(e: any) => `Disposição de controle por toque feito por ${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}`,
|
||||
@@ -292,7 +307,7 @@ export class Translations {
|
||||
static get<T=string>(key: keyof typeof Texts, values?: any): T {
|
||||
let text = null;
|
||||
|
||||
if (Translations.#selectedLocale !== Translations.#EN_US) {
|
||||
if (Translations.#foreignTranslations && Translations.#selectedLocale !== Translations.#EN_US) {
|
||||
text = Translations.#foreignTranslations[key];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user