diff options
| author | AAGaming <aa@mail.catvibers.me> | 2023-02-22 22:00:23 -0500 |
|---|---|---|
| committer | AAGaming <aa@mail.catvibers.me> | 2023-02-22 22:00:30 -0500 |
| commit | 97bb3fa4c879cf2a517e59b1f7177c9e49e0a692 (patch) | |
| tree | 5e60e481a02d31ac4c88a780bdd853a6906a4b67 /frontend/src | |
| parent | 611245aec9c056383692fac8a1214efd4718449f (diff) | |
| download | decky-loader-97bb3fa4c879cf2a517e59b1f7177c9e49e0a692.tar.gz decky-loader-97bb3fa4c879cf2a517e59b1f7177c9e49e0a692.zip | |
Fix loader on feb 22 2023 beta
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/QuickAccessVisibleState.tsx | 10 | ||||
| -rw-r--r-- | frontend/src/components/modals/filepicker/patches/library.ts | 11 | ||||
| -rw-r--r-- | frontend/src/components/settings/pages/developer/index.tsx | 2 | ||||
| -rw-r--r-- | frontend/src/components/store/Store.tsx | 2 | ||||
| -rw-r--r-- | frontend/src/steamfixes/index.ts | 2 | ||||
| -rw-r--r-- | frontend/src/steamfixes/reload.ts | 11 | ||||
| -rw-r--r-- | frontend/src/steamfixes/restart.ts | 7 | ||||
| -rw-r--r-- | frontend/src/tabs-hook.tsx | 17 | ||||
| -rw-r--r-- | frontend/src/utils/windows.ts | 4 |
9 files changed, 30 insertions, 36 deletions
diff --git a/frontend/src/components/QuickAccessVisibleState.tsx b/frontend/src/components/QuickAccessVisibleState.tsx index 09babe84..ef977442 100644 --- a/frontend/src/components/QuickAccessVisibleState.tsx +++ b/frontend/src/components/QuickAccessVisibleState.tsx @@ -4,15 +4,11 @@ const QuickAccessVisibleState = createContext<boolean>(true); export const useQuickAccessVisible = () => useContext(QuickAccessVisibleState); -export const QuickAccessVisibleStateProvider: FC<{ initial: boolean; setter: ((val: boolean) => {}[]) | never[] }> = ({ - children, - initial, - setter, -}) => { +export const QuickAccessVisibleStateProvider: FC<{ initial: boolean; tab: any }> = ({ children, initial, tab }) => { const [visible, setVisible] = useState<boolean>(initial); const [prev, setPrev] = useState<boolean>(initial); - // hack to use an array as a "pointer" to pass the setter up the tree - setter[0] = setVisible; + // HACK but i can't think of a better way to do this + tab.qAMVisibilitySetter = setVisible; if (initial != prev) { setPrev(initial); setVisible(initial); diff --git a/frontend/src/components/modals/filepicker/patches/library.ts b/frontend/src/components/modals/filepicker/patches/library.ts index 3abf824b..d398b83d 100644 --- a/frontend/src/components/modals/filepicker/patches/library.ts +++ b/frontend/src/components/modals/filepicker/patches/library.ts @@ -4,13 +4,6 @@ import Logger from '../../../../logger'; const logger = new Logger('LibraryPatch'); -declare global { - interface Window { - SteamClient: any; - appDetailsStore: any; - } -} - let patch: Patch; function rePatch() { @@ -20,7 +13,9 @@ function rePatch() { const details = window.appDetailsStore.GetAppDetails(appid); logger.debug('game details', details); // strShortcutStartDir - const file = await window.DeckyPluginLoader.openFilePicker(details.strShortcutStartDir.replaceAll('"', '')); + const file = await window.DeckyPluginLoader.openFilePicker( + details?.strShortcutStartDir.replaceAll('"', '') || '/', + ); logger.debug('user selected', file); window.SteamClient.Apps.SetShortcutExe(appid, JSON.stringify(file.path)); const pathArr = file.path.split('/'); diff --git a/frontend/src/components/settings/pages/developer/index.tsx b/frontend/src/components/settings/pages/developer/index.tsx index d9859c46..bd80cb77 100644 --- a/frontend/src/components/settings/pages/developer/index.tsx +++ b/frontend/src/components/settings/pages/developer/index.tsx @@ -52,7 +52,7 @@ export default function DeveloperSettings() { > <Toggle value={reactDevtoolsEnabled} - disabled={reactDevtoolsIP == ''} + // disabled={reactDevtoolsIP == ''} onChange={(toggleValue) => { setReactDevtoolsEnabled(toggleValue); setShouldConnectToReactDevTools(toggleValue); diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx index 7a9c0e33..68f6c077 100644 --- a/frontend/src/components/store/Store.tsx +++ b/frontend/src/components/store/Store.tsx @@ -15,7 +15,7 @@ import Logger from '../../logger'; import { StorePlugin, getPluginList } from '../../store'; import PluginCard from './PluginCard'; -const logger = new Logger('FilePicker'); +const logger = new Logger('Store'); const StorePage: FC<{}> = () => { const [currentTabRoute, setCurrentTabRoute] = useState<string>('browse'); diff --git a/frontend/src/steamfixes/index.ts b/frontend/src/steamfixes/index.ts index 988f3bd7..fe0e3e05 100644 --- a/frontend/src/steamfixes/index.ts +++ b/frontend/src/steamfixes/index.ts @@ -7,6 +7,6 @@ export function deinitSteamFixes() { } export async function initSteamFixes() { - fixes.push(reloadFix()); + fixes.push(await reloadFix()); fixes.push(await restartFix()); } diff --git a/frontend/src/steamfixes/reload.ts b/frontend/src/steamfixes/reload.ts index e31f78fc..8635abdc 100644 --- a/frontend/src/steamfixes/reload.ts +++ b/frontend/src/steamfixes/reload.ts @@ -1,10 +1,17 @@ +import { getFocusNavController, sleep } from 'decky-frontend-lib'; + import Logger from '../logger'; const logger = new Logger('ReloadSteamFix'); -export default function reloadFix() { +declare global { + var GamepadNavTree: any; +} + +export default async function reloadFix() { // Hack to unbreak the ui when reloading it - if (window.FocusNavController?.m_rgAllContexts?.length == 0) { + await sleep(4000); + if (getFocusNavController()?.m_rgAllContexts?.length == 0) { SteamClient.URL.ExecuteSteamURL('steam://open/settings'); logger.log('Applied UI reload fix.'); } diff --git a/frontend/src/steamfixes/restart.ts b/frontend/src/steamfixes/restart.ts index 467efd6a..93fc08f7 100644 --- a/frontend/src/steamfixes/restart.ts +++ b/frontend/src/steamfixes/restart.ts @@ -4,13 +4,6 @@ import Logger from '../logger'; const logger = new Logger('RestartSteamFix'); -declare global { - interface Window { - SteamClient: any; - appDetailsStore: any; - } -} - let patch: Patch; function rePatch() { diff --git a/frontend/src/tabs-hook.tsx b/frontend/src/tabs-hook.tsx index d9c76ca6..3498b1aa 100644 --- a/frontend/src/tabs-hook.tsx +++ b/frontend/src/tabs-hook.tsx @@ -128,22 +128,23 @@ class TabsHook extends Logger { let deckyTabAmount = existingTabs.reduce((prev: any, cur: any) => (cur.decky ? prev + 1 : prev), 0); if (deckyTabAmount == this.tabs.length) { for (let tab of existingTabs) { - if (tab?.decky) tab.panel.props.setter[0](visible); + if (tab?.decky && tab?.qAMVisibilitySetter) tab?.qAMVisibilitySetter(visible); } return; } for (const { title, icon, content, id } of this.tabs) { - existingTabs.push({ + const tab: any = { key: id, title, tab: icon, decky: true, - panel: ( - <QuickAccessVisibleStateProvider initial={visible} setter={[]}> - {content} - </QuickAccessVisibleStateProvider> - ), - }); + }; + tab.panel = ( + <QuickAccessVisibleStateProvider initial={visible} tab={tab}> + {content} + </QuickAccessVisibleStateProvider> + ); + existingTabs.push(tab); } } } diff --git a/frontend/src/utils/windows.ts b/frontend/src/utils/windows.ts index 2b5181d8..a08f304a 100644 --- a/frontend/src/utils/windows.ts +++ b/frontend/src/utils/windows.ts @@ -1,7 +1,9 @@ +import { getFocusNavController } from '../../../../lib/dist'; + export function findSP(): Window { // old (SP as host) if (document.title == 'SP') return window; // new (SP as popup) - return FocusNavController.m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root + return getFocusNavController().m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root .Element.ownerDocument.defaultView; } |
