From 3669bc0b90af78cfa8c40a8eb814ef2774fdddfa Mon Sep 17 00:00:00 2001 From: Carl Geib Date: Wed, 17 Jan 2024 10:32:55 +1300 Subject: [PATCH] Initial version of a KSY file for comps.dat --- resources/Kaitai Struct/comps.ksy | 134 ++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 resources/Kaitai Struct/comps.ksy diff --git a/resources/Kaitai Struct/comps.ksy b/resources/Kaitai Struct/comps.ksy new file mode 100644 index 0000000..4116fe0 --- /dev/null +++ b/resources/Kaitai Struct/comps.ksy @@ -0,0 +1,134 @@ +meta: + id: comps_dat + title: Comps.dat file extracted from an RSLogix 5000 ACD + file-extension: dat + license: CC0-1.0 + ks-version: 0.9 + endian: le + bit-endian: le +doc: | + Docs for Comps.dat of ACD File Format +doc-ref: + - URL Reference? +seq: + - id: magic_number_maybe + type: u4 + repeat: expr + repeat-expr: 2 + - id: header + type: header + - id: unknown_data_between_header_and_records + type: u1 + repeat: expr + repeat-expr: header.region_pointer_offset - 28 + - id: region_header + type: region_header + - id: unknown_betw_reghead_and_region + type: u1 + repeat: expr + repeat-expr: region_header.pointer_records_region - header.region_pointer_offset - 22 + - id: record_header + type: record_header + - id: unknown_between_head_and_rec + type: u1 + repeat: expr + repeat-expr: 36 #self.pointer_records_region + self.record_header_length + - id: records + type: record + repeat: expr + #repeat-expr: 2 #self.header.no_records + self.header.no_records_table2 + repeat-expr: header.num_records + header.num_records_table2 + +types: + header: + seq: + - id: total_length + type: u4 + - id: region_pointer_offset + type: u4 + - id: header_unknown_1 + type: u4 + - id: num_records + type: u4 + - id: num_records_table2 + type: u4 + region_header: + seq: + - id: magic_num + contents: [0xfe, 0xfe] + - id: region_pointer_length + type: u4 + - id: rec_header_unknown_1 + type: u4 + - id: rec_header_unknown_2 + type: u4 + - id: pointer_metadata_region + type: u4 + - id: pointer_records_region + type: u4 + record_header: + seq: + - id: magic_num + contents: [0xfe, 0xfe] + - id: record_header_length + type: u4 + - id: unknown4 + type: u4 + - id: unknown5 + type: u4 + - id: record_format + type: u4 + enum: record_format + enums: + record_format: + #there might be other types, but these are the 2 in the python file + #and I haven't dug too deep yet in my sample files + 132: xfer_db + 512: tag_record_i_presume + record: + seq: + #- id: header + # type: record_header + #- id: unknwon_between_head_and_ident + # type: u1 + # repeat: expr + # repeat-expr: 36 #self.pointer_records_region + self.record_header_length + - id: identifier + type: u2 + - id: length + type: u4 + - id: data + type: + switch-on: identifier + cases: + 0xFAFA: dat_record + 0xFDFD: ptr_dat_record + dat_record: + seq: + - id: length + type: u4 + - id: dat_rec_unknown_1 + type: u4 + - id: sequence_number + type: u2 + - id: record_type + type: u2 + #enum: ? + - id: dat_rec_unknown_2 + type: u4 + - id: obj_id + type: u4 + - id: parent_id_offset + type: u4 + - id: rec_text + type: str + size: 124 + encoding: UTF-16LE + - id: unknown_remaining_rec_data + type: u1 + repeat: expr + repeat-expr: length - 144 + ptr_dat_record: + seq: + - id: temporary_2 + type: u1