Fix engine draw on windows (#26)
This commit is contained in:
parent
fd9f56c58d
commit
c3404b5ef4
@ -3,6 +3,7 @@
|
||||
#include <sdk/draw.hh>
|
||||
#include <sdk/hooks.hh>
|
||||
#include <sdk/log.hh>
|
||||
#include <sdk/platform.hh>
|
||||
#include <sdk/sdk.hh>
|
||||
|
||||
using namespace sdk;
|
||||
@ -13,7 +14,12 @@ hooks::HookFunction<EngineVgui, 0> *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<void>(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<EngineVgui, 0>(IFace<EngineVgui>().get(), 14, 14, 14, reinterpret_cast<void *>(&hooked_paint));
|
||||
engine_vgui_hook = new hooks::HookFunction<EngineVgui, 0>(IFace<EngineVgui>().get(), 13, 14, 14, reinterpret_cast<void *>(&hooked_paint));
|
||||
}
|
||||
|
||||
void shutdown_all() {
|
||||
|
@ -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<StartDrawing>("vguimatsurface", "55 89 E5 53 81 EC 94 00 00 00", 0);
|
||||
} else if constexpr (doghook_platform::windows()) {
|
||||
return nullptr;
|
||||
return signature::find_pattern<StartDrawing>("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<FinishDrawing>("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<FinishDrawing>("vguimatsurface", "55 8B EC 6A FF 68 ? ? ? ? 64 A1 ? ? ? ? 50 64 89 25 ? ? ? ? 51 56 6A 00", 0);
|
||||
}
|
||||
}
|
||||
();
|
||||
|
Reference in New Issue
Block a user