forked from akanyan/STARTLINER
feat: chusanApp.exe patching
This commit is contained in:
@ -8,9 +8,10 @@ use tauri::{AppHandle, Manager, State};
|
||||
use crate::model::config::GlobalConfigField;
|
||||
use crate::model::misc::Game;
|
||||
use crate::model::patch::Patch;
|
||||
use crate::modules::package::prepare_dlls;
|
||||
use crate::pkg::{Package, PkgKey};
|
||||
use crate::pkg_store::{InstallResult, PackageStore};
|
||||
use crate::profiles::{self, Profile, ProfileData, ProfileMeta, ProfilePaths};
|
||||
use crate::profiles::{self, Profile, ProfileData, ProfileMeta, ProfilePaths, StartPayload};
|
||||
use crate::appdata::{AppData, ToggleAction};
|
||||
use crate::model::misc::StartCheckError;
|
||||
use crate::util;
|
||||
@ -59,18 +60,40 @@ pub async fn startline(app: AppHandle, refresh: bool) -> Result<(), String> {
|
||||
let state = app.state::<Mutex<AppData>>();
|
||||
let mut hash = "".to_owned();
|
||||
|
||||
let mut appd = state.lock().await;
|
||||
let appd = state.lock().await;
|
||||
let mut game_dlls = Vec::new();
|
||||
let mut amd_dlls = Vec::new();
|
||||
if let Some(p) = &appd.profile {
|
||||
hash = appd.sum_packages(p);
|
||||
(game_dlls, amd_dlls) = prepare_dlls(p.mod_pkgs(), &appd.pkgs).map_err(|e| e.to_string())?
|
||||
}
|
||||
if let Some(p) = &mut appd.profile {
|
||||
if let Some(p) = &appd.profile {
|
||||
log::debug!("{}", hash);
|
||||
p.line_up(hash, refresh, app.clone()).await
|
||||
let info = p.prepare_display()
|
||||
.map_err(|e| e.to_string())?;
|
||||
let lineup_res = p.line_up(hash, refresh, &appd.patch_vec).await
|
||||
.map_err(|e| e.to_string());
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
if let Some(info) = info {
|
||||
use crate::model::profile::Display;
|
||||
if lineup_res.is_ok() {
|
||||
Display::wait_for_exit(app.clone(), info);
|
||||
} else {
|
||||
Display::clean_up(&info).map_err(|e| e.to_string())?;
|
||||
}
|
||||
}
|
||||
|
||||
lineup_res?;
|
||||
|
||||
let app_clone = app.clone();
|
||||
let p_clone = p.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
if let Err(e) = p_clone.start(app_clone).await {
|
||||
if let Err(e) = p_clone.start(StartPayload {
|
||||
app: app_clone,
|
||||
game_dlls,
|
||||
amd_dlls
|
||||
}).await {
|
||||
log::error!("Startup failed:\n{}", e);
|
||||
}
|
||||
});
|
||||
@ -152,6 +175,10 @@ pub async fn get_all_packages(state: State<'_, Mutex<AppData>>) -> Result<HashMa
|
||||
|
||||
let appd = state.lock().await;
|
||||
|
||||
let pkgs_all = appd.pkgs.get_all();
|
||||
|
||||
log::debug!("pkgs_all: {:?}", pkgs_all);
|
||||
|
||||
Ok(appd.pkgs.get_all())
|
||||
}
|
||||
|
||||
@ -466,7 +493,7 @@ pub async fn list_patches(state: State<'_, Mutex<AppData>>, target: String) -> R
|
||||
|
||||
let mut appd = state.lock().await;
|
||||
appd.fix();
|
||||
let list = appd.patch_set.find_patches(target).map_err(|e| e.to_string())?;
|
||||
let list = appd.patch_vec.find_patches(target).map_err(|e| e.to_string())?;
|
||||
|
||||
Ok(list)
|
||||
}
|
Reference in New Issue
Block a user