From 3140dad37881d2c3c06bb589a1a051b3911b33f2 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 16 Mar 2025 18:35:11 -0400 Subject: [PATCH] Remove leftover bits of debugging logging --- src/bin/kawari-lobby.rs | 1 - src/bin/kawari-world.rs | 1 - src/packet/compression.rs | 10 ---------- src/packet/encryption.rs | 3 --- src/packet/ipc.rs | 3 --- src/packet/packet.rs | 13 ++----------- src/world/chat_handler.rs | 2 +- src/world/ipc/mod.rs | 4 ---- 8 files changed, 3 insertions(+), 34 deletions(-) diff --git a/src/bin/kawari-lobby.rs b/src/bin/kawari-lobby.rs index c816cb5..228dd21 100644 --- a/src/bin/kawari-lobby.rs +++ b/src/bin/kawari-lobby.rs @@ -148,7 +148,6 @@ async fn main() { let chara_make = CharaMake::from_json(&character_action.json); - println!("charamake: {:#?}", chara_make); // a slightly different character created packet now { diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 589e41e..26f9f3e 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -58,7 +58,6 @@ async fn main() { .expect("Failed to read data!"); if n != 0 { - println!("recieved {n} bytes..."); let (segments, connection_type) = connection.parse_packet(&buf[..n]).await; for segment in &segments { match &segment.segment_type { diff --git a/src/packet/compression.rs b/src/packet/compression.rs index 742cb2e..79c0d02 100644 --- a/src/packet/compression.rs +++ b/src/packet/compression.rs @@ -1,5 +1,4 @@ use binrw::binrw; -use std::fs::write; use std::io::Cursor; use binrw::{BinRead, BinResult}; @@ -29,16 +28,9 @@ pub(crate) fn decompress( let size = header.size as usize - std::mem::size_of::(); - println!( - "known packet size: {} but decompressing {} bytes", - header.size, size - ); - let mut data = vec![0; size]; reader.read_exact(&mut data).unwrap(); - write("compressed.bin", &data).unwrap(); - let data = match header.compression_type { crate::packet::CompressionType::Uncompressed => data, crate::packet::CompressionType::Oodle => oodle.decode(data, header.uncompressed_size), @@ -52,8 +44,6 @@ pub(crate) fn decompress( ); } - write("decompressed.bin", &data).unwrap(); - let mut cursor = Cursor::new(&data); for _ in 0..header.segment_count { diff --git a/src/packet/encryption.rs b/src/packet/encryption.rs index 618b727..2403d09 100644 --- a/src/packet/encryption.rs +++ b/src/packet/encryption.rs @@ -1,4 +1,3 @@ -use std::fs::write; use std::io::Cursor; use binrw::BinResult; @@ -33,8 +32,6 @@ pub(crate) fn decrypt( let blowfish = Blowfish::new(encryption_key); blowfish.decrypt(&mut data); - write("decrypted.bin", &data).unwrap(); - let mut cursor = Cursor::new(&data); T::read_options(&mut cursor, endian, ()) } else { diff --git a/src/packet/ipc.rs b/src/packet/ipc.rs index 8b5ced7..3c38f6e 100644 --- a/src/packet/ipc.rs +++ b/src/packet/ipc.rs @@ -19,12 +19,9 @@ where { pub unk1: u8, pub unk2: u8, - #[br(dbg)] pub op_code: OpCode, #[brw(pad_before = 2)] // empty - #[br(dbg)] pub server_id: u16, - #[br(dbg)] pub timestamp: u32, #[brw(pad_before = 4)] #[br(args(&op_code))] diff --git a/src/packet/packet.rs b/src/packet/packet.rs index 60041c3..b98e670 100644 --- a/src/packet/packet.rs +++ b/src/packet/packet.rs @@ -91,14 +91,10 @@ pub struct PacketHeader { #[derive(Debug, Clone)] pub struct PacketSegment { #[bw(calc = self.calc_size())] - #[br(dbg)] pub size: u32, - #[br(dbg)] pub source_actor: u32, - #[br(dbg)] pub target_actor: u32, #[brw(args(size, encryption_key))] - #[br(dbg)] pub segment_type: SegmentType, } @@ -122,11 +118,9 @@ impl PacketSegment { #[brw(import(oodle: &mut FFXIVOodle, encryption_key: Option<&[u8]>))] #[derive(Debug)] struct Packet { - #[br(dbg)] header: PacketHeader, #[bw(args(encryption_key))] #[br(parse_with = decompress, args(oodle, &header, encryption_key,))] - #[br(dbg)] segments: Vec>, } @@ -220,12 +214,9 @@ pub async fn parse_packet( state.client_key.as_ref().map(|s: &[u8; 16]| s.as_slice()), ), ) { - Ok(packet) => { - println!("{:#?}", packet); - (packet.segments, packet.header.connection_type) - } + Ok(packet) => (packet.segments, packet.header.connection_type), Err(err) => { - println!("{err}"); + tracing::error!("{err}"); dump("Failed to parse packet!", data); (Vec::new(), ConnectionType::None) diff --git a/src/world/chat_handler.rs b/src/world/chat_handler.rs index 6e86938..579f300 100644 --- a/src/world/chat_handler.rs +++ b/src/world/chat_handler.rs @@ -32,7 +32,7 @@ impl ChatHandler { .await; } "!spawnactor" => { - println!("Spawning actor..."); + tracing::info!("Spawning actor..."); // send player spawn { diff --git a/src/world/ipc/mod.rs b/src/world/ipc/mod.rs index 53503af..a2d9adf 100644 --- a/src/world/ipc/mod.rs +++ b/src/world/ipc/mod.rs @@ -300,7 +300,6 @@ pub enum ClientZoneIpcData { #[br(pre_assert(*magic == ClientZoneIpcType::InitRequest))] InitRequest { // TODO: full of possibly interesting information - #[br(dbg)] unk: [u8; 105], }, #[br(pre_assert(*magic == ClientZoneIpcType::FinishLoading))] @@ -371,7 +370,6 @@ pub enum ClientZoneIpcData { command: GameMasterCommandType, #[br(pad_before = 3)] // idk, not empty though arg: u32, - #[br(dbg)] unk: [u8; 24], }, #[br(pre_assert(*magic == ClientZoneIpcType::Unk12))] @@ -387,12 +385,10 @@ pub enum ClientZoneIpcData { }, #[br(pre_assert(*magic == ClientZoneIpcType::Unk13))] Unk13 { - #[br(dbg)] unk: [u8; 16], // TODO: unknown }, #[br(pre_assert(*magic == ClientZoneIpcType::Unk14))] Unk14 { - #[br(dbg)] unk: [u8; 8], // TODO: unknown }, }