From 76137231510b56f3fbb552ce116937577236a773 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 9 Mar 2025 00:20:41 -0500 Subject: [PATCH] Roll delete into a more general lobby action --- src/bin/kawari-lobby.rs | 21 ++++++++++++++++----- src/ipc.rs | 24 ++++++++++++++++++------ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/bin/kawari-lobby.rs b/src/bin/kawari-lobby.rs index bdcfa56..5bd1675 100644 --- a/src/bin/kawari-lobby.rs +++ b/src/bin/kawari-lobby.rs @@ -51,11 +51,22 @@ async fn main() { send_lobby_info(&mut write, &state, *sequence).await; } - IPCStructData::RequestCharacterDelete { name } => { - tracing::info!( - "Client is requesting character named {name} to be deleted. Ignoring since it's not implemented yet." - ); - } + IPCStructData::LobbyCharacterAction { + sequence, + action, + name, + } => match &action { + kawari::ipc::LobbyCharacterAction::Delete => { + tracing::info!( + "Client is requesting character named {name} to be deleted. Ignoring since it's not implemented yet." + ); + } + kawari::ipc::LobbyCharacterAction::Request => { + tracing::info!( + "Client is requesting character data! Ignoring since it's not implemented yet." + ); + } + }, _ => { panic!("The server is recieving a IPC response packet!") } diff --git a/src/ipc.rs b/src/ipc.rs index 05bbcc7..3e798d9 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -10,8 +10,8 @@ pub enum IPCOpCode { RequestCharacterList = 0x3, /// Sent by the client after exchanging encryption information with the lobby server. ClientVersionInfo = 0x5, - /// Sent by the client when they request a character to be deleted. - RequestCharacterDelete = 0xB, + /// Sent by the client when they request something about the character (e.g. deletion.) + LobbyCharacterAction = 0xB, /// Sent by the server to inform the client of their service accounts. LobbyServiceAccountList = 0xC, /// Sent by the server to inform the client of their characters. @@ -86,6 +86,14 @@ pub struct CharacterDetails { pub unk2: [u8; 20], } +#[binrw] +#[brw(repr = u8)] +#[derive(Clone, PartialEq, Debug)] +pub enum LobbyCharacterAction { + Delete = 0x4, + Request = 0x15, +} + #[binrw] #[br(import(magic: &IPCOpCode))] #[derive(Debug, Clone)] @@ -112,9 +120,13 @@ pub enum IPCStructData { sequence: u64, // TODO: what is in here? }, - #[br(pre_assert(*magic == IPCOpCode::RequestCharacterDelete))] - RequestCharacterDelete { - #[brw(pad_before = 28)] + #[br(pre_assert(*magic == IPCOpCode::LobbyCharacterAction))] + LobbyCharacterAction { + #[brw(pad_before = 16)] + sequence: u64, + #[brw(pad_before = 1)] + action: LobbyCharacterAction, + #[brw(pad_before = 2)] #[bw(pad_size_to = 32)] #[br(count = 32)] #[br(map = read_string)] @@ -200,7 +212,7 @@ impl IPCSegment { IPCStructData::LobbyServerList { .. } => 24 + (6 * 84), IPCStructData::LobbyRetainerList { .. } => 210, IPCStructData::LobbyCharacterList { .. } => 80 + (2 * 1184), - IPCStructData::RequestCharacterDelete { .. } => todo!(), + IPCStructData::LobbyCharacterAction { .. } => todo!(), } } }