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

Add support for character delete packets

This commit is contained in:
Joshua Goins 2025-03-09 00:06:54 -05:00
parent 3e34020282
commit c35a5448d1
3 changed files with 21 additions and 18 deletions

View file

@ -51,6 +51,11 @@ async fn main() {
send_lobby_info(&mut write, &state, *sequence).await; 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!") panic!("The server is recieving a IPC response packet!")
} }

View file

@ -1,3 +1,4 @@
use std::fs::write;
use std::{io::Cursor, slice}; use std::{io::Cursor, slice};
use binrw::{BinRead, BinResult, BinWrite}; 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 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); 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); let mut cursor = Cursor::new(&decrypted_data);
T::read_options(&mut cursor, endian, ()) T::read_options(&mut cursor, endian, ())
} }

View file

@ -10,6 +10,8 @@ pub enum IPCOpCode {
RequestCharacterList = 0x3, RequestCharacterList = 0x3,
/// Sent by the client after exchanging encryption information with the lobby server. /// Sent by the client after exchanging encryption information with the lobby server.
ClientVersionInfo = 0x5, 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. /// Sent by the server to inform the client of their service accounts.
LobbyServiceAccountList = 0xC, LobbyServiceAccountList = 0xC,
/// Sent by the server to inform the client of their characters. /// Sent by the server to inform the client of their characters.
@ -84,24 +86,6 @@ pub struct CharacterDetails {
pub unk2: [u8; 20], 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] #[binrw]
#[br(import(magic: &IPCOpCode))] #[br(import(magic: &IPCOpCode))]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -128,6 +112,16 @@ pub enum IPCStructData {
sequence: u64, sequence: u64,
// TODO: what is in here? // 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 // Server->Client IPC
LobbyServiceAccountList { LobbyServiceAccountList {
@ -206,6 +200,7 @@ impl IPCSegment {
IPCStructData::LobbyServerList { .. } => 24 + (6 * 84), IPCStructData::LobbyServerList { .. } => 24 + (6 * 84),
IPCStructData::LobbyRetainerList { .. } => 210, IPCStructData::LobbyRetainerList { .. } => 210,
IPCStructData::LobbyCharacterList { .. } => 80 + (2 * 1184), IPCStructData::LobbyCharacterList { .. } => 80 + (2 * 1184),
IPCStructData::RequestCharacterDelete { .. } => todo!(),
} }
} }
} }