mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-10 07:07:46 +02:00
Use a better method to show the Better xCloud button ASAP
This commit is contained in:
@@ -8,8 +8,9 @@ import type { SpeakerState } from "@/modules/shortcuts/sound-shortcut";
|
||||
type EventCallback<T = any> = (payload: T) => void;
|
||||
|
||||
type ScriptEvents = {
|
||||
'xcloud.server.ready': {};
|
||||
'xcloud.server.unavailable': {};
|
||||
'xcloud.server': {
|
||||
status: 'ready' | 'unavailable' | 'signed-out',
|
||||
};
|
||||
|
||||
'dialog.shown': {};
|
||||
'dialog.dismissed': {};
|
||||
@@ -34,6 +35,8 @@ type ScriptEvents = {
|
||||
};
|
||||
|
||||
'webgpu.ready': {},
|
||||
|
||||
'header.rendered': {},
|
||||
};
|
||||
|
||||
type StreamEvents = {
|
||||
|
@@ -14,6 +14,7 @@ export namespace BxEvent {
|
||||
export const TOUCH_LAYOUT_MANAGER_READY = 'bx-touch-layout-manager-ready';
|
||||
|
||||
// Inside app
|
||||
// TODO: Use EventBus
|
||||
export const REMOTE_PLAY_READY = 'bx-remote-play-ready';
|
||||
export const REMOTE_PLAY_FAILED = 'bx-remote-play-failed';
|
||||
|
||||
|
@@ -242,6 +242,7 @@ export const BxExposed = {
|
||||
|
||||
localCoOpManager: isFullVersion() ? LocalCoOpManager.getInstance() : null,
|
||||
reactCreateElement: function(...args: any[]) {},
|
||||
reactUseEffect: function(...args: any[]) {},
|
||||
|
||||
createReactLocalCoOpIcon: isFullVersion() ? (attrs: any): any => {
|
||||
const reactCE = window.BX_EXPOSED.reactCreateElement;
|
||||
|
@@ -3,7 +3,6 @@ import { isFullVersion } from "@macros/build" with { type: "macro" };
|
||||
import { BxEvent } from "@utils/bx-event";
|
||||
import { LoadingScreen } from "@modules/loading-screen";
|
||||
import { RemotePlayManager } from "@/modules/remote-play-manager";
|
||||
import { HeaderSection } from "@/modules/ui/header";
|
||||
import { BxEventBus } from "./bx-event-bus";
|
||||
import { NavigationDialogManager } from "@/modules/ui/dialog/navigation-dialog";
|
||||
|
||||
@@ -35,7 +34,5 @@ export function onHistoryChanged(e: PopStateEvent) {
|
||||
NavigationDialogManager.getInstance().hide();
|
||||
|
||||
LoadingScreen.reset();
|
||||
window.setTimeout(HeaderSection.watchHeader, 2000);
|
||||
|
||||
BxEventBus.Stream.emit('state.stopped', {});
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@ import { ControllerCustomizationDefaultPresetId } from "../local-db/controller-c
|
||||
import { ControllerShortcutDefaultId } from "../local-db/controller-shortcuts-table";
|
||||
import { BxEventBus } from "../bx-event-bus";
|
||||
import { WebGPUPlayer } from "@/modules/player/webgpu/webgpu-player";
|
||||
import { BX_FLAGS } from "../bx-flags";
|
||||
|
||||
|
||||
export class StreamSettingsStorage extends BaseSettingsStorage<StreamPref> {
|
||||
|
@@ -52,7 +52,7 @@ export class XcloudInterceptor {
|
||||
const response = await NATIVE_FETCH(request, init);
|
||||
if (response.status !== 200) {
|
||||
// Unsupported region
|
||||
BxEventBus.Script.emit('xcloud.server.unavailable', {});
|
||||
BxEventBus.Script.emit('xcloud.server', { status: 'unavailable' });
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,6 @@ export class XcloudInterceptor {
|
||||
STATES.serverRegions[region.name] = Object.assign({}, region);
|
||||
}
|
||||
|
||||
BxEventBus.Script.emit('xcloud.server.ready', {});
|
||||
|
||||
const preferredRegion = getPreferredServerRegion();
|
||||
if (preferredRegion && preferredRegion in STATES.serverRegions) {
|
||||
const tmp = Object.assign({}, STATES.serverRegions[preferredRegion]);
|
||||
@@ -104,6 +102,7 @@ export class XcloudInterceptor {
|
||||
}
|
||||
|
||||
STATES.gsToken = obj.gsToken;
|
||||
BxEventBus.Script.emit('xcloud.server', { status: 'ready' });
|
||||
|
||||
response.json = () => Promise.resolve(obj);
|
||||
return response;
|
||||
|
Reference in New Issue
Block a user