diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp index 23ffdd8..77f8799 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp @@ -73,6 +73,19 @@ auto CAndromedaClient::OnClientOutput() -> void auto CAndromedaClient::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void { + static bool bConfigLoaded = false; + + if ( !bConfigLoaded ) + { + bConfigLoaded = true; + + if ( Settings::Config::AutoLoadOnInject ) + { + Settings::Config::FileName = Settings::Config::AutoLoadFile; + Settings::LoadConfig(); + } + } + if ( !Settings::SafeMode::Active ) GetVisual()->OnCreateMove(); diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp index e3a3d27..54822f0 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp @@ -846,6 +846,40 @@ auto CAndromedaMenu::RenderConfigPanel() -> void Settings::LoadConfig(); } + ImGui::Separator(); + + Checkbox( "Beim Inject automatisch laden" , Settings::Config::AutoLoadOnInject ); + + if ( Settings::Config::AutoLoadOnInject ) + { + const auto vAutoFiles = Settings::Config::ListFiles(); + + std::vector vAutoItems; + + for ( const auto& file : vAutoFiles ) + vAutoItems.push_back( file.c_str() ); + + if ( vAutoItems.empty() ) + vAutoItems.push_back( "(keine .mh gefunden)" ); + + static int iAutoLoadIdx = -1; + + for ( int i = 0; i < static_cast( vAutoFiles.size() ); i++ ) + { + if ( vAutoFiles[ i ] == Settings::Config::AutoLoadFile ) + { + iAutoLoadIdx = i; + break; + } + } + + if ( Combo( "Auto-Load Datei" , iAutoLoadIdx , vAutoItems.data() , static_cast( vAutoItems.size() ) ) ) + { + if ( iAutoLoadIdx >= 0 && iAutoLoadIdx < static_cast( vAutoFiles.size() ) ) + Settings::Config::AutoLoadFile = vAutoFiles[ iAutoLoadIdx ]; + } + } + ImGui::SeparatorText( "Menu" ); SliderInt( "Menu Alpha" , Settings::Menu::MenuAlpha , 100 , 255 ); diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp index b83cafe..f111ac9 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp @@ -11,6 +11,8 @@ #include #include +#include + namespace Settings { namespace Visual @@ -238,6 +240,8 @@ namespace Settings namespace Config { inline std::string FileName = "default.mh"; + inline auto AutoLoadOnInject = false; + inline std::string AutoLoadFile = "default.mh"; inline auto GetDirectory() -> std::string { @@ -292,12 +296,12 @@ namespace Settings inline auto ParseInt( const std::string& szValue ) -> int { - return std::stoi( szValue ); + try { return std::stoi( szValue ); } catch ( ... ) { return 0; } } inline auto ParseFloat( const std::string& szValue ) -> float { - return std::stof( szValue ); + try { return std::stof( szValue ); } catch ( ... ) { return 0.f; } } inline auto ParseColor( const std::string& szValue ) -> ImVec4 @@ -389,6 +393,13 @@ namespace Settings MH_SEC( SafeMode ) MH_WB( SafeMode , Active ) MH_WB( SafeMode , DrawIndicator ) + MH_SEC( Skins ) + + for ( const auto& [ defIdx , paintKit ] : GetInventoryItemsManager()->GetWeaponSkinSelections() ) + File << "weapon_" << static_cast( defIdx ) << "=" << paintKit << "\n"; + + File << "music=" << GetInventoryItemsManager()->GetMusicSelection() << "\n"; + 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 ) @@ -510,6 +521,30 @@ namespace Settings MH_LC( Colors::Visual , GlowTT ) MH_LC( Colors::Visual , GlowTT_Visible ) MH_LC( Colors::Visual , GlowCT ) MH_LC( Colors::Visual , GlowCT_Visible ) + { + auto* pMgr = GetInventoryItemsManager(); + + auto& Selections = pMgr->GetWeaponSkinSelections(); + Selections.clear(); + + const std::string szPrefix = "Skins.weapon_"; + + for ( const auto& [ key , value ] : mValues ) + { + if ( key.rfind( szPrefix , 0 ) == 0 ) + { + const int defIdx = ConfigIO::ParseInt( key.substr( szPrefix.size() ) ); + + if ( defIdx >= 0 && defIdx <= 0xFFFF ) + Selections[ static_cast( defIdx ) ] = ConfigIO::ParseInt( value ); + } + else if ( key == "Skins.music" ) + { + pMgr->GetMusicSelection() = ConfigIO::ParseInt( value ); + } + } + } + #undef MH_LB #undef MH_LI #undef MH_LF