summaryrefslogtreecommitdiff
path: root/cheat/gmod/is_hltv.cpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/gmod/is_hltv.cpp
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'cheat/gmod/is_hltv.cpp')
-rw-r--r--cheat/gmod/is_hltv.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/cheat/gmod/is_hltv.cpp b/cheat/gmod/is_hltv.cpp
new file mode 100644
index 0000000..a611d2e
--- /dev/null
+++ b/cheat/gmod/is_hltv.cpp
@@ -0,0 +1,31 @@
+#include "hooks.hpp"
+#include "pattern.hpp"
+#include "mem.hpp"
+
+bool __fastcall hooks::is_hltv( void* ecx, uintptr_t pvs_ent ) {
+ static auto is_hltv_o = g_csgo.m_engine->get_old_function< decltype( &hooks::is_hltv ) >( 93 );
+ static auto pvs_retaddr = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "84 C0 0F 85 ? ? ? ? A1 ? ? ? ? 8B B7" ) );
+
+ if ( !g_csgo.m_panic && pvs_retaddr ) {
+ stack_t stack( get_baseptr( ) );
+ auto return_address = stack.return_address( );
+
+ if ( return_address == pvs_retaddr ) {
+ if ( pvs_ent && reinterpret_cast< c_base_player* >( pvs_ent )->is_valid( ) ) {
+ *( int* )( pvs_ent + 0xa24 ) = -1;
+ *( int* )( pvs_ent + 0xa2c ) = *( int* )( pvs_ent + 0xa28 );
+ *( int* )( pvs_ent + 0xa28 ) = 0;
+ return true;
+ }
+ }
+ }
+
+ return is_hltv_o( ecx, pvs_ent );
+}
+
+bool __declspec( naked ) __fastcall hooks::is_hltv_proxy( void*, void* ) {
+ __asm {
+ mov edx, edi;
+ jmp is_hltv;
+ }
+} \ No newline at end of file