From bd5eb97f6e8f78f37bc10fb27b9f3820dd4e9e55 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Thu, 3 Jul 2025 21:31:27 +0200 Subject: [PATCH] fix: beatmaps, skins and osu info not updating after wizard completed --- src/pages/Launch.svelte | 11 ++++- src/pages/SetupWizard.svelte | 78 ++++++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/src/pages/Launch.svelte b/src/pages/Launch.svelte index 2b7186a..93fc093 100644 --- a/src/pages/Launch.svelte +++ b/src/pages/Launch.svelte @@ -112,6 +112,13 @@ if (beatmapSetCount) { beatmapSets.set(beatmapSetCount); } + + const skinsCount: number | null = await invoke('get_skins_count', { + folder: selectedPath, + }); + if (skinsCount) { + skins.set(skinsCount); + } } }; @@ -153,7 +160,7 @@ } else { launchInfo = 'You are up to date!'; } - } catch(err) { + } catch (err) { console.log(err); toast.error('Hmmm...', { description: 'Failed to check for updates.', @@ -683,7 +690,7 @@ diff --git a/src/pages/SetupWizard.svelte b/src/pages/SetupWizard.svelte index 3243450..ad96af0 100644 --- a/src/pages/SetupWizard.svelte +++ b/src/pages/SetupWizard.svelte @@ -9,16 +9,22 @@ import { Check, CheckCircle, CircleOff, Settings2 } from 'lucide-svelte'; import { open } from '@tauri-apps/plugin-dialog'; import Checkbox from '@/components/ui/checkbox/checkbox.svelte'; - import { cursorSmoothening, customCursor, reduceAnimations, userSettings } from '@/userSettings'; + import { + cursorSmoothening, + customCursor, + osuInstallationPath, + reduceAnimations, + userSettings, + } from '@/userSettings'; import Label from '@/components/ui/label/label.svelte'; - import { beatmapSets, currentView } from '@/global'; + import { beatmapSets, currentView, osuBuild, osuStream, skins } from '@/global'; import Launch from './Launch.svelte'; import Confetti from 'svelte-confetti'; let selectedStep = $state(1); const steps = ['Welcome', 'Locate your osu! Installation', 'Appearance Settings']; - let osuInstallationPath = $state(''); + let osuInstallPath = $state(''); let manualSelect = $state(false); let manualSelectValid = $state(false); let autoDetectedOsuPath = $state(false); @@ -58,30 +64,52 @@ manualSelect = true; if (!validFolder) { manualSelectValid = false; - osuInstallationPath = ''; + osuInstallPath = ''; return; } - osuInstallationPath = selectedPath; + osuInstallPath = selectedPath; autoDetectedOsuPath = false; manualSelectValid = true; - $userSettings.value('osu_installation_path').set(osuInstallationPath); - - const beatmapSetCount: number | null = await invoke('get_beatmapsets_count', { - folder: osuInstallationPath, - }); - if (beatmapSetCount) { - beatmapSets.set(beatmapSetCount); - } } }; + const saveConfig = async () => { + $userSettings.value('osu_installation_path').set(osuInstallPath); + await $userSettings.save(); + osuInstallationPath.set(osuInstallPath); + + const beatmapSetCount: number | null = await invoke('get_beatmapsets_count', { + folder: osuInstallPath, + }); + if (beatmapSetCount) { + beatmapSets.set(beatmapSetCount); + } + + const skinsCount: number | null = await invoke('get_skins_count', { + folder: osuInstallPath, + }); + if (skinsCount) { + skins.set(skinsCount); + } + + const osuReleaseStream: string = await invoke('get_osu_release_stream', { + folder: $osuInstallationPath, + }); + osuStream.set(osuReleaseStream); + const osuVersion: string = await invoke('get_osu_version', { + folder: $osuInstallationPath, + }); + osuBuild.set(osuVersion); + + currentView.set(Launch); + }; + onMount(async () => { - const osuInstallPath: string | null = await invoke('find_osu_installation'); - console.log('osu install path: ' + osuInstallPath); - if (osuInstallPath) { - osuInstallationPath = osuInstallPath; + const osuPath: string | null = await invoke('find_osu_installation'); + if (osuPath) { + osuInstallPath = osuPath; autoDetectedOsuPath = true; - $userSettings.value('osu_installation_path').set(osuInstallationPath); + $userSettings.value('osu_installation_path').set(osuInstallPath); } }); @@ -93,15 +121,7 @@

EZPPLauncher Setup completed!

You are now ready to farm some maps!

- + {:else}
@@ -172,7 +192,7 @@ class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-r-none" type="text" placeholder="Path to osu! installation" - value={osuInstallationPath} + value={osuInstallPath} />