 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
apemanzilla How do I cheat?
Reputation: 0
Joined: 24 Feb 2016 Posts: 8
|
Posted: Fri Feb 26, 2016 10:40 am Post subject: Reading integers from an array? |
|
|
I've been working on a hack for a game I play, and I've run into a slight issue. I can track down pointers/addresses of the values I need reliably, except for one value, which is stored in an array of 32-bit integers. (4 bytes) The length of the array and the specific index of the array I need change, but I can get those too. I can't figure out how to read data from an index of an array though. For example:
I can get the address of the array I need, and the index I need, by following some pointers from the Mono dissector. Let's say I need index 5 of an integer array that starts at address 01234567. I know that the array contains 10 values - is there a way to read the 4 byte value of index 5 from the array?
I've done some searching on Google, but I've found a lot of results about AOB scans and none related to this question.
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 961
|
Posted: Fri Feb 26, 2016 11:52 am Post subject: |
|
|
I've a look at how mono assembler 32bit code handle list/array type, these my understanding (may be wrong),
| Code: |
32bit
for array: TypeName[]
base+0xc -> count/array length
base+idx*size+0x10 -> element @ idx
for list: List<TypeName>
base+0xc -> count/list length
base+0x8 -> buffer address,buff
buff+0xc -> buffer count/capacity, note, capacity can be larger than list length
buff+idx*size+0x10 -> element @ idx
|
If the element is a small struct, they may store by value (not pointer), for example, Vector3 will be store as 3 consecutive float, so the size will be 12.
The difference of list and array may be that list allow dynamic grow its capacity/length, while array length/capacity is fixed.
Try check how the assembler code handle the data, this will be most accurate.
ADDED:
for idx 5 element of Int32[] array, in ce pointer form should be:
| Code: | [base+24] // +5(idx)*4(size)+10 = +24
lua: readInteger('base+24') |
for List<Int32>, in ce pointer form should be:
| Code: | [[base+08]+24]
lua: readInteger('[base+08]+24') |
_________________
- Retarded. |
|
| Back to top |
|
 |
apemanzilla How do I cheat?
Reputation: 0
Joined: 24 Feb 2016 Posts: 8
|
Posted: Fri Feb 26, 2016 12:24 pm Post subject: |
|
|
| panraven wrote: | I've a look at how mono assembler 32bit code handle list/array type, these my understanding (may be wrong),
| Code: |
32bit
for array: TypeName[]
base+0xc -> count/array length
base+idx*size+0x10 -> element @ idx
for list: List<TypeName>
base+0xc -> count/list length
base+0x8 -> buffer address,buff
buff+0xc -> buffer count/capacity, note, capacity can be larger than list length
buff+idx*size+0x10 -> element @ idx
|
If the element is a small struct, they may store by value (not pointer), for example, Vector3 will be store as 3 consecutive float, so the size will be 12.
The difference of list and array may be that list allow dynamic grow its capacity/length, while array length/capacity is fixed.
Try check how the assembler code handle the data, this will be most accurate.
ADDED:
for idx 5 element of Int32[] array, in ce pointer form should be:
| Code: | [base+24] // +5(idx)*4(size)+10 = +24
lua: readInteger('base+24') |
for List<Int32>, in ce pointer form should be:
| Code: | [[base+08]+24]
lua: readInteger('[base+08]+24') |
|
Alright, thanks - right now I'm only interested in arrays of primitives. I'll try your solution once I get a chance.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|