private void AddMemoryDomain(LibMeteor.MemoryArea which, int size, string name)
        {
            IntPtr data = LibMeteor.libmeteor_getmemoryarea(which);

            if (data == IntPtr.Zero)
            {
                throw new Exception("libmeteor_getmemoryarea() returned NULL??");
            }

            MemoryDomain md = MemoryDomain.FromIntPtr(name, size, MemoryDomain.Endian.Little, data);

            _domainList.Add(md);
        }
Exemplo n.º 2
0
        void AddMemoryDomain(LibMeteor.MemoryArea which, int size, string name)
        {
            IntPtr data = LibMeteor.libmeteor_getmemoryarea(which);

            if (data == IntPtr.Zero)
            {
                throw new Exception("libmeteor_getmemoryarea() returned NULL??");
            }

            MemoryDomain md = new MemoryDomain(name, size, MemoryDomain.Endian.Little,
                                               delegate(int addr)
            {
                unsafe
                {
                    byte *d = (byte *)data;
                    if (addr < 0 || addr >= size)
                    {
                        throw new IndexOutOfRangeException();
                    }
                    return(d[addr]);
                }
            },
                                               delegate(int addr, byte val)
            {
                unsafe
                {
                    byte *d = (byte *)data;
                    if (addr < 0 || addr >= size)
                    {
                        throw new IndexOutOfRangeException();
                    }
                    d[addr] = val;
                }
            });

            _MemoryDomains.Add(md);
        }