Skip to content

AddAddress Flag

AddAddress modifies the memory address(es) of the following condition by the calculated value. It works similar to AddSource, but modifies the address, not the resulting value. Additionally, it affects addresses on both sides of the condition.

AddAddress only affects the next condition. If multiple AddAddress lines are chained together, each lookup in the chain will be altered; the values won't all be added to the final lookup.

image

The 32-bit value at 0x0112F8 is a pointer to the data for the first character in the party. When the party order changes, the pointer will point at a different block of memory, but data within the block will have the same structure.

  • The value is an address in the actual system representation and differs from the addresses provided by the memory inspector. However, you can rely on the fact that the memory inspector represents the same memory, so while the actual address may differ, the sequence of bytes does not.

To translate the real pointer to a memory inspector address, we compare the two values. For example:

  • The 32-bit value at 0x0112F8 is 0x800110B8.
  • The memory we're interested in is at 0x011114 in the memory inspector.
  • Using a 24-bit read instead of a 32-bit read gives us 0x0110B8
  • 0x011114 - 0x0110B8 = 0x00005C, so that becomes the "base address" in the second condition.

Types of Pointerslink

AddAddress is how RAIntegration handles pointers. There are four major types of pointer support:

Direct Pointer: The pointer contains another address that is referenced without modification. These are most commonly used for string pointers. To use a direct pointer, the base address to which the pointer is added would be 0.

Indirect Pointer: The pointer contains another address that indicates the start of some block of data. The data of interest is a fixed number of bytes into the block of data. These are commonly used for attributes of a character/object.

For both Direct and Indirect Pointers, the AddAddress line should reference the pointer, and the address in the following line should be the offset into the block of data for the information relevant to the condition. While you would typically use 0 for a Direct Pointers, the following line would also contain any value necessary to convert between a real address and a memory inspector address.

The example above is an Indirect Pointer, where the data is 0x5C bytes into a block of data. The conversion from a real address to a memory inspector address is handled by using a 24-bit read instead of a 32-bit read.

Array Index: The pointer contains an offset to apply to a fixed pointer.

Scaled Array Index: The pointer contains an offset to apply to a fixed pointer after it has been scaled.

For Array Indices, the AddAddress line should reference the offset to apply, and the following line should contain the address of the first element of the array (index 0). For example:

AddAddress 16-bit Mem 0x1234
           8-bit  Mem 0x4567

Would read a 16-bit number from 0x1234 and read the single byte that is that many bytes after 0x4567.

NOTE: Scaling an array index is not currently supported. The intent is that the first line would become AddAddress 16-bit Mem 0x1234 * 4 to indicate that each time 0x1234 is incremented by 1, the offset past 0x4567 would be incremented by 4. Attempting to call AddAddress four times to simulate the multiplication won't work because each line of the chain is a separate lookup.

Chaining Pointerslink

AddAddress can be chained to perform multi-step lookups, but only one step at a time. As such, you can reference data pointed at by a pointer that's pointed at by another pointer, but you can't reference data in an array that's pointed at by another pointer unless either the array or the array index is at a fixed address.

Changeloglink

Last 10 changes on this page:

  • [2019-11-17 22:18] meleu: fix markdown formats
  • [2019-11-16 07:53] Jamiras: Updated AddAddress Flag (markdown)
  • [2019-11-14 20:25] Jamiras: Created AddAddress Flag (markdown)