🚨 修复编译器异常,移除多余依赖

This commit is contained in:
BTMuli
2025-12-02 00:05:13 +08:00
committed by 目棃
parent 38f3301664
commit 2d1890645d
4 changed files with 8 additions and 56 deletions

16
src-tauri/Cargo.lock generated
View File

@@ -7,7 +7,6 @@ name = "TeyvatGuide"
version = "0.8.6" version = "0.8.6"
dependencies = [ dependencies = [
"chrono", "chrono",
"libloading 0.8.9",
"log", "log",
"prost", "prost",
"prost-types", "prost-types",
@@ -27,7 +26,6 @@ dependencies = [
"tauri-plugin-single-instance", "tauri-plugin-single-instance",
"tauri-plugin-sql", "tauri-plugin-sql",
"tauri-utils", "tauri-utils",
"tokio",
"url", "url",
"walkdir", "walkdir",
"windows-sys 0.61.2", "windows-sys 0.61.2",
@@ -2323,7 +2321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf"
dependencies = [ dependencies = [
"gtk-sys", "gtk-sys",
"libloading 0.7.4", "libloading",
"once_cell", "once_cell",
] ]
@@ -2343,16 +2341,6 @@ dependencies = [
"winapi", "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]] [[package]]
name = "libm" name = "libm"
version = "0.2.15" version = "0.2.15"
@@ -5462,9 +5450,7 @@ dependencies = [
"bytes", "bytes",
"libc", "libc",
"mio", "mio",
"parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.61.2", "windows-sys 0.61.2",

View File

@@ -21,7 +21,6 @@ tauri-build = { version = "2.5.2", features = [] }
[dependencies] [dependencies]
chrono = "0.4.42" chrono = "0.4.42"
libloading = "0.8"
log = "0.4.28" log = "0.4.28"
prost = "0.14.1" prost = "0.14.1"
prost-types = "0.14.1" prost-types = "0.14.1"
@@ -29,7 +28,6 @@ serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.145" serde_json = "1.0.145"
tauri = { version = "2.9.3", features = [] } tauri = { version = "2.9.3", features = [] }
tauri-utils = "2.8.0" tauri-utils = "2.8.0"
tokio = { version = "1.48.0", features = ["full"] }
url = "2.5.7" url = "2.5.7"
walkdir = "2.5.0" walkdir = "2.5.0"

View File

@@ -40,43 +40,6 @@ fn read_conf(path: &str) -> i32 {
current.as_i64().unwrap_or(0) as i32 current.as_i64().unwrap_or(0) as i32
} }
pub fn parse_achievement_data(bytes: &[u8]) -> Vec<HashMap<u32, u32>> {
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: Read>(r: &mut R) -> io::Result<u32> { fn read_u32_le<R: Read>(r: &mut R) -> io::Result<u32> {
let mut buf = [0u8; 4]; let mut buf = [0u8; 4];
match r.read_exact(&mut buf) { match r.read_exact(&mut buf) {
@@ -170,7 +133,7 @@ pub fn call_yae_dll(app_handle: AppHandle, game_path: String) -> () {
Ok(list) => { Ok(list) => {
println!("解码成功,成就列表长度: {}", list.len()); println!("解码成功,成就列表长度: {}", list.len());
let json = serde_json::to_string_pretty(&list).unwrap(); 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), 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) { match read_u32_le(&mut file) {
Ok(len) => match read_exact_vec(&mut file, len as usize) { 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),
}, },
Err(e) => println!("读取长度失败: {:?}", e), Err(e) => println!("读取长度失败: {:?}", e),

View File

@@ -8,6 +8,7 @@ use serde::Serialize;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::{Cursor, Read}; use std::io::{Cursor, Read};
#[allow(dead_code)]
#[derive(Clone, PartialEq, Message, Serialize)] #[derive(Clone, PartialEq, Message, Serialize)]
pub struct AchievementProtoFieldInfo { pub struct AchievementProtoFieldInfo {
#[prost(uint32, tag = "1")] #[prost(uint32, tag = "1")]
@@ -26,6 +27,7 @@ pub struct AchievementProtoFieldInfo {
pub finish_timestamp: u32, pub finish_timestamp: u32,
} }
#[allow(dead_code)]
#[derive(Clone, PartialEq, Message, Serialize)] #[derive(Clone, PartialEq, Message, Serialize)]
pub struct AchievementItem { pub struct AchievementItem {
#[prost(uint32, tag = "1")] #[prost(uint32, tag = "1")]
@@ -41,6 +43,7 @@ pub struct AchievementItem {
pub description: String, pub description: String,
} }
#[allow(dead_code)]
#[derive(Clone, PartialEq, Message, Serialize)] #[derive(Clone, PartialEq, Message, Serialize)]
pub struct MethodRvaConfig { pub struct MethodRvaConfig {
#[prost(uint32, tag = "1")] #[prost(uint32, tag = "1")]
@@ -74,6 +77,7 @@ pub struct MethodRvaConfig {
pub decompress: u32, pub decompress: u32,
} }
#[allow(dead_code)]
#[derive(Clone, PartialEq, Message, Serialize)] #[derive(Clone, PartialEq, Message, Serialize)]
pub struct NativeLibConfig { pub struct NativeLibConfig {
#[prost(uint32, tag = "1")] #[prost(uint32, tag = "1")]
@@ -86,6 +90,7 @@ pub struct NativeLibConfig {
pub method_rva: HashMap<u32, MethodRvaConfig>, pub method_rva: HashMap<u32, MethodRvaConfig>,
} }
#[allow(dead_code)]
#[derive(Clone, PartialEq, Message, Serialize)] #[derive(Clone, PartialEq, Message, Serialize)]
pub struct AchievementInfo { pub struct AchievementInfo {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]