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 


Strings in cheat table

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Astaroth4256
Advanced Cheater
Reputation: 0

Joined: 25 May 2014
Posts: 59

PostPosted: Mon Apr 27, 2020 6:58 pm    Post subject: Strings in cheat table Reply with quote

I googled a little and didn't found anything so I have another autistic question of the day.
Is there a way to efficiently add string addresses to cheat table?

Like, if string length is less than 16 then the address value is the string itself, but if it's longer then it turns into a pointer. Having two addresses in cheat table per string makes it kinda ugly so is there a way to fix that?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Apr 27, 2020 7:55 pm    Post subject: Reply with quote

I can't think of any easy way of doing that with custom value types.

You could use Lua and have a timer periodically check and update the memory record if it changes.
Setting OnGetDisplayValue per memory record might be better, but I'm not sure if it's safe to change the memory record's type in that function. (if not, use the new "createTimer(delay, function(...),...)" added in 7.1)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Astaroth4256
Advanced Cheater
Reputation: 0

Joined: 25 May 2014
Posts: 59

PostPosted: Mon Apr 27, 2020 8:32 pm    Post subject: Reply with quote

Sounds complicated. I don't know any of the CE scripting so I was hoping for a quick solution. Thanks anyway.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Mon Apr 27, 2020 10:42 pm    Post subject: Reply with quote

May make a custom symbol lookup.

The following make a custom symbol lookup with the spec:
(MustHave '.')(MustHave 'Lua Global Variable Name')(optional '#' 'hex offset')
the single quote is the parts of valid symbol format.

eg. .ShortAddr#11 =>
Lua Variable = ShortAddr, hex offset = 11
then if there is a ShortAddr lua global variable and have value 'SleepEx'
the .ShortAddr#11 will parse as address value SleepEx+11
Code:
if dotSymbolAliasLookup then
  dotSymbolAliasLookup=nil,unregisterSymbolLookupCallback(dotSymbolAliasLookup)
end
dotSymbolAliasLookup = registerSymbolLookupCallback(function(sym)
  if #sym<2 or sym:sub(1,1)~='.'then return end
  local var, ofs = sym:match'^%.([_%a][_%w]*)#(%x+)$'
  if not ofs then var,ofs = sym:sub(2),0 else ofs=tonumber(ofs,16)end
  local val = _G[var]
  local adr = type(val)=='string' and GetAddressSafe(val)or
              type(val)=='number' and math.tointeger(val)
  return adr and adr + ofs
end,slNotSymbol)

so the long complex normal address string can be hold by a lua var with shorter naming.

oops: I may mistaken the autistic requirement tho ~_~

_________________
- Retarded.
Back to top
View user's profile Send private message
Astaroth4256
Advanced Cheater
Reputation: 0

Joined: 25 May 2014
Posts: 59

PostPosted: Tue Apr 28, 2020 2:45 am    Post subject: Reply with quote

panraven wrote:
May make a custom symbol lookup.

The following make a custom symbol lookup with the spec:
(MustHave '.')(MustHave 'Lua Global Variable Name')(optional '#' 'hex offset')
the single quote is the parts of valid symbol format.

eg. .ShortAddr#11 =>
Lua Variable = ShortAddr, hex offset = 11
then if there is a ShortAddr lua global variable and have value 'SleepEx'
the .ShortAddr#11 will parse as address value SleepEx+11
Code:
if dotSymbolAliasLookup then
  dotSymbolAliasLookup=nil,unregisterSymbolLookupCallback(dotSymbolAliasLookup)
end
dotSymbolAliasLookup = registerSymbolLookupCallback(function(sym)
  if #sym<2 or sym:sub(1,1)~='.'then return end
  local var, ofs = sym:match'^%.([_%a][_%w]*)#(%x+)$'
  if not ofs then var,ofs = sym:sub(2),0 else ofs=tonumber(ofs,16)end
  local val = _G[var]
  local adr = type(val)=='string' and GetAddressSafe(val)or
              type(val)=='number' and math.tointeger(val)
  return adr and adr + ofs
end,slNotSymbol)

so the long complex normal address string can be hold by a lua var with shorter naming.

oops: I may mistaken the autistic requirement tho ~_~


Thank you kind sir but I spent a good ~30 minutes trying to understand what to do with this and I failed. What am I supposed to do with the lua variables?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Apr 28, 2020 3:15 am    Post subject: Reply with quote

If you have a symbol address like
[[[GAME.EXE+123456]+110]+1f0]+224]+48
You can set a Lua variable like
XYZ = "[[[GAME.EXE+123456]+110]+1f0]+224]+48"
(in Lua script MENU/Table/Show Cheat Table Lua Script,
or in memory record script type {$lua}...{$asm} block)

then use another symbol address
.XYZ to means the address [[[GAME.EXE+123456]+110]+1f0]+224]+48
or
.XYZ#10 to means the address [[[GAME.EXE+123456]+110]+1f0]+224]+48+10

Sorry if this still not clear enough.

_________________
- Retarded.
Back to top
View user's profile Send private message
Astaroth4256
Advanced Cheater
Reputation: 0

Joined: 25 May 2014
Posts: 59

PostPosted: Tue Apr 28, 2020 3:39 am    Post subject: Reply with quote

I get it now, thanks.
Back to top
View user's profile Send private message
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