Today I finished my work on a hook for the Watch Dogs lua engine. It can now load lua script files into the game and execute them and also gives access to all lua scripting functions available ingame, so spawning vehicles, changing time of day etc. is now possible. A short scripting example:
local test = CDynamicEnvironmentManager_GetInstance(); test:SetScriptedTimeOfDay(09, 23);
This simple script changes the time to 9:23. It can be saved as anything.lua and put into /scripts/ folder and will then be loaded by my hook at startup. You can also reload it at any time during gameplay so testing new stuff is pretty easy. I might release the hook to the public soon, depending on how testing goes.
I created a proxy of dinput8.dll to get loaded into the process and then load up my custom C++ dll. The injection works by using the functions loadbuffer and pcall from lua which reside inside Disrupt_b64.dll. Once you found them, you can manually call them and load your own scripts into the game and have them processed like normal game scripts. Protoypes:
int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz, const char *name); int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
All you gotta do is find the lua state in the game and that’s it! You can then call those two functions to load your own script data and execute it while playing.
Expect more soon.
An example screen: