当前位置: 首页>>代码示例>>C#>>正文


C# System.VoidPtr类代码示例

本文整理汇总了C#中System.VoidPtr的典型用法代码示例。如果您正苦于以下问题:C# VoidPtr类的具体用法?C# VoidPtr怎么用?C# VoidPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VoidPtr类属于System命名空间,在下文中一共展示了VoidPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Duplicate

 internal static unsafe SafeHandle Duplicate(VoidPtr hFile)
 {
     VoidPtr hProc = Process.GetCurrentProcess().Handle;
     if (!DuplicateHandle(hProc, hFile, hProc, out hFile, 0, false, 2))
         Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
     return new SafeHandle(hFile);
 }
开发者ID:soneek,项目名称:Sm4sh-Tools,代码行数:7,代码来源:Win32.cs

示例2: EncodeBlock

 protected override void EncodeBlock(ARGBPixel* sPtr, VoidPtr blockAddr, int width)
 {
     wRGB5A3Pixel* dPtr = (wRGB5A3Pixel*)blockAddr;
     for (int y = 0; y < BlockHeight; y++, sPtr += width)
         for (int x = 0; x < BlockWidth; )
             *dPtr++ = (wRGB5A3Pixel)sPtr[x++];
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:7,代码来源:RGB5A3.cs

示例3: GetArrayFromAddress

 /// <summary>
 /// Copies data from memory at a specific address into an array
 /// </summary>
 /// <param name="source"></param>
 /// <param name="sourceOffset"></param>
 /// <param name="target"></param>
 /// <param name="targetOffset"></param>
 /// <param name="Length"></param>
 public static byte[] GetArrayFromAddress(VoidPtr Address, int length)
 {
     byte[] arr = new byte[length];
     for (int i = 0; i < length; i++)
         arr[i] = *(byte*)(Address + i);
     return arr;
 }
开发者ID:chrisall76,项目名称:Sm4sh-Tools,代码行数:15,代码来源:Util.cs

示例4: Parse

        public override void Parse(VoidPtr address)
        {
            MoveDefLookupOffsetNode o;
            bint* addr = First;
            VoidPtr current = BaseAddress + *addr++;
            VoidPtr next = BaseAddress + *addr++;
            int size = 0;
            for (int i = 1; i < Count; i++)
            {
                size = (int)next - (int)current;
                (o = new MoveDefLookupOffsetNode()).Initialize(this, current, size);
                if (_root._lookupSizes.ContainsKey(o.DataOffset))
                    if (_root._lookupSizes[o.DataOffset].DataSize < o.DataSize)
                        _root._lookupSizes[o.DataOffset] = o;
                    else { }
                else
                    _root._lookupSizes.Add(o.DataOffset, o);
                current = next;
                next = BaseAddress + *addr++;
            }
            size = ((int)_offset - (int)(current - BaseAddress));
            (o = new MoveDefLookupOffsetNode()).Initialize(this, current, size);

            if (!_root._lookupSizes.ContainsKey(o.DataOffset))
                _root._lookupSizes.Add(o.DataOffset, o);

            //Sorting by data offset will allow us to get the exact size of every entry!
            Children.Sort(MoveDefLookupOffsetNode.LookupCompare);
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:29,代码来源:Lookup.cs

示例5: IsDataCompressed

        public static bool IsDataCompressed(VoidPtr addr, int length)
        {
            if (*(uint*)addr == YAZ0.Tag)
                return true;
            else
            {
                CompressionHeader* cmpr = (CompressionHeader*)addr;

                if (cmpr->ExpandedSize < length)
                    return false;

                if (!cmpr->HasLegitCompression())
                    return false;

                char[] chars = characters.ToCharArray();

                //Check to make sure we're not reading a tag
                byte* c = (byte*)addr;
                byte[] tag = { c[0], c[1], c[2], c[3] };
                if ((Array.IndexOf(chars, (char)tag[0]) >= 0) &&
                    (Array.IndexOf(chars, (char)tag[1]) >= 0) &&
                    (Array.IndexOf(chars, (char)tag[2]) >= 0) &&
                    (Array.IndexOf(chars, (char)tag[3]) >= 0))
                    return false;

                return true;
            }
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:28,代码来源:Compressor.cs

示例6: OnWrite

        protected override void OnWrite(VoidPtr address)
        {
            _rebuildAddr = address;

            *(buint*)address = v1._data;
            *(buint*)(address + 4) = v2._data;
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:7,代码来源:Unknown7.cs

示例7: DecodeBlock

 protected override void DecodeBlock(VoidPtr blockAddr, ARGBPixel* dPtr, int width)
 {
     byte* sPtr = (byte*)blockAddr;
     byte b;
     if (_workingPalette != null)
     {
         for (int y = 0; y < BlockHeight; y++, dPtr += width)
             for (int x = 0; x < BlockWidth; )
             {
                 b = *sPtr++;
                 dPtr[x++] = (ARGBPixel)_workingPalette.Entries[b >> 4];
                 dPtr[x++] = (ARGBPixel)_workingPalette.Entries[b & 0xF];
             }
     }
     else
     {
         for (int y = 0; y < BlockHeight; y++, dPtr += width)
             for (int x = 0; x < BlockWidth; )
             {
                 b = *sPtr++;
                 dPtr[x++] = new ARGBPixel((byte)(b & 0xF0));
                 dPtr[x++] = new ARGBPixel((byte)(b << 4));
             }
     }
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:25,代码来源:CI4.cs

示例8: DataSource

 public DataSource(VoidPtr addr, int len, CompressionType compression)
 {
     Address = addr;
     Length = len;
     Map = null;
     Compression = compression;
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:7,代码来源:ResourceNode.cs

示例9: OnRebuild

        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            RWAR* header = (RWAR*)address;
            header->_header._version = 0x100;
            header->_header._tag = RWAR.Tag;
            header->_header.Endian = Endian.Big;
            header->_header._length = length;
            header->_header._firstOffset = 0x20;
            header->_header._numEntries = 2;
            header->_tableOffset = 0x20;

            RWARTableBlock* tabl = (RWARTableBlock*)(address + 0x20);
            tabl->_header._tag = RWARTableBlock.Tag;
            tabl->_header._length = (12 + Children.Count * 12).Align(0x20);
            tabl->_entryCount = (uint)Children.Count;

            header->_tableLength = tabl->_header._length;
            header->_dataOffset = 0x20 + header->_tableLength;

            RWARDataBlock* data = (RWARDataBlock*)(address + 0x20 + tabl->_header._length);
            data->_header._tag = RWARDataBlock.Tag;

            VoidPtr addr = (VoidPtr)data + 0x20;
            foreach (RWAVNode n in Children)
            {
                tabl->Entries[n.Index].waveFileRef = (uint)(addr - (VoidPtr)data);
                //Memory.Move(addr, n.WorkingSource.Address, (uint)n.WorkingSource.Length);
                n.MoveRaw(addr, n.WorkingUncompressed.Length);
                addr += (tabl->Entries[n.Index].waveFileSize = (uint)n.WorkingUncompressed.Length);
            }
            data->_header._length = (int)(addr - (VoidPtr)data);
            header->_dataLength = data->_header._length;
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:33,代码来源:RWARNode.cs

示例10: DecodeFrames

 public static void DecodeFrames(KeyframeArray kf, VoidPtr offset, int flags, int fixedBit)
 {
     if ((flags & fixedBit) != 0)
         kf[0] = *(bfloat*)offset;
     else
         DecodeFrames(kf, offset + *(bint*)offset);
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:7,代码来源:SCN0GroupNode.cs

示例11: Expand

        public static void Expand(CompressionHeader* header, VoidPtr dstAddress, int dstLen)
        {
            uint total = 0;
            VoidPtr ceil = dstAddress + dstLen;

            if (header->Parameter != 1)
            {
                byte* pSrc = (byte*)header->Data;
                byte* pDst = (byte*)dstAddress;
                do
                {
                    total += *pSrc++;
                    *pDst++ = (byte)total;
                }
                while (pSrc < ceil);
            }
            else
            {
                bushort* pSrc = (bushort*)header->Data;
                bushort* pDst = (bushort*)dstAddress;
                do
                {
                    total += *pSrc++;
                    *pDst++ = (ushort)total;
                }
                while (pSrc < ceil);
            }
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:28,代码来源:Differential.cs

示例12: Fill

 internal static unsafe void Fill(VoidPtr dest, uint length, byte value)
 {
     switch (Environment.OSVersion.Platform)
     {
         case PlatformID.Win32NT: { Win32.FillMemory(dest, length, value); break; }
         case PlatformID.Unix: { Linux.memset(dest, value, length); break; }
     }
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:8,代码来源:Memory.cs

示例13: DecodeBlock

 protected override void DecodeBlock(VoidPtr blockAddr, ARGBPixel* dPtr, int width)
 {
     wRGB5A3Pixel* sPtr = (wRGB5A3Pixel*)blockAddr;
     //ARGBPixel* dPtr = (ARGBPixel*)destAddr;
     for (int y = 0; y < BlockHeight; y++, dPtr += width)
         for (int x = 0; x < BlockWidth; )
             dPtr[x++] = (ARGBPixel)(*sPtr++);
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:8,代码来源:RGB5A3.cs

示例14: EncodeBlock

 protected override void EncodeBlock(ARGBPixel* sPtr, VoidPtr blockAddr, int width)
 {
     byte* stPtr = (byte*)sPtr;
     byte* dPtr = (byte*)blockAddr;
     for (int y = 0; y < BlockHeight; y++, stPtr += width)
         for (int x = 0; x < BlockWidth; )
             *dPtr++ = stPtr[x++];
 }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:8,代码来源:CI8.cs

示例15: OnWrite

        protected override void OnWrite(VoidPtr address)
        {
            VoidPtr addr = address;
            foreach (ArticleEntry b in Children)
            {
                b._buildHeader = false;
                b.Rebuild(addr, b._childLength, true);
                addr += b._childLength;
            }

            VoidPtr start = addr;
            foreach (ArticleEntry b in Children)
            {
                b._rebuildAddr = addr;

                Article* article = (Article*)addr;

                article->_id = b.id;
                article->_boneID = b.charBone;
                article->_arcGroup = b.articleBone;

                article->_actionsStart = b.aStart;
                article->_actionFlagsStart = b.aFlags;
                article->_subactionFlagsStart = b.sFlags;
                article->_subactionMainStart = b.sMStart;
                article->_subactionGFXStart = b.sGStart;
                article->_subactionSFXStart = b.sSStart;
                article->_modelVisibility = b.visStart;
                article->_collisionData = b.off1;
                article->_unknownD2 = b.off2;
                article->_unknownD3 = b.off3;

                bint* ext = (bint*)((VoidPtr)article + 52);
                ext[0] = (b._subActions == null ? 0 : b._subActions.Children.Count);

                //Add all header offsets
                bint* off = (bint*)(addr + 12);
                for (int i = 0; i < 10 + b._extraOffsets.Count; i++)
                    if (off[i] > 1480 && off[i] < _root.dataSize)
                        b._lookupOffsets.Add(&off[i]);

                _lookupOffsets.AddRange(b._lookupOffsets);

                addr += b._entryLength;
            }

            FDefListOffset* header = (FDefListOffset*)addr;

            _rebuildAddr = header;

            if (Children.Count > 0)
            {
                header->_startOffset = (int)start - (int)RebuildBase;
                _lookupOffsets.Add(header->_startOffset.Address);
            }

            header->_listCount = Children.Count;
        }
开发者ID:blahblahblahblah831,项目名称:brawltools2,代码行数:58,代码来源:MoveDefStaticArticleGroupNode.cs


注:本文中的System.VoidPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。