Don't emulate MKB in native MKB supported games

This commit is contained in:
redphx 2024-04-29 11:00:47 +07:00
parent cd6dd1e22d
commit 99aec0a60c
3 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,8 @@ import { LocalDb } from "../../utils/local-db";
import { KeyHelper } from "./key-helper"; import { KeyHelper } from "./key-helper";
import type { MkbStoredPreset } from "../../types/mkb"; import type { MkbStoredPreset } from "../../types/mkb";
import { showStreamSettings } from "../stream/stream-ui"; import { showStreamSettings } from "../stream/stream-ui";
import { STATES } from "../../utils/global";
import { UserAgent } from "../../utils/user-agent";
/* /*
This class uses some code from Yuzu emulator to handle mouse's movements This class uses some code from Yuzu emulator to handle mouse's movements
@ -457,9 +459,9 @@ export class MkbHandler {
} }
static setupEvents() { static setupEvents() {
window.addEventListener(BxEvent.STREAM_PLAYING, () => { getPref(PrefKey.MKB_ENABLED) && !UserAgent.isMobile() && window.addEventListener(BxEvent.STREAM_PLAYING, () => {
// Enable MKB // Enable MKB
if (getPref(PrefKey.MKB_ENABLED)) { if (!STATES.currentStream.titleInfo?.details.hasMkbSupport) {
console.log('Emulate MKB'); console.log('Emulate MKB');
MkbHandler.INSTANCE.init(); MkbHandler.INSTANCE.init();
} }

View File

@ -57,6 +57,7 @@ type XcloudTitleInfo = {
productId: string; productId: string;
supportedInputTypes: InputType[]; supportedInputTypes: InputType[];
hasTouchSupport: boolean; hasTouchSupport: boolean;
hasMkbSupport: boolean;
}; };
product: { product: {

View File

@ -49,7 +49,8 @@ export const BxExposed = {
supportedInputTypes = supportedInputTypes.filter(i => i !== 'MKB'); supportedInputTypes = supportedInputTypes.filter(i => i !== 'MKB');
} }
// Add custom property // Pre-check supported input types
titleInfo.details.hasMkbSupport = supportedInputTypes.includes(InputType.MKB);
titleInfo.details.hasTouchSupport = supportedInputTypes.includes(InputType.NATIVE_TOUCH) && titleInfo.details.hasTouchSupport = supportedInputTypes.includes(InputType.NATIVE_TOUCH) &&
!supportedInputTypes.includes(InputType.CUSTOM_TOUCH_OVERLAY) && !supportedInputTypes.includes(InputType.CUSTOM_TOUCH_OVERLAY) &&
!supportedInputTypes.includes(InputType.GENERIC_TOUCH); !supportedInputTypes.includes(InputType.GENERIC_TOUCH);