Memory Inspector Overview
Here is an overview of the Memory Inspector and its features. This tool can be found on "RetroAchievements" menu on any emulator integrated with RA.
See also: Memory Digging Tips.
Memory Inspector Dialoglink
1. New Searchlink
This is the first thing you must do when you're looking for something in memory.
The first drop down allows you to quick select All memory, System RAM, or Cartridge RAM. The field below the first drop down lets you type in a custom range (i.e. 0x10000-0x100FF).
The second drop down specifies the size of the data you're interested in finding.
Reset button clears out any previously captured results (part 3 of the dialog) and captures the current memory state.
Filters the memory state in an attempt to locate a specific memory address.
The first drop down allows you to specify the comparison to use. The second drop down is what you're comparing against. Most of the time you're going to be filtering on
!= Last Value, which eliminates any results where the memory has changed.
The available comparisons are:
Constant - comparison is made against the value entered in the field below the drop down.
Last Value - comparison is made against the value captured by the last applied filter, or the initial value if no filter has been applied
Last Value Plus - comparison is made against the Last Value plus the value entered in the field below the drop down. If the value were 3, the comparison would me made against a number which is three higher than the Last Value for each value captured by the last applied filter.
Last Value Minus - the same as Last Value Plus, except the value entered in the field below the drop down is subtracted from each value captured by the last applied filter.
Initial Value - comparison is made against the value captured when the New Search was begun.
Filter Once button immediately applies the selected filter and updates the Results.
Continuous Filter button applies the selected filter repeatedly until stopped. The fewer the results, the more frequently the filter is applied. The filter is only applied once every N ms, where N is the number of results / 1000. If there are less than 1000 results, it's applied every frame. If there are 50000 results, it's applied every 500ms (twice a second). If there are 1000000 results, it's only applied every 10 seconds.
As filtering is applied, the list of potential matches will appear here.
On the left side is information about the results, including the number of matches, the filter applied, and how many filters have been applied. If you believe you have applied a filter incorrectly, or the filter results in no matches, you can use the
<< button to return to the previous set of results. You can do this all the way back to the initial results. Similarly, you can use the
>> button to return to results you have backed out of. Once you apply a new filter, the forward filters are discarded and the
>> button is disabled.
Below the result information are two buttons. The first allows you to manually remove the selected items from the result set. You can use Ctrl and Shift to select multiple items. The second lets you create a bookmark for an item in the result set. It will appear in the Bookmarks dialog.
The items in the result set show the address of the match, the current value, and a brief description of the memory at the address. If a code note exists for the address, it will be shown. Otherwise, a general classification of the address will be shown.
Additionally, items in the result set can be colored. Red - the item does not currently match the filter Grey - the item does currently match the filter, but at some point since the filter was applied it did not match. Green - the item is bookmarked Blue - the item has a code note
Clicking on a row will set the selected address to the associated item.
4. Code Noteslink
Provides detailed information about the selected address, and allows the user to annotate addresses found by the search process. Try to keep your descriptions simple and clear, so they can be easily understood. Clear notes are important for debugging if a problem with an achievement occurs.
The text field shows the currently selected address from the memory view (part 5 of the dialog). You can manually type in any address, or use the up and down arrows to jump to the next or previous address that have a code note.
Just to the right of the text field is a button that opens the Code Notes dialog, which allows you to browse and search through the code notes.
Below the text field is a button that will create a bookmark from the selected address.
The large text area is where you can modify the code note for the selected address. NOTE: the changes are not saved unless you press the Save Note button. If you change the selected address without saving, the changes will be lost.
Save Note and
Delete immediately attempt to update the server - either with the modified note text, or by clearing out the note text.
5. Memory Viewlink
Allows direct browsing of the memory. The memory updates once per frame as the emulator runs.
The currently selected address appears in red. Addresses with code notes show up blue, and addresses associated to bookmarks show up green.
You can click on any piece of data in the memory viewer to jump to the associated address. You can also use the keyboard to navigation around in memory (up/down/left/right/pgup/pgdn/home/end).
When the memory viewer is focused, a cursor will be visible. You can type any hexadecimal character to change the character at the cursor to another value. This immediately changes the value for the emulator, and may cause unexpected behavior, so use at your own risk. Additionally, modifying memory (through any of the tools) prevents achievements from being unlocked on the server as an anti-cheat mechanism.
You can open the Memory Bookmarks dialog from the RetroAchievements menu. It will also automatically open when adding a bookmark from either of the buttons on the Memory Inspector dialog.
With this, you can view multiple designated addresses at once instead of having to shuffle around in the Inspector. Bookmarked addresses will show in the Memory Inspector as green.
If you double-click on an address, you can move straight to that address in the Memory Inspector.
The bookmarks can be renamed by clicking their description. This does not update the code note for the associated address.
You can change the size or format of a bookmark by clicking on the field and selecting a new value from the dropdown. Clicking on the value field will allow you to enter a new value for the bookmark. It will automatically be written to the memory.
From here you can also Freeze any bookmarks. This is helpful for things like health or consumables. Keep in mind, freezing occurs 1 frame after gameplay. This means that even when frozen, the value will change for at least one frame before returning to the frozen value. Frozen bookmarks will be displayed as yellow.
Reading data in the Memory Viewerlink
Decimal, Binary and Hexadecimal notationslink
To work well with the Memory Viewer, it's important to understand at least the basics of binary and hexadecimal numeral notations. Here are good sources of information about this matter without going into extreme details:
The digits used in binary system are
1. A binary digit is also known as bit. Eight bits is also known as one byte.
The digits used in hexadecimal system are
F. The hexadecimal notation is also known as hex.
The main reasons for the existence of these 2 notations, besides the traditional decimal notation, are:
- Decimal notation is what humans understand.
- Binary notation is what computers "understand".
- Hexadecimal notation can be seen as a middle ground between binary and decimal. Because a single hexadecimal digit represents 4 bits, then a shorter and more understandable notation for humans to work in a way that the computer "understands".
The table below shows the different notations for equivalent values.
More facts about the different number notations:
- To indicate a value is written in hexadecimal, the prefix
0x10 = 16,
10 = 10.
- Two hex digits represent 8 bits and can range from
- Four hex digits represent 16 bits and can range
- Eight hex digits represent 32 bits and can range from
Memory Viewer modeslink
The bottom part of the Memory Inspector is what we call the Memory Viewer:
You can see data in Memory Viewer using 8, 16 or 32-bit modes.
By default, the Memory Viewer shows data in 8-bit mode. This displays each byte of memory as a separate two-character hexadecimal value. And each byte has its own address.
Sixteen bytes are shown per line. The address of a byte can be determined by adding the row index (displayed to the left of the viewer) to the column index (displayed above the viewer). Using the image above as an example, the cursor is at
Before we talk about 16-bit mode and 32-bit mode, it's important to know about endianness:
Endianness describes the order in which a sequence of bytes are stored in computer systems memory. The two most common types are: Big-Endian (also known as BE) and Little-Endian (also known as LE).
In the Big-Endian order the "big end" of the number (most significant value in the sequence) is stored first (placed at the lowest address). In the image below you see the number
0x12345678stored at the address
0x100in the big-endian order. Notice that the most significant byte
0x12is at the address
In the Little-Endian order the "little end" of the number (least significant value in the sequence) is stored first. In the image below you see the number
0x12345678stored at the address
0x100in the little-endian order. Notice that the least significant byte
0x78is at the address
Values that need more then 8-bits (in other words: larger than 255) have to be stored in multiple bytes. However, the emulated systems we use store multi-byte values in little-endian order.
In the image of the Memory Viewer above you can see that at address
0x0002c0 we have the hex value
ce and in
0x0002c1 the value is
39. When you switch the viewer to 16-bit mode, the
39 values are grouped at
0x0002c0 and get displayed as
39ce. This happens because it automatically groups every two bytes and displays them as 16-bit hex values.
NOTE: While 16-bit values are usually aligned to even addresses, that's not always the case. There's actually a non-displayed 16-bit value at
0x0002c1. Since the value at
39 and the value at
29, the 16-bit value at
0x0002c1 address is
Similarly, in 32-bit mode, the four bytes from
0x0002c3 are displayed as a single 32-bit value
0x252939ce at address
0x0002c0, but there are also 32-bit values at
Working with sizes smaller than 8-bitlink
In addition to the 8-bit, 16-bit and 32-bit sizes described above, there are additional sizes that can be used when writing achievements (in the Achievement Editor).
In the memory viewer when an 8-bit address is selected you will see something like the image below (in the image: a byte with the value
6f is selected; the bits are highlighted with an orange circle):
It is very common in games to store important information as a single bit. As a bit can only have two possible values (
0), sometimes it's used to mean "yes" or "no", "on" or "off", "have item" or "no item", etc. Some games, specially those with limited memory space, use bit switches a lot.
Important: You can refer to each one of those bits individually in the Achievement Editor.
Common meaning of bit switches in a game memory:
- have an item
- button pressed (very common)
- area explored
- in game trigger activated
- cheat activated
- in demo mode
In the memory viewer you can only input hex values, then it's important to know equivalence of values between hex and binary notations. You can see the table in the "Decimal, Binary and Hexadecimal notations" section, but the usual is to use a calculator (the default calculator on MS Windows on the programmer view can do the job).
Upper4 and Lower4link
Upper4 is the upper four bits of a byte (bit: 7, 6, 5, 4), displayed as a single hexadecimal character. Lower4 is the lower four bits of a byte (bit: 3, 2, 1, 0), displayed as a single hexadecimal character.
Looking at the memory size diagram below, a byte at address
0x00a274 is selected (value
0x23). The first character,
2 is the Upper4 value. The second character
3 is the Lower4 value.
Occasionally you will only be interested working with a single hexadecimal digit. Using the memory size diagram as an example, an achievement condition where
Upper4 0x00a274 = 0x2 would be true. A condition where
Lower4 0x00a274 = 0x3 would be true.
Memory Sizes diagramlink
Last 10 changes on this page:
[2020-06-11 07:34] Jamiras:add details about Continuous Filter backoff algorithm
[2020-05-17 21:48] Jamiras:update for new memory inspector dialog
[2019-03-14 00:37] Keltron3030:Updated Memory Inspector Overview (markdown)
[2019-03-14 00:35] Keltron3030:Added some additional info to memory viewer features as requested by Jr developer.
[2019-02-14 21:56] meleu:bitfields image
[2019-02-14 21:45] meleu:test2
[2019-02-14 21:44] meleu:test
[2019-02-12 08:50] meleu:removed "bit switch" title, as unnecessary
[2019-02-12 08:48] meleu:reducing verbosity in "single bits"
[2019-02-12 08:14] meleu:fix broken links