Memory editing

From PCSX2 Wiki
Jump to navigation Jump to search

This tutorial will outline how to use an external memory editor to create patches or (more likely) cheats for games in the emulator. This tutorial explains how to do the work yourself, but for those who would rather avoid reinventing the wheel, there is a blog here (maintained by yours truly) with values. This blog is pretty small since it only has work done by myself and anything contributed by others, so please send me any values you find using this tutorial to share with the world.

Part 1 - Setting up

Before you can begin with memory editing, you need a few things. 1. A memory editor such as ArtMoney(?) or Cheat Engine. For this tutorial, we will use Cheat Engine 6.2, but most memory editors should be the same, except for interface differences (most notably the option to freeze values). 2. PCSX2 and a game (obviously!).

Now, we need to setup our environment. This simply involves starting up PCSX2, the memory editor (I will refer to it as Cheat Engine from here, but just substitute that for whichever program you use.), and getting into the game menu. Once you are there, have the memory editor target the PCSX2 process. (In the following screenshot, I would just select the pcsx2.exe and open process

Selecting the PCSX2 process
Selecting the PCSX2 process


Now, we get on to the game. For this tutorial, I will be enabling a cheat to get infinite cash for the game Rogue Galaxy, a personal favorite game of mine.

Part 2 - Finding the Cheat's Memory Address

This is the entire process of memory editing. Most cheats actually take place in the game, and so the game must be started.[1]

1. Get to a location where the value you want can be changed. For our example, we want to get infinite cash for our party, so we should head to a store location.



2. Find the value. In this tutorial, we know the value, and we also know it's a 4-byte value[2][3] The value is 106053, so we would choose "Exact Value" scan type and "4 byte" value type, and type in the value. We would normally have the memory editor pause the game, so the value doesn't accidentally get changed (very useful when searching for a health value during combat.), and it also speeds up the search considerably. The image below shows a typical first search.

Finding the initial value, notable parts of the program highlighted.
Finding the initial value, notable parts of the program highlighted.



3. Now, we must search for the initial value. A list of addresses and values will come up in the menu on the left, and the number of matches will display in the Found: line. On my search below, I only found 7 hits, but often you will come up with thousands or even millions.

Initial search
Initial search



4. For the next step (and on until you find the right address), we change the value. For this value, we would buy or sell items to change the amount of money we have. I'm going to buy a few health potions. Once the value is changed, we enter the new amount and click "next scan"[4]



5. Now that we have only a few values left, we can keep searching (since it's only 3 here, we can search by hand) or we can do something that might be faster. In this case, searching won't yield any results, since 2 of the values are tied to the one we want. For situations like this, we need to actually edit the values by hand. To do this, we add any address we are interested in to the address table. In CE6.2, we can either double click each individual address or we can select all of them and press the red arrow button.



6. Now that all 3 of our values are in the table, we have three ways to do this:

6a. We can freeze all the values and test them by doing something to change them (such as buying an item), then unfreeze them one by one until we find the one that we want (the "master address" if you want to call it that).
6b. We can freeze each value one by one and do someting to change it to see which one is the right one
6c. We can edit each value until we find the one we want.[5]



7. Once we find the value we want, we give it a name, freeze it if we want, and optionally save the cheat totally not a cheat, but a patch to a file.



Notes:

  1. Many memory values are not written until they actually appear in the game, so always be sure you are at a part where the value is actually enabled, such as during combat. You should also be able to change the value, or you won't be able to find the right one.
  2. Almost every value will be 4 bytes, but if it isn't you may have to use the "All" value type or equivalent, unless you know what to look for.
  3. Also, if you do not know the value, there is a slightly different process which will be discussed later in this tutorial
  4. Often, at this stage with only a handful of values, we can just find the rght one by eye, but for the sake of covering many possibilities, we will assume there were one million initial values.
  5. I cannot add images for each of these, so you'll have to figure this part out on your own, or wait until someone makes a video to place here... Or you can make the video yourself.