From 0ad3e6cff0a9cd5c88e85b28f8d385e822a7424c Mon Sep 17 00:00:00 2001 From: fukub Date: Sat, 27 Jul 2024 18:29:45 +0300 Subject: [PATCH] TRSRO BYPASS --- .../RSBot.Core/Components/ClientManager.cs | 64 +++++++++++++------ SDUI | 2 +- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Library/RSBot.Core/Components/ClientManager.cs b/Library/RSBot.Core/Components/ClientManager.cs index e18f8801..a0af94e3 100644 --- a/Library/RSBot.Core/Components/ClientManager.cs +++ b/Library/RSBot.Core/Components/ClientManager.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -90,34 +91,31 @@ public static async Task Start() ReadProcessMemory(process.Handle, process.MainModule.BaseAddress, moduleMemory, process.MainModule.ModuleMemorySize, out _); - var pattern = !isVtcGame ? "6A 00 68 50 2D 2D 01 68 5C 2D 2D 01" : "6A 00 68 A0 D6 28 01 68 AC D6 28 01"; - - var patchNop = new byte[] { 0x90, 0x90 }; - var patchNop2 = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 }; - var patchJmp = new byte[] { 0xEB }; - - var address = FindPattern(pattern, moduleMemory); - if (address == IntPtr.Zero) + if (isVtcGame) { - Log.Error("XIGNCODE patching error! Maybe signatures are wrong?"); - return false; - } - - WriteProcessMemory(pi.hProcess, address - 0x6A, patchJmp, 1, out _); - WriteProcessMemory(pi.hProcess, address + 0x13, patchJmp, 1, out _); + var pattern = "6A 00 68 A0 D6 28 01 68 AC D6 28 01"; + var patchNop = new byte[] { 0x90, 0x90 }; + var patchNop2 = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 }; + var patchJmp = new byte[] { 0xEB }; + var address = FindPattern(pattern, moduleMemory); + if (address == IntPtr.Zero) + { + Log.Error("XIGNCODE patching error! Maybe signatures are wrong?"); + return false; + } - if (isTRGame) - { WriteProcessMemory(pi.hProcess, address - 0x6A, patchJmp, 1, out _); - WriteProcessMemory(pi.hProcess, address + 0x0C, patchNop2, 5, out _); WriteProcessMemory(pi.hProcess, address + 0x13, patchJmp, 1, out _); - WriteProcessMemory(pi.hProcess, address + 0x95, patchJmp, 1, out _); - } - else - { WriteProcessMemory(pi.hProcess, address + 0xC, patchNop2, 5, out _); WriteProcessMemory(pi.hProcess, address + 0x90, patchJmp, 1, out _); } + if (isTRGame) + { + if (!PatchTRSROAddresses(pi.hProcess)) + { + Log.Error("XIGNCODE patching error! Maybe signatures are wrong?"); + } + } moduleMemory = null; GC.Collect(); @@ -144,6 +142,30 @@ public static async Task Start() return await Task.FromResult(true); } + /// + /// Patch TRSRO specific addresses with JMP instructions + /// + private static bool PatchTRSROAddresses(IntPtr processHandle) + { + // Addresses to patch + IntPtr address1 = new IntPtr(0x006D0964); + IntPtr address2 = new IntPtr(0x006D0BFA); + + // Patch data for address1 to JMP 0x006D0B34 + byte[] patchData1 = { 0xE9, 0xCB, 0x01, 0x00, 0x00 }; // JMP instruction with relative offset + + // Patch data for address2 to JMP 0x006D0C17 + byte[] patchData2 = { 0xE9, 0x18, 0x00, 0x00, 0x00 }; // JMP instruction with relative offset + + if (!WriteProcessMemory(processHandle, address1, patchData1, (uint)patchData1.Length, out _)) + return false; + + if (!WriteProcessMemory(processHandle, address2, patchData2, (uint)patchData2.Length, out _)) + return false; + + return true; + } + /// /// Kill the game client process /// diff --git a/SDUI b/SDUI index edee45f6..6d420298 160000 --- a/SDUI +++ b/SDUI @@ -1 +1 @@ -Subproject commit edee45f636b5091c17fb09deaffa93a64b1c31e4 +Subproject commit 6d420298e3bb56723410ee87a96e7318724a04f0