mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
Set image quality
This commit is contained in:
parent
3fe6d97133
commit
097164b92e
16
dist/better-xcloud.lite.user.js
vendored
16
dist/better-xcloud.lite.user.js
vendored
@ -407,6 +407,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
"how-to-fix": "How to fix",
|
"how-to-fix": "How to fix",
|
||||||
"how-to-improve-app-performance": "How to improve app's performance",
|
"how-to-improve-app-performance": "How to improve app's performance",
|
||||||
ignore: "Ignore",
|
ignore: "Ignore",
|
||||||
|
"image-quality": "Image quality",
|
||||||
import: "Import",
|
import: "Import",
|
||||||
"in-game-controller-customization": "In-game controller customization",
|
"in-game-controller-customization": "In-game controller customization",
|
||||||
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
||||||
@ -1437,6 +1438,20 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
label: t("hide-system-menu-icon"),
|
label: t("hide-system-menu-icon"),
|
||||||
default: !1
|
default: !1
|
||||||
},
|
},
|
||||||
|
"ui.imageQuality": {
|
||||||
|
label: t("image-quality"),
|
||||||
|
default: 90,
|
||||||
|
min: 10,
|
||||||
|
max: 90,
|
||||||
|
params: {
|
||||||
|
steps: 10,
|
||||||
|
exactTicks: 20,
|
||||||
|
customTextValue(value, min, max) {
|
||||||
|
if (value === 90) return t("default");
|
||||||
|
return value + "%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"stream.video.combineAudio": {
|
"stream.video.combineAudio": {
|
||||||
requiredVariants: "full",
|
requiredVariants: "full",
|
||||||
label: t("combine-audio-video-streams"),
|
label: t("combine-audio-video-streams"),
|
||||||
@ -4369,6 +4384,7 @@ class SettingsDialog extends NavigationDialog {
|
|||||||
label: t("ui"),
|
label: t("ui"),
|
||||||
items: [
|
items: [
|
||||||
"ui.layout",
|
"ui.layout",
|
||||||
|
"ui.imageQuality",
|
||||||
"ui.gameCard.waitTime.show",
|
"ui.gameCard.waitTime.show",
|
||||||
"ui.controllerStatus.show",
|
"ui.controllerStatus.show",
|
||||||
"ui.streamMenu.simplify",
|
"ui.streamMenu.simplify",
|
||||||
|
26
dist/better-xcloud.user.js
vendored
26
dist/better-xcloud.user.js
vendored
@ -439,6 +439,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
"how-to-fix": "How to fix",
|
"how-to-fix": "How to fix",
|
||||||
"how-to-improve-app-performance": "How to improve app's performance",
|
"how-to-improve-app-performance": "How to improve app's performance",
|
||||||
ignore: "Ignore",
|
ignore: "Ignore",
|
||||||
|
"image-quality": "Image quality",
|
||||||
import: "Import",
|
import: "Import",
|
||||||
"in-game-controller-customization": "In-game controller customization",
|
"in-game-controller-customization": "In-game controller customization",
|
||||||
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
||||||
@ -1509,6 +1510,20 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
label: t("hide-system-menu-icon"),
|
label: t("hide-system-menu-icon"),
|
||||||
default: !1
|
default: !1
|
||||||
},
|
},
|
||||||
|
"ui.imageQuality": {
|
||||||
|
label: t("image-quality"),
|
||||||
|
default: 90,
|
||||||
|
min: 10,
|
||||||
|
max: 90,
|
||||||
|
params: {
|
||||||
|
steps: 10,
|
||||||
|
exactTicks: 20,
|
||||||
|
customTextValue(value, min, max) {
|
||||||
|
if (value === 90) return t("default");
|
||||||
|
return value + "%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"stream.video.combineAudio": {
|
"stream.video.combineAudio": {
|
||||||
requiredVariants: "full",
|
requiredVariants: "full",
|
||||||
label: t("combine-audio-video-streams"),
|
label: t("combine-audio-video-streams"),
|
||||||
@ -4857,6 +4872,15 @@ ${subsVar} = subs;
|
|||||||
supportedInputIcons: supportedInputIconsVar
|
supportedInputIcons: supportedInputIconsVar
|
||||||
});
|
});
|
||||||
return str = PatcherUtils.insertAt(str, returnIndex, newCode), str;
|
return str = PatcherUtils.insertAt(str, returnIndex, newCode), str;
|
||||||
|
},
|
||||||
|
setImageQuality(str) {
|
||||||
|
let index = str.indexOf("const{size:{width:");
|
||||||
|
if (index > -1 && (index = PatcherUtils.indexOf(str, "=new URLSearchParams", index, 500)), index < 0) return !1;
|
||||||
|
let paramVar = PatcherUtils.getVariableNameBefore(str, index);
|
||||||
|
if (!paramVar) return !1;
|
||||||
|
index = PatcherUtils.indexOf(str, "return", index, 200);
|
||||||
|
let newCode = `${paramVar}.set('q', ${getPref("ui.imageQuality")});`;
|
||||||
|
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||||
}
|
}
|
||||||
}, PATCH_ORDERS = PatcherUtils.filterPatches([
|
}, PATCH_ORDERS = PatcherUtils.filterPatches([
|
||||||
...AppInterface && getPref("nativeMkb.mode") === "on" ? [
|
...AppInterface && getPref("nativeMkb.mode") === "on" ? [
|
||||||
@ -4866,6 +4890,7 @@ ${subsVar} = subs;
|
|||||||
] : [],
|
] : [],
|
||||||
"exposeReactCreateComponent",
|
"exposeReactCreateComponent",
|
||||||
"gameCardCustomIcons",
|
"gameCardCustomIcons",
|
||||||
|
getPref("ui.imageQuality") < 90 && "setImageQuality",
|
||||||
"modifyPreloadedState",
|
"modifyPreloadedState",
|
||||||
"optimizeGameSlugGenerator",
|
"optimizeGameSlugGenerator",
|
||||||
"detectBrowserRouterReady",
|
"detectBrowserRouterReady",
|
||||||
@ -6488,6 +6513,7 @@ class SettingsDialog extends NavigationDialog {
|
|||||||
label: t("ui"),
|
label: t("ui"),
|
||||||
items: [
|
items: [
|
||||||
"ui.layout",
|
"ui.layout",
|
||||||
|
"ui.imageQuality",
|
||||||
"ui.gameCard.waitTime.show",
|
"ui.gameCard.waitTime.show",
|
||||||
"ui.controllerStatus.show",
|
"ui.controllerStatus.show",
|
||||||
"ui.streamMenu.simplify",
|
"ui.streamMenu.simplify",
|
||||||
|
@ -86,6 +86,7 @@ export const enum PrefKey {
|
|||||||
UI_SKIP_SPLASH_VIDEO = 'ui.splashVideo.skip',
|
UI_SKIP_SPLASH_VIDEO = 'ui.splashVideo.skip',
|
||||||
UI_HIDE_SYSTEM_MENU_ICON = 'ui.systemMenu.hideHandle',
|
UI_HIDE_SYSTEM_MENU_ICON = 'ui.systemMenu.hideHandle',
|
||||||
UI_REDUCE_ANIMATIONS = 'ui.reduceAnimations',
|
UI_REDUCE_ANIMATIONS = 'ui.reduceAnimations',
|
||||||
|
UI_IMAGE_QUALITY = 'ui.imageQuality',
|
||||||
|
|
||||||
VIDEO_PLAYER_TYPE = 'video.player.type',
|
VIDEO_PLAYER_TYPE = 'video.player.type',
|
||||||
VIDEO_POWER_PREFERENCE = 'video.player.powerPreference',
|
VIDEO_POWER_PREFERENCE = 'video.player.powerPreference',
|
||||||
@ -172,6 +173,7 @@ export type PrefTypeMap = {
|
|||||||
[PrefKey.UI_GAME_CARD_SHOW_WAIT_TIME]: boolean,
|
[PrefKey.UI_GAME_CARD_SHOW_WAIT_TIME]: boolean,
|
||||||
[PrefKey.UI_HIDE_SECTIONS]: UiSection[],
|
[PrefKey.UI_HIDE_SECTIONS]: UiSection[],
|
||||||
[PrefKey.UI_HIDE_SYSTEM_MENU_ICON]: boolean,
|
[PrefKey.UI_HIDE_SYSTEM_MENU_ICON]: boolean,
|
||||||
|
[PrefKey.UI_IMAGE_QUALITY]: number,
|
||||||
[PrefKey.UI_LAYOUT]: UiLayout,
|
[PrefKey.UI_LAYOUT]: UiLayout,
|
||||||
[PrefKey.UI_REDUCE_ANIMATIONS]: boolean,
|
[PrefKey.UI_REDUCE_ANIMATIONS]: boolean,
|
||||||
[PrefKey.UI_SCROLLBAR_HIDE]: boolean,
|
[PrefKey.UI_SCROLLBAR_HIDE]: boolean,
|
||||||
|
@ -1081,6 +1081,28 @@ ${subsVar} = subs;
|
|||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// 27.0.6-hotfix.1, 78831.js
|
||||||
|
setImageQuality(str: string) {
|
||||||
|
let index = str.indexOf('const{size:{width:');
|
||||||
|
index > -1 && (index = PatcherUtils.indexOf(str, '=new URLSearchParams', index, 500));
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const paramVar = PatcherUtils.getVariableNameBefore(str, index);
|
||||||
|
if (!paramVar) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find "return" keyword
|
||||||
|
index = PatcherUtils.indexOf(str, 'return', index, 200);
|
||||||
|
|
||||||
|
const newCode = `${paramVar}.set('q', ${getPref(PrefKey.UI_IMAGE_QUALITY)});`;
|
||||||
|
str = PatcherUtils.insertAt(str, index, newCode);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let PATCH_ORDERS = PatcherUtils.filterPatches([
|
let PATCH_ORDERS = PatcherUtils.filterPatches([
|
||||||
@ -1094,6 +1116,8 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
'gameCardCustomIcons',
|
'gameCardCustomIcons',
|
||||||
// 'gameCardPassTitle',
|
// 'gameCardPassTitle',
|
||||||
|
|
||||||
|
getPref(PrefKey.UI_IMAGE_QUALITY) < 90 && 'setImageQuality',
|
||||||
|
|
||||||
'modifyPreloadedState',
|
'modifyPreloadedState',
|
||||||
|
|
||||||
'optimizeGameSlugGenerator',
|
'optimizeGameSlugGenerator',
|
||||||
|
@ -274,6 +274,7 @@ export class SettingsDialog extends NavigationDialog {
|
|||||||
label: t('ui'),
|
label: t('ui'),
|
||||||
items: [
|
items: [
|
||||||
PrefKey.UI_LAYOUT,
|
PrefKey.UI_LAYOUT,
|
||||||
|
PrefKey.UI_IMAGE_QUALITY,
|
||||||
PrefKey.UI_GAME_CARD_SHOW_WAIT_TIME,
|
PrefKey.UI_GAME_CARD_SHOW_WAIT_TIME,
|
||||||
PrefKey.UI_CONTROLLER_SHOW_STATUS,
|
PrefKey.UI_CONTROLLER_SHOW_STATUS,
|
||||||
PrefKey.UI_SIMPLIFY_STREAM_MENU,
|
PrefKey.UI_SIMPLIFY_STREAM_MENU,
|
||||||
|
@ -192,6 +192,23 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
|||||||
label: t('hide-system-menu-icon'),
|
label: t('hide-system-menu-icon'),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
[PrefKey.UI_IMAGE_QUALITY]: {
|
||||||
|
label: t('image-quality'),
|
||||||
|
default: 90,
|
||||||
|
min: 10,
|
||||||
|
max: 90,
|
||||||
|
params: {
|
||||||
|
steps: 10,
|
||||||
|
exactTicks: 20,
|
||||||
|
customTextValue(value, min, max) {
|
||||||
|
if (value === 90) {
|
||||||
|
return t('default');
|
||||||
|
}
|
||||||
|
|
||||||
|
return value + '%';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
[PrefKey.STREAM_COMBINE_SOURCES]: {
|
[PrefKey.STREAM_COMBINE_SOURCES]: {
|
||||||
requiredVariants: 'full',
|
requiredVariants: 'full',
|
||||||
|
@ -151,6 +151,7 @@ const Texts = {
|
|||||||
"how-to-fix": "How to fix",
|
"how-to-fix": "How to fix",
|
||||||
"how-to-improve-app-performance": "How to improve app's performance",
|
"how-to-improve-app-performance": "How to improve app's performance",
|
||||||
"ignore": "Ignore",
|
"ignore": "Ignore",
|
||||||
|
"image-quality": "Image quality",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"in-game-controller-customization": "In-game controller customization",
|
"in-game-controller-customization": "In-game controller customization",
|
||||||
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
"in-game-controller-shortcuts": "In-game controller shortcuts",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user