Beispiel #1
0
        private void ValidateEntry(BCM_Entry entry)
        {
            //Checks for children if it has a Child GoTo
            if (entry.LoopAsChild != null && entry.BCMEntries != null)
            {
                throw new InvalidDataException(String.Format("Invalid Loop_As_Child tag on Idx {0}.\nCannot set the tag (Loop_As_Child=\"{1}\") as the BCM Entry at Idx {0} has actual child entries.", entry.Index, entry.LoopAsChild));
            }

            if (entry.BCMEntries != null)
            {
                bool   siblingLoop = false;
                string idx         = null;
                string loopIdx     = null;

                foreach (var child in entry.BCMEntries)
                {
                    if (siblingLoop)
                    {
                        throw new InvalidDataException(String.Format("Invalid Loop_As_Sibling tag on Idx {0}.\nCannot set the tag (Sibling_GoTo_Idx=\"{1}\") as the BCM Entry at Idx {0} has an actual sibling.", idx, loopIdx));
                    }

                    if (child.LoopAsSibling != null)
                    {
                        siblingLoop = true;
                        idx         = child.Index;
                        loopIdx     = child.LoopAsSibling;
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Checks to see if two entries are identical (excluding index and parent/children/siblings)
 /// </summary>
 /// <returns></returns>
 public bool Compare(BCM_Entry entry)
 {
     if (I_00 == entry.I_00 && I_04 == entry.I_04 &&
         I_12 == entry.I_12 && I_16 == entry.I_16 &&
         I_20 == entry.I_20 && I_22 == entry.I_22 &&
         I_24 == entry.I_24 && I_28 == entry.I_28 &&
         I_32 == entry.I_32 && I_34 == entry.I_34 &&
         I_36 == entry.I_36 && I_38 == entry.I_38 &&
         I_40 == entry.I_40 && I_42 == entry.I_42 &&
         I_44 == entry.I_44 && I_46 == entry.I_46 &&
         I_64 == entry.I_64 && I_68 == entry.I_68 &&
         I_72 == entry.I_72 && I_80 == entry.I_80 &&
         I_84 == entry.I_84 && I_88 == entry.I_88 &&
         I_92 == entry.I_92 && I_100 == entry.I_100 &&
         I_102 == entry.I_102 && I_104 == entry.I_104 &&
         I_108 == entry.I_108 && I_76 == entry.I_76
         )
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
        private BCM_Entry ParseBcmEntry(int offset, int parentOffset, int index, bool ignoreLoop)
        {
            totalTestCount++;

            BCM_Entry bcmEntry = new BCM_Entry()
            {
                Index = index.ToString(),
                I_00  = BitConverter.ToUInt32(rawBytes, offset + 0),
                I_04  = (DirectionalInput)BitConverter.ToUInt32(rawBytes, offset + 4),
                I_08  = (ButtonInput)BitConverter.ToUInt32(rawBytes, offset + 8),
                I_12  = BitConverter.ToUInt32(rawBytes, offset + 12),
                I_16  = BitConverter.ToUInt32(rawBytes, offset + 16),
                I_20  = BitConverter.ToUInt16(rawBytes, offset + 20),
                I_22  = BitConverter.ToUInt16(rawBytes, offset + 22),
                I_24  = BitConverter.ToUInt32(rawBytes, offset + 24),
                I_28  = (ActivatorState)BitConverter.ToUInt32(rawBytes, offset + 28),
                I_32  = BitConverter.ToInt16(rawBytes, offset + 32),
                I_34  = BitConverter.ToInt16(rawBytes, offset + 34),
                I_36  = BitConverter.ToInt16(rawBytes, offset + 36),
                I_38  = BitConverter.ToInt16(rawBytes, offset + 38),
                I_40  = BitConverter.ToInt16(rawBytes, offset + 40),
                I_42  = BitConverter.ToInt16(rawBytes, offset + 42),
                I_44  = BitConverter.ToUInt16(rawBytes, offset + 44),
                I_46  = BitConverter.ToUInt16(rawBytes, offset + 46),
                I_64  = BitConverter.ToUInt32(rawBytes, offset + 64),
                I_68  = BitConverter.ToUInt32(rawBytes, offset + 68),
                I_72  = BitConverter.ToUInt32(rawBytes, offset + 72),
                I_76  = (BacCases)BitConverter.ToUInt32(rawBytes, offset + 76),
                I_80  = BitConverter.ToUInt32(rawBytes, offset + 80),
                I_84  = BitConverter.ToUInt32(rawBytes, offset + 84),
                I_88  = BitConverter.ToUInt32(rawBytes, offset + 88),
                I_92  = BitConverter.ToUInt32(rawBytes, offset + 92),
                F_96  = BitConverter.ToSingle(rawBytes, offset + 96),
                I_100 = BitConverter.ToInt16(rawBytes, offset + 100),
                I_102 = BitConverter.ToInt16(rawBytes, offset + 102),
                I_104 = BitConverter.ToUInt32(rawBytes, offset + 104),
                I_108 = BitConverter.ToUInt32(rawBytes, offset + 108),
            };

            //Loop Check
            int sibling = (BitConverter.ToInt32(rawBytes, offset + 48) != 0) ? GetBcmIndex(BitConverter.ToInt32(rawBytes, offset + 48)) : -1;
            int child   = (BitConverter.ToInt32(rawBytes, offset + 52) != 0) ? GetBcmIndex(BitConverter.ToInt32(rawBytes, offset + 52)) : -1;



            if (SiblingLoop(offset) && sibling != -1)
            {
                bcmEntry.LoopAsSibling = sibling.ToString();
            }
            if (ChildrenLoop(offset) && ignoreLoop == false && child != -1)
            {
                bcmEntry.LoopAsChild = child.ToString();
            }

            return(bcmEntry);
        }
Beispiel #4
0
        private void WriteBcmEntry(BCM_Entry bcmEntry, int parentOffset, int rootOffset)
        {
            ValidateEntry(bcmEntry);
            IndexList.Add(bcmEntry.Index);
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_00));
            bytes.AddRange(BitConverter.GetBytes((uint)bcmEntry.I_04));
            bytes.AddRange(BitConverter.GetBytes((uint)bcmEntry.I_08));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_12));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_16));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_20));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_22));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_24));
            bytes.AddRange(BitConverter.GetBytes((uint)bcmEntry.I_28));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_32));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_34));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_36));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_38));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_40));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_42));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_44));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_46));

            if (bcmEntry.LoopAsSibling != null)
            {
                PtrToWriteList.Add(new PtrToWrite()
                {
                    Idx          = bcmEntry.LoopAsSibling,
                    OffsetToFill = bytes.Count()
                });
            }
            bytes.AddRange(BitConverter.GetBytes(0));

            if (bcmEntry.LoopAsChild != null)
            {
                PtrToWriteList.Add(new PtrToWrite()
                {
                    Idx          = bcmEntry.LoopAsChild,
                    OffsetToFill = bytes.Count()
                });
            }
            bytes.AddRange(BitConverter.GetBytes(0));

            bytes.AddRange(BitConverter.GetBytes(parentOffset));
            bytes.AddRange(BitConverter.GetBytes(rootOffset));


            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_64));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_68));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_72));
            bytes.AddRange(BitConverter.GetBytes((int)bcmEntry.I_76));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_80));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_84));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_88));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_92));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.F_96));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_100));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_102));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_104));
            bytes.AddRange(BitConverter.GetBytes(bcmEntry.I_108));



            TotalEntryCount++;
        }