diff --git a/src/bin/kawari-lobby.rs b/src/bin/kawari-lobby.rs index 6d3e363..bdcfa56 100644 --- a/src/bin/kawari-lobby.rs +++ b/src/bin/kawari-lobby.rs @@ -51,6 +51,11 @@ 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." + ); + } _ => { panic!("The server is recieving a IPC response packet!") } diff --git a/src/encryption.rs b/src/encryption.rs index 03c1a66..ab88794 100644 --- a/src/encryption.rs +++ b/src/encryption.rs @@ -1,3 +1,4 @@ +use std::fs::write; use std::{io::Cursor, slice}; use binrw::{BinRead, BinResult, BinWrite}; @@ -48,6 +49,8 @@ where let decryption_result = blowfish_decode(encryption_key.as_ptr(), 16, data.as_ptr(), size); let decrypted_data = slice::from_raw_parts(decryption_result, size as usize); + write("decrypted.bin", &decrypted_data).unwrap(); + let mut cursor = Cursor::new(&decrypted_data); T::read_options(&mut cursor, endian, ()) } diff --git a/src/ipc.rs b/src/ipc.rs index 2846329..05bbcc7 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -10,6 +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 server to inform the client of their service accounts. LobbyServiceAccountList = 0xC, /// Sent by the server to inform the client of their characters. @@ -84,24 +86,6 @@ pub struct CharacterDetails { pub unk2: [u8; 20], } -/*impl Default for CharacterDetails { - fn default() -> Self { - Self { - id: 0, - content_id: 0, - index: 1, - server_id: 0, - server_id1: 0, - unk1: [0; 16], - character_name: String::new(), - character_server_name: String::new(), - character_server_name1: String::new(), - character_detail_json: String::new(), - unk2: [0; 20], - } - } -}*/ - #[binrw] #[br(import(magic: &IPCOpCode))] #[derive(Debug, Clone)] @@ -128,6 +112,16 @@ pub enum IPCStructData { sequence: u64, // TODO: what is in here? }, + #[br(pre_assert(*magic == IPCOpCode::RequestCharacterDelete))] + RequestCharacterDelete { + #[brw(pad_before = 28)] + #[bw(pad_size_to = 32)] + #[br(count = 32)] + #[br(map = read_string)] + #[bw(map = write_string)] + name: String, + // TODO: what else is in here? + }, // Server->Client IPC LobbyServiceAccountList { @@ -206,6 +200,7 @@ impl IPCSegment { IPCStructData::LobbyServerList { .. } => 24 + (6 * 84), IPCStructData::LobbyRetainerList { .. } => 210, IPCStructData::LobbyCharacterList { .. } => 80 + (2 * 1184), + IPCStructData::RequestCharacterDelete { .. } => todo!(), } } }