mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-11 07:37:46 +02:00
6.0
This commit is contained in:
19
src/utils/bx-exposed.ts
Normal file → Executable file
19
src/utils/bx-exposed.ts
Normal file → Executable file
@@ -7,9 +7,10 @@ import { BxLogger } from "./bx-logger";
|
||||
import { BX_FLAGS } from "./bx-flags";
|
||||
import { NavigationDialogManager } from "@/modules/ui/dialog/navigation-dialog";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref, StreamTouchController } from "./settings-storages/global-settings-storage";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
import { GamePassCloudGallery } from "@/enums/game-pass-gallery";
|
||||
import { TouchController } from "@/modules/touch-controller";
|
||||
import { NativeMkbMode, TouchControllerMode } from "@/enums/pref-values";
|
||||
|
||||
export enum SupportedInputType {
|
||||
CONTROLLER = 'Controller',
|
||||
@@ -89,17 +90,17 @@ export const BxExposed = {
|
||||
}
|
||||
|
||||
// Remove native MKB support on mobile browsers or by user's choice
|
||||
if (getPref(PrefKey.NATIVE_MKB_ENABLED) === 'off') {
|
||||
if (getPref<NativeMkbMode>(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.OFF) {
|
||||
supportedInputTypes = supportedInputTypes.filter(i => i !== SupportedInputType.MKB);
|
||||
}
|
||||
|
||||
titleInfo.details.hasMkbSupport = supportedInputTypes.includes(SupportedInputType.MKB);
|
||||
|
||||
if (STATES.userAgent.capabilities.touch) {
|
||||
let touchControllerAvailability = getPref(PrefKey.STREAM_TOUCH_CONTROLLER);
|
||||
let touchControllerAvailability = getPref<TouchControllerMode>(PrefKey.TOUCH_CONTROLLER_MODE);
|
||||
|
||||
// Disable touch control when gamepad found
|
||||
if (touchControllerAvailability !== StreamTouchController.OFF && getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) {
|
||||
if (touchControllerAvailability !== TouchControllerMode.OFF && getPref(PrefKey.TOUCH_CONTROLLER_AUTO_OFF)) {
|
||||
const gamepads = window.navigator.getGamepads();
|
||||
let gamepadFound = false;
|
||||
|
||||
@@ -110,10 +111,10 @@ export const BxExposed = {
|
||||
}
|
||||
}
|
||||
|
||||
gamepadFound && (touchControllerAvailability = StreamTouchController.OFF);
|
||||
gamepadFound && (touchControllerAvailability = TouchControllerMode.OFF);
|
||||
}
|
||||
|
||||
if (touchControllerAvailability === StreamTouchController.OFF) {
|
||||
if (touchControllerAvailability === TouchControllerMode.OFF) {
|
||||
// Disable touch on all games (not native touch)
|
||||
supportedInputTypes = supportedInputTypes.filter(i => i !== SupportedInputType.CUSTOM_TOUCH_OVERLAY && i !== SupportedInputType.GENERIC_TOUCH);
|
||||
// Empty TABs
|
||||
@@ -126,7 +127,7 @@ export const BxExposed = {
|
||||
supportedInputTypes.includes(SupportedInputType.CUSTOM_TOUCH_OVERLAY) ||
|
||||
supportedInputTypes.includes(SupportedInputType.GENERIC_TOUCH);
|
||||
|
||||
if (!titleInfo.details.hasTouchSupport && touchControllerAvailability === StreamTouchController.ALL) {
|
||||
if (!titleInfo.details.hasTouchSupport && touchControllerAvailability === TouchControllerMode.ALL) {
|
||||
// Add generic touch support for non touch-supported games
|
||||
titleInfo.details.hasFakeTouchSupport = true;
|
||||
supportedInputTypes.push(SupportedInputType.GENERIC_TOUCH);
|
||||
@@ -172,7 +173,7 @@ export const BxExposed = {
|
||||
resetControllerShortcut: isFullVersion() && ControllerShortcut.reset,
|
||||
|
||||
overrideSettings: {
|
||||
'Tv_settings': {
|
||||
Tv_settings: {
|
||||
hasCompletedOnboarding: true,
|
||||
},
|
||||
},
|
||||
@@ -206,4 +207,6 @@ export const BxExposed = {
|
||||
/ {2,}/g,
|
||||
/ /g,
|
||||
],
|
||||
|
||||
toggleLocalCoOp: (enable: boolean) => {},
|
||||
};
|
||||
|
Reference in New Issue
Block a user