Пример #1
0
        public StrategyOption(System.IO.Stream stream, uint refStringStart)
        {
            uint entrySize = stream.PeekUInt32().SwapEndian();

            Data = new uint[entrySize / 4];
            for (int i = 0; i < Data.Length; ++i)
            {
                Data[i] = stream.ReadUInt32().SwapEndian();
            }

            Category = Data[1];
            InGameID = Data[2];
            uint refStringLocation = Data[3];

            NameStringDicID = Data[4];
            DescStringDicID = Data[5];
            Characters      = Data[6];
            ID = Data[7];

            long pos = stream.Position;

            stream.Position = refStringStart + refStringLocation;
            RefString       = stream.ReadAsciiNullterm();
            stream.Position = pos;
        }
Пример #2
0
        public CFLD(System.IO.Stream stream) : base(stream)
        {
            if (SectionIdentifierHumanReadable != "CFLD")
            {
                throw new System.Exception("Attempted to parse a 'CFLD' section with data from a '" + SectionIdentifierHumanReadable + "' section.");
            }

            Subsections = new List <IFileSection>();

            long PositionAtBeginning = stream.Position;

            stream.ReadAlign(0x10);
            while (stream.Position < PositionAtBeginning + _SectionSize)
            {
                if (stream.PeekUInt32() == 0x00000000)
                {
                    stream.DiscardBytes(0x10);
                    continue;
                }
                IFileSection s = FileSectionFactory.ParseNextSection(stream);
                Subsections.Add(s);
                stream.ReadAlign(0x10);
            }
            stream.ReadAlign(0x10);
        }
Пример #3
0
        public EncounterGroup(System.IO.Stream stream, uint refStringStart)
        {
            uint[] Data;
            uint   entryLength = stream.PeekUInt32().SwapEndian();

            Data = new uint[entryLength / 4];
            for (int i = 0; i < Data.Length; ++i)
            {
                Data[i] = stream.ReadUInt32().SwapEndian();
            }

            ID          = Data[1];
            StringDicID = Data[2];
            InGameID    = Data[3];

            EnemyGroupIDs = new uint[10];
            for (int i = 0; i < 10; ++i)
            {
                EnemyGroupIDs[i] = Data[5 + i];
            }

            long pos = stream.Position;

            stream.Position = refStringStart + Data[4];
            RefString       = stream.ReadAsciiNullterm();
            stream.Position = pos;
        }
Пример #4
0
        public EnemyGroup(System.IO.Stream stream, uint refStringStart)
        {
            uint entryLength = stream.PeekUInt32().SwapEndian();

            Data = new uint[entryLength / 4];
            for (int i = 0; i < Data.Length; ++i)
            {
                Data[i] = stream.ReadUInt32().SwapEndian();
            }

            ID          = Data[1];
            StringDicID = Data[2];
            InGameID    = Data[3];

            EnemyIDs = new int[8];
            for (int i = 0; i < EnemyIDs.Length; ++i)
            {
                EnemyIDs[i] = (int)Data[5 + i];
            }

            UnknownFloats = new float[8];
            for (int i = 0; i < UnknownFloats.Length; ++i)
            {
                UnknownFloats[i] = Data[13 + i].UIntToFloat();
            }
            PosX = new float[8];
            for (int i = 0; i < PosX.Length; ++i)
            {
                PosX[i] = Data[21 + i].UIntToFloat();
            }
            PosY = new float[8];
            for (int i = 0; i < PosY.Length; ++i)
            {
                PosY[i] = Data[29 + i].UIntToFloat();
            }
            Scale = new float[8];
            for (int i = 0; i < Scale.Length; ++i)
            {
                Scale[i] = Data[37 + i].UIntToFloat();
            }

            SomeFlag    = Data[45];
            UnknownInts = new uint[8];
            for (int i = 0; i < UnknownInts.Length; ++i)
            {
                UnknownInts[i] = Data[46 + i];
            }

            long pos = stream.Position;

            stream.Position = refStringStart + Data[4];
            RefString       = stream.ReadAsciiNullterm();
            stream.Position = pos;
        }
Пример #5
0
        public static IFileSection ParseNextSection(System.IO.Stream stream)
        {
            switch (stream.PeekUInt32().SwapEndian())
            {
            case 0x43464C44: return(new FileSections.CFLD(stream));

            case 0x44415441: return(new FileSections.DATA(stream));

            case 0x4D455320: return(new FileSections.MES(stream));

            case 0x4E414D45: return(new FileSections.NAME(stream));

            case 0x5441424C: return(new FileSections.TABL(stream));

            default: throw new Exception("Unknown file section '" + Encoding.ASCII.GetString(BitConverter.GetBytes(stream.PeekUInt32())) + "'.");
            }
        }
Пример #6
0
        public StrategySet(System.IO.Stream stream, uint refStringStart)
        {
            uint[] Data;
            uint   entrySize = stream.PeekUInt32().SwapEndian();

            Data = new uint[entrySize / 4];
            for (int i = 0; i < Data.Length; ++i)
            {
                Data[i] = stream.ReadUInt32().SwapEndian();
            }

            ID = Data[1];
            uint refStringLocation = Data[2];

            NameStringDicID = Data[3];
            DescStringDicID = Data[4];

            StrategyDefaults = new uint[8, 9];
            for (uint x = 0; x < 8; ++x)
            {
                for (uint y = 0; y < 9; ++y)
                {
                    StrategyDefaults[x, y] = Data[x * 9 + y + 5];
                }
            }

            ID2 = Data[77];

            UnknownFloats1 = new float[9];
            for (int i = 0; i < UnknownFloats1.Length; ++i)
            {
                UnknownFloats1[i] = Data[78 + i].UIntToFloat();
            }
            UnknownFloats2 = new float[9];
            for (int i = 0; i < UnknownFloats2.Length; ++i)
            {
                UnknownFloats2[i] = Data[87 + i].UIntToFloat();
            }

            long pos = stream.Position;

            stream.Position = refStringStart + refStringLocation;
            RefString       = stream.ReadAsciiNullterm();
            stream.Position = pos;
        }
Пример #7
0
        public Arte(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, BitUtils.Bitness bits)
        {
            uint Size = stream.PeekUInt32().FromEndian(endian);

            if ((Size % 4) != 0)
            {
                throw new Exception("Arte data size not divisble by 4.");
            }

            Size -= (bits.NumberOfBytes() - 4) * 2;               // just hack this so i don't have to rewrite this mess...
            Data  = new uint[Size / 4];
            for (int i = 0; i < Data.Length; ++i)
            {
                if (i == 3 || i == 4)
                {
                    Data[i] = (uint)stream.ReadUInt(bits, endian);                       // just hack this so i don't have to rewrite this mess...
                }
                else
                {
                    Data[i] = stream.ReadUInt32().FromEndian(endian);
                }
            }

            ID       = Data[1];
            InGameID = Data[2];

            uint refStringLocaton = Data[3];             // seems to be identical with Data[4]

            RefString = stream.ReadAsciiNulltermFromLocationAndReset(refStringStart + refStringLocaton);

            NameStringDicId = Data[5];
            DescStringDicId = Data[6];
            Type            = (ArteType)Data[7];

            TPUsage         = Data[8];
            ElementFire     = Data[10];
            ElementEarth    = Data[11];
            ElementWind     = Data[12];
            ElementWater    = Data[13];
            ElementLight    = Data[14];
            ElementDarkness = Data[15];


            // for some reason the data order different between versions?
            if (Size == 876)
            {
                LearnRequirementsOtherArtesType = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesType.Length; ++i)
                {
                    LearnRequirementsOtherArtesType[i] = Data[128 + 22 + i];
                }
                LearnRequirementsOtherArtesId = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesId.Length; ++i)
                {
                    LearnRequirementsOtherArtesId[i] = Data[128 + 28 + i];
                }
                LearnRequirementsOtherArtesUsageCount = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesUsageCount.Length; ++i)
                {
                    LearnRequirementsOtherArtesUsageCount[i] = Data[128 + 34 + i];
                }

                AlteredArteRequirementType = new uint[5];
                for (int i = 0; i < AlteredArteRequirementType.Length; ++i)
                {
                    AlteredArteRequirementType[i] = Data[127 + 69 + i];
                }
                AlteredArteRequirementId = new uint[5];
                for (int i = 0; i < AlteredArteRequirementId.Length; ++i)
                {
                    AlteredArteRequirementId[i] = Data[127 + 74 + i];
                }
                //CharacterRelatedField = Data[?];
                Character = Data[21];

                FatalStrikeType = Data[210];

                UsableInMenu = Data[128 + 44];
            }
            else
            {
                LearnRequirementsOtherArtesType = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesType.Length; ++i)
                {
                    LearnRequirementsOtherArtesType[i] = Data[22 + i];
                }
                LearnRequirementsOtherArtesId = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesId.Length; ++i)
                {
                    LearnRequirementsOtherArtesId[i] = Data[28 + i];
                }
                LearnRequirementsOtherArtesUsageCount = new uint[6];
                for (int i = 0; i < LearnRequirementsOtherArtesUsageCount.Length; ++i)
                {
                    LearnRequirementsOtherArtesUsageCount[i] = Data[34 + i];
                }

                AlteredArteRequirementType = new uint[5];
                for (int i = 0; i < AlteredArteRequirementType.Length; ++i)
                {
                    AlteredArteRequirementType[i] = Data[69 + i];
                }
                AlteredArteRequirementId = new uint[5];
                for (int i = 0; i < AlteredArteRequirementId.Length; ++i)
                {
                    AlteredArteRequirementId[i] = Data[74 + i];
                }
                CharacterRelatedField = Data[95];
                Character             = Data[96];

                FatalStrikeType = Data[83];

                UsableInMenu = Data[44];
            }

            // always identical: 16, 17
            // 59 is some sort of status effect field
        }