| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Thu Sep 26, 2024 2:55 pm    Post subject: |   |  
				| 
 |  
				| you're best of using getNameFromAddress and parse the +xxx part 
 but if you really want to, it's something like this:
 
 
  	  | Code: |  	  | local address = getMemoryViewForm().DisassemblerView.SelectedAddress
 local symbolinfo=getMainSymbolList().getSymbolFromAddress(address)
 
 if symbolinfo then
 printf("symbol address of %s=%x, so offset is %x", symbolinfo.searchkey, symbolinfo.address, address-symbolinfo.address )
 else
 printf("not a symbol. Checking modules")
 local ml=enumModules()
 for i=1,#ml do
 if address>=ml[i].Address then
 local ms=getModuleSize(ml[i].Name)  --7.6 will have .Size part of the modulelist
 if address<ml[i].Address+ms then
 printf("module address=%x, so offset is %x", ml[i].Address, address-ml[i].Address)
 end
 break --the modulelist is sorted by address, so if this isn't it, it's not in the list
 end
 end
 end
 
 | 
 _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 |  |