mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
commit 4da14d7ddecc0d8c322fc7ee372be67481fb0b99 Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Sat Jan 15 20:13:11 2022 +0100 Cleaned up native server browser and commented functions. commit b366e4ce826c9c7dbeb2af26cb6c34656b2c93f2 Author: r-ex <67599507+r-ex@users.noreply.github.com> Date: Sat Jan 15 17:57:18 2022 +0000 sq server browser clean up (#63) * sq server browser clean up * Properly loop through std::vector on GetAvailableMaps. Co-authored-by: IcePixelx <41352111+PixieCore@users.noreply.github.com> commit 829e122cead5521d5ffa57daa7e9fbd10755d68f Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Sat Jan 15 15:25:19 2022 +0100 SQ Serverbrowser V1 push. Clean-up following after @r-ex fixed SQ things. commit 29fe6be989f176321406e4e521da406e65229acd Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Fri Jan 14 20:59:06 2022 +0100 Fix pre-compiled headers for imgui_utility.cpp commit f2f8a088bfbc8b7311f2efb402963eb3b0802a46 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 20:51:32 2022 +0100 Fix compiler error caused merge from separate branch commit 1c5df4e178a29234139c3ebf06b25fcd795689ea Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 20:45:36 2022 +0100 Ansi terminal color support + big optimizations on all log systems + 'Warning()' hook * Ansi colors can now be enabled with the '-ansiclr- flag. * All loggers have been optimized and are all initialized only once at process startup. * New hook for 'Warning()' print function with warning level. commit 012a317c846ba4fcf727ffb97678ee080f2dd976 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 15:39:09 2022 +0100 Update init.cpp commit a14480e7cfdb869d222da04275f2619ca1405ce3 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 15:38:48 2022 +0100 Update stdafx.h commit bdc67e90cb5624ee5d9f8a3620fe64a0d80726a5 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 15:37:08 2022 +0100 Set default spdlog level to trace commit 96ee434d4e58a79a091cb0fee0caa5d838f629df Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 14 15:36:51 2022 +0100 Fix missing header errors for SpdLog commit 6bbb16dcb9f821e6f71bbfa9f0b4b12167907f43 Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Fri Jan 14 20:39:11 2022 +0100 Fix sendrequest crash. Due to htResults being null. commit 5612c7a3a7e38f725b17e98d17d06f146135feae Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 12 13:11:11 2022 +0100 This seems no longer needed for dedicated servers Shader/texture assets are no longer loaded where the pointer parameters to the asset unloading function won't be out of scope anymore commit e6254e3a036b26a70b4dc29df7f8a5082a0f5297 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 12 13:09:06 2022 +0100 Fix issue with ImGui windows where input could loose focus and not work 'ImGui_ImplWin32_WndProcHandler' has to be called at all times from the HwndProc handler as it has to track all events to prevent issues with input. commit de3b3f53bd2c32015e9accaed873d06a722ab7da Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 12 02:53:07 2022 +0100 Optimizations + QoL improvements/cleanup * IConsole overlay now clears the oldest log entries to stay under the vector limit instead of clearing the whole vector. * IConsole code cleanup. * IBrowser code cleanup, reordered class methods. * Use ConVar utilities to get/set values for strings in IBrowser and IConsole. * New ConVar's for RUI console overlay to tweak colors. commit 44102abbcca2d088dcb253da8ec7c9b869064139 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon Jan 10 02:47:19 2022 +0100 Execute dev configs when '-devsdk' parameter is passed commit 8d1023212abd8e2b250f5fb7b33fdfa329b07b40 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon Jan 10 02:24:30 2022 +0100 Small alignment commit 38d9d431c9aaef1ede7b6ceb594aa9b9971c261f Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon Jan 10 02:03:31 2022 +0100 Fix potential bug where 'cm_return_false_cmdquery_all' cvar would never work commit c0f24e64ff04bacb8d5b51961de1687dfb75bc71 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon Jan 10 01:31:25 2022 +0100 Rename global cvar pointer commit 0146f22e0a8bcd7ec137bb205d117cea49f533dc Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon Jan 10 01:20:44 2022 +0100 Implement CommandLine utilities commit 64c07af6e067bc85385a78981d29770eebd3eb6b Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Sun Jan 9 17:17:05 2022 +0100 Cleanup to use new ConVar utilities commit 19f5010bd26e010746436766c05515dff85d7695 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Sun Jan 9 16:29:36 2022 +0100 Fix compiler error + rename debug dll's Rename for easier debugging and config separation commit c292d8ad46b22c7a34c6d3caf8143e131e8dd997 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Sun Jan 9 16:14:17 2022 +0100 Implement new ConVar features Slight cleanup with new ConVar features to be used throughout the SDK commit 0177c17da94dc977f85babe2aa8168cefb56bf45 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Sat Jan 8 02:05:33 2022 +0100 Draw simulation stats and GPU stats to debug text overlay commit 21a10e201b6ea7afd4ffdd7d6b9668806085b6a5 Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Sun Jan 9 14:36:22 2022 +0100 Typos. commit ae09372cc79053f5515529e403402494ffa6dfe4 Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Sun Jan 9 14:35:43 2022 +0100 Pylon system changes. commit 98a428ace9226442fa623a0870af9f7e12f35eb0 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Jan 7 01:03:35 2022 +0100 Fix S2 crash when launching a different version commit c98301d175b8b1b80b2f480bc29e0703cf12c350 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Jan 6 17:30:10 2022 +0100 Fix LZHAM recompiling pch for each implementation file commit b80be10c4dc2c1f27917cd68a2c4c47819ee5fe5 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Jan 6 15:08:39 2022 +0100 Compile LZHAM with the solution. Fix missing detours files for sdklauncher commit a0b7bbf3661cc9b4d2d0cdefe9050a78f1c2bc67 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Jan 6 02:22:28 2022 +0100 Compile Microsoft Detours with the solution commit 9a3175fb6df047445e26ca3d4692e42f01cbabc8 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Jan 6 01:51:55 2022 +0100 Fix console input text reclaim to reflect latest ImGui changes commit 556894b3e3d81e41fa461321a749f50aa0eb169f Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 5 23:50:14 2022 +0100 Add connect command fix back Accidentally removed. commit 1612c439d2bb68fea29b4804b67c7de7a2aeaed7 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 5 23:44:01 2022 +0100 Fix project filters commit 47fdd4211d3088a84aeb93e425288928d1b37e70 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 5 23:43:51 2022 +0100 Fix for S3 For some reason the same byte pattern wasn't found in the miles dll for the S3 game, even though they where identical. Changed the byte patterns to search for the last 2 bytes of the instruction as well and made the conditional jmp instructions, unconditional for making sure mileswin64.dll doesn't close the process when a debugger is found. commit d52bd5eeec4f9f86422b3864446521c4ca46f02b Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 5 22:56:49 2022 +0100 Initial support for S1 commit 7c3994dfc280d8312632c9256f40a776c13158a4 Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Wed Jan 5 19:23:53 2022 +0100 dedicated refuselist commit c486c2d59354b3672709013c24454017fdce5cf2 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Jan 5 02:07:37 2022 +0100 Portability to S2 completed CServer functions are evolving quite heavily over these seasons, so these need a bit of work commit fbcea85631fe9ee1b378a3fc6657908230b85403 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Tue Jan 4 12:11:59 2022 +0100 Fix compiler error caused by merging commits from different branches commit 84e7729ca045c05e4add7f05d09d032833e39a7b Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Tue Jan 4 11:53:54 2022 +0100 Add client and debug utilities + cleanup commit 477152b35443246dace6f5b4deccd52ea1cc6e9c Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Dec 31 03:45:48 2021 +0100 Fix compiler error commit 5f664d8e6ba9a2e0bd72c29c5f4ba5279e29e75a Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Fri Dec 31 03:41:33 2021 +0100 Create signatures for all used Dedicated functions commit 2c7ced128d8c48a5abf8fd64dbb06909dc632f35 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Dec 30 22:13:15 2021 +0100 Heavy dedicated cleanup * Since the material mode is set to '2', all of the render loops and shader loading functions are no longer called. These have all been removed. * Added description for patches that missed them * Traced root caller/cause for certain patches to skip even more unnecessary code and save more memory. commit 22c0b5c867664a2524c18d865dbc54ff067dda22 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Dec 30 17:20:41 2021 +0100 Dedicated server improvements commit 6d4f7e345f38872ce45751604b40871b969cec8f Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Dec 30 02:47:42 2021 +0100 Fix a typo commit 39a8a8fd30612522a274e1474c9a66e5019aeea3 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu Dec 30 02:36:43 2021 +0100 Implement patch to enable 'DrawAllOverlays()'. commit 83129e88f8a6033f8f4c13e3cac639097068cb3c Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 22:59:34 2021 +0100 Fix LLVM compiler error commit c48ed7f7a53a9985e3c2642db3639007d7c9129a Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 18:06:37 2021 +0100 Rename dedicated variables commit d1ba2bd56720a0776824a8e309d7d859704244bc Author: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Wed Dec 29 15:35:48 2021 +0100 Fixed changelevel, needs more research tho. commit 46950125716c05171f25a12d8805811112e90551 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 13:58:03 2021 +0100 Fix 'C_PropDoor' not spawning properly on the server commit 6a9a00735a9d4b8c415acc248c83e6e8d6dc2ff1 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 13:57:16 2021 +0100 Rename hooked command callbacks commit b514f928a69a9c4ac1d3d1e5c662f93a1f0d131d Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 02:16:21 2021 +0100 Use a separate executable for dedicated server The dedicated server still has directx dll imports which will cause issues with ReShade or 3DMigoto, or trying to load it on a headless machine with no directx installed. The imports have to be cleared to avoid issues. The most convenient approach is to do this with a separate exe rather then patching it in runtime. commit bc8f9400d3911e360757059700a31510e329546d Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Wed Dec 29 00:18:56 2021 +0100 Fix collisions for headless dedicated server commit 0e36aa647ffb15ca4f8c76b0431f7c3a83741d80 Author: Amos <48657826+Mauler125@users.noreply.github.com> Date: Tue Dec 28 20:19:17 2021 +0100 Dedicated without ShaderApi and DirectX pre-alpha The instruction at 'CalcPropStaticFrustumCull' [0x14028F3B0 + 0x5C7] moves RSP + 0x70 into the R13 register. RSP + 0x70 seems to contain a pointer to collission data for that particular prop model. When running NoShaderApi() and passing the dedicated server the '-noshaderapi' command line parameter, RSP + 0x70 will be a nullptr. This has to be fixed to have prop static collissions on the server.
192 lines
11 KiB
C++
192 lines
11 KiB
C++
#pragma once
|
|
#include "basetypes.h"
|
|
#include "ConCommand.h"
|
|
#include "mathlib/color.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Command to ConVars and ConCommands
|
|
//-----------------------------------------------------------------------------
|
|
// ConVar systems
|
|
#define FCVAR_NONE 0 // The default, no flags at all
|
|
#define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc.
|
|
#define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined.
|
|
#define FCVAR_GAMEDLL (1<<2) // defined by the game DLL
|
|
#define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL
|
|
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out.
|
|
|
|
// ConVar only
|
|
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
|
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
|
#define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc
|
|
#define FCVAR_NOTIFY (1<<8) // notifies players when changed
|
|
#define FCVAR_USERINFO (1<<9) // changes the client's info string
|
|
|
|
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
|
|
|
#define FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS (1<<10) // When on concommands this allows remote clients to execute this cmd on the server.
|
|
// We are changing the default behavior of concommands to disallow execution by remote clients without
|
|
// this flag due to the number existing concommands that can lag or crash the server when clients abuse them.
|
|
|
|
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
|
#define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar
|
|
|
|
// It's a ConVar that's shared between the client and the server.
|
|
// At signon, the values of all such ConVars are sent from the server to the client (skipped for local
|
|
// client, of course )
|
|
// If a change is requested it must come from the console (i.e., no remote client changes)
|
|
// If a value is changed while a server is active, it's replicated to all connected clients
|
|
#define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time
|
|
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
|
|
#define FCVAR_SS (1<<15) // causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated
|
|
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
|
|
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
|
|
#define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players
|
|
#define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars avaliable to customers
|
|
#define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload
|
|
#define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload
|
|
|
|
#define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server
|
|
#define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread
|
|
#define FCVAR_ARCHIVE_GAMECONSOLE (1<<24) // cvar written to config.cfg on the Xbox
|
|
|
|
#define FCVAR_SERVER_CAN_EXECUTE (1<<28) // the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd.
|
|
#define FCVAR_SERVER_CANNOT_QUERY (1<<29) // If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue).
|
|
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
|
|
|
|
/*
|
|
class ConVar : ConCommandBase, IConVar; [MI] (#classinformer)
|
|
dq offset ? ? _R4ConVar@@6B@; const ConVar::`RTTI Complete Object Locator'
|
|
|
|
dq offset ??_G__ExceptionPtr@@QEAAPEAXI@Z_0; 0 Index
|
|
dq offset sub_1401F9930
|
|
dq offset loc_14046FE90
|
|
dq offset ConVar__AddFlags
|
|
dq offset ConVar__RemoveFlags
|
|
dq offset sub_14046FEA0
|
|
dq offset loc_14046FF70
|
|
dq offset ConVar__GetHelpString
|
|
dq offset sub_14046FEC0
|
|
dq offset sub_14046FEE0
|
|
dq offset ConVar__IsRegistered
|
|
dq offset ConVar__GetDllIdentifier
|
|
dq offset sub_14046F3F0
|
|
dq offset sub_14046F470
|
|
dq offset ConVar__InternalSetFloatValue; The one below also does something similar
|
|
dq offset sub_140470340
|
|
dq offset sub_140470420; Seems to be InternalSetInt below maybe ?
|
|
dq offset sub_140470510
|
|
dq offset nullsub
|
|
dq offset sub_140470300
|
|
dq offset sub_1404701A0
|
|
dq offset RegisterConVar; #STR: "Convar '%s' is flagged as both FCVAR_ARCHIVE and FCVAR_ARC
|
|
*/
|
|
|
|
class ConVar
|
|
{
|
|
public:
|
|
ConVar(void){};
|
|
ConVar(const char* pszName, const char* pszDefaultValue, int nFlags, const char*pszHelpString,
|
|
bool bMin, float fMin, bool bMax, float fMax, void* pCallback, void* unk);
|
|
~ConVar(void);
|
|
|
|
void Init(void);
|
|
|
|
const char* GetBaseName(void);
|
|
const char* GetHelpText(void);
|
|
|
|
void AddFlags(int nFlags);
|
|
void RemoveFlags(int nFlags);
|
|
|
|
bool IsRegistered(void);
|
|
|
|
bool GetBool(void);
|
|
float GetFloat(void);
|
|
int GetInt(void);
|
|
Color GetColor(void);
|
|
const char* GetString(void);
|
|
|
|
bool GetMin(float& flMinValue);
|
|
bool GetMax(float& flMaxValue);
|
|
float GetMinValue(void);
|
|
float GetMaxValue(void);
|
|
bool HasMin(void);
|
|
bool HasMax(void);
|
|
|
|
void SetValue(int nValue);
|
|
void SetValue(float flValue);
|
|
void SetValue(const char* pszValue);
|
|
void SetValue(Color clValue);
|
|
|
|
void Revert(void);
|
|
|
|
const char* GetDefault(void);
|
|
void SetDefault(const char* pszDefault);
|
|
|
|
void ChangeStringValue(const char* pszTempValue, float flOldValue);
|
|
bool SetColorFromString(const char* pszValue);
|
|
bool ClampValue(float& value);
|
|
|
|
static bool IsFlagSet(ConVar* pConVar, int nFlags);
|
|
void ClearHostNames(void);
|
|
|
|
ConCommandBase m_ConCommandBase {}; //0x0000
|
|
void* m_pConVarVTable {}; //0x0040
|
|
ConVar* m_pParent {}; //0x0048
|
|
const char* m_pszDefaultValue{}; //0x0050
|
|
const char* m_pzsCurrentValue{}; //0x0058
|
|
std::int64_t m_iStringLength {}; //0x0060
|
|
float m_flValue {}; //0x0068
|
|
int m_iValue {}; //0x006C
|
|
bool m_bHasMin {}; //0x0070
|
|
float m_flMinValue {}; //0x0074
|
|
bool m_bHasMax {}; //0x0078
|
|
float m_flMaxValue {}; //0x007C
|
|
char pad_0080[32] {}; //0x0080
|
|
}; //Size: 0x00A0
|
|
|
|
namespace
|
|
{
|
|
/* ==== ICONVAR ========================================================================================================================================================= */
|
|
ADDRESS p_IConVar_IsFlagSet = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x8B\x41\x48\x85\x50\x38", "xxxxxxx");
|
|
bool (*IConVar_IsFlagSet)(ConVar* pConVar, int nFlag) = (bool (*)(ConVar*, int))p_IConVar_IsFlagSet.GetPtr(); /*48 8B 41 48 85 50 38*/
|
|
|
|
ADDRESS p_ConVar_SetInfo = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x48\x83\xEC\x60\x48\x8B\xD9\xC6\x41\x10\x00\x33\xC9\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x4C\x24\x00\x0F\x57\xC0\x48\x89\x4C\x24\x00\x48\x89\x03\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x43\x40", "xxxxxxxxxxxxxxxxxx????xxxx?xxxxxxx?xxxxxx????xxxx");
|
|
void* (*ConVar_SetInfo)(void* a1, int a2, int a3, int a4, void* a5) = (void* (*)(void* a1, int a2, int a3, int a4, void* a5))p_ConVar_SetInfo.GetPtr(); /*40 53 48 83 EC 60 48 8B D9 C6 41 10 00 33 C9 48 8D 05 ? ? ? ? 48 89 4C 24 ? 0F 57 C0 48 89 4C 24 ? 48 89 03 48 8D 05 ? ? ? ? 48 89 43 40*/
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
ADDRESS p_ConVar_Register = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x48\x89\x6C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x83\xEC\x30\xF3\x0F\x10\x44\x24\x00", "xxxx?xxxx?xxxx?xxxx?xxxxxxxxxxx?"); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 83 EC 30 F3 0F 10 44 24 ?*/
|
|
void* (*ConVar_Register)(ConVar* allocatedConvar, const char* szName, const char* szDefaultValue, int nFlags, const char* szHelpString, bool bMin, float fMin, bool bMax, float fMax, void* pCallback, void* unk) = (void* (*)(ConVar*, const char*, const char*, int, const char*, bool, float, bool, float, void*, void*))p_ConVar_Register.GetPtr();
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
|
ADDRESS p_ConVar_Register = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x48\x89\x6C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x83\xEC\x40\xF3\x0F\x10\x84\x24\x00\x00\x00\x00", "xxxx?xxxx?xxxx?xxxxxxxxxx????"); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 40 F3 0F 10 84 24 ? ? ? ?*/
|
|
void* (*ConVar_Register)(ConVar* allocatedConvar, const char* szName, const char* szDefaultValue, int nFlags, const char* szHelpString, bool bMin, float fMin, bool bMax, float fMax, void* pCallback, void* unk) = (void* (*)(ConVar*, const char*, const char*, int, const char*, bool, float, bool, float, void*, void*))p_ConVar_Register.GetPtr();
|
|
#endif
|
|
}
|
|
|
|
namespace
|
|
{
|
|
ADDRESS g_pConVarVtable = p_ConVar_SetInfo.Offset(0x00).FindPatternSelf("48 8D 05", ADDRESS::Direction::DOWN, 100).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr(); // Get vtable ptr for ConVar table.
|
|
ADDRESS g_pIConVarVtable = p_ConVar_SetInfo.Offset(0x16).FindPatternSelf("48 8D 05", ADDRESS::Direction::DOWN, 100).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr(); // Get vtable ptr for ICvar table.
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void IConVar_Attach();
|
|
void IConVar_Detach();
|
|
|
|
extern ConVar* g_pConVar;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class HConVar : public IDetour
|
|
{
|
|
virtual void debugp()
|
|
{
|
|
std::cout << "| FUN: IConVar::IsFlagSet : 0x" << std::hex << std::uppercase << p_IConVar_IsFlagSet.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "| FUN: IConVar::SetInfo : 0x" << std::hex << std::uppercase << p_ConVar_SetInfo.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "| FUN: IConVar::Register : 0x" << std::hex << std::uppercase << p_ConVar_Register.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "| VAR: g_pConVarVtable : 0x" << std::hex << std::uppercase << g_pConVarVtable.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "| VAR: g_pIConVarVtable : 0x" << std::hex << std::uppercase << g_pIConVarVtable.GetPtr() << std::setw(npad) << " |" << std::endl;
|
|
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
|
}
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
REGISTER(HConVar);
|