Esempio n. 1
0
        public unsafe void SetPacketID(byte packet_id)
        {
            fixed(byte *ptr = buffer)
            {
                DataHeader *hdr = (DataHeader *)(ptr + HEADER_SIZE);

                hdr->PacketID = packet_id;
            }
        }
Esempio n. 2
0
        public unsafe void SetCommandID(ushort command_id)
        {
            fixed(byte *ptr = buffer)
            {
                DataHeader *hdr = (DataHeader *)(ptr + HEADER_SIZE);

                hdr->CommandID = command_id;
            }
        }
Esempio n. 3
0
        private unsafe void SetDataSize(ushort data_size)
        {
            fixed(byte *ptr = buffer)
            {
                DataHeader *hdr = (DataHeader *)(ptr + HEADER_SIZE);

                hdr->DataSize = data_size;
            }
        }
Esempio n. 4
0
        public override void Parse(VoidPtr address)
        {
            //Initialize lists
            _extraEntries = new List <MovesetEntry>();
            _articles     = new SortedList <int, MovesetEntry>();
            _subActions   = new BindingList <SubActionEntry>();

            //Set header values
            DataHeader *h = (DataHeader *)address; _hdr = *h;

            _unk27  = _hdr.Unknown27;
            _unk28  = _hdr.Unknown28;
            _flags1 = _hdr.Flags1;
            _flags2 = _hdr.Flags2;

            bint *v = (bint *)address;

            int[] sizes = MovesetFile.CalculateSizes(_root._dataSize, v, 27, true);
            ParseScripts(v, sizes);

            //Parse all data entries.
            //If an offset is 0 (except for the attributes), the entry will be set to null.
            _modelVis         = Parse <ModelVisibility>(v[1]);
            _attributes       = Parse <AttributeList>(v[2], "Attributes");
            _sseAttributes    = Parse <AttributeList>(v[3]);
            _misc             = Parse <Miscellaneous>(v[4]);
            _unknown7         = Parse <EntryList <Unknown7Entry> >(v[7], 8);
            _actionInterrupts = Parse <ActionInterrupts>(v[8]);
            _actionPre        = Parse <EntryList <ActionPre> >(v[11], 4);
            _anchoredItems    = Parse <EntryList <ItemAnchor> >(v[16], sItemAnchor.Size);
            _gooeyBomb        = Parse <EntryList <ItemAnchor> >(v[17], sItemAnchor.Size);
            _boneRef1         = Parse <EntryList <BoneIndexValue> >(v[18], 4, sizes[18] / 4);
            _boneRef2         = Parse <BoneReferences2>(v[19]);
            _entryOverrides   = Parse <ActionOverrideList>(v[20]);
            _exitOverrides    = Parse <ActionOverrideList>(v[21]);
            _unknown22        = Parse <Unknown22>(v[22]);
            _boneFloats3      = Parse <EntryList <ItemAnchor> >(v[23], sItemAnchor.Size + 4);
            _unknown24        = Parse <Unknown24>(v[24]);

            //Parse extra offsets specific to this character
            OffsetHolder o = ExtraDataOffsets.GetOffsets(_root.Character);

            if (o != null)
            {
                o.Parse(this, address + DataHeader.Size);
            }

            int u = 0;

            foreach (ArticleEntry e in _articles.Values)
            {
                e._index = u++;
            }
        }
Esempio n. 5
0
        private unsafe void UpdateSize(ushort size)
        {
            index += size;

            fixed(byte *ptr = buffer)
            {
                PacketHeader *pkt = (PacketHeader *)(ptr);
                DataHeader *  dt  = (DataHeader *)(ptr + HEADER_SIZE);

                dt->DataSize += size;
                pkt->Size     = (ushort)(HEADER_SIZE + dt->DataSize);
            }
        }
        public override void Build(VoidPtr address)
        {
            dataHeader = (DataHeader *)(address + _data._childLength);

            //Action arrays are at the start of part 3
            actionArrays[0] = (bint *)(address + _lengths[0] + _lengths[1]);
            actionArrays[1] = actionArrays[0] + _moveset._actions.Count;

            //Subaction arrays are at the start of part 4
            subActionArrays[0] = (bint *)(address + (_lengths[0] + _lengths[1] + _lengths[2]));
            subActionArrays[1] = (bint *)(subActionArrays[0] + _data._subActions.Count);
            subActionArrays[2] = (bint *)(subActionArrays[1] + _data._subActions.Count);
            subActionArrays[3] = (bint *)(subActionArrays[2] + _data._subActions.Count);

            //Misc is right before the data header
            miscHeader = (sDataMisc *)(address + (_data._childLength - sDataMisc.Size));

            dataHeader->MiscSectionOffset   = Offset(miscHeader);
            dataHeader->SubactionMainStart  = Offset(subActionArrays[0]);
            dataHeader->SubactionGFXStart   = Offset(subActionArrays[1]);
            dataHeader->SubactionSFXStart   = Offset(subActionArrays[2]);
            dataHeader->SubactionOtherStart = Offset(subActionArrays[3]);
            dataHeader->EntryActionsStart   = Offset(actionArrays[0]);
            dataHeader->ExitActionsStart    = Offset(actionArrays[1]);

            base.Build(address);

            dataHeader->Unknown27 = _data.Unknown27;
            dataHeader->Unknown28 = _data.Unknown28;
            dataHeader->Flags1    = _data.Flags1uint;
            dataHeader->Flags2    = _data.Flags2int;

            List <VoidPtr> lookup = _extraDataOffsets.Write(_data, (VoidPtr)dataHeader + DataHeader.Size);

#if DEBUG
            foreach (VoidPtr addr in lookup)
            {
                if ((int)addr < (int)_baseAddress)
                {
                    throw new Exception("Offset value set in lookup, not the address of the offset value.");
                }
            }
#endif

            _lookupAddresses.AddRange(lookup);
        }