Remove leftover binrw debugging

This commit is contained in:
Joshua Goins 2025-02-23 15:04:04 -05:00
parent e5b9e9150e
commit a4615b29ce
6 changed files with 27 additions and 28 deletions

View file

@ -9,7 +9,6 @@ fn custom_parser(size_in_bytes: u32, value_type: &str) -> BinResult<Vec<ArrayEnt
let end = current + size_in_bytes as u64 - 4;
while current < end {
println!("current: {}, end: {}", current, end);
result.push(ArrayEntry::read_options(reader, endian, (value_type,)).unwrap());
current = reader.stream_position().unwrap();
}
@ -22,7 +21,7 @@ fn custom_parser(size_in_bytes: u32, value_type: &str) -> BinResult<Vec<ArrayEnt
#[br(import(value_type: &str))]
pub struct ArrayEntry {
#[br(args { magic: &value_type })]
#[br(dbg)]
pub key: MabSubProperty,
}
@ -30,7 +29,7 @@ pub struct ArrayEntry {
#[derive(Debug)]
pub struct ArrayProperty {
// Plus this int
#[br(dbg)]
pub size_in_bytes: u32,
#[br(temp)]
@ -40,7 +39,7 @@ pub struct ArrayProperty {
#[br(count = key_name_length)]
#[bw(map = |x : &String | x.as_bytes())]
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
#[br(dbg)]
pub key_name: String,
#[br(pad_before = 1)]

View file

@ -77,7 +77,7 @@ pub enum StringBasedProperty {
pub struct Entry {
#[br(temp)]
#[bw(ignore)]
#[br(dbg)]
pub name_length: u32,
#[br(count = name_length)]
#[bw(map = |x : &String | x.as_bytes())]

View file

@ -41,7 +41,7 @@ pub struct StructMaybeKey {
#[br(pad_after = 8)] // nothingness and then length for the struct
pub unk_type: String,
#[br(dbg)]
#[br(pad_before = 4)] // type length
pub r#struct: Struct,
}
@ -180,11 +180,11 @@ pub enum MapKeyProperty {
#[br(import(key_type: &KeyType, value_type: &str))]
pub struct MapEntry {
#[br(args { magic: key_type})]
#[br(dbg)]
pub key: MapKeyProperty,
#[br(args { magic: value_type })]
#[br(dbg)]
pub value: MabSubProperty,
}
@ -220,7 +220,7 @@ fn custom_parser(size_in_bytes: u32, key_type: &KeyType, value_type: &str) -> Bi
#[derive(Debug)]
pub struct MapProperty {
// Plus this int
#[br(dbg)]
pub size_in_bytes: u32,
#[br(temp)]
@ -241,7 +241,7 @@ pub struct MapProperty {
pub value_name: String,
#[br(pad_before = 5)]
#[br(dbg)]
pub key_type: KeyType,
#[br(parse_with = custom_parser, args(size_in_bytes, &key_type, &value_name))]

View file

@ -21,7 +21,7 @@ pub struct SetEntry {
pub unk_type: String,
#[br(args { magic: &unk_type })]
#[br(dbg)]
pub key: StringBasedProperty,
}

View file

@ -17,11 +17,11 @@ pub enum Struct {
#[br(magic = b"PrimaryAssetType\0")]
PrimaryAssetType {
#[br(pad_before = 17)]
#[br(dbg)]
name: PrimaryAssetNameProperty,
#[br(pad_before = 9)] // "None" and it's length in bytes plus the null terminator
#[br(pad_after = 9)] // ditto
#[br(dbg)]
primary_asset_name: PrimaryAssetNameProperty,
},
#[br(magic = b"PrimaryAssetId\0")]
@ -42,16 +42,16 @@ pub enum Struct {
LinearColor(LinearColorStruct),
#[br(magic = b"CarryCount\0")]
CarryCount {
#[br(dbg)]
carry_count: CarryCountProperty,
#[br(dbg)]
#[br(pad_before = 15)] // "StoreCount" + 4 bytes for length + 1 byte for endofstring
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
store_count: CarryCountProperty,
},
#[br(magic = b"Map\0")]
Map {
#[br(dbg)]
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
map: CarryCountProperty,
},
@ -59,20 +59,20 @@ pub enum Struct {
#[br(magic = b"ID\0")]
ID {
unk: [u8; 149], // not sure how to parse this yet
#[br(dbg)]
#[br(pad_after = 9)] // "None" and it's length in bytes plus the null terminator
name: PrimaryAssetNameProperty,
#[br(dbg)]
#[br(pad_after = 9)] // "None" and it's length in bytes plus the null terminator
primary_asset_name: PrimaryAssetNameProperty,
#[br(dbg)]
data: [u8; 137],
},
#[br(magic = b"Set\0")]
Set {
#[br(dbg)]
#[br(pad_after = 9)] // "None" + 1 byte for endofstring + 4 bytes for length
set: CarryCountProperty,
},

View file

@ -38,29 +38,29 @@ pub struct ParamsStruct {
pub struct PrimaryAssetNameProperty {
#[br(temp)]
#[bw(ignore)]
#[br(dbg)]
pub property_name_length: u32,
#[br(count = property_name_length)]
#[bw(map = |x : &String | x.as_bytes())]
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
#[br(dbg)]
pub property_name: String,
#[br(temp)]
#[bw(ignore)]
#[br(if(property_name != "None"))]
#[br(dbg)]
pub type_length: u32,
#[br(count = type_length)]
#[bw(map = |x : &String | x.as_bytes())]
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
#[br(if(property_name != "None"))]
#[br(dbg)]
pub type_name: String,
#[br(if(property_name != "None"))]
#[br(args { magic: &type_name})]
//#[br(dbg)]
//
pub key: Option<Box<StringBasedProperty>>,
}
@ -70,16 +70,16 @@ pub struct PrimaryAssetNameProperty {
pub struct CarryCountProperty {
#[br(temp)]
#[bw(ignore)]
#[br(dbg)]
pub property_name_length: u32,
#[br(count = property_name_length)]
#[bw(map = |x : &String | x.as_bytes())]
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
#[br(dbg)]
pub property_name: String,
#[br(args { magic: &property_name})]
//#[br(dbg)]
//
pub key: Option<Box<StringBasedProperty>>,
}