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 


How to visualize multilevel pointers from a dev perspective?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
h3x1c
Master Cheater
Reputation: 17

Joined: 27 Apr 2013
Posts: 306

PostPosted: Thu Jul 14, 2016 4:14 pm    Post subject: How to visualize multilevel pointers from a dev perspective? Reply with quote

Since my education thus far has come primarily from the angle of reverse-engineering, I'm trying to find some good explanations/analogies/cases to visualize multilevel pointers from a forward-engineering perspective.

For instance, I understand creating a pointer for variables that won't be known until runtime, but why point to a pointer? Also, when pointer-scanning and you find a base address that's, say, 10 levels deep or something crazy like that, what on earth would that look like from the perspective of the source code? A pointer pointing to a pointer pointing to a pointer pointing to a pointer pointing to a pointer, etc. Is this just something the compiler ends up doing with what is actually a much more simplistic bit of high-level source code?

Last of note, when you find your way to multiple base addresses that will all persist in a cheat table across restarts of a game, why are there so many addresses redundantly holding the same data (or references to the same data)? Is there really only one ACTUAL base address where that information is stored? Is it just one location in physical RAM, but there are multiple virtual addresses pointing to it?

I understand physical/virtual/mapped memory, stack/heap/global/data/etc., what allocating memory for a single-level/multilevel pointer in C looks like, and the purpose of single-level pointers, but I'm just having a rough time envisioning multilevel pointers from a forward-engineering perspective.

Thanks for any explanations/videos/links/images/etc. you might have to help clear it up! Very Happy

_________________
Back to top
View user's profile Send private message Visit poster's website
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Jul 14, 2016 5:01 pm    Post subject: Reply with quote

Code:
class GameConstants {
  static GameSettings settings;
}
class GameSettings {
  CurrentLevel level;
}
class CurrentLevel {
  Unit[] units;
}
class Unit {
  Statistics stats;
}
class Statistics {
  float health;
}
[[[[GameConstants.settings]+GameSettings.level]+CurrentLevel.units[0]]+Unit.stats]+Statistics.health
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Jul 14, 2016 5:14 pm    Post subject: Reply with quote

what Zanzer said

as for redundancy, it's a matter of performance, debugging, and knowledge of the other parts of the engine.

for example:
a game engine may store it's last created object on a static address so that when it crashes, it can query information about it.

But the game developer may only get a pointer to the game object. And for speed reasons he stored it in a static location. This already causes two duplicate pointers

Also, sometimes there are objects that point to eachother or related object. E.g the class Unit might have a pointer to CurrentLevel, and the GUI may have a pointer to the selected Unit, and the Game may have a static address to the GUI

so, by getting the GUI object, you can get to the Unit Object, then go to the Current Level, and then get Unit[0], which is likely the player (and then go to the stats)

_________________
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
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 14, 2016 5:46 pm    Post subject: Reply with quote

In C++, it is common to see something like this (below from Unreal Engine):
Code:
World->DefaultPhysicsVolume->FluidFriction = 35.0;



Quote:
to visualize multilevel pointers from a forward-engineering perspective

You can play with Unreal Engine and see how one object has reference to another object. And that object has reference to another, and so on...

_________________
Back to top
View user's profile Send private message MSN Messenger
h3x1c
Master Cheater
Reputation: 17

Joined: 27 Apr 2013
Posts: 306

PostPosted: Thu Jul 14, 2016 7:14 pm    Post subject: Reply with quote

Awesome stuff, you guys. Thank you so much for the replies; that all really helped things click for me! Seeing that example looks like things I've certainly seen before, but I was missing the ability to visualize the code being chained together via pointers to that extent.

Again, thanks for the answers. Very Happy

_________________
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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