1
Posted December 23, 2009 by Spyros in Reverse Engineering
 
 

How to use Diffing to Make Cheats for Games

i-cheat
i-cheat

More than 6-7 years ago, i’ve written a small tutorial for the great and well known Krobar’s website that featured thousands of reverse engineering tutorials at the time. This essay was about diffing, a technique that, among other things, can be used to make cheats for games. Unluckily, in today’s games there is a high chance that this one will not work, due to serialization, encryption or compression.

However, it will work on old games like simcity 2000 and more. Hence, it’s a good idea that you know how to do that, there will be some cases that it will serve you well. You can find the same essay, courtesy of Krobar here.

What is The Purpose of This Tutorial ?

The purpose of this tutorial is not to teach you a method for cheating games but to let you know of a technique,called diffing.This technique is the practice of comparing two files to find any differences between them,especially if there has been a change.This branch is a game hacking one, but i figured out that it would be really helpful to all newbies,cause it will make them think(and cheat a game).Be certain that the ability to THINK is the greatest achievement of a human-being, according to me at least.So,it is twice an achievement for crackers.

So, How Do I Use This “Diffing” Technnique ?

In order to use this technique more efficiently,i would suggest that you have a program that is able to make a binary comparison of two files,such as Hex Workshop.It won’t be necessary,though, if you are able to use the fc /b command in dos.So,let’s take the example of a well-known game,
which is Simcity 2000.You may be wondering why i am taking the example of such an old one.The answer is that the newer the game is,the more data it needs to store in a saved file and it shows so many changes,that it takes time to find the change you are looking for.Newer games may also encrypt their saved files and decrypt them while they get loaded.In such a case,diffing would be pointless.

Cheat Money on Simcity 2000

I suppose you have installed the game and played it many times.I am also quite sure that you have sometimes had problems with money(except if you are a Simcity wizard).So here is what to do next:

1.Start a new game,or load an existing one and save the game when you have 20000$.Name it as you want.Mine will be crack1.

2.Continue to play the game you have just saved and buy a thing that will cost you the lowest money possible.So,in my case,i build a road and spend 10$.My money now is 19990$.Then i save the game in a new save and i name it crack2.

3.Then i exit the game and open the calculator of my computer.I now change the simple view of my calculator to the scientific one.Then i take care that my calculator shows the decimal value of a number(dec),i type 20000 and i change Dec to Hex.Now my calculator shows the value of 20000 in Hex.It is 4E20.The same thing i do with 19990.It shows 4E16.Now,we have:

20000(dec)=4E20(hex)
19990(dec)=4E16(hex)

So as you may notice the difference between these two numbers in hex is 4E(20-16).As a matter of that,you will have to make a binary comparison between these two files and as you see the differences, you will surely see something like 20 in one save and 16 in the other one.When you see it,look at
their offset number.In my case it’s 00000028.So,my next stop is in hex editor.I open the second save and i search for offset 00000028.Then i see:

00000028:024E16

I change 024E16 to 02ffff,cause f is the highest (hex)adecimal value.Next time i load the game back,i have 65535$,in my bank.

I Have Changed 4E20 to FFFF and GOT 65535, What Happens If I Want More ?

In this case,you will have to experiment.Try to change the adjacent byte,too,or a nearby one. However,i advise you to spend this sum of money and then do that again.One way or another,the fact is that you now know what diffing is and how to use it to cheat games.


Spyros