diff --git a/src/common_file_operations.rs b/src/common_file_operations.rs index 61b8335..d28dad2 100644 --- a/src/common_file_operations.rs +++ b/src/common_file_operations.rs @@ -63,7 +63,7 @@ pub(crate) fn string_from_offset(start: u64) -> BinResult { let old_pos = reader.stream_position()?; reader.seek(SeekFrom::Start(start + offset as u64))?; - reader.seek(SeekFrom::Start(start as u64))?; + reader.seek(SeekFrom::Start(start))?; let mut next_char = reader.read_le::().unwrap() as char; while next_char != '\0' { string.push(next_char); diff --git a/src/layer/mod.rs b/src/layer/mod.rs index a3b8cc3..df70174 100644 --- a/src/layer/mod.rs +++ b/src/layer/mod.rs @@ -8,7 +8,7 @@ use crate::common_file_operations::{ }; use crate::{ByteBuffer, ByteSpan}; use binrw::{BinRead, BinReaderExt, BinWrite, binread}; -use binrw::{BinResult, Endian, Error, binrw, binwrite}; +use binrw::{Endian, Error, binrw}; mod aetheryte; pub use aetheryte::AetheryteInstanceObject; @@ -79,12 +79,10 @@ const LGP1_ID: u32 = u32::from_le_bytes(*b"LGP1"); pub struct HeapString { #[br(temp)] // TODO: this cast is stupid - #[bw(calc = string_heap.get_free_offset_string(&value) as u32)] - #[br(dbg)] + #[bw(calc = string_heap.get_free_offset_string(value) as u32)] pub offset: u32, #[br(calc = string_heap.read_string(r, offset,))] #[bw(ignore)] - #[br(dbg)] pub value: String, } @@ -120,8 +118,6 @@ impl StringHeap { let old_pos = self.free_pos; self.free_pos += buffer.len() as u64; - println!("free pos for {:#?} is {}!", obj, old_pos); - old_pos as i32 } @@ -141,8 +137,6 @@ impl StringHeap { let old_pos = self.free_pos; self.free_pos += buffer.len() as u64; - println!("free pos for {:#?} is {}!", obj, old_pos); - old_pos as i32 } @@ -189,7 +183,7 @@ impl StringHeap { let old_pos = reader.stream_position().unwrap(); - reader.seek(SeekFrom::Start(offset as u64)).unwrap(); + reader.seek(SeekFrom::Start(offset)).unwrap(); let mut next_char = reader.read_le::().unwrap() as char; while next_char != '\0' { string.push(next_char); @@ -526,7 +520,6 @@ struct LayerHeader { pub festival_phase_id: u16, pub is_temporary: u8, pub is_housing: u8, - #[br(dbg)] pub version_mask: u16, #[brw(pad_before = 4)] @@ -663,16 +656,12 @@ impl LayerGroup { return None; } - dbg!(&file_header); - // yes, for some reason it begins at 8 bytes in?!?! let chunk_string_heap = StringHeap::from(cursor.position() + 8); let chunk_header = LayerChunkHeader::read_le_args(&mut cursor, (&chunk_string_heap,)).unwrap(); - dbg!(&chunk_header); - if chunk_header.chunk_size <= 0 { return None; } @@ -684,8 +673,6 @@ impl LayerGroup { layer_offsets[i as usize] = cursor.read_le::().unwrap(); } - dbg!(&layer_offsets); - let mut layers = Vec::new(); for i in 0..chunk_header.layer_count { @@ -836,9 +823,6 @@ impl LayerGroup { free_pos: data_base + 4, }; - println!("FINAL STRING HEAP: {:#?}", chunk_string_heap); - println!("FINAL DATA HEAP: {:#?}", chunk_data_heap); - // write header now, because it has a string cursor .seek(SeekFrom::Start(layer_chunk_header_pos)) diff --git a/src/layer/npc.rs b/src/layer/npc.rs index d95fea3..73cee6e 100644 --- a/src/layer/npc.rs +++ b/src/layer/npc.rs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2025 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later -use binrw::{binread, binrw}; +use binrw::binread; use super::common::RelativePositions; diff --git a/src/layer/pop.rs b/src/layer/pop.rs index abbb986..fe61138 100644 --- a/src/layer/pop.rs +++ b/src/layer/pop.rs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2025 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later -use binrw::{binread, binrw}; +use binrw::binread; use super::common::RelativePositions;