ERM Hooker v1.0.0
Era plugin allows to easily install and remove code hooks which execute corresponding ERM handlers.
{code block address} => {erm function receiving the context}
API:
(*
ErmHandlerFunc receives two SN:X arguments: (Context pointer, ExecuteOverwrittenCode? = 1)
If you set ExecuteOverwrittenCode to 0, be sure to change context.RetAddr
Context structure (offsets in brackets):
: EDI (0), ESI (4), EBP (8), ESP (12), EBX (16), EDX (20), ECX (24), EAX (28)
: RetAddr (32)
Returns non-zero value on success. Fails if another hook is set at the same address.
*)
function SetHook (Addr: pointer; ErmHandlerFunc: integer): longbool; stdcall;
(*
Removes erm hook at specified address. Returns true if hook existed.
*)
function UnsetHook (Addr: pointer): longbool; stdcall;
(*
Prints list of hooks in "Debug\Era\erm hooks.txt"
*)
procedure PrintHooks; stdcall;
All hooks are automatically removed on the following events: new game start, game loading, game leaving (Era 2.55+).
Plugin supports both Era 2.46 and Era 2.55+. For 2.55+ it handles OnGenerateDebugInfoEvent (you can generate list of hooks by pressing F11) and OnGameLeave event.
Example of usage: