Esempio n. 1
0
        public override bool CreateField(BinaryFileReader r, GameFormat format, string type, int dataSize)
        {
            switch (type)
            {
            case "PGRP":
                PGRPs = new PGRDRecord.PGRPField[dataSize >> 4];
                for (var i = 0; i < PGRPs.Length; i++)
                {
                    PGRPs[i] = new PGRDRecord.PGRPField(r, dataSize);
                }
                return(true);

            case "PGRR": PGRR = r.ReadUNKN(dataSize); return(true);

            default: return(false);
            }
        }
Esempio n. 2
0
        public PGRIField[] PGRIs;      // Inter-Cell Connections

        public override bool CreateField(BinaryFileReader r, GameFormat format, string type, int dataSize)
        {
            switch (type)
            {
            case "EDID":
            case "NAME": EDID = r.ReadSTRV(dataSize); return(true);

            case "DATA": DATA = new DATAField(r, dataSize, format); return(true);

            case "PGRP":
                PGRPs = new PGRPField[dataSize >> 4];
                for (var i = 0; i < PGRPs.Length; i++)
                {
                    PGRPs[i] = new PGRPField(r, 16);
                }
                return(true);

            case "PGRC": PGRC = r.ReadUNKN(dataSize); return(true);

            case "PGAG": PGAG = r.ReadUNKN(dataSize); return(true);

            case "PGRR":
                PGRRs = new PGRRField[dataSize >> 2];
                for (var i = 0; i < PGRRs.Length; i++)
                {
                    PGRRs[i] = new PGRRField(r, 4);
                }
                r.Skip(dataSize % 4); return(true);

            case "PGRL": if (PGRLs == null)
                {
                    PGRLs = new List <PGRLField>();
                }
                PGRLs.Add(new PGRLField(r, dataSize)); return(true);

            case "PGRI":
                PGRIs = new PGRIField[dataSize >> 4];
                for (var i = 0; i < PGRIs.Length; i++)
                {
                    PGRIs[i] = new PGRIField(r, 16);
                }
                return(true);

            default: return(false);
            }
        }
        public override bool CreateField(UnityBinaryReader r, GameFormatId format, string type, int dataSize)
        {
            if (format == GameFormatId.TES3)
            {
                switch (type)
                {
                case "NAME": EDID = r.ReadSTRV(dataSize); return(true);

                case "FNAM": FULL = r.ReadSTRV(dataSize); return(true);

                case "RADT": DATA = new DATAField(r, dataSize, format); return(true);

                case "NPCS": SPLOs.Add(r.ReadSTRV(dataSize)); return(true);

                case "DESC": DESC = r.ReadSTRV(dataSize); return(true);

                default: return(false);
                }
            }
            if (format == GameFormatId.TES4)
            {
                switch (_nameState)
                {
                case 0:
                    switch (type)
                    {
                    case "EDID": EDID = r.ReadSTRV(dataSize); return(true);

                    case "FULL": FULL = r.ReadSTRV(dataSize); return(true);

                    case "DESC": DESC = r.ReadSTRV(dataSize); return(true);

                    case "DATA": DATA = new DATAField(r, dataSize, format); return(true);

                    case "SPLO": SPLOs.Add(r.ReadSTRV(dataSize)); return(true);

                    case "VNAM": VNAM = new FMID2Field <RACERecord>(r, dataSize); return(true);

                    case "DNAM": DNAM = new FMID2Field <HAIRRecord>(r, dataSize); return(true);

                    case "CNAM": CNAM = r.ReadT <BYTEField>(dataSize); return(true);

                    case "PNAM": PNAM = r.ReadT <FLTVField>(dataSize); return(true);

                    case "UNAM": UNAM = r.ReadT <FLTVField>(dataSize); return(true);

                    case "XNAM": XNAM = r.ReadUNKN(dataSize); return(true);

                    case "ATTR": DATA.ATTRField(r, dataSize); return(true);

                    case "NAM0": _nameState++; return(true);

                    default: return(false);
                    }

                case 1:     // Face Data
                    switch (type)
                    {
                    case "INDX": FaceParts.Add(new FacePartGroup {
                            INDX = r.ReadT <UI32Field>(dataSize)
                        }); return(true);

                    case "MODL": FaceParts.Last().MODL = new MODLGroup(r, dataSize); return(true);

                    case "ICON": FaceParts.Last().ICON = r.ReadFILE(dataSize); return(true);

                    case "MODB": FaceParts.Last().MODL.MODBField(r, dataSize); return(true);

                    case "NAM1": _nameState++; return(true);

                    default: return(false);
                    }

                case 2:     // Body Data
                    switch (type)
                    {
                    case "MNAM": _genderState = 0; return(true);

                    case "FNAM": _genderState = 1; return(true);

                    case "MODL": Bodys[_genderState].MODL = r.ReadFILE(dataSize); return(true);

                    case "MODB": Bodys[_genderState].MODB = r.ReadT <FLTVField>(dataSize); return(true);

                    case "INDX": Bodys[_genderState].BodyParts.Add(new BodyPartGroup {
                            INDX = r.ReadT <UI32Field>(dataSize)
                        }); return(true);

                    case "ICON": Bodys[_genderState].BodyParts.Last().ICON = r.ReadFILE(dataSize); return(true);

                    case "HNAM": _nameState++; break;

                    default: return(false);
                    }
                    goto case 3;

                case 3:     // Postamble
                    switch (type)
                    {
                    case "HNAM": for (var i = 0; i < dataSize >> 2; i++)
                        {
                            HNAMs.Add(new FMIDField <HAIRRecord>(r, 4));
                        }
                        return(true);

                    case "ENAM": for (var i = 0; i < dataSize >> 2; i++)
                        {
                            ENAMs.Add(new FMIDField <EYESRecord>(r, 4));
                        }
                        return(true);

                    case "FGGS": FGGS = r.ReadBYTV(dataSize); return(true);

                    case "FGGA": FGGA = r.ReadBYTV(dataSize); return(true);

                    case "FGTS": FGTS = r.ReadBYTV(dataSize); return(true);

                    case "SNAM": SNAM = r.ReadUNKN(dataSize); return(true);

                    default: return(false);
                    }

                default: return(false);
                }
            }
            return(false);
        }