Merge pull request #55 from diamante0018/unlock-fps

Unlock max fps on mp
This commit is contained in:
Maurice Heumann 2022-03-23 12:54:40 +01:00 committed by GitHub
commit 7e2f7cd073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,8 @@ namespace game
Dvar_RegisterBool_t Dvar_RegisterBool;
Dvar_RegisterInt_t Dvar_RegisterInt;
Dvar_RegisterFloat_t Dvar_RegisterFloat;
Dvar_SetIntByName_t Dvar_SetIntByName;
@ -626,6 +628,8 @@ namespace game
native::Dvar_RegisterBool = native::Dvar_RegisterBool_t(SELECT_VALUE(0x4914D0, 0x5BE9F0, 0x0));
native::Dvar_RegisterInt = native::Dvar_RegisterInt_t(SELECT_VALUE(0x48CD40, 0x5BEA40, 0x0));
native::Dvar_RegisterFloat = native::Dvar_RegisterFloat_t(SELECT_VALUE(0x4F9CC0, 0x5BEA80, 0x0));
native::Dvar_SetIntByName = native::Dvar_SetIntByName_t(SELECT_VALUE(0x5396B0, 0x5BF560, 0x0));

View File

@ -27,6 +27,10 @@ namespace game
unsigned __int16 flags, const char* description);
extern Dvar_RegisterBool_t Dvar_RegisterBool;
typedef const dvar_t* (*Dvar_RegisterInt_t)(const char* dvarName, int value,
int min, int max, unsigned __int16 flags, const char* description);
extern Dvar_RegisterInt_t Dvar_RegisterInt;
typedef const dvar_t* (*Dvar_RegisterFloat_t)(const char* dvarName, float value,
float min, float max, unsigned __int16 flags, const char* description);
extern Dvar_RegisterFloat_t Dvar_RegisterFloat;

View File

@ -40,6 +40,8 @@ private:
void patch_mp() const
{
// Note: on SP it's already unlocked to 1000
utils::hook(0x55411F, &dvar_register_com_max_fps, HOOK_CALL).install()->quick();
}
void patch_dedi() const
@ -56,6 +58,12 @@ private:
longjmp(buf, value);
}
static const game::native::dvar_t* dvar_register_com_max_fps(const char* dvarName, int value,
int min, int /*max*/, unsigned __int16 flags, const char* description)
{
return game::native::Dvar_RegisterInt(dvarName, value, min, 1000, flags, description);
}
};
REGISTER_MODULE(patches)