コード例 #1
0
ファイル: Patch.cs プロジェクト: decay88/GameSharp
 public void Disable()
 {
     if (IsActive)
     {
         PatchAddress.Write(OriginalBytes);
         IsActive = false;
     }
 }
コード例 #2
0
ファイル: Patch.cs プロジェクト: decay88/GameSharp
 public void Enable()
 {
     if (!IsActive)
     {
         PatchAddress.Write(NewBytes);
         IsActive = true;
     }
 }
コード例 #3
0
ファイル: MemoryPatch.cs プロジェクト: oathgg/GameSharp
        /// <summary>
        ///     A patch can be used to change byte(s) starting at the defined address.
        /// </summary>
        /// <param name="addressToPatch">The address of the byte where we want our patch to start.</param>
        public MemoryPatch(MemoryPointer addressToPatch, byte[] newBytes)
        {
            PatchAddress  = addressToPatch ?? throw new ArgumentNullException(nameof(addressToPatch));
            NewBytes      = newBytes ?? throw new ArgumentNullException(nameof(newBytes));
            OriginalBytes = PatchAddress.Read(NewBytes.Length);

            MemoryPatches.Add(this);
        }