diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/gmod/get_screen_size.cpp | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (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/get_screen_size.cpp')
| -rw-r--r-- | cheat/gmod/get_screen_size.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cheat/gmod/get_screen_size.cpp b/cheat/gmod/get_screen_size.cpp new file mode 100644 index 0000000..19d9908 --- /dev/null +++ b/cheat/gmod/get_screen_size.cpp @@ -0,0 +1,37 @@ +#include "hooks.hpp"
+#include "settings.hpp"
+
+#include <intrin.h>
+#include "context.hpp"
+#include "mem.hpp"
+
+void __fastcall hooks::get_screen_size( void* ecx, void* edx, int& w, int& h ) {
+ static auto get_screen_size_o = g_csgo.m_surface->get_old_function< decltype( &hooks::get_screen_size ) >( 44 );
+ static auto draw_crosshair_h = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "8B 0D ? ? ? ? 99 2B C2 D1 F8 89" ) );
+
+ stack_t stack( get_baseptr( ) );
+ auto ret = stack.next( ).return_address( );
+ //call original
+ get_screen_size_o( ecx, edx, w, h );
+
+ //alter screen width and height to adjust the crosshair position on screen
+ if( g_settings.visuals.recoil_crosshair && g_ctx.m_local ) {
+ if( ret == draw_crosshair_h || ret == draw_crosshair_h - 14 /* width call is 14 bytes above height call*/ ) {
+ w /= 2;
+ h /= 2;
+
+ vec3_t punch_angles = g_ctx.m_local->m_aimPunchAngle( ) * 2.f;
+
+ if( punch_angles.x < -0.1f ) {
+ float fov = g_ctx.m_fov;
+ float angle_step = h / fov;
+
+ w -= int( punch_angles.y * angle_step );
+ h += int( punch_angles.x * angle_step );
+ }
+
+ w *= 2;
+ h *= 2;
+ }
+ }
+}
\ No newline at end of file |
