Add example event listener on player_footstep.

Signed-off-by: aixxe <me@aixxe.net>
This commit is contained in:
aixxe
2016-12-23 12:19:12 +00:00
parent c1738ce42b
commit afc72efcd8
3 changed files with 31 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
#include "Basehook.h"
#include "Hooks/Hooks.h"
#include "Events/TestListener.h"
ICvar* cvar = nullptr;
IPanel* panel = nullptr;
@@ -51,6 +52,8 @@ std::unique_ptr<VMTHook> enginevgui_hook;
std::unique_ptr<VMTHook> modelrender_hook;
std::unique_ptr<VMTHook> inputinternal_hook;
std::unique_ptr<TestEventListener> testevent;
extern "C" void __attribute__((constructor)) css_basehook_open() {
// Get class pointers from game libraries using partial interface versions.
cvar = GetInterface<ICvar>("bin/libvstdlib.so", "VEngineCvar0");
@@ -118,6 +121,9 @@ extern "C" void __attribute__((constructor)) css_basehook_open() {
globalvars = **reinterpret_cast<CGlobalVarsBase***>(
clientdll_hook->GetOriginalFunction<uintptr_t>(11) + 8
);
// Register an event listener.
testevent = std::make_unique<TestEventListener>("player_footstep");
}
extern "C" void __attribute__((destructor)) css_basehook_close() {