@@ -17,13 +17,8 @@ namespace profile_patches
1717 const char default_profile_config_name[] = " config_mp.cfg" ;
1818 const char custom_profile_config_name[] = " consolation_mp.cfg" ;
1919 const char decrypted_profile_config_name[] = " consolation_mp_decrypted.cfg" ;
20- constexpr int active_profile_index = 0 ;
21- constexpr auto live_clan_target_primary = 0x111CF170 ;
22- constexpr auto live_clan_target_secondary = 0x111F1C00 ;
23- constexpr auto clan_dirty_flags = 0x1149E6BC ;
2420 void print_profile_message (const char * fmt, ...);
2521 std::string build_profile_file_path (const char * filename);
26-
2722 const char * get_dvar_string (const std::size_t dvar_ptr_address)
2823 {
2924 const auto dvar = *reinterpret_cast <game::dvar_s**>(game::game_offset (dvar_ptr_address));
@@ -35,11 +30,6 @@ namespace profile_patches
3530 return dvar->current .string ;
3631 }
3732
38- const char * get_dvar_string (game::dvar_s* dvar)
39- {
40- return dvar && dvar->current .string ? dvar->current .string : " " ;
41- }
42-
4333 std::string join_path (const std::string& base, const std::string& leaf)
4434 {
4535 if (base.empty ())
@@ -185,54 +175,6 @@ namespace profile_patches
185175 return value.substr (first, last - first + 1 );
186176 }
187177
188- std::string normalize_clan_name (const std::string& raw_value)
189- {
190- std::string result{};
191- result.reserve (4 );
192-
193- for (const auto ch : raw_value)
194- {
195- if (result.size () >= 4 )
196- {
197- break ;
198- }
199-
200- const auto normalized = static_cast <unsigned char >(ch);
201- if (normalized < 32
202- || normalized == ' ^'
203- || normalized == 0xA4
204- || normalized == ' {'
205- || normalized == ' }'
206- || normalized == ' @' )
207- {
208- continue ;
209- }
210-
211- result.push_back (static_cast <char >(normalized));
212- }
213-
214- return trim_copy (result);
215- }
216-
217- bool is_developer_reserved_clan_tag (const std::string& clan_name)
218- {
219- static const std::unordered_set<std::string> reserved_tags =
220- {
221- " csl" ,
222- };
223-
224- return reserved_tags.find (to_lower (clan_name)) != reserved_tags.end ();
225- }
226-
227- void update_clan_name_state (const std::string& clan_name)
228- {
229- game::Dvar_SetString (" clanName" , clan_name.c_str ());
230- game::GamerProfile_UpdateProfileFromDvars (active_profile_index, 1 );
231- game::Live_UpdateClan (game::game_offset (live_clan_target_primary), clan_name.c_str ());
232- game::Live_UpdateClan (game::game_offset (live_clan_target_secondary), clan_name.c_str ());
233- *reinterpret_cast <std::uint32_t *>(game::game_offset (clan_dirty_flags)) |= 2u ;
234- }
235-
236178 const char * find_canonical_dvar_name (const std::string& key)
237179 {
238180 static const std::unordered_map<std::string, const char *> canonical_names =
@@ -576,8 +518,9 @@ namespace profile_patches
576518 public:
577519 void post_load () override
578520 {
579- // Keep the profile helper commands available, but avoid touching the
580- // stock signed-in config on the profile-login hot path.
521+ // Keep the profile helper commands available, but do not alter the
522+ // game's active config filename or save path automatically while we
523+ // investigate signed-in startup freezes.
581524
582525 scheduler::once ([]()
583526 {
@@ -588,41 +531,6 @@ namespace profile_patches
588531 migrate_config ();
589532 });
590533
591- command::add (" clanName" , [](const command::params& args)
592- {
593- auto * const clan_name = game::Dvar_FindVar (" clanName" );
594- if (!clan_name)
595- {
596- print_profile_message (" ^1clanName: dvar is unavailable\n " );
597- return ;
598- }
599-
600- if (args.size () < 2 )
601- {
602- print_profile_message (" ^3clanName: current tag is \" %s\"\n " , get_dvar_string (clan_name));
603- print_profile_message (" ^3usage: clanName <tag>\n " );
604- return ;
605- }
606-
607- const auto normalized = normalize_clan_name (args.join (1 ));
608- if (normalized.empty ())
609- {
610- print_profile_message (" ^1clanName: tag is empty or contains unsupported characters\n " );
611- return ;
612- }
613-
614- #ifndef DEBUG
615- if (is_developer_reserved_clan_tag (normalized))
616- {
617- print_profile_message (" ^1clanName: tag \" %s\" is reserved for developer builds\n " , normalized.c_str ());
618- return ;
619- }
620- #endif
621-
622- update_clan_name_state (normalized);
623- print_profile_message (" ^3clanName: set tag to \" %s\"\n " , normalized.c_str ());
624- });
625-
626534 command::add (" profile_convert_config" , []()
627535 {
628536 convert_config ();
@@ -657,6 +565,36 @@ namespace profile_patches
657565 });
658566 }, scheduler::main);
659567
568+ scheduler::loop ([]()
569+ {
570+ static std::string imported_profile{};
571+ static std::string missing_profile{};
572+
573+ const auto profile_name = get_profile_name ();
574+ if (profile_name.empty ())
575+ {
576+ return ;
577+ }
578+
579+ if (profile_name == imported_profile || profile_name == missing_profile)
580+ {
581+ return ;
582+ }
583+
584+ const auto source_path = get_custom_profile_import_path ();
585+ if (source_path.empty ())
586+ {
587+ missing_profile = profile_name;
588+ return ;
589+ }
590+
591+ if (import_custom_profile_config_into_stock ())
592+ {
593+ imported_profile = profile_name;
594+ missing_profile.clear ();
595+ }
596+ }, scheduler::main, 250ms);
597+
660598 scheduler::on_shutdown ([]()
661599 {
662600 export_stock_profile_config_to_custom ();
0 commit comments