diff --git a/src/array_property.rs b/src/array_property.rs index 9318836..7effd71 100644 --- a/src/array_property.rs +++ b/src/array_property.rs @@ -9,7 +9,6 @@ fn custom_parser(size_in_bytes: u32, value_type: &str) -> BinResult BinResult | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())] - #[br(dbg)] + pub key_name: String, #[br(pad_before = 1)] diff --git a/src/lib.rs b/src/lib.rs index 8fe0f5c..e221efd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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())] diff --git a/src/map_property.rs b/src/map_property.rs index f210104..0c24621 100644 --- a/src/map_property.rs +++ b/src/map_property.rs @@ -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))] diff --git a/src/set_property.rs b/src/set_property.rs index 06a3cfa..f813866 100644 --- a/src/set_property.rs +++ b/src/set_property.rs @@ -21,7 +21,7 @@ pub struct SetEntry { pub unk_type: String, #[br(args { magic: &unk_type })] - #[br(dbg)] + pub key: StringBasedProperty, } diff --git a/src/struct_property.rs b/src/struct_property.rs index ba5e18a..346f1f9 100644 --- a/src/struct_property.rs +++ b/src/struct_property.rs @@ -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, }, diff --git a/src/structs.rs b/src/structs.rs index 56a5a26..44ef41b 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -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 | 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 | 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>, } @@ -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 | 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>, }