Add back the ability to use native MKB feature on unofficial titles

This commit is contained in:
redphx
2024-06-02 10:43:59 +07:00
parent 850afb4ca7
commit 2e0a59cbe1
6 changed files with 90 additions and 13 deletions

View File

@@ -439,12 +439,20 @@ class XcloudInterceptor {
overrides.inputConfiguration = overrides.inputConfiguration || {};
overrides.inputConfiguration.enableVibration = true;
let overrideMkb: boolean | null = null;
if (getPref(PrefKey.NATIVE_MKB_DISABLED) || UserAgent.isMobile()) {
overrideMkb = false;
} else if (BX_FLAGS.ForceNativeMkbTitles.includes(STATES.currentStream.titleInfo!.details.productId)) {
overrideMkb = true;
}
if (overrideMkb !== null) {
overrides.inputConfiguration = Object.assign(overrides.inputConfiguration, {
enableMouseInput: false,
enableAbsoluteMouse: false,
enableKeyboardInput: false,
});
enableMouseInput: overrideMkb,
enableAbsoluteMouse: overrideMkb,
enableKeyboardInput: overrideMkb,
});
}
overrides.videoConfiguration = overrides.videoConfiguration || {};
@@ -614,6 +622,21 @@ export function interceptHttpRequests() {
return response;
}
if (BX_FLAGS.ForceNativeMkbTitles && url.includes('catalog.gamepass.com/sigls/') && url.includes(GamePassCloudGallery.NATIVE_MKB)) {
const response = await NATIVE_FETCH(request, init);
const obj = await response.clone().json();
try {
const newCustomList = BX_FLAGS.ForceNativeMkbTitles.map((item: string) => ({ id: item }));
obj.push(...newCustomList);
} catch (e) {
console.log(e);
}
response.json = () => Promise.resolve(obj);
return response;
}
let requestType: RequestType;
if (url.includes('/sessions/home') || url.includes('xhome.') || (STATES.remotePlay.isPlaying && url.endsWith('/inputconfigs'))) {
requestType = RequestType.XHOME;