More patches

This commit is contained in:
Joelrau 2021-01-01 17:40:13 +02:00
parent a5745d0525
commit 73a3cc7f61
4 changed files with 83 additions and 22 deletions

View File

@ -307,7 +307,7 @@ namespace command
static void add_commands_sp()
{
}
static void add_commands_mp()

View File

@ -19,6 +19,17 @@ namespace patches
return game::Dvar_FindVar("name")->current.string;
}
utils::hook::detour dvar_register_string_hook;
game::dvar_t* dvar_register_string(const char* name, const char* value, unsigned int flags, const char* description)
{
if (name == "name"s)
{
flags = 0x1;
}
return dvar_register_string_hook.invoke<game::dvar_t*>(name, value, flags, description);
}
game::dvar_t* register_com_maxfps_stub(const char* name, int /*value*/, int /*min*/, int /*max*/,
const unsigned int /*flags*/,
const char* description)
@ -83,9 +94,21 @@ namespace patches
LoadLibraryA("PhysXDevice64.dll");
LoadLibraryA("PhysXUpdateLoader64.dll");
// Edit dvars on create
dvar_register_string_hook.create(SELECT_VALUE(0x140372050, 0x1404C1450), &dvar_register_string);
// Unlock fps in main menu
utils::hook::set<BYTE>(SELECT_VALUE(0x140144F5B, 0x140213C3B), 0xEB);
// Unlock fps
utils::hook::call(SELECT_VALUE(0x1402F8726, 0x1403CF8CA), register_com_maxfps_stub);
// Unlock cg_fov
utils::hook::call(SELECT_VALUE(0x1400EF830, 0x140014F66), register_cg_fov_stub);
// Unlock cg_fovscale
utils::hook::call(SELECT_VALUE(0x140227599, 0x140014F9B), register_fovscale_stub);
// Patch Dvar_Command to print out values how CoD4 does it
utils::hook::jump(SELECT_VALUE(0x1402FB4C0, 0x1403D31C0), dvar_command_patch);
@ -95,18 +118,21 @@ namespace patches
{
SetThreadExecutionState(ES_DISPLAY_REQUIRED);
}, scheduler::pipeline::main);
if (game::environment::is_sp())
{
patch_sp();
}
else
{
patch_mp();
}
}
static void patch_mp()
{
// Unlock fps
utils::hook::call(0x1403CF8CA, register_com_maxfps_stub);
// Unlock cg_fov
utils::hook::call(0x140014F66, register_cg_fov_stub);
// Unlock cg_fovscale
utils::hook::call(0x140014F9B, register_fovscale_stub);
// Use name dvar
live_get_local_client_name_hook.create(0x1404D47F0, &live_get_local_client_name);
}
static void patch_sp()

View File

@ -699,16 +699,6 @@ namespace game
dvar_limits domain;
};
struct client_t
{
};
struct gentity_s
{
};
struct Material
{
const char* name;
@ -737,4 +727,35 @@ namespace game
Material* glowMaterial;
Glyph* glyphs;
};
struct client_t
{
};
namespace mp
{
struct gentity_s
{
};
}
namespace sp
{
struct gclient_s
{
};
struct gentity_s
{
int number;
};
struct playerState_s
{
};
}
}

View File

@ -23,9 +23,13 @@ namespace game
WEAK symbol<void(int localClientNum, int controllerIndex, const char* buffer,
void(int, int, const char*))> Cbuf_ExecuteBufferInternal{ 0x1402ED9A0, 0x1403AEE80 };
WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessage{ 0x1401A3050, 0x1400EE500 };
WEAK symbol<dvar_t* (const char* name)> Dvar_FindVar{ 0x140370860, 0x1404BF8B0 };
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{ 0x1402FB590, 0x1403D3290 };
WEAK symbol<void(const char* dvar, const char* buffer)> Dvar_SetCommand{ 0x1403730D0, 0x1404C2520 };
WEAK symbol<void(dvar_t* dvar, const char* string)> Dvar_SetString{ 0x140373DE0, 0x1404C3610 };
WEAK symbol<void(const char*, const char*, DvarSetSource)> Dvar_SetFromStringByNameFromSource{ 0x1403737D0, 0x1404C2E40 };
WEAK symbol<const char* (dvar_t* dvar, dvar_value value)> Dvar_ValueToString{ 0x140374E10, 0x1404C47B0 };
WEAK symbol<dvar_t* (const char* dvarName, bool value, unsigned int flags, const char* description)>
@ -36,6 +40,8 @@ namespace game
const char* description)> Dvar_RegisterFloat{ 0x140371C20, 0x1404C0FB0 };
WEAK symbol<dvar_t* (const char* dvarName, int value, int min, int max, unsigned int flags, const char* desc)>
Dvar_RegisterInt{ 0x140371CF0, 0x1404C1080 };
WEAK symbol<dvar_t* (const char* dvarName, const char* value, unsigned int flags, const char* description)>
Dvar_RegisterString{ 0x140372050, 0x1404C1450 };
WEAK symbol<dvar_t* (const char* dvarName, float x, float y, float z, float w, float min, float max,
unsigned int flags, const char* description)> Dvar_RegisterVec4{ 0x140372430, 0x1404C1800 };
@ -60,7 +66,7 @@ namespace game
WEAK symbol<void(int, int, const char*)> SV_GameSendServerCommand{ 0, 0x14043E120 };
WEAK symbol<const char* (int clientNum)> SV_GetGuid{ 0, 0x14043E1E0 };
WEAK symbol<void(int clientNum, const char* reason)> SV_KickClientNum{ 0, 0x1404377A0 };
WEAK symbol<bool()> SV_Loaded{ 0, 0x14043FA50 };
WEAK symbol<bool()> SV_Loaded{ 0x1403F42C0, 0x14043FA50 };
WEAK symbol<bool(const char* map) >SV_MapExists{ 0, 0x140437800 };
WEAK symbol<void(int localClientNum, const char* map)> SV_StartMap{ 0, 0x140438320 };
WEAK symbol<void(int localClientNum, const char* map, bool migrate)> SV_StartMapForParty{ 0, 0x140438490 };
@ -82,8 +88,16 @@ namespace game
WEAK symbol<int> dvarCount{ 0x14A7BFF34, 0x14B32AA30 };
WEAK symbol<dvar_t*> sortedDvars{ 0x14A7BFF50, 0x14B32AA50 };
WEAK symbol<gentity_s> g_entities{ 0x143C26DC0, 0x144758C70 };
WEAK symbol<int> svs_numclients{ 0, 0x1496C4B0C };
WEAK symbol<client_t> svs_clients{ 0, 0x1496C4B10 };
namespace mp
{
WEAK symbol<gentity_s> g_entities{ 0, 0x144758C70 };
}
namespace sp
{
WEAK symbol<gentity_s> g_entities{ 0x143C26DC0, 0 };
}
}