Beispiel #1
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.Visibility);
            writer.WriteValueU32((uint)this.Flags);

            if ((this.Flags & FunctionFlags.IsNative) == 0)
            {
                writer.WriteReference(this.SourceFile);
                writer.WriteValueU32(this.SourceLine);
            }

            if ((this.Flags & FunctionFlags.HasReturnValue) != 0)
            {
                writer.WriteReference(this.ReturnType);
                writer.WriteValueB8(this.Unknown50);
            }

            if ((this.Flags & FunctionFlags.Unknown8) != 0)
            {
                writer.WriteReference(this.Unknown58);
            }

            if ((this.Flags & FunctionFlags.HasParameters) != 0)
            {
                writer.WriteReferences(this.Parameters);
            }
            if ((this.Flags & FunctionFlags.HasLocals) != 0)
            {
                writer.WriteReferences(this.Locals);
            }
            if ((this.Flags & FunctionFlags.Unknown6) != 0)
            {
                writer.WriteValueU32(this.Unknown98);
            }
            if ((this.Flags & FunctionFlags.Unknown12) != 0)
            {
                writer.WriteValueU8(this.UnknownA0);
            }
            if ((this.Flags & FunctionFlags.HasBody) != 0)
            {
                var bodySizePosition = writer.Position;
                writer.WriteValueU32(uint.MaxValue);
                var bodySize    = Instructions.Write(writer, this.Body);
                var endPosition = writer.Position;
                writer.Position = bodySizePosition;
                writer.WriteValueU32(bodySize);
                writer.Position = endPosition;
            }
        }
Beispiel #2
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8(this.Unknown2A);
            writer.WriteValueU8(this.Size);
            writer.WriteReferences(this.Enumerals);
            writer.WriteValueB8(this.Unknown29);
        }
Beispiel #3
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.Visibility);
            writer.WriteValueU16((ushort)this.Flags);
            writer.WriteReference(this.BaseClass);
            if ((this.Flags & ClassFlags.HasFunctions) != 0)
            {
                writer.WriteReferences(this.Functions);
            }
            if ((this.Flags & ClassFlags.Unknown5) != 0)
            {
                writer.WriteReferences(this.Unknown20s);
            }
            if ((this.Flags & ClassFlags.Unknown8) != 0)
            {
                writer.WriteReferences(this.Unknown30s);
            }
        }