Ejemplo n.º 1
0
 public partial ParseResult DisabledCloudLayersCustomParse(OverlayStream stream, int offset)
 {
     WeatherBinaryCreateTranslation.FillBinaryDisabledCloudLayers(
         new MutagenFrame(new MutagenInterfaceReadStream(stream, _package.MetaData)),
         _clouds);
     return(null);
 }
Ejemplo n.º 2
0
            public static GlobalBinaryOverlay GlobalFactory(
                OverlayStream stream,
                BinaryOverlayFactoryPackage package,
                RecordTypeConverter recordTypeConverter)
            {
                var majorFrame = package.MetaData.Constants.MajorRecordFrame(stream.RemainingMemory);
                var globalChar = GlobalCustomParsing.GetGlobalChar(majorFrame);

                switch (globalChar)
                {
                case GlobalInt.TRIGGER_CHAR:
                    return(GlobalIntBinaryOverlay.GlobalIntFactory(
                               stream,
                               package));

                case GlobalShort.TRIGGER_CHAR:
                    return(GlobalShortBinaryOverlay.GlobalShortFactory(
                               stream,
                               package));

                case GlobalFloat.TRIGGER_CHAR:
                    return(GlobalFloatBinaryOverlay.GlobalFloatFactory(
                               stream,
                               package));

                default:
                    throw new ArgumentException($"Unknown trigger char: {globalChar}");
                }
            }
Ejemplo n.º 3
0
 partial void ParseCustomParse(OverlayStream stream, int offset)
 {
     morphs = new AvailableMorphs();
     AvailableMorphsBinaryCreateTranslation.FillBinaryParse(
         new MutagenFrame(new MutagenInterfaceReadStream(stream: stream, metaData: _package.MetaData)),
         morphs);
 }
Ejemplo n.º 4
0
        public static LensFlareBinaryOverlay LensFlareFactory(
            OverlayStream stream,
            BinaryOverlayFactoryPackage package,
            TypedParseParams?parseParams = null)
        {
            stream = PluginUtilityTranslation.DecompressStream(stream);
            var ret = new LensFlareBinaryOverlay(
                bytes: HeaderTranslation.ExtractRecordMemory(stream.RemainingMemory, package.MetaData.Constants),
                package: package);
            var finalPos = checked ((int)(stream.Position + stream.GetMajorRecord().TotalLength));
            int offset   = stream.Position + package.MetaData.Constants.MajorConstants.TypeAndLengthLength;

            ret._package.FormVersion = ret;
            stream.Position         += 0x10 + package.MetaData.Constants.MajorConstants.TypeAndLengthLength;
            ret.CustomFactoryEnd(
                stream: stream,
                finalPos: finalPos,
                offset: offset);
            ret.FillSubrecordTypes(
                majorReference: ret,
                stream: stream,
                finalPos: finalPos,
                offset: offset,
                parseParams: parseParams,
                fill: ret.FillRecordType);
            return(ret);
        }
Ejemplo n.º 5
0
 private ParseResult CustomRecordFallback(
     OverlayStream stream,
     int finalPos,
     int offset,
     RecordType type,
     PreviousParse lastParsed,
     TypedParseParams?parseParams = null)
 {
     if (type.TypeInt == 0x44494445) // EDID
     {
         return(base.FillRecordType(
                    stream: stream,
                    finalPos: finalPos,
                    offset: offset,
                    type: type,
                    recordParseCount: null,
                    lastParsed: lastParsed,
                    parseParams: parseParams));
     }
     WeatherBinaryCreateTranslation.FillCloudTexture(
         new MutagenFrame(new MutagenInterfaceReadStream(stream, _package.MetaData)),
         type,
         _cloudTextures);
     return(default(int?));
 }
        public static ActorValueInformationBinaryOverlay ActorValueInformationFactory(
            OverlayStream stream,
            BinaryOverlayFactoryPackage package,
            RecordTypeConverter?recordTypeConverter = null)
        {
            stream = UtilityTranslation.DecompressStream(stream);
            var ret = new ActorValueInformationBinaryOverlay(
                bytes: HeaderTranslation.ExtractRecordMemory(stream.RemainingMemory, package.MetaData.Constants),
                package: package);
            var finalPos = checked ((int)(stream.Position + stream.GetMajorRecord().TotalLength));
            int offset   = stream.Position + package.MetaData.Constants.MajorConstants.TypeAndLengthLength;

            ret._package.FormVersion = ret;
            stream.Position         += 0x10 + package.MetaData.Constants.MajorConstants.TypeAndLengthLength;
            ret.CustomFactoryEnd(
                stream: stream,
                finalPos: finalPos,
                offset: offset);
            ret.FillSubrecordTypes(
                majorReference: ret,
                stream: stream,
                finalPos: finalPos,
                offset: offset,
                recordTypeConverter: recordTypeConverter,
                fill: ret.FillRecordType);
            return(ret);
        }
Ejemplo n.º 7
0
            partial void CustomEnd(OverlayStream stream, int finalPos, int offset)
            {
                if (stream.Complete)
                {
                    return;
                }
                var startPos = stream.Position;

                if (!stream.TryGetGroup(out var groupMeta))
                {
                    return;
                }
                if (groupMeta.GroupType != (int)GroupTypeEnum.TopicChildren)
                {
                    return;
                }
                this._grupData = stream.ReadMemory(checked ((int)groupMeta.TotalLength));
                var formKey = FormKey.Factory(_package.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData));

                if (formKey != this.FormKey)
                {
                    throw new ArgumentException("Dialog children group did not match the FormID of the parent.");
                }
                var contentSpan = this._grupData.Value.Slice(_package.MetaData.Constants.GroupConstants.HeaderLength);

                this.Items = BinaryOverlayList.FactoryByArray <IDialogItemGetter>(
                    contentSpan,
                    _package,
                    getter: (s, p) => DialogItemBinaryOverlay.DialogItemFactory(new OverlayStream(s, p), p),
                    locs: ParseRecordLocations(
                        stream: new OverlayStream(contentSpan, _package),
                        trigger: DialogItem_Registration.TriggeringRecordType,
                        constants: GameConstants.Oblivion.MajorConstants,
                        skipHeader: false));
            }
Ejemplo n.º 8
0
 partial void PatrolScriptMarkerCustomParse(OverlayStream stream, int offset)
 {
     if (stream.ReadSubrecordFrame().Content.Length != 0)
     {
         throw new ArgumentException($"Marker had unexpected length.");
     }
 }
Ejemplo n.º 9
0
            partial void CustomFactoryEnd(OverlayStream stream, int finalPos, int offset)
            {
                var fileNameEnd = 0x2 + BinaryPrimitives.ReadUInt16LittleEndian(_data.Slice(0x2)) + 2;

                stream.Position = fileNameEnd;
                int onBeginEnd;

                if (Flags.HasFlag(Flag.OnBegin))
                {
                    stream.Position = fileNameEnd;
                    OnBegin         = ScriptFragmentBinaryOverlay.ScriptFragmentFactory(stream, _package);
                    onBeginEnd      = stream.Position;
                }
                else
                {
                    onBeginEnd = fileNameEnd;
                }
                if (Flags.HasFlag(Flag.OnEnd))
                {
                    stream.Position = onBeginEnd;
                    OnEnd           = ScriptFragmentBinaryOverlay.ScriptFragmentFactory(stream, _package);
                    _onEndEnd       = stream.Position;
                }
                else
                {
                    _onEndEnd = onBeginEnd;
                }
            }
Ejemplo n.º 10
0
            protected void Initialize(OverlayStream stream)
            {
                var fileNameEnd = 0x2 + BinaryPrimitives.ReadUInt16LittleEndian(_data.Slice(0x2)) + 2;

                stream.Position = fileNameEnd;
                int onBeginEnd;

                if (Flags.HasFlag(Flag.OnBegin))
                {
                    stream.Position = fileNameEnd;
                    OnBegin         = ScriptFragmentBinaryOverlay.ScriptFragmentFactory(stream, _package);
                    onBeginEnd      = stream.Position;
                }
                else
                {
                    onBeginEnd = fileNameEnd;
                }
                if (Flags.HasFlag(Flag.OnEnd))
                {
                    stream.Position = onBeginEnd;
                    OnEnd           = ScriptFragmentBinaryOverlay.ScriptFragmentFactory(stream, _package);
                    FlagsEndingPos  = stream.Position;
                }
                else
                {
                    FlagsEndingPos = onBeginEnd;
                }
            }
Ejemplo n.º 11
0
        public override ParseResult FillRecordType(
            OverlayStream stream,
            int finalPos,
            int offset,
            RecordType type,
            int?lastParsed,
            Dictionary <RecordType, int>?recordParseCount,
            RecordTypeConverter?recordTypeConverter = null)
        {
            type = recordTypeConverter.ConvertToStandard(type);
            switch (type.TypeInt)
            {
            case RecordTypeInts.FNAM:
            {
                TypeCharCustomParse(
                    stream,
                    offset);
                return(null);
            }

            default:
                return(base.FillRecordType(
                           stream: stream,
                           finalPos: finalPos,
                           offset: offset,
                           type: type,
                           lastParsed: lastParsed,
                           recordParseCount: recordParseCount));
            }
        }
Ejemplo n.º 12
0
            public partial ParseResult CountCustomParse(OverlayStream stream, int offset)
            {
                int[] counts = FootstepSetBinaryCreateTranslation.GetListCounts(stream);

                IReadOnlyList <IFormLinkGetter <IFootstepGetter> > Get(int index)
                {
                    var ret = BinaryOverlayList.FactoryByCount <IFormLinkGetter <IFootstepGetter> >(
                        _data.Slice(stream.Position - offset, 4 * counts[index]),
                        _package,
                        itemLength: 4,
                        count: checked ((uint)counts[index]),
                        getter: (s, p) => new FormLink <IFootstepGetter>(FormKeyBinaryTranslation.Instance.Parse(s, p.MetaData.MasterReferences !)));

                    stream.Position += 4 * counts[index];
                    return(ret);
                }

                WalkForwardFootsteps           = Get(0);
                RunForwardFootsteps            = Get(1);
                WalkForwardAlternateFootsteps  = Get(2);
                RunForwardAlternateFootsteps   = Get(3);
                WalkForwardAlternateFootsteps2 = Get(4);

                return(null);
            }
Ejemplo n.º 13
0
 public partial ParseResult ParseCustomParse(OverlayStream stream, int offset, PreviousParse lastParsed)
 {
     morphs = new AvailableMorphs();
     AvailableMorphsBinaryCreateTranslation.FillBinaryParse(
         new MutagenFrame(new MutagenInterfaceReadStream(stream: stream, metaData: _package.MetaData)),
         morphs);
     return(lastParsed);
 }
Ejemplo n.º 14
0
            partial void DataLogicCustomParse(OverlayStream stream, int offset)
            {
                var subHeader     = stream.ReadSubrecord();
                var contentLength = subHeader.ContentLength;

                _dataSpan        = _data.Slice(stream.Position - offset, contentLength);
                stream.Position += contentLength;
            }
Ejemplo n.º 15
0
 partial void CustomFactoryEnd(OverlayStream stream, int finalPos, int offset)
 {
     _RecordCache = GroupMajorRecordCacheWrapper <T> .Factory(
         stream,
         _data,
         _package,
         offset);
 }
Ejemplo n.º 16
0
 partial void DirectionalAmbientLightingColorsCustomParse(OverlayStream stream, long finalPos, int offset)
 {
     if (_directionalLoc.HasValue)
     {
         return;
     }
     _directionalLoc = (ushort)(stream.Position - offset);
 }
Ejemplo n.º 17
0
        partial void PointsCustomParse(OverlayStream stream, long finalPos, int offset, RecordType type, PreviousParse lastParsed)
        {
            if (stream.Complete)
            {
                return;
            }
            var subMeta = stream.GetSubrecord();

            if (subMeta.RecordType != RecordTypes.PGRP)
            {
                return;
            }
            stream.Position += subMeta.HeaderLength;
            var pointBytes = stream.ReadMemory(subMeta.ContentLength);

            subMeta = stream.GetSubrecord();
            switch (subMeta.RecordTypeInt)
            {
            case 0x52524750:     // "PGRR":
                stream.Position += subMeta.HeaderLength;
                var connBytes = stream.ReadMemory(subMeta.ContentLength);
                this.Points = BinaryOverlayList.FactoryByLazyParse <IRoadPointGetter>(
                    pointBytes,
                    _package,
                    getter: (s, p) =>
                {
                    int numPts         = pointBytes.Length / RoadBinaryCreateTranslation.POINT_LEN;
                    RoadPoint[] points = new RoadPoint[numPts];
                    var connFloats     = connBytes.Span.AsFloatSpan();
                    for (int i = 0; i < numPts; i++)
                    {
                        var pt          = RoadBinaryCreateTranslation.ReadPathGridPoint(s, out var numConn);
                        s               = s.Slice(RoadBinaryCreateTranslation.POINT_LEN);
                        P3Float[] conns = new P3Float[numConn];
                        for (int j = 0; j < numConn; j++)
                        {
                            conns[j] = new P3Float(
                                x: connFloats[0],
                                y: connFloats[1],
                                z: connFloats[2]);
                            connFloats = connFloats.Slice(3);
                        }
                        pt.Connections.AddRange(conns);
                        points[i] = pt;
                    }
                    return(points);
                });
                break;

            default:
                this.Points = BinaryOverlayList.FactoryByStartIndex <IRoadPointGetter>(
                    pointBytes,
                    _package,
                    itemLength: RoadBinaryCreateTranslation.POINT_LEN,
                    getter: (s, p) => RoadBinaryCreateTranslation.ReadPathGridPoint(s, out var numConn));
                break;
            }
        }
Ejemplo n.º 18
0
            public partial ParseResult PatrolScriptMarkerCustomParse(OverlayStream stream, int offset, PreviousParse lastParsed)
            {
                if (stream.ReadSubrecordFrame().Content.Length != 0)
                {
                    throw new ArgumentException($"Marker had unexpected length.");
                }

                return(lastParsed);
            }
Ejemplo n.º 19
0
 partial void CustomFactoryEnd(OverlayStream stream, int finalPos, int offset)
 {
     stream.Position = FileNameEndingPos;
     Fragments       = BinaryOverlayList.FactoryByCount <IIndexedScriptFragmentGetter>(
         stream,
         _package,
         stream.ReadUInt16(),
         (s, p) => IndexedScriptFragmentBinaryOverlay.IndexedScriptFragmentFactory(s, p));
 }
Ejemplo n.º 20
0
 partial void FaceFxPhonemesRawParsingCustomParse(OverlayStream stream, int offset)
 {
     if (_faceFxPhonemesLoc == null)
     {
         _faceFxPhonemesLoc = (ushort)(stream.Position - offset);
     }
     UtilityTranslation.SkipPastAll(stream, _package.MetaData.Constants, RecordTypes.PHTN);
     UtilityTranslation.SkipPastAll(stream, _package.MetaData.Constants, RecordTypes.PHWT);
 }
Ejemplo n.º 21
0
 partial void AnimationsCustomParse(OverlayStream stream, long finalPos, int offset, RecordType type, PreviousParse lastParsed)
 {
     var subHeader = stream.ReadSubrecord();
     Animations = BinaryOverlayList.FactoryByStartIndex<IFormLinkGetter<IIdleAnimationGetter>>(
         mem: stream.RemainingMemory.Slice(0, subHeader.ContentLength),
         package: _package,
         itemLength: 4,
         getter: (s, p) => new FormLink<IIdleAnimationGetter>(FormKey.Factory(p.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(s))));
 }
Ejemplo n.º 22
0
 partial void FlagsOverrideCustomParse(OverlayStream stream, long finalPos, int offset)
 {
     _flagsOverride = PackageFlagsOverride.CreateFromBinary(new MutagenFrame(
                                                                new MutagenInterfaceReadStream(stream, _package.MetaData)));
     if (stream.TryGetSubrecord(RecordTypes.PFO2, out var rec))
     {
         FlagsOverrideUnused = PackageFlagsOverride.CreateFromBinary(new MutagenFrame(
                                                                         new MutagenInterfaceReadStream(stream, _package.MetaData)));
     }
 }
Ejemplo n.º 23
0
            partial void UnusedConditionsLogicCustomParse(OverlayStream stream, int offset)
            {
                var nextHeader = stream.ReadSubrecordFrame();

                if (nextHeader.RecordType != RecordTypes.NEXT ||
                    nextHeader.Content.Length != 0)
                {
                    throw new ArgumentException("Unexpected NEXT header");
                }
                UnusedConditions = ConditionBinaryOverlay.ConstructBinayOverlayList(stream, _package);
            }
Ejemplo n.º 24
0
 partial void TopicsCustomParse(
     OverlayStream stream,
     long finalPos,
     int offset,
     RecordType type,
     int?lastParsed)
 {
     Topics = new List <IATopicReferenceGetter>(
         ATopicReferenceBinaryCreateTranslation.Factory(
             new MutagenFrame(stream)));
 }
Ejemplo n.º 25
0
 partial void CustomFactoryEnd(OverlayStream stream, int finalPos, int offset)
 {
     if (this.Versioning.HasFlag(ImageSpaceDepthOfField.VersioningBreaks.Break0))
     {
         return;
     }
     ImageSpaceDepthOfFieldBinaryCreateTranslation.ParseSkyBlurRadius(
         BinaryPrimitives.ReadUInt16LittleEndian(_data.Slice(0xE)),
         out _radius,
         out _sky);
 }
Ejemplo n.º 26
0
 partial void CellsCustomParse(OverlayStream stream, long finalPos, int offset, RecordType type, PreviousParse lastParsed)
 {
     this.Cells = BinaryOverlayList.FactoryByArray <CellBinaryOverlay>(
         mem: stream.RemainingMemory,
         package: _package,
         parseParams: null,
         getter: (s, p, recConv) => CellBinaryOverlay.CellFactory(new OverlayStream(s, p), p, recConv),
         locs: CellBinaryOverlay.ParseRecordLocations(
             stream: stream,
             package: _package));
 }
Ejemplo n.º 27
0
 partial void ItemsCustomParse(OverlayStream stream, long finalPos, int offset, RecordType type, int?lastParsed)
 {
     this.Items = BinaryOverlayList.FactoryByArray <CellBinaryOverlay>(
         mem: stream.RemainingMemory,
         package: _package,
         recordTypeConverter: null,
         getter: (s, p, recConv) => CellBinaryOverlay.CellFactory(new OverlayStream(s, p), p, insideWorldspace: true),
         locs: CellBinaryOverlay.ParseRecordLocations(
             stream: stream,
             package: _package));
 }
Ejemplo n.º 28
0
 partial void CustomFactoryEnd(
     OverlayStream stream,
     int finalPos,
     int offset)
 {
     _Records = GroupListOverlay <T> .Factory(
         stream,
         _data,
         _package,
         offset : offset,
         objectType : ObjectType.Group);
 }
Ejemplo n.º 29
0
            partial void VestigialCustomParse(OverlayStream stream, int offset)
            {
                var subMeta = stream.ReadSubrecord();

                if (subMeta.ContentLength != 1)
                {
                    throw new ArgumentException($"Unexpected length: {subMeta.ContentLength}");
                }
                if (stream.ReadUInt8() > 0)
                {
                    this._vestigialMarker = true;
                }
            }
Ejemplo n.º 30
0
            partial void IDParseCustomParse(OverlayStream stream, int offset)
            {
                var subMeta = stream.ReadSubrecord();

                this.Type = subMeta.RecordTypeInt switch
                {
                    // ALST
                    0x54534C41 => QuestAlias.TypeEnum.Reference,
                    // ALLS
                    0x534C4C41 => QuestAlias.TypeEnum.Location,
                    _ => throw new NotImplementedException(),
                };
                this.ID = stream.ReadUInt32();
            }