Remove non-cloud games from touch games list

This commit is contained in:
redphx
2024-05-08 08:03:58 +07:00
parent 7eda0b61cc
commit c2efbd9c1d
4 changed files with 39 additions and 11 deletions

View File

@@ -1,7 +1,8 @@
import { STATES } from "@utils/global";
import { UserAgent } from "@utils/user-agent";
import { BxLogger } from "./bx-logger";
import { GALLERY_TOUCH_GAMES, TouchController } from "@modules/touch-controller";
import { TouchController } from "@modules/touch-controller";
import { GamePassCloudGallery } from "./gamepass-gallery";
const LOG_TAG = 'PreloadState';
@@ -29,10 +30,19 @@ export function overridePreloadState() {
// Add list of games with custom layouts to the official list
if (STATES.hasTouchSupport) {
TouchController.updateCustomList();
const customList = TouchController.getCustomList();
let customList = TouchController.getCustomList();
try {
state.xcloud.sigls[GALLERY_TOUCH_GAMES]?.data.products.push(...customList);
const sigls = state.xcloud.sigls;
if (GamePassCloudGallery.TOUCH in sigls) {
const allGames = sigls[GamePassCloudGallery.ALL].data.products;
// Remove non-cloud games from the list
customList = customList.filter(id => allGames.includes(id));
// Add to the official list
sigls[GamePassCloudGallery.TOUCH]?.data.products.push(...customList);
}
} catch (e) {
BxLogger.error(LOG_TAG, e);
}