good job yoda
My pattern finding function
A little bit of an update, I don't know if it works yet, my hack still crashes the game even if I just declare the correct addresses. Please let me know if it works for you.
The point of this update it to make the function easier to C+P... since pretty much everyone uses the function with the prototype:
This is my method:
Includes:
And the functions:
The point of this update it to make the function easier to C+P... since pretty much everyone uses the function with the prototype:
Code:
DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char *szMask)
Includes:
Code:
#include <Windows.h> #include <string.h>
And the functions:
Code:
#define realAddy( cast, base, offset ) (cast)((DWORD)(base) + (DWORD)(offset))
bool bExist(BYTE part, BYTE *whole, char *mask)
{
BYTE *start = (BYTE*)(whole + sizeof(whole) - 1);
for(DWORD loc = 0; loc < sizeof(whole); loc++)
if((*(BYTE*)(start - loc) == part) || (*(mask + (strlen(mask) - 1) - loc) == '?')) return true;
return false;
}
DWORD lastLocationOfByte(BYTE part, BYTE *whole, char *mask)
{
BYTE *start = (BYTE*)(whole + sizeof(whole) - 1);
for(DWORD loc = 0; loc < sizeof(whole); loc++)
if((*(BYTE*)(start - loc) == part) || (*(mask + (strlen(mask) - 1) - loc) == '?')) return (sizeof(whole) - loc);
}
DWORD FindPattern(DWORD first, DWORD total, BYTE *val, char *mask)
{
size_t next = sizeof(*val);
BYTE *addy = (BYTE*)((val + next) - 1);
bool exist = false;
BYTE *loc;
for(DWORD n = (next - 1); n < total;)
{
DWORD spot;
for(spot = 0; (*(unsigned char*)(first + n - spot) == *(unsigned char*)(addy - spot)) || (*(mask + (strlen(mask) - 1) - spot) == '?'); spot++);
if(spot == next) return realAddy( DWORD, first, n );
else if(bExist(*(BYTE*)(first + n), val, mask))
n += lastLocationOfByte(*(BYTE*)(first + n), val, mask);
else n += next;
}
return false;
}
i'll test it when i come to my home yoda and i really like your work brother 

This thread is closed for replies.
Similar Threads
WarRock - International HacksAdvanced Hacking tutorial (How to find adresses for the coolest trainer functions)
8 General Game Hackingfinding and hooking an unknown functionJO 1 WarRock - International HacksWhere do i find WPE Pro?RI 1 WarRock - International Hackshi can any1 help me make or find a cheat codeCR 3 General Game Hackinghi, can some1 make a cheat code or find a cheat code for me for this game i play onliCR 37