Ejemplo n.º 1
0
 private void OpenInternalAnimations(IReadOnlyBinaryDataAccessor f, int animationIndex, int animationCount)
 {
     for (var i = animationIndex; i <= animationIndex + (0xC4 * animationCount) - 1; i += 0xC4)
     {
         var animName    = (f.ReadNullTerminatedString(i, System.Text.Encoding.ASCII));        // Max length: &H40
         var animDevName = (f.ReadNullTerminatedString(i + 0x40, System.Text.Encoding.ASCII)); // Max length: &H80
         if (!string.IsNullOrEmpty(animDevName))
         {
             // If any animation has a dev name, then this is a file format that requires them
             UsesDevNames = true;
         }
         var       animType = (AnimationType)f.ReadInt32(i + 0xC0);
         Animation anim     = new Animation(animName, animDevName, animType);
         Animations.Add(anim);
     }
 }
Ejemplo n.º 2
0
        private void OpenInternalNormal(IReadOnlyBinaryDataAccessor f)
        {
            BgrsName    = f.ReadNullTerminatedString(0x58, Encoding.ASCII);        // Max length: &H40
            BgrsDevName = f.ReadNullTerminatedString(0x58 + 0x40, Encoding.ASCII); // Max length: &H80

            // Yes, the counts of these two sections are in a different order than the sections themselves
            var animationCount = f.ReadInt32(0x118);
            var partCount      = f.ReadInt32(0x11C);

            for (var partIndex = 0x140; partIndex <= 0x140 + (0x80 * partCount) - 1; partIndex += 0x80)
            {
                var partName = f.ReadNullTerminatedString(partIndex + 0x18, System.Text.Encoding.ASCII);
                Parts.Add(new ModelPart(f.ReadArray(partIndex, 0x80), partName));
            }
            UnknownModelPartsFooter = f.ReadArray(0x140 + (0x80 * partCount), 0x18);
            OpenInternalAnimations(f, 0x140 + (0x80 * partCount) + 0x18, animationCount);
        }
Ejemplo n.º 3
0
        public BGRS(IReadOnlyBinaryDataAccessor data)
        {
            Magic = data.ReadNullTerminatedString(0, System.Text.Encoding.ASCII);
            ReferencedBchFileName = (data.ReadNullTerminatedString(0x8, System.Text.Encoding.ASCII)).TrimEnd('0'); // Max length: 0x40
            Type = (BgrsType)data.ReadInt32(0x48);

            switch (Type)
            {
            case BgrsType.Normal:
                OpenInternalNormal(data);
                break;

            case BgrsType.Extension:
                OpenInternalExtended(data);
                break;

            default:
                throw new NotSupportedException("Unsupported BGRS type: " + Type.ToString());
            }
        }