diff --git a/Cargo.toml b/Cargo.toml index cd1eda3..3aa82a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anime-launcher-sdk" -version = "1.4.4" +version = "1.4.5" authors = ["Nikita Podvirnyy "] license = "GPL-3.0" readme = "README.md" @@ -8,7 +8,7 @@ edition = "2021" [dependencies.anime-game-core] git = "https://github.com/an-anime-team/anime-game-core" -tag = "1.10.2" +tag = "1.10.3" features = ["all"] # path = "../anime-game-core" # ! for dev purposes only diff --git a/src/games/genshin/config/schema/patch.rs b/src/games/genshin/config/schema/patch.rs index 4ce292a..dae0ccb 100644 --- a/src/games/genshin/config/schema/patch.rs +++ b/src/games/genshin/config/schema/patch.rs @@ -9,6 +9,7 @@ use crate::genshin::consts::launcher_dir; pub struct Patch { pub path: PathBuf, pub servers: Vec, + pub apply_main: bool, pub apply_xlua: bool, pub root: bool } @@ -26,6 +27,7 @@ impl Default for Patch { String::from("https://notabug.org/Krock/dawn") ], + apply_main: true, apply_xlua: false, // Disable root requirement for patching if we're running launcher in flatpak @@ -70,6 +72,11 @@ impl From<&JsonValue> for Patch { None => default.servers }, + apply_main: match value.get("apply_main") { + Some(value) => value.as_bool().unwrap_or(default.apply_main), + None => default.apply_main + }, + apply_xlua: match value.get("apply_xlua") { Some(value) => value.as_bool().unwrap_or(default.apply_xlua), None => default.apply_xlua diff --git a/src/games/genshin/states.rs b/src/games/genshin/states.rs index 6b9b685..2c0a1d2 100644 --- a/src/games/genshin/states.rs +++ b/src/games/genshin/states.rs @@ -68,6 +68,7 @@ pub struct LauncherStateParams { pub patch_servers: Vec, pub patch_folder: PathBuf, + pub use_main_patch: bool, pub use_xlua_patch: bool, pub status_updater: F @@ -152,10 +153,12 @@ impl LauncherState { } // Check UnityPlayer patch - let player_patch = patch.unity_player_patch()?; + if params.use_main_patch { + let player_patch = patch.unity_player_patch()?; - if !player_patch.is_applied(¶ms.game_path)? { - return Ok(Self::UnityPlayerPatchAvailable(player_patch)); + if !player_patch.is_applied(¶ms.game_path)? { + return Ok(Self::UnityPlayerPatchAvailable(player_patch)); + } } // Check xlua patch @@ -221,6 +224,7 @@ impl LauncherState { patch_servers: config.patch.servers, patch_folder: config.patch.path, + use_main_patch: config.patch.apply_main, use_xlua_patch: config.patch.apply_xlua, status_updater