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 


Adding two registered symbols in a cheat table as an address
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
markheloking
Cheater
Reputation: 2

Joined: 21 Nov 2009
Posts: 35

PostPosted: Thu Jan 14, 2016 2:32 pm    Post subject: Reply with quote

Thank you very much. +rep for that solution right there.
Back to top
View user's profile Send private message
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 Jan 14, 2016 4:12 pm    Post subject: This post has 1 review(s) Reply with quote

Next revision of my previous script adds support for those:

- [sym1+100]+[sym2]*[sym3]

- [sym1+sym4*10]+[sym2]*[sym3]



and nested pointers, i.e. pointer used as offset (or base) for another pointer:

- [sym1+[sym4]*10]+[sym2]*[sym3]

- [[sym1+[sym4]*10]+[sym2]*[sym3]]


revision 2:
Code:
skipMoreAdvancedLookup=false
function moreAdvancedLookup(s)
 if skipMoreAdvancedLookup then return nil end
 if s=='' then return end
 local copyofs,result=s

 for out in s:gmatch('%b[]') do
   local address = string.format('%x',(readPointer(out:sub(2,-2)) or 0))
   local out2=out:gsub('[.*+%%[-]','%%%1') -- escape more chars, forgot about it in rev1
   copyofs=copyofs:gsub(out2,address)
 end

 skipMoreAdvancedLookup=true
 local errorOnLookupFailureOldState=errorOnLookupFailure(false)
 result=getAddress(copyofs)
 errorOnLookupFailure(errorOnLookupFailureOldState)
 skipMoreAdvancedLookup=false
 return result
end

if moreAdvancedLookupID~=nil then unregisterSymbolLookupCallback(moreAdvancedLookupID) end
moreAdvancedLookupID = registerSymbolLookupCallback(moreAdvancedLookup, slNotInt)



Because it allows nested pointers it is much slower.
If you don't need nested pointers support, use this instead:

Code:
skipMoreAdvancedLookup=false
function moreAdvancedLookup(s)
 if skipMoreAdvancedLookup then return nil end
 if s=='' then return end
 local copyofs,result=s

 skipMoreAdvancedLookup=true

 for out in s:gmatch('%b[]') do
   local address = string.format('%x',(readPointer(out:sub(2,-2)) or 0))
   local out2=out:gsub('[.*+%%[-]','%%%1') -- escape more chars, forgot about it in rev1
   copyofs=copyofs:gsub(out2,address)
 end

 --skipMoreAdvancedLookup=true
 local errorOnLookupFailureOldState=errorOnLookupFailure(false)
 result=getAddress(copyofs)
 errorOnLookupFailure(errorOnLookupFailureOldState)
 skipMoreAdvancedLookup=false
 return result
end

if moreAdvancedLookupID~=nil then unregisterSymbolLookupCallback(moreAdvancedLookupID) end
moreAdvancedLookupID = registerSymbolLookupCallback(moreAdvancedLookup, slNotInt)




Edit:
forgot local for errorOnLookupFailureOldState variable

Edit2:
readPointer instead of readInteger

_________________


Last edited by mgr.inz.Player on Thu Jan 14, 2016 7:04 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
markheloking
Cheater
Reputation: 2

Joined: 21 Nov 2009
Posts: 35

PostPosted: Thu Jan 14, 2016 6:14 pm    Post subject: Reply with quote

Even more amazing! Thank you so much!
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
Goto page Previous  1, 2, 3
Page 3 of 3

 
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