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 


Hack into game/s LUA engine?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
jgoemat
Master Cheater
Reputation: 23

Joined: 25 Sep 2011
Posts: 264

PostPosted: Thu Oct 03, 2013 2:15 pm    Post subject: Hack into game/s LUA engine? Reply with quote

I'd like to write a hack to work with a game's (Tropico 4's) LUA state. Has anybody done this or have any suggestions? Tropico 4 has lua51.dll in it's game directory, I was thinking I could have an AA script that hacked into it's function that creates a new state and store that value, then call the dll's functions myself to run my own scripts. If I can't do that I could hack another function that is used in the DLL and get the most recent LUA state passed to it.

Is this a good way to go about it or does anyone have any other suggestions? I think it would be cool to have my own pop-up LUA console in the game where I could type things like "player.money = 9999999". Are there any existing tools that enable functionality like that in a running EXE?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25808
Location: The netherlands

PostPosted: Thu Oct 03, 2013 2:40 pm    Post subject: Reply with quote

It's easiest to hook an often called lua function so your code executes in the same thread, thus no threading issues (often lua is compiled without threading support)

lua_gettop() is called often, so that is a good spot to hook

In there check if a lua command is waiting, and if so call lual_loadstring followed by lua_pcall (do use critical sections in case it is multithreaded)

_________________
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
View user's profile Send private message MSN Messenger
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Thu Oct 03, 2013 3:51 pm    Post subject: Re: Hack into game/s LUA engine? Reply with quote

jgoemat wrote:
I'd like to write a hack to work with a game's (Tropico 4's) LUA state. Has anybody done this
Me and mgr.inz.Player wrote injected lua consoles here. Since we were also working on a lua 5.1 dll, simply fixing the modules names might be enough... might.
_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Oct 03, 2013 4:56 pm    Post subject: This post has 1 review(s) Reply with quote

What Gniarf said.

Also, I updated my script (proper error handling, etc.) and posted it here:
http://forum.cheatengine.org/viewtopic.php?t=564665
a day after my last post ("Love2D" topic) I created above topic.

Of course you have to adjust it for your Lua version.

 

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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