| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Bit Byte Advanced Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2022
 Posts: 62
 
 
 | 
			
				|  Posted: Mon Jul 15, 2024 3:03 am    Post subject: Is it possible to execute game code through Cheat Engine? |   |  
				| 
 |  
				| I have used cheat engine code filter to find addresses which show that they are executed every time for a certain action done in game. 
 how can I use the addresses in cheat engine LUA scripting or AA to have them executed at my demand on the press of a hotkey
 
 Something like this:
 
 
  	  | Code: |  	  | function executeAddresses() executeAddress(getAddress("game.exe+6ADC00"))
 executeAddress(getAddress("game.exe+28CE6F"))
 executeAddress(getAddress("game.exe+5C0C90"))
 end
 
 createHotkey(executeAddresses, VK_Z
 | 
 
 "executeAddress" is not a special keyword like "getAddress"
 So an example script of how to get code execution working will help
 
 Thanks
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jul 15, 2024 8:02 am    Post subject: |   |  
				| 
 |  
				| executeCode(address) works.  But are you sure you can just call it like that or do those funcrions need specific parameters? _________________
 
 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
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Csimbi I post too much
 
  Reputation: 97 
 Joined: 14 Jul 2007
 Posts: 3327
 
 
 | 
			
				|  Posted: Mon Jul 15, 2024 8:35 am    Post subject: |   |  
				| 
 |  
				| Interesting. Would this be executed in context of the game (as if it was executed internally, with access to all code and memory), or, would be executed in context of CE?
 
 Thank you!
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Bit Byte Advanced Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2022
 Posts: 62
 
 
 | 
			
				|  Posted: Mon Jul 15, 2024 8:43 am    Post subject: |   |  
				| 
 |  
				| Thank you for your answer @Dark Byte I learned a new thing "executeCode(address)"
 
 Well now the attached image shows how it is, filtered out 3 addresses being executed for a certain in game button click. Showing one of them opcodes in memory viewer
 
 I just want to simulate that same thing at the press of a keyboard button.
 Kinda like say power up when ever I want at will pressing Z key.
 
 Would executeCode work or do I need to do it differently?
 Where can I read up on this or can I get examples.
 
 Thanks
 
 
 
 
	
		
	 
		| Description: |  |  
		| Filesize: | 66.4 KB |  
		| Viewed: | 3515 Time(s) |  
		| 
  
 
 |  
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jul 15, 2024 9:24 am    Post subject: |   |  
				| 
 |  
				| it executes inside the game 
 You do need to call the code from the function start, so likely a bit higher. And most functions have parameters.  (usually in rcx,rdx,r8 and r9 but can be anything else as well if it's an internal function)
 
 You can pass those parameters as well with executeCode but the main issue is figuring out what the parameters are. e.g. for object oriented code the first parameter (rcx) is often the instance of the object (base address of the object)  so you'd first have to find that before you can call the function
 _________________
 
 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
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Bit Byte Advanced Cheater
 
 ![]() Reputation: 0 
 Joined: 28 Nov 2022
 Posts: 62
 
 
 | 
			
				|  Posted: Mon Jul 15, 2024 2:42 pm    Post subject: |   |  
				| 
 |  
				| Ok I did a bit more investigating afterwards 
 Of the 3 addresses that I got from code filtering, I found which one executes first using breakpoints.
 
 Then I right clicked on that address in memory view and clicked the "select current function" which I believe highlights the whole function from start to end.
 
 So from what I saw it seems like it starts from where the first found address is.
 I attached image.
 
 what should I do next?
 
 
 
 
	
		
	 
		| Description: |  |  
		| Filesize: | 103.77 KB |  
		| Viewed: | 3479 Time(s) |  
		| 
  
 
 |  
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| ParkourPenguin I post too much
 
  Reputation: 152 
 Joined: 06 Jul 2014
 Posts: 4706
 
 
 | 
			
				|  Posted: Mon Jul 15, 2024 5:49 pm    Post subject: |   |  
				| 
 |  
				| Figure out what the only parameter, rcx, is and how to find or make it yourself. In that image it seems like it's in the stack, so you'll probably need to look at the caller to figure that out. 
 Then call the function with the right argument and it might work. It also might require some other setup- e.g. games using mono need to do something to a thread before it can call code IIRC
 _________________
 
 I don't know where I'm going, but I'll figure it out when I get there. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |