From 166e8024e0728e4971683dea6788a4470f75195b Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 14 Jul 2025 21:35:32 -0400 Subject: [PATCH] Fill out more fields in PrepareZoning IPC This fixes the loading screen between zones (as it now displays text.) How we do things isn't very accurate still. --- src/bin/kawari-world.rs | 21 --------------------- src/ipc/zone/mod.rs | 26 ++++++++++++++++++++++++-- src/world/connection.rs | 29 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 355dfc2..f6cee00 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -384,27 +384,6 @@ async fn client_loop( .await; } - // fade in? - { - let ipc = ServerZoneIpcSegment { - op_code: ServerZoneIpcType::PrepareZoning, - timestamp: timestamp_secs(), - data: ServerZoneIpcData::PrepareZoning { - unk: [0, 0, 0, 0], - }, - ..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: SegmentData::Ipc { data: ipc }, - }) - .await; - } - // wipe any exit position so it isn't accidentally reused connection.exit_position = None; connection.exit_rotation = None; diff --git a/src/ipc/zone/mod.rs b/src/ipc/zone/mod.rs index 1f9e364..e6f3788 100644 --- a/src/ipc/zone/mod.rs +++ b/src/ipc/zone/mod.rs @@ -247,7 +247,18 @@ pub enum ServerZoneIpcData { LinkShellInformation { unk: [u8; 456] }, /// Sent by the server when it wants the client to... prepare to zone? #[br(pre_assert(*magic == ServerZoneIpcType::PrepareZoning))] - PrepareZoning { unk: [u32; 4] }, + PrepareZoning { + log_message: u32, + target_zone: u16, + animation: u16, + param4: u8, + hide_character: u8, + fade_out: u8, + param_7: u8, + fade_out_time: u8, + unk1: u8, + unk2: u16, + }, /// Sent by the server #[br(pre_assert(*magic == ServerZoneIpcType::ActorControl))] ActorControl(ActorControl), @@ -787,7 +798,18 @@ mod tests { ), ( ServerZoneIpcType::PrepareZoning, - ServerZoneIpcData::PrepareZoning { unk: [0; 4] }, + ServerZoneIpcData::PrepareZoning { + log_message: 0, + target_zone: 0, + animation: 0, + param4: 0, + hide_character: 0, + fade_out: 0, + param_7: 0, + fade_out_time: 0, + unk1: 0, + unk2: 0, + }, ), ( ServerZoneIpcType::ActorControl, diff --git a/src/world/connection.rs b/src/world/connection.rs index 80ff861..5688874 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -368,6 +368,35 @@ impl ZoneConnection { self.player_data.zone_id = new_zone_id; + // fade in? + { + let ipc = ServerZoneIpcSegment { + op_code: ServerZoneIpcType::PrepareZoning, + timestamp: timestamp_secs(), + data: ServerZoneIpcData::PrepareZoning { + log_message: 0, + target_zone: self.player_data.zone_id, + animation: 0, + param4: 0, + hide_character: 0, + fade_out: 1, + param_7: 1, + fade_out_time: 1, + unk1: 8, + unk2: 0, + }, + ..Default::default() + }; + + self.send_segment(PacketSegment { + source_actor: self.player_data.actor_id, + target_actor: self.player_data.actor_id, + segment_type: SegmentType::Ipc, + data: SegmentData::Ipc { data: ipc }, + }) + .await; + } + // Player Class Info self.update_class_info().await;