Merge pull request #351 from Brentdevent/dvar_patches

Remove schedule delay dvar patches
This commit is contained in:
Maurice Heumann 2023-03-17 07:49:51 +01:00 committed by GitHub
commit 853f429834
4 changed files with 21 additions and 8 deletions

View File

@ -13,16 +13,11 @@ namespace dvars_patches
{ {
void patch_dvars() void patch_dvars()
{ {
if (game::is_server()) game::register_sessionmode_dvar_bool("com_pauseSupported", !game::is_server(), game::DVAR_SERVERINFO, "Whether is pause is ever supported by the game mode");
{
game::register_dvar_bool("com_pauseSupported", false, game::DVAR_NONE, "Whether is pause is ever supported by the game mode");
}
} }
void patch_flags() void patch_flags()
{ {
game::dvar_set_flags("com_pauseSupported", game::DVAR_SERVERINFO);
if (game::is_client()) if (game::is_client())
{ {
game::dvar_set_flags("r_dof_enable", game::DVAR_ARCHIVE); game::dvar_set_flags("r_dof_enable", game::DVAR_ARCHIVE);
@ -65,8 +60,8 @@ namespace dvars_patches
public: public:
void post_unpack() override void post_unpack() override
{ {
patch_dvars(); scheduler::once(patch_dvars, scheduler::pipeline::main);
scheduler::once(patch_flags, scheduler::pipeline::main, 10s); scheduler::once(patch_flags, scheduler::pipeline::main);
if (game::is_server()) if (game::is_server())
{ {

View File

@ -108,6 +108,10 @@ namespace game
const char* description)> Dvar_RegisterBool{ const char* description)> Dvar_RegisterBool{
0x1422D0900, 0x14057B500 0x1422D0900, 0x14057B500
}; };
WEAK symbol<dvar_t* (dvarStrHash_t hash, const char* dvarName, bool value, dvarFlags_e flags,
const char* description)> Dvar_SessionModeRegisterBool{
0x1422D0D40, 0x14057BAA0
};
WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, const char* value, dvarFlags_e flags, WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, const char* value, dvarFlags_e flags,
const char* description)> Dvar_RegisterString{ const char* description)> Dvar_RegisterString{
0x1422D0B70 0x1422D0B70

View File

@ -38,6 +38,19 @@ namespace game
return dvar->current.value.enabled; 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)
{
const auto hash = Dvar_GenerateHash(dvar_name);
auto registered_dvar = Dvar_SessionModeRegisterBool(hash, dvar_name, value, flags, description);
if (registered_dvar)
{
registered_dvar->debugName = dvar_name;
}
return registered_dvar;
}
dvar_t* register_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description) dvar_t* register_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description)
{ {
const auto hash = Dvar_GenerateHash(dvar_name); const auto hash = Dvar_GenerateHash(dvar_name);

View File

@ -9,6 +9,7 @@ namespace game
bool get_dvar_bool(const char* dvar_name); 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_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);
void dvar_add_flags(const char* dvar, dvarFlags_e flags); void dvar_add_flags(const char* dvar, dvarFlags_e flags);
void dvar_set_flags(const char* dvar_name, dvarFlags_e flags); void dvar_set_flags(const char* dvar_name, dvarFlags_e flags);
} }