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 


Search all possible values/address from an offset

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

Joined: 08 Apr 2022
Posts: 1

PostPosted: Fri Apr 08, 2022 2:26 pm    Post subject: Search all possible values/address from an offset Reply with quote

Hello everyone! I am a little new with cheat engine, so maybe this have a really simple solution that I am just unable to see, will try my best to explain my current problem.

I have a "Base pointer", it is: [[[$process+Add1]+Offset1]+Offset2]

So with that in mind, lets suppose [[[$process+Add1]+Offset1]+Offset2+4] gives me Monster8 as a result.

I want Monster500 and I already know it is on [[[$process+Add1]+Offset1]+Offset2+914]

As you can see, the offset is not correlative with the monster number, so if I want for example monster1, I will not get it in the first offset, it can totally be on the +1k, I don't know.

Surely I can search for it manually and checking every single value every 4 bytes, that will take some time, but can totally be done, but what if need to do that 50 times? it becomes an exponential time waste

My idea is: It is possible to do an array or a table of EVERY value? From [[[$process+Add1]+Offset1]+Offset2+4] to [[[$process+Add1]+Offset1]+Offset2+40000] and at the same time filters only the results of every +4 bytes, so it will look like:

Code:
Search 1: Blabla+4 =  Monster8 -> Extracted offset = 4
Search 2: Blabla+8 =  Monster3912 -> Extracted offset = 8
Search 3: Blabla+C =  Monster32 -> Extracted offset = C
...
Search 10000: Blabla+40000 = Monster200 -> Extracted offset = 40000


So I can search my specific value/address and extract the offset from it, I am not 100% sure, but I think it can be done in lua, so I want to ask if someone did something similar in the past that can give me a hint on how to proceed.

I already tried by Structure dissect, but unless I am missing something, it will not filter by every +4 and also the address are not necessarily in order, so Monster2 can be really away from monster1 in terms of address.

In other words, I know the value and the address of every monster of the list, but I don't know the offsets, only the base pointer and I need a way to make a custom "search" that will give me offsets as a result, pointer scan would be time consuming same as doing +4 manually because I need to collect a lot of them, probably more than 100, as I am making a program where the end-user can choose a specific monster from a list.

Thank you in advance!

EDIT: Finally found a way to make this, I was struggling with the lua outputs as they for some weird reason automatically converts hex to dec, so I made this solution:

Code:

Offset1 = 'CENSOREDOFFSET'
Offset1Add = 0x4
c = 1

repeat
CurrentAddress = '[[$process+CENSOREDADDRESS]+' .. Offset1 .. ' +' .. string.format('0x%x', Offset1Add) .. ']'
print(readString(CurrentAddress, 50, false),' = ' .. string.format('0x%x', Offset1Add) .. '')
Offset1Add = Offset1Add + 0x4
c = c + 1
until c == 101


As output I get:
MonsterName = Offset where it is located

I censored the address from the game I am playing, but that should be irrelevant for the reader, I will leave the code here in case anyone want to use it for similar reasons, keep in mind I am using it with readstring, but you can do readbytes or whatever you want, also maybe this is a rustic solution, but at least it works Razz I stored the first offset as a string and the loop addition as an int, that's kinda weird, but as lua have the bad behavior of automatically converting hex to dec, they kinda f..up the offsets if you try to use them as hex.
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