diff --git a/examples/vanilla_client/src/server.rs b/examples/vanilla_client/src/server.rs index f2f4677c89..8ad04dfb62 100644 --- a/examples/vanilla_client/src/server.rs +++ b/examples/vanilla_client/src/server.rs @@ -32,8 +32,8 @@ pub fn server( username: USERNAME.to_string(), client_seed: seed_value, client_proof, - decompressed_addon_info_size: 0, - compressed_addon_info: vec![], + decompressed_addon_info_size: 342, + addon_info: vec![66, 108, 105, 122, 122, 97, 114, 100, 95, 65, 117, 99, 116, 105, 111, 110, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 66, 97, 116, 116, 108, 101, 102, 105, 101, 108, 100, 77, 105, 110, 105, 109, 97, 112, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165, 66, 108, 105, 122, 122, 97, 114, 100, 95, 66, 105, 110, 100, 105, 110, 103, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 67, 111, 109, 98, 97, 116, 84, 101, 120, 116, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165, 66, 108, 105, 122, 122, 97, 114, 100, 95, 67, 114, 97, 102, 116, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 71, 77, 83, 117, 114, 118, 101, 121, 85, 73, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165, 66, 108, 105, 122, 122, 97, 114, 100, 95, 73, 110, 115, 112, 101, 99, 116, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 77, 97, 99, 114, 111, 85, 73, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165, 66, 108, 105, 122, 122, 97, 114, 100, 95, 82, 97, 105, 100, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 84, 97, 108, 101, 110, 116, 85, 73, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165, 66, 108, 105, 122, 122, 97, 114, 100, 95, 84, 114, 97, 100, 101, 83, 107, 105, 108, 108, 85, 73, 0, 1, 109, 119, 28, 76, 0, 0, 0, 0, 66, 108, 105, 122, 122, 97, 114, 100, 95, 84, 114, 97, 105, 110, 101, 114, 85, 73, 0, 1, 109, 119, 28, 76, 27, 223, 5, 165], } .write_unencrypted_client(stream) .unwrap(); diff --git a/intermediate_representation.json b/intermediate_representation.json index f2a468ec33..822a2ed2c5 100644 --- a/intermediate_representation.json +++ b/intermediate_representation.json @@ -94790,7 +94790,7 @@ { "type": "definition", "content": { - "name": "compressed_addon_info", + "name": "addon_info", "member_type": { "type": "array", "content": { @@ -94808,7 +94808,9 @@ "constant_value": null, "used_as_size_in": null, "used_in_if": false, - "tags": {} + "tags": { + "compressed": "decompressed_addon_info_size" + } } } ], @@ -94925,141 +94927,353 @@ "tags": {} }, { - "variable_name": "compressed_addon_info", + "variable_name": "addon_info", "value": { "type": "array", "content": { "values": [ - 120, - 156, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 65, 117, - 204, - 189, - 14, - 194, - 48, - 12, - 4, - 224, - 242, - 30, - 188, - 12, + 99, + 116, + 105, + 111, + 110, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, 97, - 64, - 149, - 200, + 114, + 100, + 95, 66, - 195, - 140, + 97, + 116, + 116, + 108, + 101, + 102, + 105, + 101, + 108, + 100, + 77, + 105, + 110, + 105, + 109, + 97, + 112, + 0, + 1, + 109, + 119, + 28, 76, - 226, - 34, - 11, - 199, - 169, - 140, - 203, - 79, - 159, - 30, - 22, - 36, - 6, - 115, - 235, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 66, + 105, + 110, + 100, + 105, + 110, + 103, + 85, + 73, + 0, + 1, + 109, 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 67, + 111, + 109, + 98, + 97, + 116, + 84, + 101, + 120, + 116, + 0, + 1, + 109, 119, - 129, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, 105, - 89, - 64, - 203, + 122, + 122, + 97, + 114, + 100, + 95, + 67, + 114, + 97, + 102, + 116, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, 105, - 51, - 103, - 163, - 38, - 199, - 190, - 91, - 213, - 199, 122, - 223, - 125, - 18, - 190, - 22, - 192, - 140, - 113, - 36, - 228, - 18, + 122, + 97, + 114, + 100, + 95, + 71, + 77, + 83, + 117, + 114, + 118, + 101, + 121, + 85, 73, - 168, - 194, - 228, - 149, - 72, - 10, - 201, - 197, - 61, - 216, - 182, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, 122, - 6, - 75, - 248, - 52, - 15, - 21, - 70, + 122, + 97, + 114, + 100, + 95, + 73, + 110, 115, - 103, - 187, - 56, - 204, + 112, + 101, + 99, + 116, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, 122, - 199, - 151, - 139, - 189, - 220, - 38, - 204, - 254, - 48, + 122, + 97, + 114, + 100, + 95, + 77, + 97, + 99, + 114, + 111, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, 66, - 214, - 230, - 202, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 82, + 97, + 105, + 100, + 85, + 73, + 0, 1, - 168, - 184, - 144, - 128, - 81, - 252, - 183, - 164, - 80, - 112, - 184, - 18, - 243, - 63, - 38, - 65, - 253, - 181, - 55, - 144, - 25, - 102, - 143 + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 84, + 97, + 108, + 101, + 110, + 116, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 84, + 114, + 97, + 100, + 101, + 83, + 107, + 105, + 108, + 108, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0, + 66, + 108, + 105, + 122, + 122, + 97, + 114, + 100, + 95, + 84, + 114, + 97, + 105, + 110, + 101, + 114, + 85, + 73, + 0, + 1, + 109, + 119, + 28, + 76, + 0, + 0, + 0, + 0 ], "size": { "type": "endless" @@ -95483,7 +95697,7 @@ { "type": "definition", "content": { - "name": "compressed_addon_info", + "name": "addon_info", "member_type": { "type": "array", "content": { @@ -95501,7 +95715,9 @@ "constant_value": null, "used_as_size_in": null, "used_in_if": false, - "tags": {} + "tags": { + "compressed": "decompressed_addon_info_size" + } } } ], @@ -95525,7 +95741,7 @@ "tests": [], "file_info": { "file_name": "wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm", - "start_position": 70 + "start_position": 101 }, "only_has_io_error": false, "features": [ diff --git a/wow_message_parser/src/ir_printer/mod.rs b/wow_message_parser/src/ir_printer/mod.rs index 7ebcf1e0b1..4ae21bc8a9 100644 --- a/wow_message_parser/src/ir_printer/mod.rs +++ b/wow_message_parser/src/ir_printer/mod.rs @@ -139,6 +139,8 @@ pub(crate) struct IrTags { version: Option, #[serde(skip_serializing_if = "Option::is_none")] unimplemented: Option, + #[serde(skip_serializing_if = "Option::is_none")] + compressed: Option, } impl IrTags { @@ -147,6 +149,8 @@ impl IrTags { let comment = tags.comment().map(|d| d.as_ir_string()); + let compressed = tags.compressed().map(|d| d.to_string()); + let unimplemented = if tags.contains("unimplemented") { Some("true".to_string()) } else { @@ -168,6 +172,7 @@ impl IrTags { } else { None }, + compressed, unimplemented, } } diff --git a/wow_message_parser/src/main.rs b/wow_message_parser/src/main.rs index cf2c62c734..85900aae39 100644 --- a/wow_message_parser/src/main.rs +++ b/wow_message_parser/src/main.rs @@ -46,6 +46,7 @@ const UTILITY_PATH: &str = "crate::util"; const VERSIONS: &str = "versions"; const DESCRIPTION: &str = "description"; +const COMPRESSED: &str = "compressed"; const COMMENT: &str = "comment"; const DISPLAY: &str = "display"; const TEST_STR: &str = "test"; diff --git a/wow_message_parser/src/parser/types/tags.rs b/wow_message_parser/src/parser/types/tags.rs index 3e38d8038f..0a1e1c2296 100644 --- a/wow_message_parser/src/parser/types/tags.rs +++ b/wow_message_parser/src/parser/types/tags.rs @@ -4,7 +4,7 @@ use std::fmt::{Display, Formatter, Write}; use crate::file_utils::get_import_path; use crate::rust_printer::Version; use crate::{ - Objects, COMMENT, DESCRIPTION, DISPLAY, LOGIN_VERSIONS, RUST_BASE_TYPE, TEST_STR, VERSIONS, + Objects, COMMENT, DESCRIPTION, COMPRESSED, DISPLAY, LOGIN_VERSIONS, RUST_BASE_TYPE, TEST_STR, VERSIONS, }; #[derive(Debug, Eq, PartialEq, Copy, Clone)] @@ -240,6 +240,7 @@ pub(crate) struct Tags { login_logon_versions: Vec, world_versions: Vec, description: Option, + compressed: Option, comment: Option, display: String, } @@ -323,6 +324,8 @@ impl Tags { t.add(value); self.description = Some(t); } + } else if key == COMPRESSED { + self.compressed = Some(value.to_owned()); } else if key == COMMENT { if let Some(comment) = &mut self.comment { comment.add(value); @@ -535,6 +538,14 @@ impl Tags { self.description.as_ref() } + pub(crate) fn compressed(&self) -> Option<&String> { + self.compressed.as_ref() + } + + pub(crate) fn is_compressed(&self) -> bool { + self.compressed.is_some() + } + pub(crate) fn comment(&self) -> Option<&TagString> { self.comment.as_ref() } diff --git a/wow_message_parser/src/rust_printer/structs/print_common_impls/mod.rs b/wow_message_parser/src/rust_printer/structs/print_common_impls/mod.rs index c1007a7257..275b268da6 100644 --- a/wow_message_parser/src/rust_printer/structs/print_common_impls/mod.rs +++ b/wow_message_parser/src/rust_printer/structs/print_common_impls/mod.rs @@ -191,12 +191,17 @@ pub(crate) fn print_size_of_ty_rust_view(s: &mut Writer, m: &RustMember, prefix: ty = integer_type.rust_str(), ), ArraySize::Variable(_) | ArraySize::Endless => { - format!( - "{prefix}{name}.len() * core::mem::size_of::<{ty}>()", - name = m.name(), - prefix = prefix, - ty = integer_type.rust_str(), - ) + // ZLib compression is not predictable, so we compress the data and count the bytes. + if m.tags().is_compressed() { + format!("crate::util::zlib_compressed_size(&{prefix}{name})", prefix = prefix, name = m.name()) + } else { + format!( + "{prefix}{name}.len() * core::mem::size_of::<{ty}>()", + name = m.name(), + prefix = prefix, + ty = integer_type.rust_str(), + ) + } } }, ArrayType::Complex(_) => match array.size() { diff --git a/wow_message_parser/src/rust_printer/structs/print_common_impls/print_read.rs b/wow_message_parser/src/rust_printer/structs/print_common_impls/print_read.rs index dd46f0abcf..d62b29b945 100644 --- a/wow_message_parser/src/rust_printer/structs/print_common_impls/print_read.rs +++ b/wow_message_parser/src/rust_printer/structs/print_common_impls/print_read.rs @@ -285,6 +285,29 @@ fn print_read_array( s.wln("current_size += 1;"); }); s.newline(); + + if let Some(decompresssed_size_field) = d.tags().compressed() { + let decompressed_name = format!("{}_temp", d.name()); + + s.wln(format!( + "let mut {temp_field} = Vec::with_capacity({decompressed_size} as usize);", + temp_field = decompressed_name, decompressed_size = decompresssed_size_field + )); + s.wln(format!( + "let mut decoder = flate2::read::ZlibDecoder::new({field}.as_slice());", + field = d.name() + )); + s.wln(format!( + "decoder.read_to_end(&mut {temp_field})?;", + temp_field = decompressed_name + )); + s.newline(); + s.wln(format!( + "let mut {field} = {temp_field};", + field = d.name(), temp_field = decompressed_name + )); + s.newline(); + } } } } diff --git a/wow_message_parser/src/rust_printer/structs/print_common_impls/print_write.rs b/wow_message_parser/src/rust_printer/structs/print_common_impls/print_write.rs index b9c645cea9..01d1fdcc69 100644 --- a/wow_message_parser/src/rust_printer/structs/print_common_impls/print_write.rs +++ b/wow_message_parser/src/rust_printer/structs/print_common_impls/print_write.rs @@ -25,23 +25,30 @@ pub(crate) fn print_unencrypted_write_header(s: &mut Writer, e: &Container, post pub(crate) fn print_write_field_array( s: &mut Writer, - variable_name: &str, + d: &StructMemberDefinition, variable_prefix: &str, array: &Array, postfix: &str, ) { + if d.tags().is_compressed() { + s.wln("let mut encoder = flate2::write::ZlibEncoder::new(w, flate2::Compression::default());"); + } + s.open_curly(format!( "for i in {prefix}{name}.iter()", - name = variable_name, + name = d.name(), prefix = variable_prefix )); match array.ty() { - ArrayType::Integer(integer_type) => s.wln(format!( - "w.write_all(&i.to_{endian}_bytes()){postfix}?;", - endian = integer_type.rust_endian_str(), - postfix = postfix, - )), + ArrayType::Integer(integer_type) => { + s.wln(format!( + "{writer}.write_all(&i.to_{endian}_bytes()){postfix}?;", + writer = if d.tags().is_compressed() {"encoder"} else {"w"}, + endian = integer_type.rust_endian_str(), + postfix = postfix, + )) + }, ArrayType::Complex(_) => s.wln("i.write_into_vec(w)?;"), ArrayType::CString => { s.wln(format!("w.write_all(i.as_bytes()){}?;", postfix)); @@ -216,7 +223,7 @@ pub(crate) fn print_write_definition( )); } Type::Array(array) => { - print_write_field_array(s, d.name(), variable_prefix, array, postfix); + print_write_field_array(s, d, variable_prefix, array, postfix); } Type::Enum { e, upcast } | Type::Flag { e, upcast } => { let integer = match upcast { diff --git a/wow_message_parser/tests/wireshark/imports.txt b/wow_message_parser/tests/wireshark/imports.txt index 8b6e012c1c..f4eb07395c 100644 --- a/wow_message_parser/tests/wireshark/imports.txt +++ b/wow_message_parser/tests/wireshark/imports.txt @@ -6,6 +6,7 @@ static int hf_woww_action_bars = -1; static int hf_woww_action_type = -1; static int hf_woww_activate_taxi_reply = -1; static int hf_woww_actual_roll = -1; +static int hf_woww_addon_info = -1; static int hf_woww_agility = -1; static int hf_woww_ai_reaction = -1; static int hf_woww_allow_movement = -1; @@ -161,7 +162,6 @@ static int hf_woww_client_proof = -1; static int hf_woww_client_seed = -1; static int hf_woww_code = -1; static int hf_woww_coded = -1; -static int hf_woww_compressed_addon_info = -1; static int hf_woww_compressed_chat_data = -1; static int hf_woww_container_slots = -1; static int hf_woww_content = -1; diff --git a/wow_message_parser/tests/wireshark/parser.txt b/wow_message_parser/tests/wireshark/parser.txt index 01e89228e5..aedff6d74f 100644 --- a/wow_message_parser/tests/wireshark/parser.txt +++ b/wow_message_parser/tests/wireshark/parser.txt @@ -82,7 +82,7 @@ ptvcursor_add(ptv, hf_woww_client_proof, 20, ENC_NA); ptvcursor_add(ptv, hf_woww_decompressed_addon_info_size, 4, ENC_LITTLE_ENDIAN); len = offset_packet_end - ptvcursor_current_offset(ptv); - ptvcursor_add(ptv, hf_woww_compressed_addon_info, len, ENC_NA); + ptvcursor_add(ptv, hf_woww_addon_info, len, ENC_NA); break; case CMSG_AUTOBANK_ITEM: ptvcursor_add(ptv, hf_woww_bag_index, 1, ENC_LITTLE_ENDIAN); diff --git a/wow_message_parser/tests/wireshark/register.txt b/wow_message_parser/tests/wireshark/register.txt index c41f22727b..8232a2864f 100644 --- a/wow_message_parser/tests/wireshark/register.txt +++ b/wow_message_parser/tests/wireshark/register.txt @@ -46,6 +46,12 @@ NULL, HFILL } }, + { &hf_woww_addon_info, + { "Addon Info", "woww.addon.info", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL + } + }, { &hf_woww_agility, { "Agility", "woww.agility", FT_UINT32, BASE_HEX_DEC, NULL, 0, @@ -976,12 +982,6 @@ NULL, HFILL } }, - { &hf_woww_compressed_addon_info, - { "Compressed Addon Info", "woww.compressed.addon.info", - FT_BYTES, BASE_NONE, NULL, 0, - NULL, HFILL - } - }, { &hf_woww_compressed_chat_data, { "Compressed Chat Data", "woww.compressed.chat.data", FT_BYTES, BASE_NONE, NULL, 0, diff --git a/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm b/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm index f3d6a93bad..1bcd0c1920 100644 --- a/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm +++ b/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm @@ -7,8 +7,8 @@ cmsg CMSG_AUTH_SESSION = 0x1ED { u32 client_seed; u8[20] client_proof; u32 decompressed_addon_info_size; - u8[-] compressed_addon_info { - compressed = "true"; + u8[-] addon_info { + compressed = "decompressed_addon_info_size"; } } { description = "Sent after receiving [SMSG_AUTH_CHALLENGE]."; @@ -26,14 +26,45 @@ test CMSG_AUTH_SESSION { 219, 164, 251, 163, 231, 126, 103, 172, 234, 198, ]; decompressed_addon_info_size = 342; - compressed_addon_info = [ - 120, 156, 117, 204, 189, 14, 194, 48, 12, 4, 224, 242, 30, 188, 12, 97, 64, 149, 200, 66, 195, 140, 76, - 226, 34, 11, 199, 169, 140, 203, 79, 159, 30, 22, 36, 6, 115, 235, 119, 119, 129, 105, 89, 64, 203, - 105, 51, 103, 163, 38, 199, 190, 91, 213, 199, 122, 223, 125, 18, 190, 22, 192, 140, 113, 36, - 228, 18, 73, 168, 194, 228, 149, 72, 10, 201, 197, 61, 216, 182, 122, 6, 75, 248, 52, 15, 21, - 70, 115, 103, 187, 56, 204, 122, 199, 151, 139, 189, 220, 38, 204, 254, 48, 66, 214, 230, 202, - 1, 168, 184, 144, 128, 81, 252, 183, 164, 80, 112, 184, 18, 243, 63, 38, 65, 253, 181, 55, 144, - 25, 102, 143, + addon_info = [ + 0x42, 0x6c, 0x69, 0x7a, 0x7a, 0x61, 0x72, 0x64, 0x5f, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x49, + 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, 0x61, 0x72, 0x64, + 0x5f, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x61, + 0x70, 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, 0x61, 0x72, + 0x64, 0x5f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, 0x61, + 0x72, 0x64, 0x5f, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6d, 0x77, 0x1c, + 0x4c, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, + 0x7a, 0x61, 0x72, 0x64, 0x5f, 0x43, 0x72, 0x61, 0x66, + 0x74, 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, + 0x61, 0x72, 0x64, 0x5f, 0x47, 0x4d, 0x53, 0x75, 0x72, + 0x76, 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, + 0x1c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, + 0x7a, 0x7a, 0x61, 0x72, 0x64, 0x5f, 0x49, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6d, + 0x77, 0x1c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, + 0x69, 0x7a, 0x7a, 0x61, 0x72, 0x64, 0x5f, 0x4d, 0x61, + 0x63, 0x72, 0x6f, 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, + 0x1c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, + 0x7a, 0x7a, 0x61, 0x72, 0x64, 0x5f, 0x52, 0x61, 0x69, + 0x64, 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, + 0x61, 0x72, 0x64, 0x5f, 0x54, 0x61, 0x6c, 0x65, 0x6e, + 0x74, 0x55, 0x49, 0x00, 0x01, 0x6d, 0x77, 0x1c, 0x4c, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x6c, 0x69, 0x7a, 0x7a, + 0x61, 0x72, 0x64, 0x5f, 0x54, 0x72, 0x61, 0x64, 0x65, + 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x49, 0x00, 0x01, + 0x6d, 0x77, 0x1c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6c, 0x69, 0x7a, 0x7a, 0x61, 0x72, 0x64, 0x5f, 0x54, + 0x72, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x55, 0x49, 0x00, + 0x01, 0x6d, 0x77, 0x1c, 0x4c, 0x00, 0x00, 0x00, 0x00 ]; } [ 0x00, 0xac, /* size */ @@ -82,7 +113,9 @@ cmsg CMSG_AUTH_SESSION = 0x1ED { } u8[20] client_proof; u32 decompressed_addon_info_size; - u8[-] compressed_addon_info; + u8[-] addon_info { + compressed = "decompressed_addon_info_size"; + } } { description = "Sent after receiving [SMSG_AUTH_CHALLENGE]."; comment = "This message is never encrypted."; diff --git a/wow_world_messages/Cargo.toml b/wow_world_messages/Cargo.toml index eda4e174dc..6042fe80cf 100644 --- a/wow_world_messages/Cargo.toml +++ b/wow_world_messages/Cargo.toml @@ -26,6 +26,10 @@ encryption = ["wow_srp"] version = "0.4" optional = true +[dependencies.flate2] +version = "1.0.24" +optional = false + [dependencies.tokio] version = "1" default-features = false diff --git a/wow_world_messages/src/util/mod.rs b/wow_world_messages/src/util/mod.rs index f03dfe7214..c8f61217bd 100644 --- a/wow_world_messages/src/util/mod.rs +++ b/wow_world_messages/src/util/mod.rs @@ -174,3 +174,10 @@ pub fn read_f64_be(r: &mut R) -> Result { r.read_exact(&mut v)?; Ok(f64::from_be_bytes(v)) } + +pub fn zlib_compressed_size(data: &[u8]) -> usize { + let mut encoder = flate2::write::ZlibEncoder::new(Vec::new(), flate2::Compression::default()); + encoder.write_all(data).expect("Failed to compress data when calculating message size."); + let compressed_data = encoder.finish().expect("Failed to flush compressed data when calculating message size."); + compressed_data.len() +} diff --git a/wow_world_messages/src/world/shared/cmsg_auth_session12.rs b/wow_world_messages/src/world/shared/cmsg_auth_session12.rs index f33acb292e..3f2545ebb0 100644 --- a/wow_world_messages/src/world/shared/cmsg_auth_session12.rs +++ b/wow_world_messages/src/world/shared/cmsg_auth_session12.rs @@ -15,7 +15,7 @@ use std::io::{Write, Read}; /// u32 client_seed; /// u8[20] client_proof; /// u32 decompressed_addon_info_size; -/// u8[-] compressed_addon_info; +/// u8[-] addon_info; /// } /// ``` pub struct CMSG_AUTH_SESSION { @@ -27,7 +27,7 @@ pub struct CMSG_AUTH_SESSION { pub client_seed: u32, pub client_proof: [u8; 20], pub decompressed_addon_info_size: u32, - pub compressed_addon_info: Vec, + pub addon_info: Vec, } impl crate::Message for CMSG_AUTH_SESSION { @@ -62,9 +62,10 @@ impl crate::Message for CMSG_AUTH_SESSION { // decompressed_addon_info_size: u32 w.write_all(&self.decompressed_addon_info_size.to_le_bytes())?; - // compressed_addon_info: u8[-] - for i in self.compressed_addon_info.iter() { - w.write_all(&i.to_le_bytes())?; + // addon_info: u8[-] + let mut encoder = flate2::write::ZlibEncoder::new(w, flate2::Compression::default()); + for i in self.addon_info.iter() { + encoder.write_all(&i.to_le_bytes())?; } Ok(()) @@ -90,7 +91,7 @@ impl crate::Message for CMSG_AUTH_SESSION { // decompressed_addon_info_size: u32 let decompressed_addon_info_size = crate::util::read_u32_le(r)?; - // compressed_addon_info: u8[-] + // addon_info: u8[-] let mut current_size = { 4 // build: u32 + 4 // server_id: u32 @@ -99,12 +100,18 @@ impl crate::Message for CMSG_AUTH_SESSION { + 20 * core::mem::size_of::() // client_proof: u8[20] + 4 // decompressed_addon_info_size: u32 }; - let mut compressed_addon_info = Vec::with_capacity(body_size as usize - current_size); + let mut addon_info = Vec::with_capacity(body_size as usize - current_size); while current_size < (body_size as usize) { - compressed_addon_info.push(crate::util::read_u8_le(r)?); + addon_info.push(crate::util::read_u8_le(r)?); current_size += 1; } + let mut addon_info_temp = Vec::with_capacity(decompressed_addon_info_size as usize); + let mut decoder = flate2::read::ZlibDecoder::new(addon_info.as_slice()); + decoder.read_to_end(&mut addon_info_temp)?; + + let mut addon_info = addon_info_temp; + Ok(Self { build, server_id, @@ -112,7 +119,7 @@ impl crate::Message for CMSG_AUTH_SESSION { client_seed, client_proof, decompressed_addon_info_size, - compressed_addon_info, + addon_info, }) } @@ -131,7 +138,7 @@ impl CMSG_AUTH_SESSION { + 4 // client_seed: u32 + 20 * core::mem::size_of::() // client_proof: u8[20] + 4 // decompressed_addon_info_size: u32 - + self.compressed_addon_info.len() * core::mem::size_of::() // compressed_addon_info: u8[-] + + crate::util::zlib_compressed_size(&self.addon_info) // addon_info: u8[-] } } @@ -171,19 +178,38 @@ mod test1 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -199,7 +225,7 @@ mod test1 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); @@ -221,19 +247,38 @@ mod test1 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -249,7 +294,7 @@ mod test1 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); @@ -271,19 +316,38 @@ mod test1 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -299,7 +363,7 @@ mod test1 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); @@ -347,19 +411,38 @@ mod test2 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -375,7 +458,7 @@ mod test2 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); @@ -397,19 +480,38 @@ mod test2 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -425,7 +527,7 @@ mod test2 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); @@ -447,19 +549,38 @@ mod test2 { client_proof: [ 0x88, 0x9D, 0xEF, 0x05, 0x25, 0xBB, 0xC1, 0xAB, 0xA7, 0x8A, 0xDB, 0xA4, 0xFB, 0xA3, 0xE7, 0x7E, 0x67, 0xAC, 0xEA, 0xC6, ], decompressed_addon_info_size: 0x156, - compressed_addon_info: vec![ 0x78, 0x9C, 0x75, 0xCC, 0xBD, 0x0E, 0xC2, - 0x30, 0x0C, 0x04, 0xE0, 0xF2, 0x1E, 0xBC, 0x0C, 0x61, 0x40, 0x95, - 0xC8, 0x42, 0xC3, 0x8C, 0x4C, 0xE2, 0x22, 0x0B, 0xC7, 0xA9, 0x8C, - 0xCB, 0x4F, 0x9F, 0x1E, 0x16, 0x24, 0x06, 0x73, 0xEB, 0x77, 0x77, - 0x81, 0x69, 0x59, 0x40, 0xCB, 0x69, 0x33, 0x67, 0xA3, 0x26, 0xC7, - 0xBE, 0x5B, 0xD5, 0xC7, 0x7A, 0xDF, 0x7D, 0x12, 0xBE, 0x16, 0xC0, - 0x8C, 0x71, 0x24, 0xE4, 0x12, 0x49, 0xA8, 0xC2, 0xE4, 0x95, 0x48, - 0x0A, 0xC9, 0xC5, 0x3D, 0xD8, 0xB6, 0x7A, 0x06, 0x4B, 0xF8, 0x34, - 0x0F, 0x15, 0x46, 0x73, 0x67, 0xBB, 0x38, 0xCC, 0x7A, 0xC7, 0x97, - 0x8B, 0xBD, 0xDC, 0x26, 0xCC, 0xFE, 0x30, 0x42, 0xD6, 0xE6, 0xCA, - 0x01, 0xA8, 0xB8, 0x90, 0x80, 0x51, 0xFC, 0xB7, 0xA4, 0x50, 0x70, - 0xB8, 0x12, 0xF3, 0x3F, 0x26, 0x41, 0xFD, 0xB5, 0x37, 0x90, 0x19, - 0x66, 0x8F, ], + addon_info: vec![ 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x41, 0x75, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, 0x61, 0x74, 0x74, 0x6C, + 0x65, 0x66, 0x69, 0x65, 0x6C, 0x64, 0x4D, 0x69, 0x6E, 0x69, 0x6D, + 0x61, 0x70, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x42, + 0x69, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x43, 0x6F, 0x6D, 0x62, 0x61, 0x74, + 0x54, 0x65, 0x78, 0x74, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x43, 0x72, 0x61, 0x66, 0x74, 0x55, 0x49, 0x00, 0x01, 0x6D, + 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, + 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x47, 0x4D, 0x53, 0x75, 0x72, 0x76, + 0x65, 0x79, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, + 0x5F, 0x49, 0x6E, 0x73, 0x70, 0x65, 0x63, 0x74, 0x55, 0x49, 0x00, + 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, + 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x4D, 0x61, 0x63, 0x72, + 0x6F, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, + 0x52, 0x61, 0x69, 0x64, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, + 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, 0x7A, 0x7A, 0x61, + 0x72, 0x64, 0x5F, 0x54, 0x61, 0x6C, 0x65, 0x6E, 0x74, 0x55, 0x49, + 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x6C, 0x69, 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, + 0x64, 0x65, 0x53, 0x6B, 0x69, 0x6C, 0x6C, 0x55, 0x49, 0x00, 0x01, + 0x6D, 0x77, 0x1C, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6C, 0x69, + 0x7A, 0x7A, 0x61, 0x72, 0x64, 0x5F, 0x54, 0x72, 0x61, 0x69, 0x6E, + 0x65, 0x72, 0x55, 0x49, 0x00, 0x01, 0x6D, 0x77, 0x1C, 0x4C, 0x00, + 0x00, 0x00, 0x00, ], }; let header_size = 2 + 4; @@ -475,7 +596,7 @@ mod test2 { assert_eq!(t.client_seed, expected.client_seed); assert_eq!(t.client_proof, expected.client_proof); assert_eq!(t.decompressed_addon_info_size, expected.decompressed_addon_info_size); - assert_eq!(t.compressed_addon_info, expected.compressed_addon_info); + assert_eq!(t.addon_info, expected.addon_info); assert_eq!(t.size() + header_size, RAW0.len()); diff --git a/wow_world_messages/src/world/wrath/cmsg_auth_session.rs b/wow_world_messages/src/world/wrath/cmsg_auth_session.rs index cbec98f5c6..808e6c3de1 100644 --- a/wow_world_messages/src/world/wrath/cmsg_auth_session.rs +++ b/wow_world_messages/src/world/wrath/cmsg_auth_session.rs @@ -6,7 +6,7 @@ use std::io::{Write, Read}; /// /// This message is never encrypted. /// -/// Auto generated from the original `wowm` in file [`wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm:70`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm#L70): +/// Auto generated from the original `wowm` in file [`wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm:101`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm#L101): /// ```text /// cmsg CMSG_AUTH_SESSION = 0x01ED { /// u32 client_build; @@ -20,7 +20,7 @@ use std::io::{Write, Read}; /// u64 dos_response; /// u8[20] client_proof; /// u32 decompressed_addon_info_size; -/// u8[-] compressed_addon_info; +/// u8[-] addon_info; /// } /// ``` pub struct CMSG_AUTH_SESSION { @@ -38,7 +38,7 @@ pub struct CMSG_AUTH_SESSION { pub dos_response: u64, pub client_proof: [u8; 20], pub decompressed_addon_info_size: u32, - pub compressed_addon_info: Vec, + pub addon_info: Vec, } impl crate::Message for CMSG_AUTH_SESSION { @@ -88,9 +88,10 @@ impl crate::Message for CMSG_AUTH_SESSION { // decompressed_addon_info_size: u32 w.write_all(&self.decompressed_addon_info_size.to_le_bytes())?; - // compressed_addon_info: u8[-] - for i in self.compressed_addon_info.iter() { - w.write_all(&i.to_le_bytes())?; + // addon_info: u8[-] + let mut encoder = flate2::write::ZlibEncoder::new(w, flate2::Compression::default()); + for i in self.addon_info.iter() { + encoder.write_all(&i.to_le_bytes())?; } Ok(()) @@ -131,7 +132,7 @@ impl crate::Message for CMSG_AUTH_SESSION { // decompressed_addon_info_size: u32 let decompressed_addon_info_size = crate::util::read_u32_le(r)?; - // compressed_addon_info: u8[-] + // addon_info: u8[-] let mut current_size = { 4 // client_build: u32 + 4 // login_server_id: u32 @@ -145,12 +146,18 @@ impl crate::Message for CMSG_AUTH_SESSION { + 20 * core::mem::size_of::() // client_proof: u8[20] + 4 // decompressed_addon_info_size: u32 }; - let mut compressed_addon_info = Vec::with_capacity(body_size as usize - current_size); + let mut addon_info = Vec::with_capacity(body_size as usize - current_size); while current_size < (body_size as usize) { - compressed_addon_info.push(crate::util::read_u8_le(r)?); + addon_info.push(crate::util::read_u8_le(r)?); current_size += 1; } + let mut addon_info_temp = Vec::with_capacity(decompressed_addon_info_size as usize); + let mut decoder = flate2::read::ZlibDecoder::new(addon_info.as_slice()); + decoder.read_to_end(&mut addon_info_temp)?; + + let mut addon_info = addon_info_temp; + Ok(Self { client_build, login_server_id, @@ -163,7 +170,7 @@ impl crate::Message for CMSG_AUTH_SESSION { dos_response, client_proof, decompressed_addon_info_size, - compressed_addon_info, + addon_info, }) } @@ -184,7 +191,7 @@ impl CMSG_AUTH_SESSION { + 8 // dos_response: u64 + 20 * core::mem::size_of::() // client_proof: u8[20] + 4 // decompressed_addon_info_size: u32 - + self.compressed_addon_info.len() * core::mem::size_of::() // compressed_addon_info: u8[-] + + crate::util::zlib_compressed_size(&self.addon_info) // addon_info: u8[-] } } diff --git a/wowm_language/src/docs/cmsg_auth_session.md b/wowm_language/src/docs/cmsg_auth_session.md index ef14ab8d49..ff6043e400 100644 --- a/wowm_language/src/docs/cmsg_auth_session.md +++ b/wowm_language/src/docs/cmsg_auth_session.md @@ -21,7 +21,7 @@ cmsg CMSG_AUTH_SESSION = 0x01ED { u32 client_seed; u8[20] client_proof; u32 decompressed_addon_info_size; - u8[-] compressed_addon_info; + u8[-] addon_info; } ``` ### Header @@ -45,7 +45,7 @@ CMSG have a header of 6 bytes. | - | 4 / Little | u32 | client_seed | | | | - | ? / - | u8[20] | client_proof | | | | - | 4 / Little | u32 | decompressed_addon_info_size | | | -| - | ? / - | u8[-] | compressed_addon_info | | | +| - | ? / - | u8[-] | addon_info | | | ### Examples @@ -68,7 +68,7 @@ CMSG have a header of 6 bytes. 10, 201, 197, 61, 216, 182, 122, 6, 75, 248, 52, 15, 21, 70, 115, 103, 187, 56, 204, 122, 199, 151, 139, 189, 220, 38, 204, 254, 48, 66, 214, 230, 202, 1, 168, 184, 144, 128, 81, 252, 183, 164, 80, 112, 184, 18, 243, 63, 38, 65, 253, 181, 55, 144, 25, -102, 143, // compressed_addon_info: u8[-] +102, 143, // addon_info: u8[-] ``` # CMSG_AUTH_SESSION @@ -84,7 +84,7 @@ This message is never encrypted. ### Wowm Representation -Autogenerated from `wowm` file at [`wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm:70`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm#L70). +Autogenerated from `wowm` file at [`wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm:101`](https://github.com/gtker/wow_messages/tree/main/wow_message_parser/wowm/world/character_screen/cmsg_auth_session.wowm#L101). ```rust,ignore cmsg CMSG_AUTH_SESSION = 0x01ED { u32 client_build; @@ -98,7 +98,7 @@ cmsg CMSG_AUTH_SESSION = 0x01ED { u64 dos_response; u8[20] client_proof; u32 decompressed_addon_info_size; - u8[-] compressed_addon_info; + u8[-] addon_info; } ``` ### Header @@ -127,5 +127,5 @@ CMSG have a header of 6 bytes. | - | 8 / Little | u64 | dos_response | | Purpose and exact meaning of name unknown.
TrinityCore has this name but never uses the variable afterwards. | | - | ? / - | u8[20] | client_proof | | | | - | 4 / Little | u32 | decompressed_addon_info_size | | | -| - | ? / - | u8[-] | compressed_addon_info | | | +| - | ? / - | u8[-] | addon_info | | |