mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-09 23:47:46 +00:00
Add ClientChatIpcSegment
This is just a dummy for now, we just need it downstream in Packet Analzyer.
This commit is contained in:
parent
5acf6580f3
commit
f2239378f6
2 changed files with 114 additions and 76 deletions
2
build.rs
2
build.rs
|
@ -21,7 +21,6 @@ fn main() {
|
||||||
let key = element.0;
|
let key = element.0;
|
||||||
let opcodes = element.1.as_array().unwrap();
|
let opcodes = element.1.as_array().unwrap();
|
||||||
|
|
||||||
if !opcodes.is_empty() {
|
|
||||||
// beginning
|
// beginning
|
||||||
output_str.push_str("#[binrw]\n");
|
output_str.push_str("#[binrw]\n");
|
||||||
output_str.push_str("#[derive(Clone, PartialEq, Debug)]\n");
|
output_str.push_str("#[derive(Clone, PartialEq, Debug)]\n");
|
||||||
|
@ -99,7 +98,6 @@ fn main() {
|
||||||
// end impl
|
// end impl
|
||||||
output_str.push_str("}\n\n");
|
output_str.push_str("}\n\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::fs::write("src/opcodes.rs", output_str).expect("Failed to write opcodes file!");
|
std::fs::write("src/opcodes.rs", output_str).expect("Failed to write opcodes file!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
opcodes::ServerChatIpcType,
|
opcodes::{ClientChatIpcType, ServerChatIpcType},
|
||||||
packet::{IPC_HEADER_SIZE, IpcSegment, ReadWriteIpcSegment},
|
packet::{IPC_HEADER_SIZE, IpcSegment, ReadWriteIpcSegment},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,6 +38,36 @@ impl Default for ServerChatIpcSegment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type ClientChatIpcSegment = IpcSegment<ClientChatIpcType, ClientChatIpcData>;
|
||||||
|
|
||||||
|
impl ReadWriteIpcSegment for ClientChatIpcSegment {
|
||||||
|
fn calc_size(&self) -> u32 {
|
||||||
|
IPC_HEADER_SIZE + self.op_code.calc_size()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_name(&self) -> &'static str {
|
||||||
|
self.op_code.get_name()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_opcode(&self) -> u16 {
|
||||||
|
self.op_code.get_opcode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: make generic
|
||||||
|
impl Default for ClientChatIpcSegment {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
unk1: 0x14,
|
||||||
|
unk2: 0,
|
||||||
|
op_code: ClientChatIpcType::Unknown(0),
|
||||||
|
option: 0,
|
||||||
|
timestamp: 0,
|
||||||
|
data: ClientChatIpcData::Unknown { unk: Vec::new() },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[br(import(magic: &ServerChatIpcType, size: &u32))]
|
#[br(import(magic: &ServerChatIpcType, size: &u32))]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -50,3 +80,13 @@ pub enum ServerChatIpcData {
|
||||||
unk: Vec<u8>,
|
unk: Vec<u8>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[binrw]
|
||||||
|
#[br(import(_magic: &ClientChatIpcType, size: &u32))]
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum ClientChatIpcData {
|
||||||
|
Unknown {
|
||||||
|
#[br(count = size - 32)]
|
||||||
|
unk: Vec<u8>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue