Wei Shi
Wei Shi

Reputation: 5055

Modify game settings in binary file

(I asked this question on Gaming, but was closed and ppl suggest I ask on Stackoverflow. If this doesn't fit here, please suggest a better place before you close it. Thanks.)

One general way to cheat in game is to use a memory scan tool to track down the value you want to change. However another common way to cheat is to modify the binary file.

For example, in a game you get +5 exp when you kill an enemy, and by changing 5 to 50 stored in binary you can get +50 exp. As far as I know, many iPhone game cheats work that way, which requires you to patch a binary file or use HEX editor.

I'm interested in how those hackers locate the settings. What is the general method/tool to find out which binary file a specific value is in and the corresponding offset? If it's a very unique number or a ascii string, like 3219 or google.com, you can just search the HEX value, but what if it's a common value, like 1?

Upvotes: 4

Views: 3133

Answers (2)

Sparafusile
Sparafusile

Reputation: 4956

Try to figure out the file format through trial and error. Programmers usually don't make things intentionally difficult unless the game is an MMO or huge blockbuster prone to cheating. If you're playing a game that gives you Exp for killing slugs, here are some basic steps to take:

  1. Locate the "Monster" file or database table. This contains the information on all monsters.
  2. Search for some known information. In this case, the name of the monster is "Slug".
  3. Use a hex editor to examine the bytes near the name of the monster. Look for a DWORD, WORD, or BYTE that contains the value '50'.
  4. Change 50 to 51 and save the change. Kill a "Slug" and see if the exp changed.
  5. If you still get 50 exp, try some other value near "Slug" and repeat.

With enough time and patience you will eventually figure out the entire file format and be able to change anything at will.

Upvotes: 0

user786653
user786653

Reputation: 30460

You could disassemble the game executable, that way you could in principle know what every memory location does. This is probably not practical for most games.

Two other approaches that more directly target specific values:

  • Pause the game with a debugger right before gaining experience and step through the code to see what memory locations are affected.
  • Though there is bound to be many locations containing the same number as your experience you can quickly narrow them down: Say you have 50 EXP, dump a list of all memory locations* containing 50, then gain some more EXP (say 20) now you can exclude all locations that haven't changed to 70.

* You will probably be searching for a 32/64-bit integer not a single byte location.

Upvotes: 4

Related Questions