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 


How do I use Lua to display addresses used by asm ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
NoMoreBSoD
Advanced Cheater
Reputation: 3

Joined: 03 Sep 2013
Posts: 85

PostPosted: Thu May 21, 2015 6:25 am    Post subject: How do I use Lua to display addresses used by asm ? Reply with quote

I would like to be able to use Lua to store all the addresses accessed by an assembly function and then display an offset. For example, lots of games have a function that check all the items in the inventory when you access it. How do I store those item addresses then display them, either in the lua console or in a modifiable form ?

I would really like to this in the Witcher 3 game but I do not see where to start. This thread will recap my steps toward this goal and in the end I will write a tutorial on the different hacking approaches I used for Witcher 3 and how I managed to integrate them with LUA.

__________________________________________________________________

Edit 1 :

Here is current script that checks many player attributes including base carrying weight in Witcher 3 :

Code:
[ENABLE]

aobscanmodule(aob_weight,witcher3.exe,f3 0F 10 74 33 0C 0f 2f 74 33 10) // should be unique
alloc(newmem,$1000,"witcher3.exe"+A16F30)

label(code)
label(return)
registersymbol(pointer_weight)
alloc(pointer_weight,8)

newmem:
  cmp [rbx+rsi],0000aa03
  jne code
  //mov dword ptr [rbx+rsi+c],(float)10
  push rsi
  lea rsi,[rbx+rsi]
  mov [pointer_weight],rsi
  pop rsi

code:
  movss xmm6,[rbx+rsi+0C]
  jmp return

aob_weight:
  jmp newmem
  nop
return:
registersymbol(aob_weight)

[DISABLE]

aob_weight:
  db f3 0F 10 74 33 0C

unregistersymbol(aob_weight)
dealloc(newmem)
unregistersymbol(pointer_weight)
dealloc(pointer_weight)


I filtered the addresses accessed using a simple cmp function but I would prefer to save all those addresses in a LUA table and filter them from there. How should I do that ?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon May 25, 2015 4:11 pm    Post subject: Reply with quote

Code:
address_list = {}
function debugger_onBreakpoint()
  address_list[RBX + RSI + 12] = true
  debug_continueFromBreakpoint(co_run)
  return 1
end
debug_setBreakpoint(address)


Code:
for i in pairs(address_list) do
  print(string.format("%X",i))
end
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 Lua Scripting 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