mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files. Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer. TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
86 lines
2.4 KiB
C++
86 lines
2.4 KiB
C++
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
|
||
//
|
||
// Purpose:
|
||
//
|
||
// $NoKeywords: $
|
||
//
|
||
//=============================================================================//
|
||
#if !defined( USERCMD_H )
|
||
#define USERCMD_H
|
||
#ifdef _WIN32
|
||
#pragma once
|
||
#endif
|
||
|
||
#include "public/utility/memaddr.h"
|
||
#include "mathlib/vector.h"
|
||
|
||
//-------------------------------------------------------------------------------------
|
||
// Forward declarations
|
||
//-------------------------------------------------------------------------------------
|
||
class CUserCmd;
|
||
|
||
inline CMemory p_CUserCmd__Reset;
|
||
inline auto v_CUserCmd__Reset = p_CUserCmd__Reset.RCast<void(*)(CUserCmd* pUserCmd)>();
|
||
|
||
inline CMemory p_CUserCmd__Copy;
|
||
inline auto v_CUserCmd__Copy = p_CUserCmd__Copy.RCast<CUserCmd*(*)(CUserCmd* pDest, CUserCmd* pSource)>();
|
||
|
||
//-------------------------------------------------------------------------------------
|
||
//
|
||
//-------------------------------------------------------------------------------------
|
||
class CUserCmd
|
||
{
|
||
public:
|
||
CUserCmd() // Cannot be constructed during DLL init.
|
||
{
|
||
v_CUserCmd__Reset(this);
|
||
}
|
||
|
||
CUserCmd* Copy(CUserCmd* pSource)
|
||
{
|
||
return v_CUserCmd__Copy(this, pSource);
|
||
}
|
||
|
||
int32_t command_number;
|
||
int32_t tick_count;
|
||
float curtime;
|
||
QAngle viewangles;
|
||
char pad_0x0018[12];
|
||
float forwardmove;
|
||
float sidemove;
|
||
float upmove;
|
||
int32_t buttons;
|
||
char pad_0x0034[336];
|
||
int32_t randomseed;
|
||
char pad_0x0188[8];
|
||
Vector3D headposition;
|
||
float maxpitch;
|
||
char pad_0x01A0[60];
|
||
};
|
||
|
||
|
||
///////////////////////////////////////////////////////////////////////////////
|
||
class VUserCmd : public IDetour
|
||
{
|
||
virtual void GetAdr(void) const
|
||
{
|
||
LogFunAdr("CUserCmd::Reset", p_CUserCmd__Reset.GetPtr());
|
||
LogFunAdr("CUserCmd::Copy", p_CUserCmd__Copy.GetPtr());
|
||
}
|
||
virtual void GetFun(void) const
|
||
{
|
||
p_CUserCmd__Reset = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 83 FD FF 74 0A").FollowNearCallSelf();
|
||
v_CUserCmd__Reset = p_CUserCmd__Reset.RCast<void(*)(CUserCmd*)>();
|
||
|
||
p_CUserCmd__Copy = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 4C 8B 9B ?? ?? ?? ??").FollowNearCallSelf();
|
||
v_CUserCmd__Copy = p_CUserCmd__Copy.RCast<CUserCmd* (*)(CUserCmd*, CUserCmd*)>();
|
||
}
|
||
virtual void GetVar(void) const { }
|
||
virtual void GetCon(void) const { }
|
||
virtual void Attach(void) const { }
|
||
virtual void Detach(void) const { }
|
||
};
|
||
///////////////////////////////////////////////////////////////////////////////
|
||
|
||
#endif // USERCMD_H
|