예제 #1
0
        /// <summary>
        /// Constructor for static memory address.
        /// </summary>
        public MemoryAddress(Game game, string name, long address, GameVersion gameVersion, DataType type, int length = 0)
            : this(game, name, type, length)
        {
            if (gameVersion == null)
            {
                throw new ArgumentNullException(nameof(gameVersion), "Unable to construct memory address: No game version set.");
            }

            Address = address;
            GameVersion = gameVersion;
        }
예제 #2
0
        public void UpdateForVersion(GameVersion newVersion)
        {
            // NOTE(Ligh): Dynamic addresses do not depend on the version.
            if (IsDynamic)
            {
                return;
            }

            if (newVersion == null || GameVersion == null)
            {
                throw new ArgumentNullException("Tried to update address for version but version is not defined.");
            }

            if (newVersion != GameVersion)
            {
                address += newVersion.GetOffsetForVersion(address) - GameVersion.GetOffsetForVersion(address);
            }
        }