feat(genshin): updated dawn patch
This commit is contained in:
parent
e46f42674d
commit
f8e0b67cc6
3 changed files with 36 additions and 32 deletions
|
@ -9,7 +9,7 @@ edition = "2021"
|
|||
|
||||
[dependencies.anime-game-core]
|
||||
git = "https://github.com/an-anime-team/anime-game-core"
|
||||
tag = "1.12.6"
|
||||
tag = "1.13.0"
|
||||
features = ["all"]
|
||||
|
||||
# path = "../anime-game-core" # ! for dev purposes only
|
||||
|
|
|
@ -9,9 +9,9 @@ use crate::genshin::consts::launcher_dir;
|
|||
pub struct Patch {
|
||||
pub path: PathBuf,
|
||||
pub servers: Vec<String>,
|
||||
pub apply_main: bool,
|
||||
pub apply_xlua: bool,
|
||||
pub root: bool
|
||||
pub apply: bool,
|
||||
pub root: bool,
|
||||
pub disable_mhypbase: bool
|
||||
}
|
||||
|
||||
impl Default for Patch {
|
||||
|
@ -27,11 +27,12 @@ impl Default for Patch {
|
|||
String::from("https://notabug.org/Krock/dawn")
|
||||
],
|
||||
|
||||
apply_main: true,
|
||||
apply_xlua: false,
|
||||
apply: true,
|
||||
|
||||
// Disable root requirement for patching if we're running launcher in flatpak
|
||||
root: !PathBuf::from("/.flatpak-info").exists()
|
||||
root: !PathBuf::from("/.flatpak-info").exists(),
|
||||
|
||||
disable_mhypbase: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,19 +68,26 @@ 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: match value.get("apply") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.apply),
|
||||
|
||||
apply_xlua: match value.get("apply_xlua") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.apply_xlua),
|
||||
None => default.apply_xlua
|
||||
// Migration from 1.7.8 to 1.8.0
|
||||
// Xlua patch doesn't exist now so there's only one patch
|
||||
// and thus it's main, and doesn't need this suffix here
|
||||
None => match value.get("apply_main") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.apply),
|
||||
None => default.apply
|
||||
}
|
||||
},
|
||||
|
||||
root: match value.get("root") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.root),
|
||||
None => default.root
|
||||
},
|
||||
|
||||
disable_mhypbase: match value.get("disable_mhypbase") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.disable_mhypbase),
|
||||
None => default.disable_mhypbase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,10 @@ pub enum LauncherState {
|
|||
cleanup_folder: Option<PathBuf>
|
||||
},
|
||||
|
||||
UnityPlayerPatchAvailable(UnityPlayerPatch),
|
||||
XluaPatchAvailable(XluaPatch),
|
||||
PlayerPatchAvailable {
|
||||
patch: PlayerPatch,
|
||||
disable_mhypbase: bool
|
||||
},
|
||||
|
||||
#[cfg(feature = "components")]
|
||||
WineNotInstalled,
|
||||
|
@ -66,8 +68,8 @@ pub struct LauncherStateParams<F: Fn(StateUpdating)> {
|
|||
|
||||
pub patch_servers: Vec<String>,
|
||||
pub patch_folder: PathBuf,
|
||||
pub use_main_patch: bool,
|
||||
pub use_xlua_patch: bool,
|
||||
pub use_patch: bool,
|
||||
pub disable_mhypbase: bool,
|
||||
|
||||
pub status_updater: F
|
||||
}
|
||||
|
@ -151,20 +153,14 @@ impl LauncherState {
|
|||
}
|
||||
|
||||
// Check UnityPlayer patch
|
||||
if params.use_main_patch {
|
||||
let player_patch = patch.unity_player_patch()?;
|
||||
if params.use_patch {
|
||||
let player_patch = patch.player_patch()?;
|
||||
|
||||
if !player_patch.is_applied(¶ms.game_path)? {
|
||||
return Ok(Self::UnityPlayerPatchAvailable(player_patch));
|
||||
}
|
||||
}
|
||||
|
||||
// Check xlua patch
|
||||
if params.use_xlua_patch {
|
||||
let xlua_patch = patch.xlua_patch()?;
|
||||
|
||||
if !xlua_patch.is_applied(¶ms.game_path)? {
|
||||
return Ok(Self::XluaPatchAvailable(xlua_patch));
|
||||
return Ok(Self::PlayerPatchAvailable {
|
||||
patch: player_patch,
|
||||
disable_mhypbase: params.disable_mhypbase
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,8 +218,8 @@ 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,
|
||||
use_patch: config.patch.apply,
|
||||
disable_mhypbase: config.patch.disable_mhypbase,
|
||||
|
||||
status_updater
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue