diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 70394a54..f594a8dc 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -108,19 +108,22 @@ namespace game const char* description)> Dvar_RegisterBool{ 0x1422D0900, 0x14057B500 }; - WEAK symbol Dvar_SessionModeRegisterBool{ 0x1422D0D40, 0x14057BAA0 }; + WEAK symbol Dvar_SessionModeSetDefaultBool{ + 0x1422D0E90, 0x14057BCE0 + }; WEAK symbol Dvar_RegisterString{ 0x1422D0B70 }; - WEAK symbol Dvar_ForEach{0x1422BCD00}; + WEAK symbol Dvar_ForEach{0x1422BCD00}; WEAK symbol Dvar_SetFromStringByName{ 0x1422C7500 }; - WEAK symbol Dvar_GetSessionModeSpecificDvar{ + WEAK symbol Dvar_GetSessionModeSpecificDvar{ 0x1422BF500, 0x140575D90 }; diff --git a/src/client/game/utils.cpp b/src/client/game/utils.cpp index 13923087..ed5642f2 100644 --- a/src/client/game/utils.cpp +++ b/src/client/game/utils.cpp @@ -38,7 +38,7 @@ namespace game return dvar->current.value.enabled; } - dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description) + dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description, const eModes mode) { const auto hash = Dvar_GenerateHash(dvar_name); auto registered_dvar = Dvar_SessionModeRegisterBool(hash, dvar_name, value, flags, description); @@ -46,6 +46,18 @@ namespace game if (registered_dvar) { registered_dvar->debugName = dvar_name; + + if (mode == MODE_COUNT) + { + for (int i = MODE_FIRST; i < MODE_COUNT; ++i) + { + game::Dvar_SessionModeSetDefaultBool.call_safe(hash, value, static_cast(i)); + } + } + else + { + game::Dvar_SessionModeSetDefaultBool.call_safe(hash, value, mode); + } } return registered_dvar; diff --git a/src/client/game/utils.hpp b/src/client/game/utils.hpp index abef6952..07ffc164 100644 --- a/src/client/game/utils.hpp +++ b/src/client/game/utils.hpp @@ -9,7 +9,7 @@ namespace game bool get_dvar_bool(const char* dvar_name); dvar_t* register_dvar_bool(const char* dvar_name, bool value, dvarFlags_e flags, const char* description); - dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description); + dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description, const eModes mode = MODE_COUNT); void dvar_add_flags(const char* dvar, dvarFlags_e flags); void dvar_set_flags(const char* dvar_name, dvarFlags_e flags); }