public void WriteUnknown(BCMUnknown unknown, BinaryWriter b) { for (int i = 0; i < unknown.data.Count; i++) { b.Write(unknown.data[i]); } }
public BCMData(BinaryReader bReader) { Int64 header = bReader.ReadInt64(); if (header != BCM_HEADER_A) { Log(header.ToString() + " is not expected BCM header... error."); return; } header = bReader.ReadInt64(); if (header != BCM_HEADER_B) { Log(header.ToString() + " is not expected BCM header... error."); return; } bReader.BaseStream.Seek(16, SeekOrigin.Begin); UInt16 size_unknown_list = bReader.ReadUInt16(); Log(size_unknown_list + " size of unknown list"); bReader.BaseStream.Seek(18, SeekOrigin.Begin); UInt16 size_motion_list = bReader.ReadUInt16(); Log(size_motion_list + " size of motion list"); bReader.BaseStream.Seek(20, SeekOrigin.Begin); UInt16 size_input_list = bReader.ReadUInt16(); Log(size_input_list + " size of input list"); bReader.BaseStream.Seek(22, SeekOrigin.Begin); UInt16 size_cancel_list = bReader.ReadUInt16(); Log(size_cancel_list + " size of cancel list of lists"); bReader.BaseStream.Seek(24, SeekOrigin.Begin); UInt32 addr_unknown_list = bReader.ReadUInt32(); Log(addr_unknown_list + " pointer to unknown list"); bReader.BaseStream.Seek(28, SeekOrigin.Begin); UInt32 addr_unknown_name_table = bReader.ReadUInt32(); Log(addr_unknown_name_table + " pointer to unknown name table"); bReader.BaseStream.Seek(32, SeekOrigin.Begin); UInt32 addr_motion_list = bReader.ReadUInt32(); Log(addr_motion_list + " pointer to motion list"); bReader.BaseStream.Seek(36, SeekOrigin.Begin); UInt32 addr_motion_name_table = bReader.ReadUInt32(); Log(addr_motion_name_table + " pointer to motion name table"); bReader.BaseStream.Seek(40, SeekOrigin.Begin); UInt32 addr_input_list = bReader.ReadUInt32(); Log(addr_input_list + " pointer to inputs"); bReader.BaseStream.Seek(44, SeekOrigin.Begin); UInt32 addr_input_name_table = bReader.ReadUInt32(); Log(addr_input_name_table + " pointer to input name table"); bReader.BaseStream.Seek(48, SeekOrigin.Begin); UInt32 addr_cancel_list = bReader.ReadUInt32(); Log(addr_cancel_list + " pointer to cancel table"); bReader.BaseStream.Seek(52, SeekOrigin.Begin); UInt32 addr_cancel_name_table = bReader.ReadUInt32(); Log(addr_cancel_name_table + " pointer to cancel name table"); // unknownlist UnknownList = new List <BCMUnknown>(size_unknown_list); for (int i = 0; i < size_unknown_list; i++) { BCMUnknown b = new BCMUnknown(); bReader.BaseStream.Seek(addr_unknown_list + (BCM_UNKNOWN_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_UNKNOWN_SIZE); bReader.BaseStream.Seek(addr_unknown_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); UnknownList.Add(b); } // motionlist MotionList = new List <BCMMotion>(size_motion_list); for (int i = 0; i < size_motion_list; i++) { BCMMotion b = new BCMMotion(); bReader.BaseStream.Seek(addr_motion_list + (BCM_MOTION_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_MOTION_SIZE); //Log(b.data[0] + " and " + b.data[BCM_MOTION_SIZE-1]); bReader.BaseStream.Seek(addr_motion_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); MotionList.Add(b); } // inputlist InputList = new List <BCMInput>(size_input_list); for (int i = 0; i < size_input_list; i++) { BCMInput b = new BCMInput(); bReader.BaseStream.Seek(addr_input_list + (BCM_INPUT_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_INPUT_SIZE); bReader.BaseStream.Seek(addr_input_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); InputList.Add(b); } // cancellist CancelList = new List <BCMCancel>(size_cancel_list); for (int i = 0; i < size_cancel_list; i++) { BCMCancel b = new BCMCancel(); bReader.BaseStream.Seek(addr_cancel_list + (8 * i), SeekOrigin.Begin); UInt32 cSize = bReader.ReadUInt32(); UInt32 cAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(addr_cancel_list + (8 * i) + cAddr, SeekOrigin.Begin); b.list = AEDataTools.SlurpUInt16(bReader, (int)(cSize * 2)); bReader.BaseStream.Seek(addr_cancel_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); CancelList.Add(b); } }
public BCMData(BinaryReader bReader) { Int64 header = bReader.ReadInt64(); if (header != BCM_HEADER_A) { Log(header.ToString() + " is not expected BCM header... error."); return; } header = bReader.ReadInt64(); if (header != BCM_HEADER_B) { Log(header.ToString() + " is not expected BCM header... error."); return; } bReader.BaseStream.Seek(16, SeekOrigin.Begin); UInt16 size_unknown_list = bReader.ReadUInt16(); Log(size_unknown_list + " size of unknown list"); bReader.BaseStream.Seek(18, SeekOrigin.Begin); UInt16 size_motion_list = bReader.ReadUInt16(); Log(size_motion_list + " size of motion list"); bReader.BaseStream.Seek(20, SeekOrigin.Begin); UInt16 size_input_list = bReader.ReadUInt16(); Log(size_input_list + " size of input list"); bReader.BaseStream.Seek(22, SeekOrigin.Begin); UInt16 size_cancel_list = bReader.ReadUInt16(); Log(size_cancel_list + " size of cancel list of lists"); bReader.BaseStream.Seek(24, SeekOrigin.Begin); UInt32 addr_unknown_list = bReader.ReadUInt32(); Log(addr_unknown_list + " pointer to unknown list"); bReader.BaseStream.Seek(28, SeekOrigin.Begin); UInt32 addr_unknown_name_table = bReader.ReadUInt32(); Log(addr_unknown_name_table + " pointer to unknown name table"); bReader.BaseStream.Seek(32, SeekOrigin.Begin); UInt32 addr_motion_list = bReader.ReadUInt32(); Log(addr_motion_list + " pointer to motion list"); bReader.BaseStream.Seek(36, SeekOrigin.Begin); UInt32 addr_motion_name_table = bReader.ReadUInt32(); Log(addr_motion_name_table + " pointer to motion name table"); bReader.BaseStream.Seek(40, SeekOrigin.Begin); UInt32 addr_input_list = bReader.ReadUInt32(); Log(addr_input_list + " pointer to inputs"); bReader.BaseStream.Seek(44, SeekOrigin.Begin); UInt32 addr_input_name_table = bReader.ReadUInt32(); Log(addr_input_name_table + " pointer to input name table"); bReader.BaseStream.Seek(48, SeekOrigin.Begin); UInt32 addr_cancel_list = bReader.ReadUInt32(); Log(addr_cancel_list + " pointer to cancel table"); bReader.BaseStream.Seek(52, SeekOrigin.Begin); UInt32 addr_cancel_name_table = bReader.ReadUInt32(); Log(addr_cancel_name_table + " pointer to cancel name table"); // unknownlist UnknownList = new List<BCMUnknown>(size_unknown_list); for (int i = 0; i < size_unknown_list; i++) { BCMUnknown b = new BCMUnknown(); bReader.BaseStream.Seek(addr_unknown_list + (BCM_UNKNOWN_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_UNKNOWN_SIZE); bReader.BaseStream.Seek(addr_unknown_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); UnknownList.Add(b); } // motionlist MotionList = new List<BCMMotion>(size_motion_list); for (int i = 0; i < size_motion_list; i++) { BCMMotion b = new BCMMotion(); bReader.BaseStream.Seek(addr_motion_list + (BCM_MOTION_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_MOTION_SIZE); //Log(b.data[0] + " and " + b.data[BCM_MOTION_SIZE-1]); bReader.BaseStream.Seek(addr_motion_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); MotionList.Add(b); } // inputlist InputList = new List<BCMInput>(size_input_list); for (int i = 0; i < size_input_list; i++) { BCMInput b = new BCMInput(); bReader.BaseStream.Seek(addr_input_list + (BCM_INPUT_SIZE * i), SeekOrigin.Begin); b.data = AEDataTools.SlurpBytes(bReader, BCM_INPUT_SIZE); bReader.BaseStream.Seek(addr_input_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); InputList.Add(b); } // cancellist CancelList = new List<BCMCancel>(size_cancel_list); for (int i = 0; i < size_cancel_list; i++) { BCMCancel b = new BCMCancel(); bReader.BaseStream.Seek(addr_cancel_list + (8 * i), SeekOrigin.Begin); UInt32 cSize = bReader.ReadUInt32(); UInt32 cAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(addr_cancel_list + (8 * i) + cAddr, SeekOrigin.Begin); b.list = AEDataTools.SlurpUInt16(bReader, (int)(cSize * 2)); bReader.BaseStream.Seek(addr_cancel_name_table + (sizeof(UInt32) * i), SeekOrigin.Begin); UInt32 nameAddr = bReader.ReadUInt32(); bReader.BaseStream.Seek(nameAddr, SeekOrigin.Begin); b.name = AEDataTools.SlurpString(bReader); Log(i + ". " + b.name); CancelList.Add(b); } }