From e63c4a4a9c7dac19f62eb5c3c9526fe225587b51 Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Fri, 2 Aug 2024 15:19:09 +0200 Subject: [PATCH] fix: fixed merging issues --- src/ui/main/apply_mfplat_patch.rs | 36 ------------------------------- src/ui/main/download_diff.rs | 4 ++-- src/ui/main/download_wine.rs | 2 +- src/ui/main/mod.rs | 27 +---------------------- src/ui/main/repair_game.rs | 2 ++ src/ui/main/update_patch.rs | 2 +- 6 files changed, 7 insertions(+), 66 deletions(-) delete mode 100644 src/ui/main/apply_mfplat_patch.rs diff --git a/src/ui/main/apply_mfplat_patch.rs b/src/ui/main/apply_mfplat_patch.rs deleted file mode 100644 index 775bec0d..00000000 --- a/src/ui/main/apply_mfplat_patch.rs +++ /dev/null @@ -1,36 +0,0 @@ -use relm4::prelude::*; - -use anime_launcher_sdk::anime_game_core::prelude::*; - -use anime_launcher_sdk::config::ConfigExt; -use anime_launcher_sdk::honkai::config::Config; - -use crate::*; - -use super::{App, AppMsg}; - -pub fn apply_mfplat_patch(sender: ComponentSender) { - sender.input(AppMsg::DisableButtons(true)); - - let config = Config::get().unwrap(); - - std::thread::spawn(move || { - let temp = config.launcher.temp.clone() - .unwrap_or_else(std::env::temp_dir); - - if let Err(err) = mfplat::apply(config.get_wine_prefix_path(), temp) { - tracing::error!("Failed to patch the game"); - - sender.input(AppMsg::Toast { - title: tr!("game-patching-error"), - description: Some(err.to_string()) - }); - } - - sender.input(AppMsg::DisableButtons(false)); - sender.input(AppMsg::UpdateLauncherState { - perform_on_download_needed: false, - show_status_page: true - }); - }); -} diff --git a/src/ui/main/download_diff.rs b/src/ui/main/download_diff.rs index 55aa3b1e..d775ee6b 100644 --- a/src/ui/main/download_diff.rs +++ b/src/ui/main/download_diff.rs @@ -32,7 +32,7 @@ pub fn download_diff(sender: ComponentSender, progress_bar_input: Sender { + InstallerUpdate::DownloadingError(err) => { tracing::error!("Downloading failed: {err}"); sender.input(AppMsg::Toast { @@ -41,7 +41,7 @@ pub fn download_diff(sender: ComponentSender, progress_bar_input: Sender { + InstallerUpdate::UnpackingError(err) => { tracing::error!("Unpacking failed: {err}"); sender.input(AppMsg::Toast { diff --git a/src/ui/main/download_wine.rs b/src/ui/main/download_wine.rs index 8297ae8d..93d28d16 100644 --- a/src/ui/main/download_wine.rs +++ b/src/ui/main/download_wine.rs @@ -87,7 +87,7 @@ pub fn download_wine(sender: ComponentSender, progress_bar_input: Sender "document-save-symbolic", Some(LauncherState::GameUpdateAvailable(_)) | - Some(LauncherState::GameNotInstalled(_)) | - Some(LauncherState::MfplatPatchAvailable) => "document-save-symbolic", + Some(LauncherState::GameNotInstalled(_)) => "document-save-symbolic", Some(LauncherState::PatchBroken) | Some(LauncherState::PatchUnsafe) | @@ -331,7 +329,6 @@ impl SimpleComponent for App { Some(LauncherState::PatchNotVerified) | Some(LauncherState::PatchConcerning) => tr!("launch"), - Some(LauncherState::MfplatPatchAvailable) => tr!("apply-patch"), Some(LauncherState::WineNotInstalled) => tr!("download-wine"), Some(LauncherState::PrefixNotExists) => tr!("create-prefix"), Some(LauncherState::GameNotInstalled(_)) => tr!("download"), @@ -761,20 +758,6 @@ impl SimpleComponent for App { sender, move || { - // Check mfplay patch - match mfplat::is_applied(CONFIG.get_wine_prefix_path()) { - Ok(applied) => sender.input(AppMsg::SetMfplatPatch(applied)), - - Err(err) => { - tracing::error!("Failed to check mfplat patch status: {err}"); - - sender.input(AppMsg::Toast { - title: tr!("patch-state-check-failed"), - description: Some(err.to_string()) - }); - } - } - // Get main patch status sender.input(AppMsg::SetMainPatch(match jadeite::get_metadata() { Ok(metadata) => { @@ -869,12 +852,6 @@ impl SimpleComponent for App { sender.input(AppMsg::SetLoadingStatus(Some(Some(tr!("loading-launcher-state--game"))))); } - StateUpdating::Voice(locale) => { - sender.input(AppMsg::SetLoadingStatus(Some(Some(tr!("loading-launcher-state--voice", { - "locale" = locale.to_name() - }))))); - } - StateUpdating::Patch => { sender.input(AppMsg::SetLoadingStatus(Some(Some(tr!("loading-launcher-state--patch"))))); } @@ -969,8 +946,6 @@ impl SimpleComponent for App { LauncherState::PatchConcerning | LauncherState::Launch => launch::launch(sender), - LauncherState::MfplatPatchAvailable => apply_mfplat_patch::apply_mfplat_patch(sender), - LauncherState::PatchNotInstalled | LauncherState::PatchUpdateAvailable => update_patch::update_patch(sender, self.progress_bar.sender().to_owned()), diff --git a/src/ui/main/repair_game.rs b/src/ui/main/repair_game.rs index 3742f688..8d4a6010 100644 --- a/src/ui/main/repair_game.rs +++ b/src/ui/main/repair_game.rs @@ -3,6 +3,8 @@ use relm4::{ Sender }; +use gtk::glib::clone; + use anime_launcher_sdk::config::ConfigExt; use anime_launcher_sdk::honkai::config::Config; diff --git a/src/ui/main/update_patch.rs b/src/ui/main/update_patch.rs index b9ba48a8..60e2556f 100644 --- a/src/ui/main/update_patch.rs +++ b/src/ui/main/update_patch.rs @@ -45,7 +45,7 @@ pub fn update_patch(sender: ComponentSender, progress_bar_input: Sender