Exemple #1
0
        /// <summary>
        /// Writes a byte to the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="value">The value.</param>
        public static void Write8(uint address, byte value)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.write8 != null)
                {
                    memoryRange.write8(address, value);
                }
            }

            return;
        }
Exemple #2
0
        /// <summary>
        /// Reads a byte from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public static byte Read8(uint address)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.read8 != null)
                {
                    return(memoryRange.read8(address));
                }
            }

            return(0);
        }
Exemple #3
0
        /// <summary>
        /// Reads an integer from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public static uint Read32(uint address)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.write8 != null)
                {
                    return((uint)(memoryRange.read8(address) | (memoryRange.read8(address + 1) << 8) | (memoryRange.read8(address + 2) << 16) | (memoryRange.read8(address + 3) << 24)));
                }
            }

            return(0);
        }
Exemple #4
0
        /// <summary>
        /// Reads a short from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public static ushort Read24(uint address)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.read8 != null)
                {
                    return((ushort)(memoryRange.read8(address) | (memoryRange.read8(address + 1) << 8) | (memoryRange.read8(address + 2) << 16)));
                }
            }

            return(0);
        }
Exemple #5
0
        /// <summary>
        /// Reads a byte from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        private static byte PhysicalRead8(uint address)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.read8 != null)
                {
                    return(memoryRange.read8(address));
                }
            }

            return(0);
        }
Exemple #6
0
        /// <summary>
        /// Reads an integer from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public static ulong Read64(uint address)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.write8 != null)
                {
                    return((ulong)(memoryRange.read8(address) | (memoryRange.read8(address + 1) << 8) | (memoryRange.read8(address + 2) << 16) | (memoryRange.read8(address + 3) << 24) |
                                   memoryRange.read8(address + 4) << 32 | (memoryRange.read8(address + 5) << 40) | (memoryRange.read8(address + 6) << 48) | (memoryRange.read8(address + 7) << 56)));
                }
            }

            return(0);
        }
Exemple #7
0
        /// <summary>
        /// Writes a short to the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="value">The value.</param>
        public static void Write16(uint address, ushort value)
        {
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.write8 != null)
                {
                    memoryRange.write8(address, (byte)value);
                    memoryRange.write8(address + 1, (byte)(value >> 8));
                }
            }

            return;
        }
Exemple #8
0
        /// <summary>
        /// Reads a byte from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public static byte Read8(uint address)
        {
            address = TranslateToPhysical(address);
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.read8 != null)
                {
                    return(memoryRange.read8(address));
                }
            }

            return(0);
        }
Exemple #9
0
        /// <summary>
        /// Writes a byte to the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <param name="value">The value.</param>
        public static void Write8(uint address, byte value)
        {
            address = TranslateToPhysical(address);
            MemoryHandler memoryRange = Find(address);

            if (memoryRange != null)
            {
                if (memoryRange.write8 != null)
                {
                    memoryRange.write8(address, value);
                }
            }

            return;
        }