mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-22 23:27:46 +00:00
Make various packet dumping optional, turned off by default
This creates a lot of clutter, and only really interesting to developers.
This commit is contained in:
parent
cbbeccb782
commit
fed21b3617
5 changed files with 18 additions and 4 deletions
|
@ -241,6 +241,10 @@ pub struct Config {
|
|||
|
||||
#[serde(default)]
|
||||
pub world: WorldConfig,
|
||||
|
||||
/// Enable various packet debug functions. This will clutter your working directory!
|
||||
#[serde(default)]
|
||||
pub packet_debugging: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
|
@ -255,6 +259,7 @@ impl Default for Config {
|
|||
patch: PatchConfig::default(),
|
||||
web: WebConfig::default(),
|
||||
world: WorldConfig::default(),
|
||||
packet_debugging: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::io::Cursor;
|
|||
use binrw::{BinRead, BinResult};
|
||||
|
||||
use crate::{
|
||||
config::get_config,
|
||||
oodle::OodleNetwork,
|
||||
packet::{PacketHeader, PacketSegment},
|
||||
};
|
||||
|
@ -46,7 +47,10 @@ pub(crate) fn decompress<T: ReadWriteIpcSegment>(
|
|||
|
||||
let mut cursor = Cursor::new(&data);
|
||||
|
||||
std::fs::write("decompressed.bin", &data).unwrap();
|
||||
let config = get_config();
|
||||
if config.packet_debugging {
|
||||
std::fs::write("decompressed.bin", &data).unwrap();
|
||||
}
|
||||
|
||||
for _ in 0..header.segment_count {
|
||||
let current_position = cursor.position();
|
||||
|
|
|
@ -5,6 +5,7 @@ use tokio::{io::AsyncWriteExt, net::TcpStream};
|
|||
|
||||
use crate::{
|
||||
common::{custom_ipc::CustomIpcSegment, read_string, timestamp_msecs, write_string},
|
||||
config::get_config,
|
||||
oodle::OodleNetwork,
|
||||
packet::{compression::compress, encryption::decrypt},
|
||||
};
|
||||
|
@ -195,7 +196,11 @@ pub async fn parse_packet<T: ReadWriteIpcSegment>(
|
|||
Ok(packet) => (packet.segments, packet.header.connection_type),
|
||||
Err(err) => {
|
||||
tracing::error!("{err}");
|
||||
dump("Failed to parse packet!", data);
|
||||
|
||||
let config = get_config();
|
||||
if config.packet_debugging {
|
||||
dump("Failed to parse packet!", data);
|
||||
}
|
||||
|
||||
(Vec::new(), ConnectionType::None)
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ impl ZoneConnection {
|
|||
}
|
||||
|
||||
// inform the client of page 1
|
||||
{
|
||||
{
|
||||
let ipc = ServerZoneIpcSegment {
|
||||
op_code: ServerZoneIpcType::ContainerInfo,
|
||||
timestamp: timestamp_secs(),
|
||||
|
|
|
@ -88,7 +88,7 @@ impl Inventory {
|
|||
pub fn new() -> Self {
|
||||
Self {
|
||||
equipped: EquippedContainer::default(),
|
||||
extra_slot: Item::default()
|
||||
extra_slot: Item::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue