1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-23 23:57:46 +00:00

Fix and check more packet sizes

This commit is contained in:
Joshua Goins 2025-03-30 19:50:31 -04:00
parent 55c1e84cc5
commit b01ec22950
2 changed files with 48 additions and 17 deletions

View file

@ -8,7 +8,7 @@
{
"name": "InitZone",
"opcode": 699,
"size": 103
"size": 112
},
{
"name": "ActorControlSelf",

View file

@ -166,8 +166,8 @@ pub enum ServerZoneIpcData {
/// Sent by the server when they send a chat message
ServerChatMessage {
unk: u8, // channel?
#[brw(pad_after = 775)]
#[br(count = 775)]
#[brw(pad_after = 774)]
#[br(count = 774)]
#[br(map = read_string)]
#[bw(map = write_string)]
message: String,
@ -375,14 +375,26 @@ mod tests {
#[test]
fn world_ipc_sizes() {
let ipc_types = [
(
ServerZoneIpcType::ActorControlSelf,
ServerZoneIpcData::ActorControlSelf(ActorControlSelf::default()),
),
(
ServerZoneIpcType::InitializeChat,
ServerZoneIpcData::InitializeChat { unk: [0; 8] },
),
(
ServerZoneIpcType::InitResponse,
ServerZoneIpcData::InitResponse {
unk1: 0,
character_id: 0,
unk2: 0,
},
),
(
ServerZoneIpcType::InitZone,
ServerZoneIpcData::InitZone(InitZone::default()),
),
(
ServerZoneIpcType::ActorControlSelf,
ServerZoneIpcData::ActorControlSelf(ActorControlSelf::default()),
),
(
ServerZoneIpcType::PlayerStats,
ServerZoneIpcData::PlayerStats(PlayerStats::default()),
@ -399,18 +411,37 @@ mod tests {
ServerZoneIpcType::PlayerSpawn,
ServerZoneIpcData::PlayerSpawn(PlayerSpawn::default()),
),
(
ServerZoneIpcType::LogOutComplete,
ServerZoneIpcData::LogOutComplete { unk: [0; 8] },
),
(
ServerZoneIpcType::ActorSetPos,
ServerZoneIpcData::ActorSetPos(ActorSetPos::default()),
),
(
ServerZoneIpcType::NpcSpawn,
ServerZoneIpcData::NpcSpawn(NpcSpawn::default()),
ServerZoneIpcType::ServerChatMessage,
ServerZoneIpcData::ServerChatMessage {
unk: 0,
message: String::new(),
},
),
(
ServerZoneIpcType::PrepareZoning,
ServerZoneIpcData::PrepareZoning { unk: [0; 4] },
),
(
ServerZoneIpcType::ActorControl,
ServerZoneIpcData::ActorControl(ActorControl::default()),
),
(
ServerZoneIpcType::ActorMove,
ServerZoneIpcData::ActorMove(ActorMove::default()),
),
(
ServerZoneIpcType::NpcSpawn,
ServerZoneIpcData::NpcSpawn(NpcSpawn::default()),
),
(
ServerZoneIpcType::StatusEffectList,
ServerZoneIpcData::StatusEffectList(StatusEffectList::default()),
@ -419,10 +450,6 @@ mod tests {
ServerZoneIpcType::WeatherChange,
ServerZoneIpcData::WeatherChange(WeatherChange::default()),
),
(
ServerZoneIpcType::ActorControl,
ServerZoneIpcData::ActorControl(ActorControl::default()),
),
(
ServerZoneIpcType::ItemInfo,
ServerZoneIpcData::ItemInfo(ItemInfo::default()),
@ -440,12 +467,16 @@ mod tests {
ServerZoneIpcData::EventStart(EventStart::default()),
),
(
ServerZoneIpcType::ActionResult,
ServerZoneIpcData::ActionResult(ActionResult::default()),
ServerZoneIpcType::UpdateHpMpTp,
ServerZoneIpcData::UpdateHpMpTp {
hp: 0,
mp: 0,
unk: 0,
},
),
(
ServerZoneIpcType::ActorMove,
ServerZoneIpcData::ActorMove(ActorMove::default()),
ServerZoneIpcType::ActionResult,
ServerZoneIpcData::ActionResult(ActionResult::default()),
),
];