summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal_rewrite/c_base_player.hpp2
-rw-r--r--internal_rewrite/color.hpp2
-rw-r--r--internal_rewrite/settings.hpp4
-rw-r--r--internal_rewrite/simple_settings.hpp17
-rw-r--r--internal_rewrite/ui.h23
-rw-r--r--internal_rewrite/ui_slider.h8
-rw-r--r--internal_rewrite/util.cpp5
7 files changed, 51 insertions, 10 deletions
diff --git a/internal_rewrite/c_base_player.hpp b/internal_rewrite/c_base_player.hpp
index 2f3a4c0..e5455f9 100644
--- a/internal_rewrite/c_base_player.hpp
+++ b/internal_rewrite/c_base_player.hpp
@@ -305,7 +305,7 @@ public:
NETVAR( m_flConstraintRadius, "m_flConstraintRadius", "DT_CSPlayer", 0, float );
OFFSET( m_CachedBoneData, 0x28FC + sizeof( void* ), CUtlVector< matrix3x4 > );
- OFFSET( m_flSpawnTime, 0xA2B0, float );
+ OFFSET( m_flSpawnTime, 0xA2C0, float );
OFFSET( m_IKContext, 0x265c, IKContext* );
public:
static uintptr_t get_player_resource( );
diff --git a/internal_rewrite/color.hpp b/internal_rewrite/color.hpp
index 49112dd..5ffd2a0 100644
--- a/internal_rewrite/color.hpp
+++ b/internal_rewrite/color.hpp
@@ -42,7 +42,7 @@ public:
class clr_t {
uint8_t R, G, B, A;
public:
- clr_t( ) : R( 0 ), G( 0 ), B( 0 ), A( 0 ) { }
+ clr_t( ) = default;
clr_t( uint8_t r, uint8_t g, uint8_t b, uint8_t a ) : R( r ), G( g ), B( b ), A( a ) { }
diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp
index e2d0c34..decdfc9 100644
--- a/internal_rewrite/settings.hpp
+++ b/internal_rewrite/settings.hpp
@@ -109,6 +109,10 @@ namespace data
}
}
+ __declspec( noinline ) void reset( ) {
+ holder_.reset( );
+ }
+
void copy_to_clipboard( ) {
holder_.save( "", xors( "./csgo/cfg/money_temp.cfg" ) );
std::vector< uint8_t > file_data;
diff --git a/internal_rewrite/simple_settings.hpp b/internal_rewrite/simple_settings.hpp
index 8dcfaca..9dffa55 100644
--- a/internal_rewrite/simple_settings.hpp
+++ b/internal_rewrite/simple_settings.hpp
@@ -20,6 +20,7 @@ public:
virtual void load( const char* path, const char* file ) = 0;
virtual void save( const char* path, const char* file ) const = 0;
+ virtual void reset( ) const = 0;
virtual void register_( ISettingNode* node_ptr ) = 0;
virtual bool has_nodes( ) { return false; }
virtual hash_t get_hash( ) { return 0; }
@@ -59,6 +60,11 @@ public:
x->save( full_path, file );
}
+ __declspec( noinline ) void reset( ) const override {
+ for( auto x : setting_nodes_ )
+ x->reset( );
+ }
+
auto& get_nodes( ) {
return setting_nodes_;
}
@@ -115,6 +121,7 @@ public:
WritePrivateProfileStringA( path, std::to_string( m_name ).c_str( ), m_value, file );
}
+
char* get( ) {
return m_value;
}
@@ -129,13 +136,15 @@ class con_var : public ISetting {
public:
__declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name ) :
name_( name ),
+ original_{ },
is_float_( std::is_floating_point_v< T > ),
is_integral_( std::is_integral_v< T > ) {
holder_ptr->register_( this );
}
- __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name , const T& rhs ) :
+ __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name, const T& rhs ) :
value_( rhs ),
name_( name ),
+ original_( value_ ),
is_float_( std::is_floating_point_v< T > ),
is_integral_( std::is_integral_v< T > ) {
holder_ptr->register_( this );
@@ -181,6 +190,11 @@ public:
simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), full_path );
}
+ __declspec( noinline ) void reset( ) const override {
+ // now this is really epic.
+ memcpy( ( void* )&value_, ( void* )&original_, sizeof( original_ ) );
+ }
+
__forceinline operator T&( ) { return value_; }
__forceinline T* operator &( ) { return &value_; }
@@ -261,4 +275,5 @@ private:
bool is_float_;
bool is_integral_;
T value_;
+ T original_;
}; \ No newline at end of file
diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h
index f7c3fd7..56f6c88 100644
--- a/internal_rewrite/ui.h
+++ b/internal_rewrite/ui.h
@@ -711,10 +711,13 @@ namespace ui
}
auto fake_ping = std::make_shared< ui::c_form >( 0, 0, 215, 0, xors( "fake latency" ) ); {
+ static auto sv_maxunlag = g_csgo.m_cvar( )->FindVar( "sv_maxunlag" );
+
fake_ping->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 120, xors( "enabled" ), &g_settings.misc.net_fakelag,
&dropdowns::fake_ping_activation ) )->add_item( std::make_shared< ui::c_key_picker_small >( 195, 0, &g_settings.misc.net_fakeping_key )
)->set_cond( [ ]( ) { return g_settings.misc.net_fakelag == 1 || g_settings.misc.net_fakelag == 2; } );
- fake_ping->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, 800, xors( "amount" ), &g_settings.misc.net_fakeping_amount( ) )
+
+ fake_ping->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 120, 0, ( int )( sv_maxunlag->get_float( ) * 1000 ), xors( "amount" ), &g_settings.misc.net_fakeping_amount( ) )
)->set_cond( [ ]( ) { return g_settings.misc.net_fakelag != 4; } );
}
@@ -804,7 +807,7 @@ namespace ui
}
subtab_movement_recorder->add_item( main_form );
- }
+ }
subtab_sheet->add_item( subtab_movement_recorder );
subtab_sheet->add_item( subtab_skins );
@@ -815,16 +818,18 @@ namespace ui
auto tab_config = std::make_shared< ui::c_tab_sheet >( xors( "config" ), &icons::sprite_config ); {
- auto cfg_form = std::make_shared< ui::c_form >( 0, 10, 200, 113, xors( "config" ) );
+ auto cfg_form = std::make_shared< ui::c_form >( 0, 10, 200, 134, xors( "config" ) );
cfg_form->add_item( std::make_shared< ui::c_dropdown< > >( 0, 0, 180, xors( "setting" ), &g_settings.menu.cur_setting, &dropdowns::configs ) );
cfg_form->add_item( std::make_shared< ui::c_button >( 0, 0, 85, 20, xors( "save" ), []( ) { g_settings.save( ); } ) );
cfg_form->add_item( std::make_shared< ui::c_button >( 95, -25, 85, 20, xors( "load" ), []( ) { g_settings.load( ); } ) );
+ cfg_form->add_item( std::make_shared< ui::c_button >( 0, -25, 85, 20, xors( "reset" ), []( ) { g_settings.reset( ); g_settings.save( ); } ) );
+ cfg_form->add_item( std::make_shared< ui::c_button >( 95, -50, 85, 20, xors( "unload" ), []( ) { g_settings.reset( ); } ) );
//cfg_form->add_item( std::make_shared< ui::c_button >( 0, -25, 85, 20, xors( "to clipboard" ), [ ]( ) { g_settings.copy_to_clipboard( ); } ) );
//cfg_form->add_item( std::make_shared< ui::c_button >( 95, -50, 85, 20, xors( "from clipboard" ), [ ]( ) { g_settings.load_from_clipboard( ); } ) );
- auto label = cfg_form->add_item( std::make_shared< ui::c_label >( 0, -25, xors( "menu color" ) ) );
+ auto label = cfg_form->add_item( std::make_shared< ui::c_label >( 0, -50, xors( "menu color" ) ) );
label->add_item( std::make_shared< ui::c_color_picker >( 165, 4, 15, &g_settings.menu.menu_color ) );
- cfg_form->add_item( std::make_shared< ui::c_checkbox >( 0, -25, xors( "anti-untrusted" ), &g_settings.menu.anti_untrusted ) );
+ cfg_form->add_item( std::make_shared< ui::c_checkbox >( 0, -50, xors( "anti-untrusted" ), &g_settings.menu.anti_untrusted ) );
tab_config->add_item( cfg_form );
}
@@ -870,6 +875,14 @@ namespace ui
static auto jitter_air = menu->find_item( xors( "in-air yaw jitter" ) );
jitter_air->set_text( g_settings.rage.air_yaw == 2 ? xors( "spin range" ) : xors( "in-air yaw jitter" ) );
+ static auto sv_maxunlag = g_csgo.m_cvar( )->FindVar( "sv_maxunlag" );
+ static auto fakeping_slider = ( c_slider< int >* )menu->find_item( xors( "amount" ) ).get( );
+
+ auto game_rules = c_base_player::get_game_rules( );
+ if( game_rules ) {
+ fakeping_slider->set_max( *( bool* )( game_rules + 0x75 ) ? 0.f : 800.f );
+ }
+
render_item( menu.get( ) );
// This was annoying me so I decided to remove it in Release mode.
diff --git a/internal_rewrite/ui_slider.h b/internal_rewrite/ui_slider.h
index e13ffae..8f54b3c 100644
--- a/internal_rewrite/ui_slider.h
+++ b/internal_rewrite/ui_slider.h
@@ -154,6 +154,14 @@ namespace ui
}
}
+ void set_min( float min ) {
+ m_min = min;
+ }
+
+ void set_max( float max ) {
+ m_max = max;
+ }
+
protected:
t* m_setting;
diff --git a/internal_rewrite/util.cpp b/internal_rewrite/util.cpp
index 9e9751f..1d19f9a 100644
--- a/internal_rewrite/util.cpp
+++ b/internal_rewrite/util.cpp
@@ -246,7 +246,7 @@ bool util::hitchance( int target, const vec3_t& angles, int percentage, int hitb
if( wep->m_iItemDefinitionIndex( ) == WEAPON_SSG08 && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) {
min_accuracy = 0.008750f;
}
-
+
if( min_accuracy >= inaccuracy )
return true;
}
@@ -373,8 +373,9 @@ float util::get_lerptime( ) {
}
bool util::is_tick_valid( int tickcount ) {
+
float latency = get_total_latency( );
- float correct = std::clamp( latency + get_lerptime( ), 0.f, 1.f );
+ float correct = std::clamp( latency + get_lerptime( ), 0.f, *( bool* )( c_base_player::get_game_rules( ) + 0x75 ) ? 0.2f : 1.0f );
float delta = correct - ( g_ctx.pred_time( ) - TICKS_TO_TIME( tickcount ) );
if( g_settings.rage.enabled ) {