r5sdk/r5dev/game/client/movehelper_client.h
Kawe Mazidjatari a618990937 Detour code refactor
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.
2023-01-25 02:26:52 +01:00

52 lines
1.6 KiB
C++
Raw Permalink Blame History

//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef MOVEHELPER_CLIENT_H
#define MOVEHELPER_CLIENT_H
#include "tier1/utlvector.h"
#include "public/gametrace.h"
#include "game/shared/imovehelper.h"
#include "c_baseplayer.h"
class CMoveHelperClient : public IMoveHelper
{
// results, tallied on client and server, but only used by server to run SV_Impact.
// we store off our velocity in the trace_t structure so that we can determine results
// of shoving boxes etc. around.
struct touchlist_t
{
Vector3D deltavelocity;
trace_t trace;
};
CUtlVector<touchlist_t> m_TouchList;
C_BaseEntity* m_pHost;
};
IMoveHelper* MoveHelperClient();
extern CMoveHelperClient* s_MoveHelperClient;
///////////////////////////////////////////////////////////////////////////////
class VMoveHelperClient : public IDetour
{
virtual void GetAdr(void) const
{
LogVarAdr("s_MoveHelperClient", reinterpret_cast<uintptr_t>(s_MoveHelperClient));
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
{
CMemory pFunc = g_GameDll.FindPatternSIMD("40 53 48 83 EC 30 80 3D ?? ?? ?? ?? ?? 48 8B D9 74 1A");
s_MoveHelperClient = pFunc.FindPattern("4C 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CMoveHelperClient*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
#endif // MOVEHELPER_CLIENT_H