Optimization of code injection game modifier

When we play the 88th, the game difficulty may be too large,

Or the game has been more skilled, you want to increase the play of the game, this time you can use the modifier.

Main-memory game modifier to modify memory game

There are two ways when changes, one timer value modify memory. Lock achieve a similar effect.

Such programs need time to run the program. Once the value of the game is closed, for example, health and so on will have to change.

It should be noted, modify the network game and have anti-cheating mechanism of the game, in addition to the game bloated, no other benefits. And there is the risk of losing data synchronization.

The second option is to modify the program code. For example,

1 modified to reduce number of shots plus a number of bullets, once firing operation, the bullet will increase.

Since the program code can be loaded dynamically. When you shoot the code will be loaded into memory. You want to change something, you have to find the location code.

Code position will change but the code is the same, as long as we search for some kind of code, you can find the location.

We put this code, called signatures. When searching for a signature offset is greater than if the signature code is loaded, you can search direct violence.

If the offset is less than the signature code is loaded, kmp algorithm may be used, or bm search algorithm.

When searching for attention, memory read function to run slower, but the amount of data to read the size of a small impact on speed. We can read large amounts of data into the cache.

This can reduce the number of function calls the memory read when using 40kb cache, only read about 1000 to complete the search time is 400ms.

In addition to speed caching, we can also narrow the search range memory, by repeatedly re-open the game, the memory location is found

0XXXXXX1 to 4XXXXXX1 between. This is when you need only search the middle of the 6x4 = 24 bit data space can be.

With guns, blood, the Italian Mafia 2 for example. Open source code has been in GitHub.

Memory operation code for a simple package. 40kb use caching to speed up the search, as described in the code.

To understand the code, you need to be familiar with assembler, C ++. And knowledge of the Windows memory.

The code has not been achieved kmp and bm, if necessary, to station B small turtle reference algorithms courses (in fact it is an old turtle! \ Funny).

Guess you like

Origin www.cnblogs.com/pojdd/p/11388643.html