diff --git a/src/hooks/engine_vgui.cc b/src/hooks/engine_vgui.cc index 0621d9f..8f7e259 100644 --- a/src/hooks/engine_vgui.cc +++ b/src/hooks/engine_vgui.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include using namespace sdk; @@ -13,7 +14,12 @@ hooks::HookFunction *engine_vgui_hook; using StartDrawing = void(__thiscall *)(void *); using FinishDrawing = void(__thiscall *)(void *); -void hooked_paint(EngineVgui *instance, u32 paint_method) { +#if doghook_platform_windows() +void __fastcall hooked_paint(EngineVgui *instance, void *edx, u32 paint_method) +#else +void hooked_paint(EngineVgui *instance, u32 paint_method) +#endif +{ engine_vgui_hook->call_original(paint_method); if (paint_method & 1) { @@ -27,7 +33,7 @@ void hooked_paint(EngineVgui *instance, u32 paint_method) { void init_all() { // hook up - engine_vgui_hook = new hooks::HookFunction(IFace().get(), 14, 14, 14, reinterpret_cast(&hooked_paint)); + engine_vgui_hook = new hooks::HookFunction(IFace().get(), 13, 14, 14, reinterpret_cast(&hooked_paint)); } void shutdown_all() { diff --git a/src/sdk/draw.cc b/src/sdk/draw.cc index 1716462..a83331e 100644 --- a/src/sdk/draw.cc +++ b/src/sdk/draw.cc @@ -73,11 +73,13 @@ void start() { assert(is_surface()); using StartDrawing = void(__thiscall *)(Surface *); + // look for -pixel_offset_x + static StartDrawing start_drawing = []() -> auto { if constexpr (doghook_platform::linux()) { return signature::find_pattern("vguimatsurface", "55 89 E5 53 81 EC 94 00 00 00", 0); } else if constexpr (doghook_platform::windows()) { - return nullptr; + return signature::find_pattern("vguimatsurface", "55 8B EC 64 A1 ? ? ? ? 6A FF 68 ? ? ? ? 50 64 89 25 ? ? ? ? 83 EC 14", 0); } } (); @@ -94,7 +96,7 @@ void finish() { if constexpr (doghook_platform::linux()) { return signature::find_pattern("vguimatsurface", "55 89 E5 53 83 EC 24 C7 04 24 00 00 00 00", 0); } else if constexpr (doghook_platform::windows()) { - return nullptr; + return signature::find_pattern("vguimatsurface", "55 8B EC 6A FF 68 ? ? ? ? 64 A1 ? ? ? ? 50 64 89 25 ? ? ? ? 51 56 6A 00", 0); } } ();