Add .mh config save/load and allow spectator list in safe mode

This commit is contained in:
2026-08-05 18:53:54 +02:00
parent d298471a04
commit 89e9553f70
3 changed files with 359 additions and 26 deletions
@@ -379,7 +379,7 @@ auto CMisc::OnClientOutput() -> void
GetRenderStackSystem()->DrawString( pSafeFont , ImVec2( 8.f , 8.f ) , FW1_LEFT | FW1_TOP , ImColor( 0 , 255 , 0 ) , "[SAFE MODE]" );
}
if ( !Settings::SafeMode::Active && Settings::Misc::SpectatorList )
if ( Settings::Misc::SpectatorList )
{
auto* pLocalController = GetCL_Players()->GetLocalPlayerController();
@@ -1,6 +1,7 @@
#include "CAndromedaMenu.hpp"
#include <cstdio>
#include <cstring>
#include <ImGui/imgui.h>
#include <ImGui/imgui_internal.h>
@@ -359,9 +360,9 @@ auto CAndromedaMenu::RenderMiscPanel() -> void
if ( Settings::SafeMode::Active )
{
ImGui::TextColored( ImVec4( 1.f , 0.4f , 0.4f , 1.f ) , "%s" , "Deaktiviert (Safe Mode)" );
return;
}
else
{
Checkbox( "Bunnyhop" , Settings::Misc::Bunnyhop );
Checkbox( "Perfect Bhop" , Settings::Misc::PerfectBhop );
Checkbox( "Auto-Strafe" , Settings::Misc::AutoStrafe );
@@ -388,6 +389,7 @@ auto CAndromedaMenu::RenderMiscPanel() -> void
if ( Settings::Misc::FOVChanger )
SliderInt( "FOV" , Settings::Misc::FOV , 70 , 120 );
}
ImGui::SeparatorText( "Overlays" );
@@ -803,6 +805,47 @@ auto CAndromedaMenu::RenderConfigPanel() -> void
ImGui::TextColored( ImVec4( 1.f , 0.4f , 0.4f , 0.9f ) , "%s" , "Movement-Hacks, NoFlash, FOV-Changer sowie alle ESP/Glow/Chams." );
ImGui::TextColored( ImVec4( 0.f , 1.f , 0.2f , 1.f ) , "%s" , "Aktiv bleibt: Legit-Aim (weiches Zielen auf sichtbare Gegner)." );
ImGui::SeparatorText( "Config (.mh)" );
static char szConfigFile[ 64 ] = "default.mh";
ImGui::SetNextItemWidth( 200.f * m_fUIScale );
ImGui::InputText( "Datei" , szConfigFile , sizeof( szConfigFile ) );
const auto vFiles = Settings::Config::ListFiles();
std::vector<const char*> vFileItems;
for ( const auto& file : vFiles )
vFileItems.push_back( file.c_str() );
if ( vFileItems.empty() )
vFileItems.push_back( "(keine .mh gefunden)" );
static int iConfigListIdx = -1;
if ( Combo( "Vorhandene Configs" , iConfigListIdx , vFileItems.data() , static_cast<int>( vFileItems.size() ) ) )
{
if ( iConfigListIdx >= 0 && iConfigListIdx < static_cast<int>( vFiles.size() ) )
{
strncpy_s( szConfigFile , sizeof( szConfigFile ) , vFiles[ iConfigListIdx ].c_str() , _TRUNCATE );
}
}
if ( ImGui::Button( "Speichern" , ImVec2( 100.f * m_fUIScale , 28.f * m_fUIScale ) ) )
{
Settings::Config::FileName = szConfigFile;
Settings::SaveConfig();
}
ImGui::SameLine();
if ( ImGui::Button( "Laden" , ImVec2( 100.f * m_fUIScale , 28.f * m_fUIScale ) ) )
{
Settings::Config::FileName = szConfigFile;
Settings::LoadConfig();
}
ImGui::SeparatorText( "Menu" );
SliderInt( "Menu Alpha" , Settings::Menu::MenuAlpha , 100 , 255 );
@@ -3,6 +3,14 @@
#include <Common/Common.hpp>
#include <ImGui/imgui.h>
#include <algorithm>
#include <cstdio>
#include <filesystem>
#include <fstream>
#include <map>
#include <string>
#include <vector>
namespace Settings
{
namespace Visual
@@ -227,4 +235,286 @@ namespace Settings
inline ImVec4 GlowCT_Visible = { 0 , 1.f , 0.f , 1.f };
}
}
namespace Config
{
inline std::string FileName = "default.mh";
inline auto GetDirectory() -> std::string
{
char szModule[ MAX_PATH ]{};
GetModuleFileNameA( GetModuleHandleA( "Andromeda-CS2-Base.dll" ) , szModule , MAX_PATH );
std::string szPath = szModule;
const auto pos = szPath.find_last_of( '\\' );
if ( pos != std::string::npos )
szPath = szPath.substr( 0 , pos + 1 );
return szPath;
}
inline auto GetFilePath() -> std::string
{
std::string szFile = FileName;
if ( szFile.size() < 4 || szFile.substr( szFile.size() - 3 ) != ".mh" )
szFile += ".mh";
return GetDirectory() + szFile;
}
inline auto ListFiles() -> std::vector<std::string>
{
std::vector<std::string> vFiles;
try
{
for ( const auto& entry : std::filesystem::directory_iterator( GetDirectory() ) )
{
if ( entry.path().extension() == ".mh" )
vFiles.push_back( entry.path().filename().string() );
}
}
catch ( ... ) {}
std::sort( vFiles.begin() , vFiles.end() );
return vFiles;
}
}
namespace ConfigIO
{
inline auto ParseBool( const std::string& szValue ) -> bool
{
return szValue != "0";
}
inline auto ParseInt( const std::string& szValue ) -> int
{
return std::stoi( szValue );
}
inline auto ParseFloat( const std::string& szValue ) -> float
{
return std::stof( szValue );
}
inline auto ParseColor( const std::string& szValue ) -> ImVec4
{
ImVec4 vecColor{};
sscanf_s( szValue.c_str() , "%f,%f,%f,%f" , &vecColor.x , &vecColor.y , &vecColor.z , &vecColor.w );
return vecColor;
}
}
inline auto SaveConfig() -> bool
{
std::ofstream File( Config::GetFilePath() , std::ios::trunc );
if ( !File.is_open() )
return false;
File << "# Andromeda-CS2-Base config (.mh)\n";
#define MH_SEC( section ) File << "[" #section "]\n";
#define MH_WB( section , key ) File << #key "=" << ( Settings::section::key ? 1 : 0 ) << "\n";
#define MH_WI( section , key ) File << #key "=" << Settings::section::key << "\n";
#define MH_WF( section , key ) File << #key "=" << Settings::section::key << "\n";
#define MH_WC( section , key ) File << #key "=" << Settings::section::key.x << "," << Settings::section::key.y << "," << Settings::section::key.z << "," << Settings::section::key.w << "\n";
MH_SEC( Visual )
MH_WB( Visual , Active ) MH_WB( Visual , Team ) MH_WB( Visual , Enemy ) MH_WB( Visual , OnlyVisible )
MH_WB( Visual , PlayerBox ) MH_WB( Visual , BoneESP ) MH_WB( Visual , BoneESPTeam ) MH_WB( Visual , BoneESPEnemy )
MH_WB( Visual , Glow ) MH_WB( Visual , GlowTeam ) MH_WB( Visual , GlowEnemy )
MH_WB( Visual , NameESP ) MH_WB( Visual , HealthESP ) MH_WB( Visual , ArmorESP ) MH_WB( Visual , WeaponESP ) MH_WB( Visual , BombESP )
MH_WI( Visual , PlayerBoxType ) MH_WB( Visual , GlassyBox ) MH_WI( Visual , GlassOpacity )
MH_SEC( Chams )
MH_WB( Chams , Enabled ) MH_WB( Chams , IgnoreZ )
MH_WC( Chams , Visible ) MH_WC( Chams , Occluded )
MH_SEC( Menu )
MH_WI( Menu , MenuAlpha ) MH_WI( Menu , MenuStyle )
MH_SEC( Misc )
MH_WB( Misc , Bunnyhop ) MH_WB( Misc , PerfectBhop ) MH_WB( Misc , AutoStrafe ) MH_WB( Misc , NullStrafe )
MH_WB( Misc , SubtickStrafe ) MH_WB( Misc , WRelease ) MH_WB( Misc , InstantStrafe ) MH_WB( Misc , SnapTap )
MH_WB( Misc , JumpBug ) MH_WB( Misc , EdgeBug ) MH_WB( Misc , EdgeJump ) MH_WB( Misc , JumpCrouch )
MH_WB( Misc , Minijump ) MH_WB( Misc , FastStop ) MH_WB( Misc , LongJump ) MH_WB( Misc , PixelSurf )
MH_WB( Misc , SlowWalk ) MH_WB( Misc , NoFlash ) MH_WB( Misc , FOVChanger ) MH_WB( Misc , SpectatorList )
MH_WB( Misc , Watermark ) MH_WB( Misc , Hitmarker ) MH_WB( Misc , HitSound ) MH_WB( Misc , Speedometer )
MH_WI( Misc , FOV )
MH_SEC( Triggerbot )
MH_WB( Triggerbot , Active ) MH_WB( Triggerbot , ScopedOnly ) MH_WB( Triggerbot , IgnoreTeammates )
MH_WB( Triggerbot , Hitbox_Head ) MH_WB( Triggerbot , Hitbox_Chest ) MH_WB( Triggerbot , Hitbox_Stomach )
MH_WB( Triggerbot , Hitbox_Arms ) MH_WB( Triggerbot , Hitbox_Legs ) MH_WB( Triggerbot , DrawIndicator )
MH_WB( Triggerbot , SeedTrigger )
MH_WI( Triggerbot , Mode ) MH_WI( Triggerbot , Key ) MH_WI( Triggerbot , Delay ) MH_WI( Triggerbot , HoldTime )
MH_WI( Triggerbot , Hitchance ) MH_WI( Triggerbot , HitchanceSamples )
MH_SEC( Ragebot )
MH_WB( Ragebot , Active ) MH_WB( Ragebot , Hitbox_Head ) MH_WB( Ragebot , Hitbox_Neck )
MH_WB( Ragebot , Hitbox_Chest ) MH_WB( Ragebot , Hitbox_Stomach ) MH_WB( Ragebot , Hitbox_Pelvis )
MH_WB( Ragebot , Hitbox_Arms ) MH_WB( Ragebot , Hitbox_Legs ) MH_WB( Ragebot , Hitbox_Feet )
MH_WB( Ragebot , Recoil ) MH_WB( Ragebot , NoSpread ) MH_WB( Ragebot , AutoFire )
MH_WB( Ragebot , AutoStop ) MH_WB( Ragebot , AutoScope ) MH_WB( Ragebot , AutoCrouch )
MH_WB( Ragebot , IgnoreTeammates ) MH_WB( Ragebot , VisibleOnly )
MH_WB( Ragebot , DrawFov ) MH_WB( Ragebot , DrawTarget )
MH_WI( Ragebot , Mode ) MH_WI( Ragebot , Key ) MH_WI( Ragebot , TargetMode )
MH_WI( Ragebot , FOV ) MH_WI( Ragebot , MaxDistance ) MH_WI( Ragebot , HitboxMode )
MH_WI( Ragebot , PreferredHitbox ) MH_WI( Ragebot , Hitchance ) MH_WI( Ragebot , HitchanceSamples )
MH_WI( Ragebot , MinDamage ) MH_WI( Ragebot , Smooth ) MH_WI( Ragebot , AutoFireDelay )
MH_WF( Ragebot , RecoilScale )
MH_SEC( Legitbot )
MH_WB( Legitbot , Active ) MH_WB( Legitbot , FovSmooth ) MH_WB( Legitbot , Hitbox_Head )
MH_WB( Legitbot , Hitbox_Neck ) MH_WB( Legitbot , Hitbox_Chest ) MH_WB( Legitbot , Hitbox_Stomach )
MH_WB( Legitbot , Hitbox_Pelvis ) MH_WB( Legitbot , RCS ) MH_WB( Legitbot , RCS_FirstBullet )
MH_WB( Legitbot , IgnoreTeammates ) MH_WB( Legitbot , VisibleOnly )
MH_WB( Legitbot , DrawFov ) MH_WB( Legitbot , DrawTarget )
MH_WI( Legitbot , Mode ) MH_WI( Legitbot , Key ) MH_WI( Legitbot , FOV )
MH_WI( Legitbot , Smooth ) MH_WI( Legitbot , ReactionDelay ) MH_WI( Legitbot , TargetLockTime )
MH_WF( Legitbot , Jitter ) MH_WF( Legitbot , RCS_Scale )
MH_SEC( AntiAim )
MH_WB( AntiAim , Active ) MH_WB( AntiAim , YawEnabled ) MH_WB( AntiAim , PitchEnabled )
MH_WB( AntiAim , OnlyWhenTarget ) MH_WB( AntiAim , DisableWhileFiring ) MH_WB( AntiAim , DrawIndicator )
MH_WI( AntiAim , Mode ) MH_WI( AntiAim , Key ) MH_WI( AntiAim , YawType )
MH_WI( AntiAim , YawOffset ) MH_WI( AntiAim , JitterRange ) MH_WI( AntiAim , JitterDelay )
MH_WI( AntiAim , SpinSpeed ) MH_WI( AntiAim , PitchType ) MH_WI( AntiAim , PitchAngle )
MH_SEC( SafeMode )
MH_WB( SafeMode , Active ) MH_WB( SafeMode , DrawIndicator )
MH_SEC( Colors::Visual )
MH_WC( Colors::Visual , PlayerBoxTT ) MH_WC( Colors::Visual , PlayerBoxTT_Visible )
MH_WC( Colors::Visual , PlayerBoxCT ) MH_WC( Colors::Visual , PlayerBoxCT_Visible )
MH_WC( Colors::Visual , BoneESPTT ) MH_WC( Colors::Visual , BoneESPTT_Visible )
MH_WC( Colors::Visual , BoneESPCT ) MH_WC( Colors::Visual , BoneESPCT_Visible )
MH_WC( Colors::Visual , GlowTT ) MH_WC( Colors::Visual , GlowTT_Visible )
MH_WC( Colors::Visual , GlowCT ) MH_WC( Colors::Visual , GlowCT_Visible )
#undef MH_SEC
#undef MH_WB
#undef MH_WI
#undef MH_WF
#undef MH_WC
return true;
}
inline auto LoadConfig() -> bool
{
std::ifstream File( Config::GetFilePath() );
if ( !File.is_open() )
return false;
std::map<std::string , std::string> mValues;
std::string szSection;
std::string szLine;
while ( std::getline( File , szLine ) )
{
const auto pos = szLine.find_first_not_of( " \t\r" );
if ( pos == std::string::npos )
continue;
szLine.erase( 0 , pos );
if ( szLine.empty() || szLine[ 0 ] == '#' )
continue;
if ( szLine.front() == '[' && szLine.back() == ']' )
{
szSection = szLine.substr( 1 , szLine.size() - 2 );
continue;
}
const auto eq = szLine.find( '=' );
if ( eq == std::string::npos )
continue;
mValues[ szSection + "." + szLine.substr( 0 , eq ) ] = szLine.substr( eq + 1 );
}
#define MH_LB( section , key ) { const auto it = mValues.find( #section "." #key ); if ( it != mValues.end() ) Settings::section::key = ConfigIO::ParseBool( it->second ); }
#define MH_LI( section , key ) { const auto it = mValues.find( #section "." #key ); if ( it != mValues.end() ) Settings::section::key = ConfigIO::ParseInt( it->second ); }
#define MH_LF( section , key ) { const auto it = mValues.find( #section "." #key ); if ( it != mValues.end() ) Settings::section::key = ConfigIO::ParseFloat( it->second ); }
#define MH_LC( section , key ) { const auto it = mValues.find( #section "." #key ); if ( it != mValues.end() ) Settings::section::key = ConfigIO::ParseColor( it->second ); }
MH_LB( Visual , Active ) MH_LB( Visual , Team ) MH_LB( Visual , Enemy ) MH_LB( Visual , OnlyVisible )
MH_LB( Visual , PlayerBox ) MH_LB( Visual , BoneESP ) MH_LB( Visual , BoneESPTeam ) MH_LB( Visual , BoneESPEnemy )
MH_LB( Visual , Glow ) MH_LB( Visual , GlowTeam ) MH_LB( Visual , GlowEnemy )
MH_LB( Visual , NameESP ) MH_LB( Visual , HealthESP ) MH_LB( Visual , ArmorESP ) MH_LB( Visual , WeaponESP ) MH_LB( Visual , BombESP )
MH_LI( Visual , PlayerBoxType ) MH_LB( Visual , GlassyBox ) MH_LI( Visual , GlassOpacity )
MH_LB( Chams , Enabled ) MH_LB( Chams , IgnoreZ )
MH_LC( Chams , Visible ) MH_LC( Chams , Occluded )
MH_LI( Menu , MenuAlpha ) MH_LI( Menu , MenuStyle )
MH_LB( Misc , Bunnyhop ) MH_LB( Misc , PerfectBhop ) MH_LB( Misc , AutoStrafe ) MH_LB( Misc , NullStrafe )
MH_LB( Misc , SubtickStrafe ) MH_LB( Misc , WRelease ) MH_LB( Misc , InstantStrafe ) MH_LB( Misc , SnapTap )
MH_LB( Misc , JumpBug ) MH_LB( Misc , EdgeBug ) MH_LB( Misc , EdgeJump ) MH_LB( Misc , JumpCrouch )
MH_LB( Misc , Minijump ) MH_LB( Misc , FastStop ) MH_LB( Misc , LongJump ) MH_LB( Misc , PixelSurf )
MH_LB( Misc , SlowWalk ) MH_LB( Misc , NoFlash ) MH_LB( Misc , FOVChanger ) MH_LB( Misc , SpectatorList )
MH_LB( Misc , Watermark ) MH_LB( Misc , Hitmarker ) MH_LB( Misc , HitSound ) MH_LB( Misc , Speedometer )
MH_LI( Misc , FOV )
MH_LB( Triggerbot , Active ) MH_LB( Triggerbot , ScopedOnly ) MH_LB( Triggerbot , IgnoreTeammates )
MH_LB( Triggerbot , Hitbox_Head ) MH_LB( Triggerbot , Hitbox_Chest ) MH_LB( Triggerbot , Hitbox_Stomach )
MH_LB( Triggerbot , Hitbox_Arms ) MH_LB( Triggerbot , Hitbox_Legs ) MH_LB( Triggerbot , DrawIndicator )
MH_LB( Triggerbot , SeedTrigger )
MH_LI( Triggerbot , Mode ) MH_LI( Triggerbot , Key ) MH_LI( Triggerbot , Delay ) MH_LI( Triggerbot , HoldTime )
MH_LI( Triggerbot , Hitchance ) MH_LI( Triggerbot , HitchanceSamples )
MH_LB( Ragebot , Active ) MH_LB( Ragebot , Hitbox_Head ) MH_LB( Ragebot , Hitbox_Neck )
MH_LB( Ragebot , Hitbox_Chest ) MH_LB( Ragebot , Hitbox_Stomach ) MH_LB( Ragebot , Hitbox_Pelvis )
MH_LB( Ragebot , Hitbox_Arms ) MH_LB( Ragebot , Hitbox_Legs ) MH_LB( Ragebot , Hitbox_Feet )
MH_LB( Ragebot , Recoil ) MH_LB( Ragebot , NoSpread ) MH_LB( Ragebot , AutoFire )
MH_LB( Ragebot , AutoStop ) MH_LB( Ragebot , AutoScope ) MH_LB( Ragebot , AutoCrouch )
MH_LB( Ragebot , IgnoreTeammates ) MH_LB( Ragebot , VisibleOnly )
MH_LB( Ragebot , DrawFov ) MH_LB( Ragebot , DrawTarget )
MH_LI( Ragebot , Mode ) MH_LI( Ragebot , Key ) MH_LI( Ragebot , TargetMode )
MH_LI( Ragebot , FOV ) MH_LI( Ragebot , MaxDistance ) MH_LI( Ragebot , HitboxMode )
MH_LI( Ragebot , PreferredHitbox ) MH_LI( Ragebot , Hitchance ) MH_LI( Ragebot , HitchanceSamples )
MH_LI( Ragebot , MinDamage ) MH_LI( Ragebot , Smooth ) MH_LI( Ragebot , AutoFireDelay )
MH_LF( Ragebot , RecoilScale )
MH_LB( Legitbot , Active ) MH_LB( Legitbot , FovSmooth ) MH_LB( Legitbot , Hitbox_Head )
MH_LB( Legitbot , Hitbox_Neck ) MH_LB( Legitbot , Hitbox_Chest ) MH_LB( Legitbot , Hitbox_Stomach )
MH_LB( Legitbot , Hitbox_Pelvis ) MH_LB( Legitbot , RCS ) MH_LB( Legitbot , RCS_FirstBullet )
MH_LB( Legitbot , IgnoreTeammates ) MH_LB( Legitbot , VisibleOnly )
MH_LB( Legitbot , DrawFov ) MH_LB( Legitbot , DrawTarget )
MH_LI( Legitbot , Mode ) MH_LI( Legitbot , Key ) MH_LI( Legitbot , FOV )
MH_LI( Legitbot , Smooth ) MH_LI( Legitbot , ReactionDelay ) MH_LI( Legitbot , TargetLockTime )
MH_LF( Legitbot , Jitter ) MH_LF( Legitbot , RCS_Scale )
MH_LB( AntiAim , Active ) MH_LB( AntiAim , YawEnabled ) MH_LB( AntiAim , PitchEnabled )
MH_LB( AntiAim , OnlyWhenTarget ) MH_LB( AntiAim , DisableWhileFiring ) MH_LB( AntiAim , DrawIndicator )
MH_LI( AntiAim , Mode ) MH_LI( AntiAim , Key ) MH_LI( AntiAim , YawType )
MH_LI( AntiAim , YawOffset ) MH_LI( AntiAim , JitterRange ) MH_LI( AntiAim , JitterDelay )
MH_LI( AntiAim , SpinSpeed ) MH_LI( AntiAim , PitchType ) MH_LI( AntiAim , PitchAngle )
MH_LB( SafeMode , Active ) MH_LB( SafeMode , DrawIndicator )
MH_LC( Colors::Visual , PlayerBoxTT ) MH_LC( Colors::Visual , PlayerBoxTT_Visible )
MH_LC( Colors::Visual , PlayerBoxCT ) MH_LC( Colors::Visual , PlayerBoxCT_Visible )
MH_LC( Colors::Visual , BoneESPTT ) MH_LC( Colors::Visual , BoneESPTT_Visible )
MH_LC( Colors::Visual , BoneESPCT ) MH_LC( Colors::Visual , BoneESPCT_Visible )
MH_LC( Colors::Visual , GlowTT ) MH_LC( Colors::Visual , GlowTT_Visible )
MH_LC( Colors::Visual , GlowCT ) MH_LC( Colors::Visual , GlowCT_Visible )
#undef MH_LB
#undef MH_LI
#undef MH_LF
#undef MH_LC
return true;
}
}