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 


Get static mono field address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Thu Nov 15, 2018 9:28 am    Post subject: Get static mono field address Reply with quote

Is there a way to get the address of static mono field by name? Like you can get the address of a mono class by name.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Fri Nov 16, 2018 6:09 am    Post subject: Reply with quote

I don't see anything in monoscript.lua that does exactly that but I think you can take function mono_class_enumFields(class, includeParents) and function mono_class_getStaticFieldAddress(domain, class) and build your own

Code:
function findStatic(domain, class, fieldname)
  local klass = mono_findClass(domain, class)
  local base = mono_class_getStaticFieldAddress(domain, class)
  for _, field in ipairs(mono_class_enumFields(klass, false)) do
    if field.name == fieldname and field.isStatic then return base + field.offset end
  end
end

disclaimer: untested, simply cobbled together from what I saw searching for static in monoscript.lua after just waking up lol

_________________
https://github.com/FreeER/ has a few CE related repos
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