forked from akanyan/STARTLINER
feat: diagnostic exports
This commit is contained in:
@ -480,13 +480,18 @@ pub async fn create_shortcut(_app: AppHandle, profile_meta: ProfileMeta) -> Resu
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn export_profile(state: State<'_, Mutex<AppData>>, export_keychip: bool, files: Vec<String>) -> Result<(), String> {
|
||||
pub async fn export_profile(
|
||||
state: State<'_, Mutex<AppData>>,
|
||||
is_diagnostic: bool,
|
||||
export_keychip: bool,
|
||||
files: Vec<String>
|
||||
) -> Result<(), String> {
|
||||
log::debug!("invoke: export_profile({:?}, {:?} files)", export_keychip, files.len());
|
||||
|
||||
let appd = state.lock().await;
|
||||
match &appd.profile {
|
||||
Some(p) => {
|
||||
p.export(export_keychip, files)
|
||||
p.export(export_keychip, files, is_diagnostic)
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
None => {
|
||||
|
@ -29,6 +29,10 @@ impl PatchFileVec {
|
||||
}
|
||||
|
||||
pub fn find_patches(&self, target: impl AsRef<Path>) -> Result<Vec<Patch>> {
|
||||
if !target.as_ref().exists() {
|
||||
log::warn!("invalid target path: {:?}", target.as_ref());
|
||||
anyhow::bail!("Unable to open {:?}. Make sure the game path is correct.", target.as_ref());
|
||||
}
|
||||
let checksum = try_digest(target.as_ref())?;
|
||||
|
||||
let mut res_patches = Vec::new();
|
||||
|
@ -36,7 +36,7 @@ impl Profile {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
pub fn export(&self, export_keychip: bool, extra_files: Vec<String>) -> anyhow::Result<()> {
|
||||
pub fn export(&self, export_keychip: bool, extra_files: Vec<String>, is_diagnostic: bool) -> anyhow::Result<()> {
|
||||
let mut prf = self.clone();
|
||||
|
||||
let dir = util::config_dir().join("exports");
|
||||
@ -45,7 +45,7 @@ impl Profile {
|
||||
std::fs::create_dir(&dir)?;
|
||||
}
|
||||
|
||||
let path = dir.join(format!("{}-{}-template.zip", &self.meta.game, &self.meta.name));
|
||||
let path = dir.join(format!("{}-{}-{}.zip", &self.meta.game, &self.meta.name, if is_diagnostic { "diagnostic" } else { "template" } ));
|
||||
|
||||
{
|
||||
let sgt = &mut prf.data.sgt;
|
||||
@ -66,7 +66,7 @@ impl Profile {
|
||||
if network.local_path.is_absolute() {
|
||||
network.local_path = PathBuf::new();
|
||||
}
|
||||
if !export_keychip {
|
||||
if !export_keychip || is_diagnostic {
|
||||
network.keychip = String::new();
|
||||
}
|
||||
}
|
||||
@ -83,6 +83,29 @@ impl Profile {
|
||||
zip.write_all(&std::fs::read(self.config_dir().join(file))?)?;
|
||||
}
|
||||
|
||||
if is_diagnostic {
|
||||
let name = "mu3.exe.log";
|
||||
let path = self.data_dir().join(name);
|
||||
if path.exists() {
|
||||
zip.start_file(name, options)?;
|
||||
zip.write_all(&std::fs::read(path)?)?;
|
||||
}
|
||||
|
||||
let name = "chusanApp.exe.log";
|
||||
let path = self.data_dir().join(name);
|
||||
if path.exists() {
|
||||
zip.start_file(name, options)?;
|
||||
zip.write_all(&std::fs::read(path)?)?;
|
||||
}
|
||||
|
||||
let name = "amdaemon.exe.log";
|
||||
let path = self.data_dir().join(name);
|
||||
if path.exists() {
|
||||
zip.start_file(name, options)?;
|
||||
zip.write_all(&std::fs::read(path)?)?;
|
||||
}
|
||||
}
|
||||
|
||||
zip.finish()?;
|
||||
|
||||
Ok(())
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "STARTLINER",
|
||||
"version": "0.18.3",
|
||||
"version": "0.19.0",
|
||||
"identifier": "zip.patafour.startliner",
|
||||
"build": {
|
||||
"beforeDevCommand": "bun run dev",
|
||||
|
Reference in New Issue
Block a user