modified: Cargo.toml

This commit is contained in:
Michael Wain 2025-03-18 22:49:57 +03:00
parent dfcdc18df8
commit df6981e34d
3 changed files with 16 additions and 14 deletions

2
Cargo.lock generated
View File

@ -353,7 +353,7 @@ dependencies = [
[[package]] [[package]]
name = "nicotine" name = "nicotine"
version = "0.1.17" version = "0.1.18"
dependencies = [ dependencies = [
"zip-extract", "zip-extract",
] ]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "nicotine" name = "nicotine"
version = "0.1.17" version = "0.1.18"
edition = "2024" edition = "2024"
description = "A small rust crate for patching mojang's Authlib" description = "A small rust crate for patching mojang's Authlib"
authors = ["alterwain"] authors = ["alterwain"]

View File

@ -30,7 +30,7 @@ fn write_7za() {
let _ = std::fs::write("tmp/7za.exe", ZIP_BIN); let _ = std::fs::write("tmp/7za.exe", ZIP_BIN);
} }
pub fn patch_jar(input_jar: &str, output_jar: &str, needle: &[u8], endpoint: &str) -> Result<(), Box<dyn Error + Sync + Send>> { pub fn patch_jar(input_jar: &str, output_jar: &str, needles: &[&[u8]], endpoint: &str) -> Result<(), Box<dyn Error + Sync + Send>> {
write_7za(); write_7za();
@ -45,6 +45,7 @@ pub fn patch_jar(input_jar: &str, output_jar: &str, needle: &[u8], endpoint: &st
for path in recursively_find_classes(PathBuf::from(".\\out")) { for path in recursively_find_classes(PathBuf::from(".\\out")) {
let mut haystack = std::fs::read(&path).unwrap(); let mut haystack = std::fs::read(&path).unwrap();
for needle in needles {
let mut v = find_subsequence(&haystack, needle); let mut v = find_subsequence(&haystack, needle);
if v.is_empty() { continue; } if v.is_empty() { continue; }
while let Some(g) = v.first() { while let Some(g) = v.first() {
@ -57,6 +58,7 @@ pub fn patch_jar(input_jar: &str, output_jar: &str, needle: &[u8], endpoint: &st
haystack = a; haystack = a;
v = find_subsequence(&haystack, needle); v = find_subsequence(&haystack, needle);
} }
}
std::fs::write(path, haystack)?; std::fs::write(path, haystack)?;
} }