Fix name dvar
This commit is contained in:
parent
c9a419e42b
commit
02fcebf24b
@ -49,6 +49,22 @@ namespace patches
|
|||||||
return std::string{username, username_len - 1};
|
return std::string{username, username_len - 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils::hook::detour com_register_dvars_hook;
|
||||||
|
|
||||||
|
void com_register_dvars_stub()
|
||||||
|
{
|
||||||
|
if (game::environment::is_mp())
|
||||||
|
{
|
||||||
|
// Make name save
|
||||||
|
dvars::register_string("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name.");
|
||||||
|
|
||||||
|
// Disable data validation error popup
|
||||||
|
dvars::register_int("data_validation_allow_drop", 0, 0, 0, game::DVAR_FLAG_NONE, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return com_register_dvars_hook.invoke<void>();
|
||||||
|
}
|
||||||
|
|
||||||
utils::hook::detour set_client_dvar_from_server_hook;
|
utils::hook::detour set_client_dvar_from_server_hook;
|
||||||
|
|
||||||
void set_client_dvar_from_server_stub(void* a1, void* a2, const char* dvar, const char* value)
|
void set_client_dvar_from_server_stub(void* a1, void* a2, const char* dvar, const char* value)
|
||||||
@ -151,6 +167,9 @@ namespace patches
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
|
// Register dvars
|
||||||
|
com_register_dvars_hook.create(SELECT_VALUE(0, 0x15BB60_b), &com_register_dvars_stub);
|
||||||
|
|
||||||
// Unlock fps in main menu
|
// Unlock fps in main menu
|
||||||
utils::hook::set<BYTE>(SELECT_VALUE(0, 0x34396B_b), 0xEB);
|
utils::hook::set<BYTE>(SELECT_VALUE(0, 0x34396B_b), 0xEB);
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ namespace game
|
|||||||
WEAK symbol<dvar_t*(int hash, const char* name, int value, int min, int max,
|
WEAK symbol<dvar_t*(int hash, const char* name, int value, int min, int max,
|
||||||
unsigned int flags)> Dvar_RegisterInt{0x0, 0x182A10};
|
unsigned int flags)> Dvar_RegisterInt{0x0, 0x182A10};
|
||||||
WEAK symbol<dvar_t*(int hash, const char* dvarName, float value, float min,
|
WEAK symbol<dvar_t*(int hash, const char* dvarName, float value, float min,
|
||||||
float max, unsigned int flags)> Dvar_RegisterFloat{0x0, 0x182900};
|
float max, unsigned int flags)> Dvar_RegisterFloat{0x0, 0x1827F0};
|
||||||
WEAK symbol<dvar_t*(int hash, const char* dvarName, const char* value,
|
WEAK symbol<dvar_t*(int hash, const char* dvarName, const char* value,
|
||||||
unsigned int flags)> Dvar_RegisterString{0x0, 0x182AF0};
|
unsigned int flags)> Dvar_RegisterString{0x0, 0x182BD0};
|
||||||
WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z,
|
WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z,
|
||||||
float w, float min, float max, unsigned int flags)> Dvar_RegisterVec4{0x0, 0x183010};
|
float w, float min, float max, unsigned int flags)> Dvar_RegisterVec4{0x0, 0x183010};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user