 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
SkeeLo How do I cheat?
Reputation: 0
Joined: 13 Feb 2016 Posts: 6
|
Posted: Sun Feb 14, 2016 5:02 am Post subject: Witcher 3 and general hacking questions |
|
|
I'm trying to learn CE and game hacking in general and have a few questions, they're mostly general questions but my examples pertain to Witcher 3 since that is the game I'm using to learn with.
Question 1:
Is it normal that you can't find any pointers at all for some things in games?
Because I cannot find any pointers for Stamina at all using any of the methods outlined in all the guides.
I've also done ridiculous amounts of pointer scanning with different offset amount and levels and it always returns a blank page a few re-scans in if not immediately, despite having hundreds of thousands "potential" pointers left before that happens.
Question 2:
I cannot find the Health address at all by scanning for it, neither by scanning for float values (exact, values between, increase/decrease etc none works and I know it's a float) nor if I scan for the exact address (I know it due to Zanzer's table). I can add it manually though. What gives?
Question 3:
I finally got to the Stamina address (persistent I mean, finding the current address is easy) via AOBScan instead of pointer and noticed that when I commented the code out in the injection it also affected the Health, Enemy Health etc.
I figured it must be a structure and did a dissect as per the tutorial I read before but I didn't know what to look for and this is where I got stuck on my own.
I then looked at Zanzer's table (noticed he used the same AOBScan, high-fived myself for that) and spent a few hours trying to understand what was going on since I've never looked at this stuff before.
Well, I finally understand most of it but I have no idea how to get there on my own and that's what I'm hoping someone can help me with.
I noticed he had a label called player_ptr and so I went looking for this address and found it by checking the Stamina instruction and looking at what it accesses, but I never would have been able to draw the conclusion here on my own since a) it displays Health so I wouldn't have understood that it was the "base" for the whole structure and b) it by default shows the value as byte so there's no way I would have known it even displays Health in the first place, since it wouldn't have occurred to me to change it to float.
So how do you even get there from the Stamina address logically?
Question 4:
Building on the last question, how do you in general find things within structures like this?
This is one example of how adding 8 offset gets you a function that holds a value that represents resource type (if I understand it correctly) and stamina is represented by 2. I can't even begin to grasp right now how I would ever figure that out on my own.
| Code: | | cmp dword ptr [rax+2C],8 |
This I assume is probably checking something pertaining to player (if the input is for player specifically maybe?) since Zanzer has it before he checks for Health etc and if I don't have it in my code before everything the enemies become invincible.
He also compares the same address with 3 before jumping into a label called is_npc (which I don't understand the top half of), so I can assume what it does but I have no idea how to arrive at that conclusion logically. How did it even occur to him/anyone to look at that offset and check for what it does? How do you even check for it? What does 8 and 3 mean in this context and how do you arrive there logically?
In other words; what do I need to look up to learn about this, are there any other advanced methods etc that I need to understand to proceed with this stuff?
I apologize for the wall of text, I just really want to learn and understand.
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Feb 14, 2016 8:26 am Post subject: |
|
|
Depending on how the game handles its structures, pointer scans may be difficult to find.
That is why I stick to code injection to retrieve my base pointers.
Health was actually quite easy to find, considering you can see the exact Vitality amount.
One thing you need to know is that it is normally always a float type and the display value is often rounded.
So if the game shows you have 3000 vitality, you need to do a float search between 2999 and 3001.
The instruction that writes to stamina/health is: movss [rax+rcx*4],xmm6
You use that to determine the base. RAX contains the base while RCX*4 positions the pointer to values within that structure.
So then you noticed that changing this instruction effects enemies too.
Well that's no good, so we must find some way to filter when it's the player structure.
Specifically for Witcher 3, you can look within the base structure and identify a pattern.
You have two floats followed by a 4-byte integer. So the floats were easy to identify.
Current health/max health. Current stamina/max stamina. Etc.
So now what could that 4-byte integer represent?
So, you find a few enemies and see what values their structures contain.
Well, you can see that enemy health is always followed by a 0.
Oh wait, some enemies have a value of 1 after their health.
Well what gives?! What's so special about these enemies?
Hang on a second! Enemies with a 1 are magical beasts.
Witcher contains two weapon types that effect mundane and magical creatures differently!
The 0/1 must be used by the game to determine which damage type effects their health.
Okay, this conclusion may have been harder to come by...
But you can clearly see that stamina is always followed by a 2 for player and NPC.
So anyway, continue looking at what values the player has that NPCs don't have.
Well, toxicity seems like a good stat. Why would the game waste time tracking toxicity on each monster?
Good news. They don't! Well, the 4-byte integer after current/max toxicity is a 3.
So all I need to do is check if the current structure contains toxicity to determine that it is the player.
| Code: | cmp dword ptr [rax+20],3
jne is_npc |
The value 8 which you listed actually deals with the horse.
I do believe 8 is the ID for the Horse Fear stat.
Well now, only the horse should have a Horse Fear stat...
So that compare just gives the horse unlimited everything.
|
|
| Back to top |
|
 |
SkeeLo How do I cheat?
Reputation: 0
Joined: 13 Feb 2016 Posts: 6
|
Posted: Sun Feb 14, 2016 2:52 pm Post subject: |
|
|
| Zanzer wrote: | Depending on how the game handles its structures, pointer scans may be difficult to find.
That is why I stick to code injection to retrieve my base pointers. |
Good to know, after hours of trying I was beginning to question my sanity.
| Zanzer wrote: | Health was actually quite easy to find, considering you can see the exact Vitality amount.
One thing you need to know is that it is normally always a float type and the display value is often rounded.
So if the game shows you have 3000 vitality, you need to do a float search between 2999 and 3001. |
I had a complete brainfart and started the search off with "exact value" because the health was at max value and then from there did the "between value" search due to it being a float value. I'm a doofus.
| Zanzer wrote: | The instruction that writes to stamina/health is: movss [rax+rcx*4],xmm6
You use that to determine the base. RAX contains the base while RCX*4 positions the pointer to values within that structure. |
Is this a common way structures are, well, structured?
I mean when you first came upon this instruction "movss [rax+rcx*4],xmm6" was it immediately obvious to you that it worked as you described above?
Maybe it would have been more clear to me had I been able to find Health last night, maybe I would have noticed it's address and RAX are the same and that the same instruction accesses it and thus put two and two together, I don't know.
I understand how this works now but as you can tell I'm trying to wrap my head around how to arrive there without help as I assume I will run into these things again in the future (maybe even within Witcher 3?).
| Zanzer wrote: | Specifically for Witcher 3, you can look within the base structure and identify a pattern.
You have two floats followed by a 4-byte integer. So the floats were easy to identify. |
That's not what the structure looks like to me which is part of why it didn't make any sense when I initially looked at it.
When I look at it right now Health at 0 offset is indeed a float, but Max Health is a Byte and I have to change it to Float for its value to become meaningful. In fact the next 4 offsets (4-7) are Byte.
And then at offset 8 I have the 4-Byte integer that is 0 for Health.
Stamina and Max Stamina are both Floats which is why I found them last night and they made sense to me and they are indeed followed by that 4-Byte integer.
But then Toxicity right after that is also a 4-Byte integer that I have to change to Float manually for it to make sense.
After Max Toxicity its "toxicity type" is also a Float instead of a 4-Byte integer.
So as you can see that pattern isn't immediately obvious, at least not to me, which eats away at me because why would it ever occur to me to start changing these value types around on my own?
| Zanzer wrote: | So, you find a few enemies and see what values their structures contain.
Well, you can see that enemy health is always followed by a 0.
Oh wait, some enemies have a value of 1 after their health.
Well what gives?! What's so special about these enemies?
Hang on a second! Enemies with a 1 are magical beasts.
Witcher contains two weapon types that effect mundane and magical creatures differently!
The 0/1 must be used by the game to determine which damage type effects their health.
Okay, this conclusion may have been harder to come by...
But you can clearly see that stamina is always followed by a 2 for player and NPC.
So anyway, continue looking at what values the player has that NPCs don't have.
Well, toxicity seems like a good stat. Why would the game waste time tracking toxicity on each monster?
Good news. They don't! Well, the 4-byte integer after current/max toxicity is a 3.
So all I need to do is check if the current structure contains toxicity to determine that it is the player. |
Thank you for explaining all this, I obviously never got this far on my own but having you lay out your thought process is extremely helpful.
| Zanzer wrote: | The value 8 which you listed actually deals with the horse.
I do believe 8 is the ID for the Horse Fear stat.
Well now, only the horse should have a Horse Fear stat...
So that compare just gives the horse unlimited everything. |
Well this explains why "weird" things happened when I used it as a check to see if it was player. /facepalm
Thank you for taking the time to answer my questions I very much appreciate it, it was incredibly helpful! You're a rockstar, mate!
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Feb 14, 2016 5:33 pm Post subject: |
|
|
The structure spider is a nice tool, but I don't tend to use it. It often guesses address types wrong.
First thing I always do after finding health or stamina is browse the memory region around that address.
So you would have set the Memory Viewer type to Float and instantly noticed maximum health right after health.
From there, you would've seen several other floats and it's quite normal that stamina/mana and other stats are around health.
So from there you would have seen all of the stats related to the player and assumed the structure base is around there.
The format of this instruction is quite normal, yes.
You start with a base and then add an offset to it.
In this case, the offset is equal to an index value times 4.
This structure is being treated like an array.
Most games use floats or 4-byte integers, so you will normally see it multiply by 4.
So if the index is 0 and you multiply by 4, you get 0. This is the offset for the first item in the array (current health).
Another format you may see is [rax+rcx*4+100]
For this, you are again dealing with an array, but this array starts 0x100 bytes after the base structure address.
Of course, you'll still likely want to grab the base address (RAX in this case).
|
|
| Back to top |
|
 |
SkeeLo How do I cheat?
Reputation: 0
Joined: 13 Feb 2016 Posts: 6
|
Posted: Sun Feb 14, 2016 7:48 pm Post subject: |
|
|
You, sir, are a gentleman and a scholar!
I didn't use the structure spider myself I just did dissect data/structures under tools as I saw this in a tutorial and that's where the information is guessed wrong by CE I assume and thus confused me.
As you can see in the attached picture of the player structure both Health and Max Health as well as some other values are the wrong value type (Toxicity at 0018 for example is 4-Byte).
Am I going about this the wrong way?
Or is it perhaps a case of I would have been able to notice that the value type was wrong if I had more experience with this?
I mean I understand these values now after having looked at your code and with the help you've provided here in this thread, so it's all pretty much crystal clear now in terms of what it does.
I'm just trying to "backtrack" as if I had not looked at your code nor received your help and see if I can understand the logical steps to find this information on my own.
| Description: |
|
| Filesize: |
146.42 KB |
| Viewed: |
18710 Time(s) |

|
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Feb 14, 2016 8:50 pm Post subject: |
|
|
After finding health, I would simply right-click the address and select Browse this memory region.
This would open up the Memory Viewer to that address.
Since the address is a float, you would right-click in the bottom and select Display Type > Float.
Now you can see the various float values for the addresses in the same general area.
All of the 0.00 values are likely non-float values. So for them, I would switch to 4-byte decimal and see the values they have.
Toss in some trial and error by changing values and seeing what effect it has in-game.
| Description: |
|
| Filesize: |
53.51 KB |
| Viewed: |
18705 Time(s) |

|
|
|
| Back to top |
|
 |
SkeeLo How do I cheat?
Reputation: 0
Joined: 13 Feb 2016 Posts: 6
|
Posted: Sun Feb 14, 2016 9:05 pm Post subject: |
|
|
Beautiful!
I cannot express my gratitude enough, thank you for all your help Zanzer!
|
|
| 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
|
|