Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Trying to find length of pointer array

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Novakin
How do I cheat?
Reputation: 0

Joined: 16 Oct 2014
Posts: 8

PostPosted: Thu Oct 16, 2014 1:58 pm    Post subject: Trying to find length of pointer array Reply with quote

First off, Cheat Engine is awesome Smile. 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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Thu Oct 16, 2014 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Novakin
How do I cheat?
Reputation: 0

Joined: 16 Oct 2014
Posts: 8

PostPosted: Fri Oct 17, 2014 4:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites