mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-10 02:17:45 +00:00
Send a better patchlist
This isn't correct yet, but closer to being usable.
This commit is contained in:
parent
46dec1b0f0
commit
37a9702a29
2 changed files with 33 additions and 21 deletions
|
@ -166,32 +166,44 @@ async fn verify_boot(
|
|||
}
|
||||
|
||||
// check if we need any patching
|
||||
let patches = list_patch_files(&config.patch.patches_location);
|
||||
let mut send_patches = Vec::new();
|
||||
let patches = list_patch_files(&*format!("{}/boot", &config.patch.patches_location));
|
||||
for patch in patches {
|
||||
let patch_str: &str = &patch;
|
||||
if actual_boot_version.partial_cmp(patch_str).unwrap() == Ordering::Less {
|
||||
// not up to date!
|
||||
let patch_list = PatchList {
|
||||
id: "477D80B1_38BC_41d4_8B48_5273ADB89CAC".to_string(),
|
||||
requested_version: boot_version.to_string().clone(),
|
||||
patch_length: 0,
|
||||
content_location: String::new(),
|
||||
patches: vec![PatchEntry {
|
||||
url: format!("http://{}/{}", config.patch.patch_dl_url, patch).to_string(),
|
||||
version: "2023.09.15.0000.0000".to_string(),
|
||||
hash_block_size: 50000000,
|
||||
length: 1479062470,
|
||||
size_on_disk: 0,
|
||||
hashes: vec![],
|
||||
unknown_a: 0,
|
||||
unknown_b: 0,
|
||||
}],
|
||||
};
|
||||
let patch_list_str = patch_list.to_string(PatchListType::Boot);
|
||||
return patch_list_str.into_response();
|
||||
let file = std::fs::File::open(&*format!(
|
||||
"{}/boot/{}.patch",
|
||||
&config.patch.patches_location, patch_str
|
||||
))
|
||||
.unwrap();
|
||||
let metadata = file.metadata().unwrap();
|
||||
|
||||
send_patches.push(PatchEntry {
|
||||
url: format!("http://{}/boot/{}.patch", config.patch.patch_dl_url, patch)
|
||||
.to_string(),
|
||||
version: patch_str.to_string(),
|
||||
hash_block_size: 50000000,
|
||||
length: metadata.len() as i64,
|
||||
size_on_disk: metadata.len() as i64, // NOTE: wrong but it should be fine to lie
|
||||
hashes: vec![],
|
||||
unknown_a: 0,
|
||||
unknown_b: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if !send_patches.is_empty() {
|
||||
let patch_list = PatchList {
|
||||
id: "477D80B1_38BC_41d4_8B48_5273ADB89CAC".to_string(),
|
||||
requested_version: boot_version.to_string().clone(),
|
||||
content_location: format!("ffxivpatch/boot/metainfo/{}.http", boot_version.0), // FIXME: i think this is actually supposed to be the target version
|
||||
patch_length: 0,
|
||||
patches: send_patches,
|
||||
};
|
||||
let patch_list_str = patch_list.to_string(PatchListType::Boot);
|
||||
return patch_list_str.into_response();
|
||||
}
|
||||
|
||||
let headers = HeaderMap::new();
|
||||
(headers).into_response()
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ impl Default for PatchConfig {
|
|||
port: 6900,
|
||||
listen_address: "127.0.0.1".to_string(),
|
||||
patch_dl_url: "patch-dl.ffxiv.localhost".to_string(),
|
||||
patches_location: String::new(),
|
||||
patches_location: "patches".to_string(),
|
||||
boot_server_name: "patch-bootver.ffxiv.localhost".to_string(),
|
||||
game_server_name: "patch-gamever.ffxiv.localhost".to_string(),
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue