mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 12:15:09 +03:00
44bb023b80
Builder Win / Build PluginLoader for Win (push) Has been cancelled
Builder / Build PluginLoader (push) Has been cancelled
Push Updated Plugin Stub to Template / copy-stub (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Type Check / Run type checkers (push) Has been cancelled
44 lines
1.8 KiB
TypeScript
44 lines
1.8 KiB
TypeScript
// Sets up DFL, then loads start.ts which starts up the loader
|
|
|
|
(async () => {
|
|
console.debug('[Decky:Boot] Frontend init');
|
|
|
|
console.time('[Decky:Boot] Waiting for SteamApp init stage 1 to finish...');
|
|
|
|
// @ts-expect-error TODO type BFinishedInitStageOne in @decky/ui
|
|
while (!window.App?.BFinishedInitStageOne()) {
|
|
await new Promise((r) => setTimeout(r, 0)); // Can't use DFL sleep here.
|
|
}
|
|
|
|
console.timeEnd('[Decky:Boot] Waiting for SteamApp init stage 1 to finish...');
|
|
|
|
if (!window.SP_REACT) {
|
|
console.debug('[Decky:Boot] Setting up Webpack & React globals...');
|
|
// deliberate partial import
|
|
const DFLWebpack = await import('@decky/ui/dist/webpack');
|
|
window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect);
|
|
window.SP_REACTDOM =
|
|
DFLWebpack.findModule((m) => m.createPortal && m.createRoot) ||
|
|
DFLWebpack.findModule((m) => m.createPortal && m.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE);
|
|
|
|
console.debug('[Decky:Boot] Setting up JSX internals...');
|
|
const jsx = DFLWebpack.findModule((m) => m.jsx && Object.keys(m).length == 1)?.jsx;
|
|
if (jsx) {
|
|
window.SP_JSX = {
|
|
jsx,
|
|
jsxs: jsx,
|
|
Fragment: window.SP_REACT.Fragment,
|
|
};
|
|
}
|
|
}
|
|
console.debug('[Decky:Boot] Setting up @decky/ui...');
|
|
window.DFL = await import('@decky/ui');
|
|
console.debug('[Decky:Boot] Authenticating with Decky backend...');
|
|
window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text());
|
|
console.debug('[Decky:Boot] Connecting to Decky backend...');
|
|
window.DeckyBackend = new (await import('./wsrouter')).WSRouter();
|
|
await DeckyBackend.connect();
|
|
console.debug('[Decky:Boot] Starting Decky!');
|
|
await import('./start');
|
|
})();
|