Scanning for arrays

You can find tutorials and ask questions about memory editing here. You may also post any game-specific information you find (ie. cheat tables or addresses).
Post Reply
Message
Author
Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Scanning for arrays

#1 Post by Exempt » Sat Feb 20, 2010 9:51 am

Is there any chance of a short array scan tutorial?

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Scanning for arrays

#2 Post by Administrator » Sat Feb 20, 2010 2:46 pm

You don't scan for arrays. You find one address that resides in an array, then check out nearby memory until you find the bounds of the array. For example, if you have an array that describes the number of each item in your inventory (0 to 99), you could find the number of HP potions you have then check nearby memory for values that do not fit this pattern (ie. a value of 255 would be invalid, so it must not be part of the array). Once you've found the start (or end) you can sometimes apply a bit of math to find the bounds. That is, if you know the array holds 100 values, and it starts at 0x00800000, then it must end by 0x00800099.

More often than not nowadays, games are going to use variable-sized containers such as vectors or lists. Most game companies implement their own code for these, so there is no one-size-fits-all code for navigating these lists. They may or not be sequential in memory, and so may not follow the same rules listed above for arrays.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Scanning for arrays

#3 Post by Exempt » Sat Feb 20, 2010 10:45 pm

Ok, so asuming i find every element of my inventory array what would be the best way to accually turn all the memory addresses into a single list in my script?

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Scanning for arrays

#4 Post by Administrator » Sat Feb 20, 2010 11:57 pm

You only need the address to the first entry. Arrays are sequential, so you can assume the address of the next entry. +0x0 is the first entry (obviously), +4 (or whichever size of data you're working with) would be second, +8 would be 3rd, etc.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Scanning for arrays

#5 Post by Exempt » Sun Feb 21, 2010 9:00 am

Ok, I have my first slot found but how would i go about storing the other 19 values to a table in my script? It's 4 byte.

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Scanning for arrays

#6 Post by Administrator » Sun Feb 21, 2010 6:42 pm

Iterate through all 20 and copy the values to a table.

Code: Select all

for i = 1,20 do
  myTab[i] = memoryReadInt(proc, someAddress + (i-1)*4);
end

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests