mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-21 23:17:45 +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)]
|
#[serde(default)]
|
||||||
pub world: WorldConfig,
|
pub world: WorldConfig,
|
||||||
|
|
||||||
|
/// Enable various packet debug functions. This will clutter your working directory!
|
||||||
|
#[serde(default)]
|
||||||
|
pub packet_debugging: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
|
@ -255,6 +259,7 @@ impl Default for Config {
|
||||||
patch: PatchConfig::default(),
|
patch: PatchConfig::default(),
|
||||||
web: WebConfig::default(),
|
web: WebConfig::default(),
|
||||||
world: WorldConfig::default(),
|
world: WorldConfig::default(),
|
||||||
|
packet_debugging: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use std::io::Cursor;
|
||||||
use binrw::{BinRead, BinResult};
|
use binrw::{BinRead, BinResult};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
config::get_config,
|
||||||
oodle::OodleNetwork,
|
oodle::OodleNetwork,
|
||||||
packet::{PacketHeader, PacketSegment},
|
packet::{PacketHeader, PacketSegment},
|
||||||
};
|
};
|
||||||
|
@ -46,7 +47,10 @@ pub(crate) fn decompress<T: ReadWriteIpcSegment>(
|
||||||
|
|
||||||
let mut cursor = Cursor::new(&data);
|
let mut cursor = Cursor::new(&data);
|
||||||
|
|
||||||
|
let config = get_config();
|
||||||
|
if config.packet_debugging {
|
||||||
std::fs::write("decompressed.bin", &data).unwrap();
|
std::fs::write("decompressed.bin", &data).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
for _ in 0..header.segment_count {
|
for _ in 0..header.segment_count {
|
||||||
let current_position = cursor.position();
|
let current_position = cursor.position();
|
||||||
|
|
|
@ -5,6 +5,7 @@ use tokio::{io::AsyncWriteExt, net::TcpStream};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{custom_ipc::CustomIpcSegment, read_string, timestamp_msecs, write_string},
|
common::{custom_ipc::CustomIpcSegment, read_string, timestamp_msecs, write_string},
|
||||||
|
config::get_config,
|
||||||
oodle::OodleNetwork,
|
oodle::OodleNetwork,
|
||||||
packet::{compression::compress, encryption::decrypt},
|
packet::{compression::compress, encryption::decrypt},
|
||||||
};
|
};
|
||||||
|
@ -195,7 +196,11 @@ pub async fn parse_packet<T: ReadWriteIpcSegment>(
|
||||||
Ok(packet) => (packet.segments, packet.header.connection_type),
|
Ok(packet) => (packet.segments, packet.header.connection_type),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
tracing::error!("{err}");
|
tracing::error!("{err}");
|
||||||
|
|
||||||
|
let config = get_config();
|
||||||
|
if config.packet_debugging {
|
||||||
dump("Failed to parse packet!", data);
|
dump("Failed to parse packet!", data);
|
||||||
|
}
|
||||||
|
|
||||||
(Vec::new(), ConnectionType::None)
|
(Vec::new(), ConnectionType::None)
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl Inventory {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
equipped: EquippedContainer::default(),
|
equipped: EquippedContainer::default(),
|
||||||
extra_slot: Item::default()
|
extra_slot: Item::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue