Skip to content
New Age Soldier edited this page Jul 31, 2020 · 15 revisions

AoB scanning is very taxing on your computer as it uses Parallel Tasks. This creates as many threads as the computer can handle, so use it sparingly. If you're using this with a game trainer, I recommend using the optional parameters like start and end address regions to decrease the scan time.

Cheat Engine Example:

AoBScan Structures

/// <param name="search">array of bytes to search for, OR your ini code label.</param>
/// <param name="writable">Include writable addresses in scan</param>
/// <param name="executable">Include executable addresses in scan</param>
/// <param name="file">ini file (OPTIONAL)</param>
/// <returns>IEnumerable of all addresses found.</returns>
public async Task<IEnumerable<long>> AoBScan(string search, bool writable = false, bool executable = true, string file = "")
/// <param name="start">Your starting address.</param>
/// <param name="end">ending address</param>
/// <param name="search">array of bytes to search for, OR your ini code label.</param>
/// <param name="file">ini file (OPTIONAL)</param>
/// <param name="writable">Include writable addresses in scan</param>
/// <param name="executable">Include executable addresses in scan</param>
/// <returns>IEnumerable of all addresses found.</returns>
public async Task<IEnumerable<long>> AoBScan(long start, long end, string search, bool writable = false, bool executable = true, string file = "")

.ini File Example (optional)

codes.ini file:

[codes]
mySigScan=?? ?? ?? ?5 ?? ?? 5? 00 ?? 00 00 00 ?? 00 50 00 4B 00 50 00 4B

C# code:

long myAoBScan = (await MemLib.AoBScan("mySigScan", false, true, codeFile)).FirstOrDefault();

Full Example with some use cases

// this function is async, which means it does not block other code
public async void SampleAoBScan()
{
    // open the process and check if it was successful before the AoB scan
    if (!MemLib.OpenProcess("MyGamesProcessName")) // you can also specify the process ID. Check Wiki for more info.
    {
        MessageBox.Show("Process Is Not Found or Open!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
        return;
    }

    // AoB scan and store it in AoBScanResults. We specify our start and end address regions to decrease scan time.
    IEnumerable<long> AoBScanResults = await MemLib.AoBScan(0x01000000, 0x04000000, "?? ?? ?? ?5 ?? ?? 5? 00 ?? 00 00 00 ?? 00 50 00", false, true);

    // get the first found address, store it in the variable SingleAoBScanResult
    long SingleAoBScanResult = AoBScanResults.FirstOrDefault();

    // pop up message box that shows our first result
    MessageBox.Show("Our First Found Address is " + SingleAoBScanResult);

    // Ex: iterate through each found address. This prints each address in the debug console in Visual Studio.
    foreach (long res in AoBScanResults)
    {
        Debug.WriteLine("I found the address {0} in the AoB scan.", res, null);
    }

    // Ex: read the value from our first found address, convert it to a string, and show a pop up message - https://github.com/erfg12/memory.dll/wiki/Read-Memory-Functions
    MessageBox.Show("Value for our address is " + MemLib.readFloat(SingleAoBScanResult.ToString("X")).ToString());

    // Ex: write to our first found address - https://github.com/erfg12/memory.dll/wiki/writeMemory
    MemLib.writeMemory(SingleAoBScanResult.ToString("X"), "float", "100.0");
}