diff --git a/src/modules/ui/global-settings.ts b/src/modules/ui/global-settings.ts index ca4c569..1f27b9a 100644 --- a/src/modules/ui/global-settings.ts +++ b/src/modules/ui/global-settings.ts @@ -55,6 +55,7 @@ const SETTINGS_UI = { [t('mouse-and-keyboard')]: { items: [ + PrefKey.NATIVE_MKB_DISABLED, PrefKey.MKB_ENABLED, PrefKey.MKB_HIDE_IDLE_CURSOR, ], diff --git a/src/utils/bx-exposed.ts b/src/utils/bx-exposed.ts index 95debf7..2177702 100644 --- a/src/utils/bx-exposed.ts +++ b/src/utils/bx-exposed.ts @@ -38,6 +38,12 @@ export const BxExposed = { titleInfo = structuredClone(titleInfo); let supportedInputTypes = titleInfo.details.supportedInputTypes; + + // Remove native MKB support on mobile browsers or by user's choice + if (getPref(PrefKey.NATIVE_MKB_DISABLED) || UserAgent.isMobile()) { + supportedInputTypes = supportedInputTypes.filter(i => i !== InputType.MKB); + } + titleInfo.details.hasMkbSupport = supportedInputTypes.includes(InputType.MKB); if (STATES.hasTouchSupport) { @@ -58,10 +64,7 @@ export const BxExposed = { gamepadFound && (touchControllerAvailability = 'off'); } - // Remove MKB support on mobile browsers - if (UserAgent.isMobile()) { - supportedInputTypes = supportedInputTypes.filter(i => i !== InputType.MKB); - } + if (touchControllerAvailability === 'off') { // Disable touch on all games (not native touch) @@ -78,10 +81,10 @@ export const BxExposed = { titleInfo.details.hasFakeTouchSupport = true; supportedInputTypes.push(InputType.GENERIC_TOUCH); } - - titleInfo.details.supportedInputTypes = supportedInputTypes; } + titleInfo.details.supportedInputTypes = supportedInputTypes; + // Save this info in STATES STATES.currentStream.titleInfo = titleInfo; BxEvent.dispatch(window, BxEvent.TITLE_INFO_READY); diff --git a/src/utils/preferences.ts b/src/utils/preferences.ts index d620417..add1c64 100644 --- a/src/utils/preferences.ts +++ b/src/utils/preferences.ts @@ -44,6 +44,7 @@ export enum PrefKey { CONTROLLER_DEVICE_VIBRATION = 'controller_device_vibration', CONTROLLER_VIBRATION_INTENSITY = 'controller_vibration_intensity', + NATIVE_MKB_DISABLED = 'native_mkb_disabled', MKB_ENABLED = 'mkb_enabled', MKB_HIDE_IDLE_CURSOR = 'mkb_hide_idle_cursor', MKB_ABSOLUTE_MOUSE = 'mkb_absolute_mouse', @@ -419,6 +420,11 @@ export class Preferences { }, }, + [PrefKey.NATIVE_MKB_DISABLED]: { + label: t('disable-native-mkb'), + default: false, + }, + [PrefKey.MKB_DEFAULT_PRESET_ID]: { default: 0, },