mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +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;
|
STATES.isPlaying = true;
|
||||||
injectStreamMenuButtons();
|
injectStreamMenuButtons();
|
||||||
|
|
||||||
GameBar.reset();
|
if (getPref(PrefKey.GAME_BAR_ENABLED)) {
|
||||||
GameBar.enable();
|
GameBar.reset();
|
||||||
GameBar.showBar();
|
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();
|
updateVideoPlayerCss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,12 +27,16 @@ const SETTINGS_UI = {
|
|||||||
items: [
|
items: [
|
||||||
PrefKey.STREAM_TARGET_RESOLUTION,
|
PrefKey.STREAM_TARGET_RESOLUTION,
|
||||||
PrefKey.STREAM_CODEC_PROFILE,
|
PrefKey.STREAM_CODEC_PROFILE,
|
||||||
PrefKey.GAME_FORTNITE_FORCE_CONSOLE,
|
|
||||||
|
PrefKey.GAME_BAR_ENABLED,
|
||||||
|
|
||||||
PrefKey.AUDIO_MIC_ON_PLAYING,
|
PrefKey.AUDIO_MIC_ON_PLAYING,
|
||||||
PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG,
|
PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG,
|
||||||
|
|
||||||
PrefKey.SCREENSHOT_APPLY_FILTERS,
|
PrefKey.SCREENSHOT_APPLY_FILTERS,
|
||||||
|
|
||||||
|
PrefKey.GAME_FORTNITE_FORCE_CONSOLE,
|
||||||
|
|
||||||
PrefKey.AUDIO_ENABLE_VOLUME_CONTROL,
|
PrefKey.AUDIO_ENABLE_VOLUME_CONTROL,
|
||||||
PrefKey.STREAM_COMBINE_SOURCES,
|
PrefKey.STREAM_COMBINE_SOURCES,
|
||||||
],
|
],
|
||||||
|
@ -427,8 +427,8 @@ export function updateVideoPlayerCss() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply video filters to screenshots
|
// Apply video filters to screenshots
|
||||||
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS)) {
|
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS) && STATES.currentStream.$screenshotCanvas) {
|
||||||
STATES.currentStream.$screenshotCanvas!.getContext('2d')!.filter = filters;
|
STATES.currentStream.$screenshotCanvas.getContext('2d')!.filter = filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREF_RATIO = getPref(PrefKey.VIDEO_RATIO);
|
const PREF_RATIO = getPref(PrefKey.VIDEO_RATIO);
|
||||||
@ -475,7 +475,7 @@ export function setupStreamUi() {
|
|||||||
setupQuickSettingsBar();
|
setupQuickSettingsBar();
|
||||||
StreamStats.render();
|
StreamStats.render();
|
||||||
|
|
||||||
GameBar.setup();
|
getPref(PrefKey.GAME_BAR_ENABLED) && GameBar.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateVideoPlayerCss();
|
updateVideoPlayerCss();
|
||||||
|
@ -14,7 +14,12 @@ enum InputType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const BxExposed = {
|
export const BxExposed = {
|
||||||
|
// Enable/disable Game Bar when playing/pausing
|
||||||
onPollingModeChanged: (mode: 'All' | 'None') => {
|
onPollingModeChanged: (mode: 'All' | 'None') => {
|
||||||
|
if (!getPref(PrefKey.GAME_BAR_ENABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!STATES.isPlaying) {
|
if (!STATES.isPlaying) {
|
||||||
GameBar.disable();
|
GameBar.disable();
|
||||||
return;
|
return;
|
||||||
|
@ -32,6 +32,8 @@ export enum PrefKey {
|
|||||||
|
|
||||||
STREAM_DISABLE_FEEDBACK_DIALOG = 'stream_disable_feedback_dialog',
|
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_ENABLED = 'local_co_op_enabled',
|
||||||
// LOCAL_CO_OP_SEPARATE_TOUCH_CONTROLLER = 'local_co_op_separate_touch_controller',
|
// LOCAL_CO_OP_SEPARATE_TOUCH_CONTROLLER = 'local_co_op_separate_touch_controller',
|
||||||
|
|
||||||
@ -312,6 +314,11 @@ export class Preferences {
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[PrefKey.GAME_BAR_ENABLED]: {
|
||||||
|
label: t('enable-game-bar'),
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
|
||||||
[PrefKey.LOCAL_CO_OP_ENABLED]: {
|
[PrefKey.LOCAL_CO_OP_ENABLED]: {
|
||||||
label: t('enable-local-co-op-support'),
|
label: t('enable-local-co-op-support'),
|
||||||
default: false,
|
default: false,
|
||||||
@ -437,6 +444,7 @@ export class Preferences {
|
|||||||
},
|
},
|
||||||
[PrefKey.USER_AGENT_PROFILE]: {
|
[PrefKey.USER_AGENT_PROFILE]: {
|
||||||
label: t('user-agent-profile'),
|
label: t('user-agent-profile'),
|
||||||
|
note: '⚠️ ' + t('user-agent-note'),
|
||||||
default: 'default',
|
default: 'default',
|
||||||
options: {
|
options: {
|
||||||
[UserAgentProfile.DEFAULT]: t('default'),
|
[UserAgentProfile.DEFAULT]: t('default'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user