1.4 KiB
1.4 KiB
FoCAPI
Project Overview
This project is a DLL hook for Star Wars: Empire at War: Forces of Corruption to add custom Lua functions available for scripting.
Client and Debug Kits
- StarWarsG.exe -- the binary shipped with the game for all clients. PDB unavailable.
- StarWarsI.exe -- the debug kit binary which comes with debug functionality but is too slow to run normally. PDB available.
- Both binares are 64-bit Windows portable executables.
DLL Hook
- Uses MinHook to create the DLL hook into the game via powerprof.dll
- Using Ghidra to find addresses of function calls from StarWarsI and map them using Version Control to addresses in StarWarsG.
Empire at War Lua Scripting Engine
The source code for parts of the Lua scripting engine in Empire at War was leaked at and can be accessed here. Use this as a guide for what Lua functions and variables are already available, and how the engine hooks Lua scripting into the rest of the game.
Adding a New Lua Function
- Create
functions/<module>.cpp— implementL_*function(s) andRegister_<Module>(lua_State* L) - Add
void Register_<Module>(lua_State* L);tofunctions/functions.h - Add
Register_<Module>(L);tofunctions/functions.cpp - Add new RVAs (if needed) to
rvas.hin the relevant section, for each supported executable - Add
functions\<module>.cpptoFoCAPI.vcxprojandFoCAPI.vcxproj.filters