mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-25 16:27:46 +00:00
Add helper function to send lobby errors
This isn't used yet, but implemented for future use.
This commit is contained in:
parent
22acdc4a3b
commit
f8a28e45c9
3 changed files with 43 additions and 1 deletions
|
@ -47,6 +47,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
SegmentType::Ipc { data } => match &data.data {
|
SegmentType::Ipc { data } => match &data.data {
|
||||||
IPCStructData::ClientVersionInfo {
|
IPCStructData::ClientVersionInfo {
|
||||||
|
sequence,
|
||||||
session_id,
|
session_id,
|
||||||
version_info,
|
version_info,
|
||||||
} => {
|
} => {
|
||||||
|
@ -57,6 +58,9 @@ async fn main() {
|
||||||
connection.state.session_id = Some(session_id.clone());
|
connection.state.session_id = Some(session_id.clone());
|
||||||
|
|
||||||
connection.send_account_list().await;
|
connection.send_account_list().await;
|
||||||
|
|
||||||
|
// request an update
|
||||||
|
//connection.send_error(*sequence, 1012, 13101).await;
|
||||||
}
|
}
|
||||||
IPCStructData::RequestCharacterList { sequence } => {
|
IPCStructData::RequestCharacterList { sequence } => {
|
||||||
tracing::info!("Client is requesting character list...");
|
tracing::info!("Client is requesting character list...");
|
||||||
|
|
14
src/ipc.rs
14
src/ipc.rs
|
@ -237,7 +237,9 @@ pub enum IPCStructData {
|
||||||
// Client->Server IPC
|
// Client->Server IPC
|
||||||
#[br(pre_assert(*magic == IPCOpCode::ClientVersionInfo))]
|
#[br(pre_assert(*magic == IPCOpCode::ClientVersionInfo))]
|
||||||
ClientVersionInfo {
|
ClientVersionInfo {
|
||||||
#[brw(pad_before = 18)] // full of nonsense i don't understand yet
|
sequence: u64,
|
||||||
|
|
||||||
|
#[brw(pad_before = 14)] // full of nonsense i don't understand yet
|
||||||
#[br(count = 64)]
|
#[br(count = 64)]
|
||||||
#[br(map = read_string)]
|
#[br(map = read_string)]
|
||||||
#[bw(ignore)]
|
#[bw(ignore)]
|
||||||
|
@ -549,6 +551,14 @@ pub enum IPCStructData {
|
||||||
Unk17 { unk: [u8; 104] },
|
Unk17 { unk: [u8; 104] },
|
||||||
#[br(pre_assert(false))]
|
#[br(pre_assert(false))]
|
||||||
SocialList(SocialList),
|
SocialList(SocialList),
|
||||||
|
#[br(pre_assert(false))]
|
||||||
|
LobbyError {
|
||||||
|
sequence: u64,
|
||||||
|
error: u32,
|
||||||
|
value: u32,
|
||||||
|
exd_error_id: u16,
|
||||||
|
unk1: u16,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
|
@ -579,6 +589,7 @@ impl Default for IPCSegment {
|
||||||
data: IPCStructData::ClientVersionInfo {
|
data: IPCStructData::ClientVersionInfo {
|
||||||
session_id: String::new(),
|
session_id: String::new(),
|
||||||
version_info: String::new(),
|
version_info: String::new(),
|
||||||
|
sequence: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -642,6 +653,7 @@ impl IPCSegment {
|
||||||
IPCStructData::ActorMove { .. } => 16,
|
IPCStructData::ActorMove { .. } => 16,
|
||||||
IPCStructData::Unk17 { .. } => 104,
|
IPCStructData::Unk17 { .. } => 104,
|
||||||
IPCStructData::SocialList { .. } => 1136,
|
IPCStructData::SocialList { .. } => 1136,
|
||||||
|
IPCStructData::LobbyError { .. } => 536,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,4 +306,30 @@ impl LobbyConnection {
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn send_error(&mut self, sequence: u64, error: u32, exd_error: u16) {
|
||||||
|
let lobby_error = IPCStructData::LobbyError {
|
||||||
|
sequence,
|
||||||
|
error,
|
||||||
|
value: 0,
|
||||||
|
exd_error_id: exd_error,
|
||||||
|
unk1: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
let ipc = IPCSegment {
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0,
|
||||||
|
op_code: IPCOpCode::InitializeChat,
|
||||||
|
server_id: 0,
|
||||||
|
timestamp: timestamp_secs(),
|
||||||
|
data: lobby_error,
|
||||||
|
};
|
||||||
|
|
||||||
|
self.send_segment(PacketSegment {
|
||||||
|
source_actor: 0,
|
||||||
|
target_actor: 0,
|
||||||
|
segment_type: SegmentType::Ipc { data: ipc },
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue