From c3a6cf37de990dd1a6abc472b43227904407dbbc Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Wed, 3 Aug 2022 10:49:13 +0200 Subject: [PATCH] 0.6.2 - updated core library; now launcher will check available free space before downloading anything - added dxvk 1.10.3 From previous commits: - added `WINEARCH=win64` to some places - added `devel` style to `FirstRunApp` if it's debug mode - changed app's id - added xdelta3 requirement during initial setup - added wine & dxvk version selection during initial setup - added "Open launcher folder" button to settings - removed `glib::Downgrade` trait from all the `App`s' `Value`s - removed `tasks` mod; removed `tokio` dependency; rewritten `OpenPreferencesPage` to work with threads instead of futures - added `opt-level = 3` to release profile - upscaled logo to 512x512; added source link - bundled all the UI files into gtk resources --- Cargo.lock | 125 +++++++++++++++++++++++++++- Cargo.toml | 2 +- anime-game-core | 2 +- assets/dxvk.json | 6 ++ src/ui/components/progress_bar.rs | 9 +- src/ui/main.rs | 2 +- src/ui/traits/download_component.rs | 14 ++-- 7 files changed, 145 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf66309..6aef93d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ dependencies = [ [[package]] name = "anime-game-core" -version = "0.1.8" +version = "0.2.2" dependencies = [ "bzip2", "curl", @@ -42,6 +42,7 @@ dependencies = [ "md5", "serde", "serde_json", + "sysinfo", "tar", "uuid", "xz", @@ -50,7 +51,7 @@ dependencies = [ [[package]] name = "anime-game-launcher" -version = "0.6.1" +version = "0.6.2" dependencies = [ "anime-game-core", "dirs", @@ -198,6 +199,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "cpufeatures" version = "0.2.2" @@ -216,6 +223,41 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "once_cell", + "scopeguard", +] + [[package]] name = "crossbeam-utils" version = "0.8.10" @@ -298,6 +340,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + [[package]] name = "field-offset" version = "0.3.4" @@ -671,6 +719,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hmac" version = "0.12.1" @@ -816,6 +873,25 @@ dependencies = [ "adler", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.5.7" @@ -1049,6 +1125,30 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.2.13" @@ -1162,6 +1262,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "sct" version = "0.7.0" @@ -1288,6 +1394,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sysinfo" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373e4bc9213f734126e2be3e2e118dbc9b909c37487d8d755822bc90f70ae62a" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "winapi", +] + [[package]] name = "system-deps" version = "6.0.2" diff --git a/Cargo.toml b/Cargo.toml index 6d465e7..91a54e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anime-game-launcher" -version = "0.6.1" +version = "0.6.2" description = "Anime Game launcher" authors = ["Nikita Podvirnyy "] license = "GPL-3.0" diff --git a/anime-game-core b/anime-game-core index 5abbea2..9820453 160000 --- a/anime-game-core +++ b/anime-game-core @@ -1 +1 @@ -Subproject commit 5abbea2f1152d25c2855c43d55133a3edc414bc0 +Subproject commit 9820453d6fdc5ccdc832fd0a8bbe80e210df2b2e diff --git a/assets/dxvk.json b/assets/dxvk.json index 39e4ffa..ffe22cb 100644 --- a/assets/dxvk.json +++ b/assets/dxvk.json @@ -1,5 +1,11 @@ { "vanilla": [ + { + "name": "dxvk-1.10.3", + "version": "1.10.3", + "uri": "https://github.com/doitsujin/dxvk/releases/download/v1.10.3/dxvk-1.10.3.tar.gz", + "recommended": true + }, { "name": "dxvk-1.10.2", "version": "1.10.2", diff --git a/src/ui/components/progress_bar.rs b/src/ui/components/progress_bar.rs index b52e5d0..7364e7b 100644 --- a/src/ui/components/progress_bar.rs +++ b/src/ui/components/progress_bar.rs @@ -3,8 +3,6 @@ use libadwaita as adw; use gtk::glib; -use std::io::Error; - use anime_game_core::prelude::*; use crate::lib::prettify_bytes::prettify_bytes; @@ -52,7 +50,8 @@ impl ProgressBar { pub fn update_from_state(&self, state: InstallerUpdate) -> ProgressUpdateResult { match state { - InstallerUpdate::DownloadingStarted(_) => self.show(), + InstallerUpdate::CheckingFreeSpace(_) => self.progress_bar.set_text(Some("Checking free space...")), + InstallerUpdate::DownloadingStarted(_) => (), InstallerUpdate::DownloadingProgress(curr, total) => { let progress = curr as f64 / total as f64; @@ -80,9 +79,9 @@ impl ProgressBar { InstallerUpdate::UnpackingStarted(_) => (), InstallerUpdate::DownloadingError(err) => return ProgressUpdateResult::Error(String::from("Failed to download"), err.into()), - InstallerUpdate::UnpackingError => return ProgressUpdateResult::Error(String::from("Failed to unpack"), Error::last_os_error()), + InstallerUpdate::UnpackingError => return ProgressUpdateResult::Error(String::from("Failed to unpack"), std::io::Error::last_os_error()), - InstallerUpdate::UnpackingFinished => return ProgressUpdateResult::Finished + InstallerUpdate::UnpackingFinished => return ProgressUpdateResult::Finished, } ProgressUpdateResult::Updated diff --git a/src/ui/main.rs b/src/ui/main.rs index 5cdc7fa..9d1c43a 100644 --- a/src/ui/main.rs +++ b/src/ui/main.rs @@ -656,7 +656,7 @@ impl App { if !is_patch_applied || !should_ignore(&file.path) { if let Err(err) = file.repair(&config.game.path) { this.update(Actions::Toast(Rc::new(( - String::from("Failed to repair game file"), err + String::from("Failed to repair game file"), err.into() )))).unwrap(); } } diff --git a/src/ui/traits/download_component.rs b/src/ui/traits/download_component.rs index 27bffbf..6f32e63 100644 --- a/src/ui/traits/download_component.rs +++ b/src/ui/traits/download_component.rs @@ -11,7 +11,7 @@ use crate::lib::config; #[derive(Debug)] pub enum DownloadingResult { - DownloadingError(std::io::Error), + DownloadingError(DownloadingError), UnpackingError, Done } @@ -40,30 +40,34 @@ pub trait DownloadComponent { InstallerUpdate::DownloadingFinished => (), InstallerUpdate::UnpackingStarted(_) => (), + InstallerUpdate::CheckingFreeSpace(_) => { + progress_bar.set_text(Some("Checking free space...")); + } + InstallerUpdate::DownloadingProgress(curr, total) => { let progress = curr as f64 / total as f64; progress_bar.set_fraction(progress); progress_bar.set_text(Some(&format!("Downloading: {}%", (progress * 100.0) as u64))); - }, + } InstallerUpdate::UnpackingProgress(curr, total) => { let progress = curr as f64 / total as f64; progress_bar.set_fraction(progress); progress_bar.set_text(Some(&format!("Unpacking: {}%", (progress * 100.0) as u64))); - }, + } InstallerUpdate::UnpackingFinished => { progress_bar.set_visible(false); button.set_visible(true); downl_send.send(DownloadingResult::Done).unwrap(); - }, + } InstallerUpdate::DownloadingError(err) => { downl_send.send(DownloadingResult::DownloadingError(err.into())).unwrap(); - }, + } InstallerUpdate::UnpackingError => { downl_send.send(DownloadingResult::UnpackingError).unwrap();