diff --git a/rust/icons/128x128.png b/rust/icons/128x128.png deleted file mode 100644 index 6be5e50..0000000 Binary files a/rust/icons/128x128.png and /dev/null differ diff --git a/rust/icons/128x128@2x.png b/rust/icons/128x128@2x.png deleted file mode 100644 index e81bece..0000000 Binary files a/rust/icons/128x128@2x.png and /dev/null differ diff --git a/rust/icons/32x32.png b/rust/icons/32x32.png deleted file mode 100644 index a437dd5..0000000 Binary files a/rust/icons/32x32.png and /dev/null differ diff --git a/rust/icons/Square107x107Logo.png b/rust/icons/Square107x107Logo.png deleted file mode 100644 index 0ca4f27..0000000 Binary files a/rust/icons/Square107x107Logo.png and /dev/null differ diff --git a/rust/icons/Square142x142Logo.png b/rust/icons/Square142x142Logo.png deleted file mode 100644 index b81f820..0000000 Binary files a/rust/icons/Square142x142Logo.png and /dev/null differ diff --git a/rust/icons/Square150x150Logo.png b/rust/icons/Square150x150Logo.png deleted file mode 100644 index 624c7bf..0000000 Binary files a/rust/icons/Square150x150Logo.png and /dev/null differ diff --git a/rust/icons/Square284x284Logo.png b/rust/icons/Square284x284Logo.png deleted file mode 100644 index c021d2b..0000000 Binary files a/rust/icons/Square284x284Logo.png and /dev/null differ diff --git a/rust/icons/Square30x30Logo.png b/rust/icons/Square30x30Logo.png deleted file mode 100644 index 6219700..0000000 Binary files a/rust/icons/Square30x30Logo.png and /dev/null differ diff --git a/rust/icons/Square310x310Logo.png b/rust/icons/Square310x310Logo.png deleted file mode 100644 index f9bc048..0000000 Binary files a/rust/icons/Square310x310Logo.png and /dev/null differ diff --git a/rust/icons/Square44x44Logo.png b/rust/icons/Square44x44Logo.png deleted file mode 100644 index d5fbfb2..0000000 Binary files a/rust/icons/Square44x44Logo.png and /dev/null differ diff --git a/rust/icons/Square71x71Logo.png b/rust/icons/Square71x71Logo.png deleted file mode 100644 index 63440d7..0000000 Binary files a/rust/icons/Square71x71Logo.png and /dev/null differ diff --git a/rust/icons/Square89x89Logo.png b/rust/icons/Square89x89Logo.png deleted file mode 100644 index f3f705a..0000000 Binary files a/rust/icons/Square89x89Logo.png and /dev/null differ diff --git a/rust/icons/StoreLogo.png b/rust/icons/StoreLogo.png deleted file mode 100644 index 4556388..0000000 Binary files a/rust/icons/StoreLogo.png and /dev/null differ diff --git a/rust/icons/icon.icns b/rust/icons/icon.icns deleted file mode 100644 index 12a5bce..0000000 Binary files a/rust/icons/icon.icns and /dev/null differ diff --git a/rust/icons/icon.ico b/rust/icons/icon.ico deleted file mode 100644 index b3636e4..0000000 Binary files a/rust/icons/icon.ico and /dev/null differ diff --git a/rust/icons/icon.png b/rust/icons/icon.png deleted file mode 100644 index e1cd261..0000000 Binary files a/rust/icons/icon.png and /dev/null differ diff --git a/rust/icons/slow.png b/rust/icons/slow.png new file mode 100644 index 0000000..64b8d7b Binary files /dev/null and b/rust/icons/slow.png differ diff --git a/rust/src/cmd.rs b/rust/src/cmd.rs index 4ab8f4f..a2ee43c 100644 --- a/rust/src/cmd.rs +++ b/rust/src/cmd.rs @@ -9,18 +9,21 @@ use crate::profile::Profile; use crate::appdata::AppData; use crate::{liner, start}; -use tauri::State; +use tauri::{AppHandle, Manager, State}; #[tauri::command] -pub async fn startline(state: State<'_, Mutex>) -> Result<(), String> { +pub async fn startline(app: AppHandle) -> Result<(), String> { log::debug!("invoke: startline"); + let app_copy = app.clone(); + let state = app.state::>(); let appd = state.lock().await; if let Some(p) = &appd.profile { // TODO if p.needsUpdate liner::line_up(p).await.expect("Line-up failed"); - start::start(p).map_err(|e| { log::error!("Error launching: {}", e.to_string()); e.to_string() }).map(|_| ()) + start::start(p, app_copy) + .map_err(|e| { log::error!("Error launching: {}", e.to_string()); e.to_string() }) //Ok(()) } else { Err("No profile".to_owned()) diff --git a/rust/src/pkg_store.rs b/rust/src/pkg_store.rs index 5bd3fe2..a4808a4 100644 --- a/rust/src/pkg_store.rs +++ b/rust/src/pkg_store.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::path::Path; use anyhow::{Result, anyhow}; use serde::{Deserialize, Serialize}; @@ -6,7 +6,7 @@ use tauri::{AppHandle, Emitter}; use tokio::fs; use tokio::task::JoinSet; use crate::model::rainy; -use crate::pkg::{Package, PkgKey}; +use crate::pkg::{Package, PkgKey, Remote}; use crate::util; use crate::download_handler::DownloadHandler; @@ -134,12 +134,14 @@ impl PackageStore { pkg: key.to_owned() })?; - let rmt = pkg.rmt.as_ref() //clone() + let rmt = pkg.rmt.as_ref() .ok_or_else(|| anyhow!("Attempted to install a pkg without remote data"))?; if install_deps { - for dep in &rmt.dependencies { - Box::pin(self.install_package(&dep, false, true)).await?; + let mut set = HashSet::new(); + self.resolve_deps(rmt.clone(), &mut set)?; + for dep in set { + Box::pin(self.install_package(&dep, false, false)).await?; } } @@ -244,4 +246,18 @@ impl PackageStore { Ok(()) } + + fn resolve_deps(&self, rmt: Remote, set: &mut HashSet) -> Result<()> { + for d in rmt.dependencies { + set.insert(d.clone()); + let subrmt = self.store.get(&d) + .ok_or_else(|| anyhow!("Attempted to delete a nonexistent pkg"))? + .rmt + .clone() + .ok_or_else(|| anyhow!("Attempted to resolve deps without fetching"))?; + self.resolve_deps(subrmt, set)?; + } + + Ok(()) + } } diff --git a/rust/src/start.rs b/rust/src/start.rs index eb8743c..5a1bfa8 100644 --- a/rust/src/start.rs +++ b/rust/src/start.rs @@ -1,18 +1,32 @@ use anyhow::Result; use tokio::process::Command; +use tauri::{AppHandle, Emitter}; use crate::profile::Profile; use crate::util; #[cfg(target_os = "linux")] -pub fn start(p: &Profile) -> Result<()> { - Command::new(p.wine_runtime.as_ref().unwrap()) - .env( - "SEGATOOLS_CONFIG_PATH", - util::profile_dir(&p).join("segatools.ini"), - ) - .env("WINEPREFIX", p.wine_prefix.as_ref().unwrap()) - .arg(p.exe_dir.join("start.bat")) - .spawn()?; +pub fn start(p: &Profile, app: AppHandle) -> Result<()> { + let p = p.clone(); + tauri::async_runtime::spawn(async move { + let rv = Command::new(p.wine_runtime.as_ref().unwrap()) + .env( + "SEGATOOLS_CONFIG_PATH", + util::profile_dir(&p).join("segatools.ini"), + ) + .env("WINEPREFIX", p.wine_prefix.as_ref().unwrap()) + .arg(p.exe_dir.join("start.bat")) + .spawn(); + match rv { + Ok(mut child) => { + _ = child.wait().await; + log::debug!("Fin"); + }, + Err(e) => { + log::error!("Fail: {}", e); + } + } + _ = app.emit("launch-end", ""); + }); Ok(()) } @@ -72,6 +86,8 @@ pub fn start(p: &Profile) -> Result<()> { set.join_next().await.expect("No spawn").expect("No result"); log::debug!("Fin"); + + app.emit("launch-end", ""); }); Ok(()) diff --git a/rust/tauri.conf.json b/rust/tauri.conf.json index b285737..88fe22d 100644 --- a/rust/tauri.conf.json +++ b/rust/tauri.conf.json @@ -42,12 +42,6 @@ "bundle": { "active": true, "targets": "all", - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ] + "icon": ["icons/slow.png"] } } diff --git a/src/components/App.vue b/src/components/App.vue index 11eb019..5db382c 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -7,6 +7,7 @@ import TabPanel from 'primevue/tabpanel'; import TabPanels from 'primevue/tabpanels'; import Tabs from 'primevue/tabs'; import { invoke } from '@tauri-apps/api/core'; +import { listen } from '@tauri-apps/api/event'; import { onOpenUrl } from '@tauri-apps/plugin-deep-link'; import { open } from '@tauri-apps/plugin-dialog'; import ModList from './ModList.vue'; @@ -19,6 +20,7 @@ const store = usePkgStore(); store.setupListeners(); const currentTab = ref('3'); +const startEnabled = ref(true); const loadProfile = async () => { await store.reloadProfile(); @@ -49,9 +51,8 @@ const loadProfile = async () => { const isProfileDisabled = computed(() => store.profile === null); const startline = async () => { + startEnabled.value = false; await invoke('startline'); - - //startDisabled.value = true; }; onOpenUrl((urls) => { @@ -61,6 +62,10 @@ onOpenUrl((urls) => { onMounted(async () => { await loadProfile(); }); + +listen('launch-end', () => { + startEnabled.value = true; +});