mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Add setting to enable/disable Game Bar feature
This commit is contained in:
parent
72579249b1
commit
6b88f73e34
15
src/index.ts
15
src/index.ts
@ -149,12 +149,17 @@ window.addEventListener(BxEvent.STREAM_PLAYING, e => {
|
||||
STATES.isPlaying = true;
|
||||
injectStreamMenuButtons();
|
||||
|
||||
GameBar.reset();
|
||||
GameBar.enable();
|
||||
GameBar.showBar();
|
||||
if (getPref(PrefKey.GAME_BAR_ENABLED)) {
|
||||
GameBar.reset();
|
||||
GameBar.enable();
|
||||
GameBar.showBar();
|
||||
}
|
||||
|
||||
if (STATES.currentStream.$screenshotCanvas) {
|
||||
STATES.currentStream.$screenshotCanvas.width = $video.videoWidth;
|
||||
STATES.currentStream.$screenshotCanvas.height = $video.videoHeight;
|
||||
}
|
||||
|
||||
STATES.currentStream.$screenshotCanvas!.width = $video.videoWidth;
|
||||
STATES.currentStream.$screenshotCanvas!.height = $video.videoHeight;
|
||||
updateVideoPlayerCss();
|
||||
});
|
||||
|
||||
|
@ -27,12 +27,16 @@ const SETTINGS_UI = {
|
||||
items: [
|
||||
PrefKey.STREAM_TARGET_RESOLUTION,
|
||||
PrefKey.STREAM_CODEC_PROFILE,
|
||||
PrefKey.GAME_FORTNITE_FORCE_CONSOLE,
|
||||
|
||||
PrefKey.GAME_BAR_ENABLED,
|
||||
|
||||
PrefKey.AUDIO_MIC_ON_PLAYING,
|
||||
PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG,
|
||||
|
||||
PrefKey.SCREENSHOT_APPLY_FILTERS,
|
||||
|
||||
PrefKey.GAME_FORTNITE_FORCE_CONSOLE,
|
||||
|
||||
PrefKey.AUDIO_ENABLE_VOLUME_CONTROL,
|
||||
PrefKey.STREAM_COMBINE_SOURCES,
|
||||
],
|
||||
|
@ -427,8 +427,8 @@ export function updateVideoPlayerCss() {
|
||||
}
|
||||
|
||||
// Apply video filters to screenshots
|
||||
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS)) {
|
||||
STATES.currentStream.$screenshotCanvas!.getContext('2d')!.filter = filters;
|
||||
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS) && STATES.currentStream.$screenshotCanvas) {
|
||||
STATES.currentStream.$screenshotCanvas.getContext('2d')!.filter = filters;
|
||||
}
|
||||
|
||||
const PREF_RATIO = getPref(PrefKey.VIDEO_RATIO);
|
||||
@ -475,7 +475,7 @@ export function setupStreamUi() {
|
||||
setupQuickSettingsBar();
|
||||
StreamStats.render();
|
||||
|
||||
GameBar.setup();
|
||||
getPref(PrefKey.GAME_BAR_ENABLED) && GameBar.setup();
|
||||
}
|
||||
|
||||
updateVideoPlayerCss();
|
||||
|
@ -14,7 +14,12 @@ enum InputType {
|
||||
}
|
||||
|
||||
export const BxExposed = {
|
||||
// Enable/disable Game Bar when playing/pausing
|
||||
onPollingModeChanged: (mode: 'All' | 'None') => {
|
||||
if (!getPref(PrefKey.GAME_BAR_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!STATES.isPlaying) {
|
||||
GameBar.disable();
|
||||
return;
|
||||
|
@ -32,6 +32,8 @@ export enum PrefKey {
|
||||
|
||||
STREAM_DISABLE_FEEDBACK_DIALOG = 'stream_disable_feedback_dialog',
|
||||
|
||||
GAME_BAR_ENABLED = 'game_bar_enabled',
|
||||
|
||||
LOCAL_CO_OP_ENABLED = 'local_co_op_enabled',
|
||||
// LOCAL_CO_OP_SEPARATE_TOUCH_CONTROLLER = 'local_co_op_separate_touch_controller',
|
||||
|
||||
@ -312,6 +314,11 @@ export class Preferences {
|
||||
default: false,
|
||||
},
|
||||
|
||||
[PrefKey.GAME_BAR_ENABLED]: {
|
||||
label: t('enable-game-bar'),
|
||||
default: true,
|
||||
},
|
||||
|
||||
[PrefKey.LOCAL_CO_OP_ENABLED]: {
|
||||
label: t('enable-local-co-op-support'),
|
||||
default: false,
|
||||
@ -437,6 +444,7 @@ export class Preferences {
|
||||
},
|
||||
[PrefKey.USER_AGENT_PROFILE]: {
|
||||
label: t('user-agent-profile'),
|
||||
note: '⚠️ ' + t('user-agent-note'),
|
||||
default: 'default',
|
||||
options: {
|
||||
[UserAgentProfile.DEFAULT]: t('default'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user