From fccd7522461613d8e478b7adf77298e7cbc96be8 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 30 Mar 2025 22:29:17 -0400 Subject: [PATCH] More misc packet size fixes --- resources/opcodes.json | 13 ++++--------- src/bin/kawari-world.rs | 26 -------------------------- src/oodle.rs | 4 ++-- src/world/ipc/mod.rs | 25 ------------------------- src/world/ipc/player_setup.rs | 4 ++-- src/world/ipc/player_stats.rs | 2 +- src/world/ipc/update_class_info.rs | 2 +- 7 files changed, 10 insertions(+), 66 deletions(-) diff --git a/resources/opcodes.json b/resources/opcodes.json index 4c241ef..80dc43d 100644 --- a/resources/opcodes.json +++ b/resources/opcodes.json @@ -18,17 +18,17 @@ { "name": "PlayerStats", "opcode": 401, - "size": 224 + "size": 144 }, { "name": "PlayerSetup", "opcode": 218, - "size": 2784 + "size": 2808 }, { "name": "UpdateClassInfo", "opcode": 119, - "size": 48 + "size": 16 }, { "name": "PlayerSpawn", @@ -78,7 +78,7 @@ { "name": "Unk15", "opcode": 652, - "size": 8 + "size": 16 }, { "name": "Unk16", @@ -197,11 +197,6 @@ "opcode": 417, "size": 16 }, - { - "name": "Unk7", - "opcode": 693, - "size": 32 - }, { "name": "UpdatePositionHandler", "opcode": 561, diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 3ee51a9..287e53d 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -581,32 +581,6 @@ async fn client_loop( } } } - ClientZoneIpcData::Unk7 { - timestamp, unk1, .. - } => { - tracing::info!("Recieved Unk7! {:#?}", unk1); - - // send unk11 in response - { - let ipc = ServerZoneIpcSegment { - op_code: ServerZoneIpcType::Unk11, - timestamp: timestamp_secs(), - data: ServerZoneIpcData::Unk11 { - timestamp: *timestamp, - unk: 333, - }, - ..Default::default() - }; - - connection - .send_segment(PacketSegment { - source_actor: connection.player_data.actor_id, - target_actor: connection.player_data.actor_id, - segment_type: SegmentType::Ipc { data: ipc }, - }) - .await; - } - } ClientZoneIpcData::UpdatePositionHandler { position, rotation } => { tracing::info!( "Character moved to {position:#?} {}", diff --git a/src/oodle.rs b/src/oodle.rs index 2c8bb9a..730e30b 100644 --- a/src/oodle.rs +++ b/src/oodle.rs @@ -149,7 +149,7 @@ impl OodleNetwork { let mut out_buf: Vec = vec![0u8; decompressed_size.try_into().unwrap()]; let success = OodleNetwork1TCP_Decode( self.state.as_mut_ptr() as *mut c_void, - self.shared.as_mut_ptr() as *const c_void, + self.shared.as_ptr() as *const c_void, padded_buffer.as_mut_ptr() as *const c_void, input.len().try_into().unwrap(), out_buf.as_mut_ptr() as *mut c_void, @@ -169,7 +169,7 @@ impl OodleNetwork { let mut out_buf: Vec = vec![0u8; input.len()]; let len = OodleNetwork1TCP_Encode( self.state.as_mut_ptr() as *mut c_void, - self.shared.as_mut_ptr() as *const c_void, + self.shared.as_ptr() as *const c_void, input.as_mut_ptr() as *const c_void, input.len().try_into().unwrap(), out_buf.as_mut_ptr() as *mut c_void, diff --git a/src/world/ipc/mod.rs b/src/world/ipc/mod.rs index bf99879..c7569e1 100644 --- a/src/world/ipc/mod.rs +++ b/src/world/ipc/mod.rs @@ -172,30 +172,14 @@ pub enum ServerZoneIpcData { #[bw(map = write_string)] message: String, }, - /// Unknown, server sends to the client before player spawn - Unk8 { unk: [u8; 808] }, /// Unknown, but seems to contain information on cross-world linkshells LinkShellInformation { unk: [u8; 456] }, - /// Unknown, server sends to the client before player spawn - Unk9 { unk: [u8; 24] }, - /// Unknown, server sends this in response to Unk7 - Unk11 { - timestamp: u32, - #[brw(pad_after = 24)] // empty bytes - unk: u32, - }, /// Sent by the server when it wants the client to... prepare to zone? PrepareZoning { unk: [u32; 4] }, - /// Sent by the server??? - Unk15 { unk: u32, player_id: u32 }, - /// Sent by the server before init zone??? - Unk16 { unk: [u8; 136] }, /// Sent by the server ActorControl(ActorControl), /// Sent by the server ActorMove(ActorMove), - /// Sent by the server - Unk17 { unk: [u8; 104] }, /// Sent by the server in response to SocialListRequest SocialList(SocialList), /// Sent by the server to spawn an NPC @@ -283,15 +267,6 @@ pub enum ClientZoneIpcData { /// Sent by the client when it requests the friends list and other related info #[br(pre_assert(*magic == ClientZoneIpcType::SocialListRequest))] SocialListRequest(SocialListRequest), - /// FIXME: 32 bytes of something from the client, not sure what yet - #[br(pre_assert(*magic == ClientZoneIpcType::Unk7))] - Unk7 { - // TODO: full of possibly interesting information - timestamp: u32, - #[brw(pad_before = 8)] // empty bytes - #[brw(pad_after = 4)] // empty bytes - unk1: [u8; 16], // something - }, #[br(pre_assert(*magic == ClientZoneIpcType::UpdatePositionHandler))] UpdatePositionHandler { /// In radians. diff --git a/src/world/ipc/player_setup.rs b/src/world/ipc/player_setup.rs index 100d75b..0383311 100644 --- a/src/world/ipc/player_setup.rs +++ b/src/world/ipc/player_setup.rs @@ -159,8 +159,8 @@ pub struct PlayerSetup { pub cleared_pvp: [u8; 5], // meh, this is where i put all of the new data - #[br(count = 192)] - #[bw(pad_size_to = 192)] + #[br(count = 216)] + #[bw(pad_size_to = 216)] pub unknown948: Vec, } diff --git a/src/world/ipc/player_stats.rs b/src/world/ipc/player_stats.rs index a336124..881f016 100644 --- a/src/world/ipc/player_stats.rs +++ b/src/world/ipc/player_stats.rs @@ -33,5 +33,5 @@ pub struct PlayerStats { pub control: u32, pub gathering: u32, pub perception: u32, - pub unk1: [u32; 26], + pub unk1: [u32; 6], } diff --git a/src/world/ipc/update_class_info.rs b/src/world/ipc/update_class_info.rs index 93bcd1d..23ea1fa 100644 --- a/src/world/ipc/update_class_info.rs +++ b/src/world/ipc/update_class_info.rs @@ -8,5 +8,5 @@ pub struct UpdateClassInfo { pub is_specialist: u8, pub synced_level: u16, pub class_level: u16, - pub role_actions: [u32; 10], + pub role_actions: [u32; 2], }