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 


Can CE typecast value at the end of [pointer chain] ?

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

Joined: 03 Oct 2014
Posts: 55

PostPosted: Wed Apr 04, 2018 9:23 am    Post subject: Can CE typecast value at the end of [pointer chain] ? Reply with quote

EC_address, EC_row_size , EE_address and EE_row_size are user symbols .

Code:
EC_address + EC_row_size * (3 - 1) + 0xE  -> 0xA // signed 2 byte

EE_address + EE_row_size * 0xA + 0x18 -> 818 // 4 bytes INT at address 22D11C60 ; works (current health of first unit in the third union of units)

EE_address + EE_row_size * [EC_address + EC_row_size * (3 - 1) + 0xE]  + 0x18 -> 86407 // 4 bytes INT at address 41ED1C60


Problem is how do I specify in need a signed 2 bytes value (typecast pointer chain ? what do I google for ? ) from this address [EC_address + EC_row_size * (3 - 1) + 0xE] and NOT a 4 bytes type one?

/////////

More context EE and EC structures (fixed length rows ) are linked not by pointer, EC has a field with an index of a record from structure EE.
Also I don't dare to imagine what fallowing 5 level of such structure links/chains would look like code wise .. (better way to do it ?)

EC (battle union stats , targeting info) -> EE ( unit battle stats and battle XP) -> F5 (attr XP ; links to skill tables) -> 104 (base stats and growth formulas)
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 63

Joined: 06 Jul 2014
Posts: 1944
Location: Arcadian Suburbia

PostPosted: Wed Apr 04, 2018 10:57 am    Post subject: This post has 1 review(s) Reply with quote

Execute this Lua code:
Code:
if sym_lookup_xptr then
  unregisterSymbolLookupCallback(sym_lookup_xptr)
  sym_lookup_xptr = nil
end
sym_lookup_xptr = registerSymbolLookupCallback(function(str)
  local vt, addr = str:match('^(%a-)[_%s]?[pP][tT][rR]%s?(%b[])$')
  if not (vt and addr) then return 0 end
  vt = string.upper(vt)

  addr = getAddressSafe(addr:sub(2,-2))
  if not addr then return 0 end

  if vt == 'BYTE' then
    return readBytes(addr, 1, false)
  elseif vt == 'WORD' then
    return readSmallInteger(addr)
  elseif vt == 'DWORD' then
    return readInteger(addr)
  elseif vt == 'QWORD' then
    return readQword(addr)
  elseif vt == 'FLOAT' then
    return math.floor(readFloat(addr))
  elseif vt == 'DOUBLE' then
    return math.floor(readDouble(addr))
  else
    return 0
  end
end, slNotSymbol)

Then you can use stuff like "word_ptr[...]" in the address string.

_________________
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
peddroelm
Advanced Cheater
Reputation: 0

Joined: 03 Oct 2014
Posts: 55

PostPosted: Wed Apr 04, 2018 11:12 am    Post subject: Reply with quote

Code:
EE_address + EE_row_size * word_ptr[EC_address + EC_row_size * (3 - 1) + 0xE] + 0x18  -> 818 ..   success

Edit:

104_address + 104_row_size * word_ptr[F5_address + F5_row_size * word_ptr[EE_address + EE_row_size * word_ptr[EC_address + EC_row_size * (3 - 1) + 0x10] + 0xA] + 0x6] + 0x10 -> 335 // 104 Base HP (Roberto in union 3 pos 2)


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 Discussions 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