From 2d1890645dcf3be72710b70b4752553e385cfd54 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Tue, 2 Dec 2025 00:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=99=A8=E5=BC=82=E5=B8=B8=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/Cargo.lock | 16 +-------------- src-tauri/Cargo.toml | 2 -- src-tauri/src/yae/mod.rs | 41 ++------------------------------------ src-tauri/src/yae/proto.rs | 5 +++++ 4 files changed, 8 insertions(+), 56 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b3141e0b..cd0eea89 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -7,7 +7,6 @@ name = "TeyvatGuide" version = "0.8.6" dependencies = [ "chrono", - "libloading 0.8.9", "log", "prost", "prost-types", @@ -27,7 +26,6 @@ dependencies = [ "tauri-plugin-single-instance", "tauri-plugin-sql", "tauri-utils", - "tokio", "url", "walkdir", "windows-sys 0.61.2", @@ -2323,7 +2321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" dependencies = [ "gtk-sys", - "libloading 0.7.4", + "libloading", "once_cell", ] @@ -2343,16 +2341,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - [[package]] name = "libm" version = "0.2.15" @@ -5462,9 +5450,7 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.61.2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 3df47989..935e1484 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -21,7 +21,6 @@ tauri-build = { version = "2.5.2", features = [] } [dependencies] chrono = "0.4.42" -libloading = "0.8" log = "0.4.28" prost = "0.14.1" prost-types = "0.14.1" @@ -29,7 +28,6 @@ serde = { version = "1.0.228", features = ["derive"] } serde_json = "1.0.145" tauri = { version = "2.9.3", features = [] } tauri-utils = "2.8.0" -tokio = { version = "1.48.0", features = ["full"] } url = "2.5.7" walkdir = "2.5.0" diff --git a/src-tauri/src/yae/mod.rs b/src-tauri/src/yae/mod.rs index e3bedfe6..8e698c71 100644 --- a/src-tauri/src/yae/mod.rs +++ b/src-tauri/src/yae/mod.rs @@ -40,43 +40,6 @@ fn read_conf(path: &str) -> i32 { current.as_i64().unwrap_or(0) as i32 } -pub fn parse_achievement_data(bytes: &[u8]) -> Vec> { - let mut cursor = std::io::Cursor::new(bytes); - let mut data = Vec::new(); - let mut err_times = 0; - - while let Ok((tag, wire_type)) = decode_key(&mut cursor) { - if wire_type == WireType::LengthDelimited { - let len = prost::encoding::decode_varint(&mut cursor).unwrap() as usize; - let mut buf = vec![0u8; len]; - if cursor.read_exact(&mut buf).is_err() { - continue; - } - - let mut inner = std::io::Cursor::new(&buf); - let mut dict = HashMap::new(); - while let Ok((inner_tag, inner_type)) = decode_key(&mut inner) { - if inner_type != WireType::Varint { - dict.clear(); - break; - } - let value = prost::encoding::decode_varint(&mut inner).unwrap() as u32; - dict.insert(inner_tag, value); - } - - if dict.len() >= 3 { - data.push(dict); - } else if err_times == 0 { - err_times += 1; - } else { - break; - } - } - } - - data -} - fn read_u32_le(r: &mut R) -> io::Result { let mut buf = [0u8; 4]; match r.read_exact(&mut buf) { @@ -170,7 +133,7 @@ pub fn call_yae_dll(app_handle: AppHandle, game_path: String) -> () { Ok(list) => { println!("解码成功,成就列表长度: {}", list.len()); let json = serde_json::to_string_pretty(&list).unwrap(); - app_handle.emit("yae_achi_list", json); + let _ = app_handle.emit("yae_achi_list", json); } Err(e) => println!("解析失败: {:?}", e), } @@ -186,7 +149,7 @@ pub fn call_yae_dll(app_handle: AppHandle, game_path: String) -> () { // 读取剩余数据 match read_u32_le(&mut file) { Ok(len) => match read_exact_vec(&mut file, len as usize) { - Ok(data) => println!("长度: {}", len), + Ok(_data) => println!("长度: {}", len), Err(e) => println!("读取数据失败: {:?}", e), }, Err(e) => println!("读取长度失败: {:?}", e), diff --git a/src-tauri/src/yae/proto.rs b/src-tauri/src/yae/proto.rs index f4430256..a54b151d 100644 --- a/src-tauri/src/yae/proto.rs +++ b/src-tauri/src/yae/proto.rs @@ -8,6 +8,7 @@ use serde::Serialize; use std::collections::HashMap; use std::io::{Cursor, Read}; +#[allow(dead_code)] #[derive(Clone, PartialEq, Message, Serialize)] pub struct AchievementProtoFieldInfo { #[prost(uint32, tag = "1")] @@ -26,6 +27,7 @@ pub struct AchievementProtoFieldInfo { pub finish_timestamp: u32, } +#[allow(dead_code)] #[derive(Clone, PartialEq, Message, Serialize)] pub struct AchievementItem { #[prost(uint32, tag = "1")] @@ -41,6 +43,7 @@ pub struct AchievementItem { pub description: String, } +#[allow(dead_code)] #[derive(Clone, PartialEq, Message, Serialize)] pub struct MethodRvaConfig { #[prost(uint32, tag = "1")] @@ -74,6 +77,7 @@ pub struct MethodRvaConfig { pub decompress: u32, } +#[allow(dead_code)] #[derive(Clone, PartialEq, Message, Serialize)] pub struct NativeLibConfig { #[prost(uint32, tag = "1")] @@ -86,6 +90,7 @@ pub struct NativeLibConfig { pub method_rva: HashMap, } +#[allow(dead_code)] #[derive(Clone, PartialEq, Message, Serialize)] pub struct AchievementInfo { #[prost(string, tag = "1")]