From 1ade8f786ded23857188f28e0901ae4ffc7a184d Mon Sep 17 00:00:00 2001 From: _or_75 Date: Thu, 13 Nov 2025 00:13:52 +0300 Subject: [PATCH] Fix WorldToScreen --- .../CS2/SDK/Interface/IEngineToClient.hpp | 12 +++++- .../Andromeda-CS2-Base/CS2/SDK/Math/Math.cpp | 38 +++++++++++-------- .../Common/Include/Config.hpp | 4 +- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Interface/IEngineToClient.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Interface/IEngineToClient.hpp index 4507996..6653449 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Interface/IEngineToClient.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Interface/IEngineToClient.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -18,8 +19,15 @@ class IVEngineToClient { public: DECLARATE_CS2_FUNCTION( bool , IsInGame , ( ) , IVEngineToClient , ( IVEngineToClient* ) , ( this ) ); - // Index -> "60" + // Index -> "62" DECLARATE_CS2_FUNCTION( const char* , GetLevelName , ( ) , IVEngineToClient , ( IVEngineToClient* ) , ( this ) ); - // Index -> "61" + // Index -> "63" DECLARATE_CS2_FUNCTION( const char* , GetLevelNameShort , ( ) , IVEngineToClient , ( IVEngineToClient* ) , ( this ) ); + +public: + auto GetScreenSize( int& width , int& height ) -> void + { + VirtualFn( void )( IVEngineToClient* , int& , int& ); + return vget< Fn >( this , 59 )( this , width , height ); + } }; diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Math/Math.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Math/Math.cpp index 264ac61..6993fef 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Math/Math.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/CS2/SDK/Math/Math.cpp @@ -3,6 +3,8 @@ #include #include +#include +#include #include namespace Math @@ -15,11 +17,13 @@ namespace Math ret = !( ScreenTransform( vIn , Out ) ); - if ( ImGui::GetCurrentContext() ) - { - vOut.x = ( ( Out.m_x + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.x; - vOut.y = ImGui::GetIO().DisplaySize.y - ( ( ( Out.m_y + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.y ); - } + auto ScreenWidth = 0; + auto ScreenHeight = 0; + + SDK::Interfaces::EngineToClient()->GetScreenSize( ScreenWidth , ScreenHeight ); + + vOut.x = ( ( Out.m_x + 1.0f ) * 0.5f ) * static_cast( ScreenWidth ); + vOut.y = static_cast( ScreenHeight ) - ( ( ( Out.m_y + 1.0f ) * 0.5f ) * static_cast( ScreenHeight ) ); return ret; } @@ -32,11 +36,13 @@ namespace Math ret = !( ScreenTransform( vIn , Out ) ); - if ( ImGui::GetCurrentContext() ) - { - vOut.m_x = ( ( Out.m_x + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.x; - vOut.m_y = ImGui::GetIO().DisplaySize.y - ( ( ( Out.m_y + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.y ); - } + auto ScreenWidth = 0; + auto ScreenHeight = 0; + + SDK::Interfaces::EngineToClient()->GetScreenSize( ScreenWidth , ScreenHeight ); + + vOut.m_x = ( ( Out.m_x + 1.0f ) * 0.5f ) * static_cast( ScreenWidth ); + vOut.m_y = static_cast( ScreenHeight ) - ( ( ( Out.m_y + 1.0f ) * 0.5f ) * static_cast( ScreenHeight ) ); return ret; } @@ -47,11 +53,13 @@ namespace Math ret = !( ScreenTransform( vIn , vOut ) ); - if ( ImGui::GetCurrentContext() ) - { - vOut.m_x = ( ( vOut.m_x + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.x; - vOut.m_y = ImGui::GetIO().DisplaySize.y - ( ( ( vOut.m_y + 1.0f ) * 0.5f ) * ImGui::GetIO().DisplaySize.y ); - } + auto ScreenWidth = 0; + auto ScreenHeight = 0; + + SDK::Interfaces::EngineToClient()->GetScreenSize( ScreenWidth , ScreenHeight ); + + vOut.m_x = ( ( vOut.m_x + 1.0f ) * 0.5f ) * static_cast( ScreenWidth ); + vOut.m_y = static_cast( ScreenHeight ) - ( ( ( vOut.m_y + 1.0f ) * 0.5f ) * static_cast( ScreenHeight ) ); return ret; } diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/Common/Include/Config.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/Common/Include/Config.hpp index c8f6601..7b48f89 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/Common/Include/Config.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/Common/Include/Config.hpp @@ -17,10 +17,8 @@ #define ENABLE_MANUAL_MAP 0 #define ENABLE_CPP_EH_EXCEPTION 0 -#define DISABLE_INVENTORY 0 - #define LOG_SDK 1 -#define LOG_SDK_PATTERN 1 +#define LOG_SDK_PATTERN 0 #define ENABLE_XOR_STR 0 #define ENABLE_XOR_VMP_STR 0