mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Detach VIRTUAL_GAMEPAD_ID from EmulatedMkbHandler
This commit is contained in:
parent
12d8d766dc
commit
8f6bc5cb1b
1340
dist/better-xcloud.lite.user.js
vendored
1340
dist/better-xcloud.lite.user.js
vendored
File diff suppressed because it is too large
Load Diff
1161
dist/better-xcloud.user.js
vendored
1161
dist/better-xcloud.user.js
vendored
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@ import { GamepadKey } from "@enums/mkb";
|
|||||||
import { PrompFont } from "@enums/prompt-font";
|
import { PrompFont } from "@enums/prompt-font";
|
||||||
import { CE, removeChildElements } from "@utils/html";
|
import { CE, removeChildElements } from "@utils/html";
|
||||||
import { t } from "@utils/translation";
|
import { t } from "@utils/translation";
|
||||||
import { EmulatedMkbHandler } from "./mkb/mkb-handler";
|
|
||||||
import { StreamStats } from "./stream/stream-stats";
|
import { StreamStats } from "./stream/stream-stats";
|
||||||
import { MicrophoneShortcut } from "./shortcuts/shortcut-microphone";
|
import { MicrophoneShortcut } from "./shortcuts/shortcut-microphone";
|
||||||
import { StreamUiShortcut } from "./shortcuts/shortcut-stream-ui";
|
import { StreamUiShortcut } from "./shortcuts/shortcut-stream-ui";
|
||||||
@ -15,6 +14,7 @@ import { setNearby } from "@/utils/navigation-utils";
|
|||||||
import { PrefKey } from "@/enums/pref-keys";
|
import { PrefKey } from "@/enums/pref-keys";
|
||||||
import { getPref } from "@/utils/settings-storages/global-settings-storage";
|
import { getPref } from "@/utils/settings-storages/global-settings-storage";
|
||||||
import { SettingsNavigationDialog } from "./ui/dialog/settings-dialog";
|
import { SettingsNavigationDialog } from "./ui/dialog/settings-dialog";
|
||||||
|
import { VIRTUAL_GAMEPAD_ID } from "./mkb/mkb-handler";
|
||||||
|
|
||||||
const enum ShortcutAction {
|
const enum ShortcutAction {
|
||||||
BETTER_XCLOUD_SETTINGS_SHOW = 'bx-settings-show',
|
BETTER_XCLOUD_SETTINGS_SHOW = 'bx-settings-show',
|
||||||
@ -185,7 +185,7 @@ export class ControllerShortcut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ignore emulated gamepad
|
// Ignore emulated gamepad
|
||||||
if (gamepad.id === EmulatedMkbHandler.VIRTUAL_GAMEPAD_ID) {
|
if (gamepad.id === VIRTUAL_GAMEPAD_ID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ const PointerToMouseButton = {
|
|||||||
4: 1,
|
4: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const VIRTUAL_GAMEPAD_ID = 'Xbox 360 Controller';
|
||||||
|
|
||||||
class WebSocketMouseDataProvider extends MouseDataProvider {
|
class WebSocketMouseDataProvider extends MouseDataProvider {
|
||||||
#pointerClient: PointerClient | undefined
|
#pointerClient: PointerClient | undefined
|
||||||
@ -136,10 +137,8 @@ export class EmulatedMkbHandler extends MkbHandler {
|
|||||||
static readonly DEFAULT_DEADZONE_COUNTERWEIGHT = 0.01;
|
static readonly DEFAULT_DEADZONE_COUNTERWEIGHT = 0.01;
|
||||||
static readonly MAXIMUM_STICK_RANGE = 1.1;
|
static readonly MAXIMUM_STICK_RANGE = 1.1;
|
||||||
|
|
||||||
static VIRTUAL_GAMEPAD_ID = 'Xbox 360 Controller';
|
|
||||||
|
|
||||||
#VIRTUAL_GAMEPAD = {
|
#VIRTUAL_GAMEPAD = {
|
||||||
id: EmulatedMkbHandler.VIRTUAL_GAMEPAD_ID,
|
id: VIRTUAL_GAMEPAD_ID,
|
||||||
index: 3,
|
index: 3,
|
||||||
connected: false,
|
connected: false,
|
||||||
hapticActuators: null,
|
hapticActuators: null,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { GamepadKey } from "@/enums/mkb";
|
import { GamepadKey } from "@/enums/mkb";
|
||||||
import { PrefKey } from "@/enums/pref-keys";
|
import { PrefKey } from "@/enums/pref-keys";
|
||||||
import { EmulatedMkbHandler } from "@/modules/mkb/mkb-handler";
|
import { VIRTUAL_GAMEPAD_ID } from "@/modules/mkb/mkb-handler";
|
||||||
import { BxEvent } from "@/utils/bx-event";
|
import { BxEvent } from "@/utils/bx-event";
|
||||||
import { STATES } from "@/utils/global";
|
import { STATES } from "@/utils/global";
|
||||||
import { CE, isElementVisible } from "@/utils/html";
|
import { CE, isElementVisible } from "@/utils/html";
|
||||||
@ -263,7 +263,7 @@ export class NavigationDialogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ignore virtual controller
|
// Ignore virtual controller
|
||||||
if (gamepad.id === EmulatedMkbHandler.VIRTUAL_GAMEPAD_ID) {
|
if (gamepad.id === VIRTUAL_GAMEPAD_ID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ export class SettingsNavigationDialog extends NavigationDialog {
|
|||||||
group: 'mkb',
|
group: 'mkb',
|
||||||
label: t('virtual-controller'),
|
label: t('virtual-controller'),
|
||||||
helpUrl: 'https://better-xcloud.github.io/mouse-and-keyboard/',
|
helpUrl: 'https://better-xcloud.github.io/mouse-and-keyboard/',
|
||||||
content: MkbRemapper.INSTANCE.render(),
|
content: isFullVersion() && MkbRemapper.INSTANCE.render(),
|
||||||
}];
|
}];
|
||||||
|
|
||||||
private readonly TAB_NATIVE_MKB_ITEMS: Array<SettingTabContent | false> = [{
|
private readonly TAB_NATIVE_MKB_ITEMS: Array<SettingTabContent | false> = [{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { EmulatedMkbHandler } from "@modules/mkb/mkb-handler";
|
import { VIRTUAL_GAMEPAD_ID } from "@modules/mkb/mkb-handler";
|
||||||
import { t } from "@utils/translation";
|
import { t } from "@utils/translation";
|
||||||
import { Toast } from "@utils/toast";
|
import { Toast } from "@utils/toast";
|
||||||
import { BxLogger } from "@utils/bx-logger";
|
import { BxLogger } from "@utils/bx-logger";
|
||||||
@ -8,7 +8,7 @@ import { getPref } from "./settings-storages/global-settings-storage";
|
|||||||
// Show a toast when connecting/disconecting controller
|
// Show a toast when connecting/disconecting controller
|
||||||
export function showGamepadToast(gamepad: Gamepad) {
|
export function showGamepadToast(gamepad: Gamepad) {
|
||||||
// Don't show Toast for virtual controller
|
// Don't show Toast for virtual controller
|
||||||
if (gamepad.id === EmulatedMkbHandler.VIRTUAL_GAMEPAD_ID) {
|
if (gamepad.id === VIRTUAL_GAMEPAD_ID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { isFullVersion } from "@macros/build" with {type: "macro"};
|
|
||||||
|
|
||||||
import { TouchController } from "@/modules/touch-controller";
|
import { TouchController } from "@/modules/touch-controller";
|
||||||
import { BxEvent } from "./bx-event";
|
import { BxEvent } from "./bx-event";
|
||||||
import { SupportedInputType } from "./bx-exposed";
|
import { SupportedInputType } from "./bx-exposed";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user