View previous topic :: View next topic |
Author |
Message |
Novakin How do I cheat? Reputation: 0
Joined: 16 Oct 2014 Posts: 8
|
Posted: Thu Oct 16, 2014 1:58 pm Post subject: Trying to find length of pointer array |
|
|
First off, Cheat Engine is awesome . Been using it successfully the last couple of months to build a voice control program (C#) for a game.
My question: I'm trying to find the length of an array in memory, or where the array stops. It's a list of pointers to 'weapon' objects/structs of the game. In the game memory it shows up as a number of pointers directly following eachother, e.g.:
.... 88 33 92 09 A0 73 93 09 40 78 93 09 .....
which would indicate pointers to 3 weapons: 09923388, 099373A0 and 09937840.
This is all great. I have a stable multi level pointer to the start of the array and all that. The problem however, is that I don't know where it stops. The game can have anywhere from 0 to 4 active weapons. But I don't know how many the player has by looking at the memory. In the example above it could just as easily be the case that there are only 2 weapons, and that the 3rd pointer is old memory that hasn't been cleared or overwritten yet or something (I guess).
If it were always followed by something like '00 00 00 00' then that would be a simple check, but that's not the case unfortunately. Also can't seem to find a simple integer anywhere in memory with the current amount of weapons.
Any tips? I think the game is written in C++ if that matters (the game btw is FTL: Faster Than Light).
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25298 Location: The netherlands
|
Posted: Thu Oct 16, 2014 3:08 pm Post subject: |
|
|
Sometimes the length of an array is stored 4 to 8 bytes in front of where the first entry of the array starts.
Other times it is stored 4 to 8 bytes in front of the pointer that points to the first entry of the array
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Novakin How do I cheat? Reputation: 0
Joined: 16 Oct 2014 Posts: 8
|
Posted: Fri Oct 17, 2014 4:30 am Post subject: |
|
|
Many thanks for the tip, think I found something usable. Did not have length nearby but the pointer to the array was followed by another pointer that pointed to the first byte following the end of the array, with that I can substract & divide by 4 to get length.
Don't know if that second pointer is on purpose or simply the way that memory happened to be allocated, but it seems stable for now.
|
|
Back to top |
|
|
|