Add 'MainViewOrigin()' and 'MainViewAngles()'

Implemented g_vecRenderOrigin and g_vecRenderAngles to SDK.
This commit is contained in:
Kawe Mazidjatari 2022-07-25 12:46:57 +02:00
parent 2db57b15fc
commit 799dac882a
7 changed files with 73 additions and 1 deletions

View File

@ -98,9 +98,12 @@
#include "game/server/detour_impl.h"
#include "game/server/fairfight_impl.h"
#include "game/server/gameinterface.h"
#include "public/include/edict.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "game/client/view.h"
#endif // !DEDICATED
#include "public/include/edict.h"
#ifndef DEDICATED
#include "public/include/idebugoverlay.h"
#include "inputsystem/inputsystem.h"
#include "windows/id3dx.h"

View File

@ -0,0 +1,19 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
//===========================================================================//
#include "core/stdafx.h"
#include "mathlib/vector.h"
#include "game/client/view.h"
const Vector3D& MainViewOrigin()
{
return (*g_vecRenderOrigin);
}
const QAngle& MainViewAngles()
{
return (*g_vecRenderAngles);
}

34
r5dev/game/client/view.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef CL_VIEW_H
#define CL_VIEW_H
const Vector3D& MainViewOrigin();
const QAngle& MainViewAngles();
inline Vector3D* g_vecRenderOrigin = nullptr;
inline QAngle* g_vecRenderAngles = nullptr;
///////////////////////////////////////////////////////////////////////////////
class V_View : public IDetour
{
virtual void GetAdr(void) const
{
spdlog::debug("| VAR: g_vecRenderOrigin : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_vecRenderOrigin));
spdlog::debug("| VAR: g_vecRenderAngles : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_vecRenderAngles));
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
{
CMemory base = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x74\x24\x00\x57\x48\x83\xEC\x30\xF3\x0F\x10\x05\x00\x00\x00\x00\x00\x8B\x00"), "xxxx?xxxxxxxxx?????x?");
g_vecRenderOrigin = base.Offset(0x00).FindPatternSelf("F3 0F 10 05").ResolveRelativeAddressSelf(0x4, 0x8).RCast<Vector3D*>();
g_vecRenderAngles = base.Offset(0x30).FindPatternSelf("F3 0F 10 0D").ResolveRelativeAddressSelf(0x4, 0x8).RCast<QAngle*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
REGISTER(V_View);
#endif // CL_VIEW_H

View File

@ -53,6 +53,7 @@
<ClCompile Include="..\gameui\IBrowser.cpp" />
<ClCompile Include="..\game\client\c_baseentity.cpp" />
<ClCompile Include="..\game\client\spritemodel.cpp" />
<ClCompile Include="..\game\client\view.cpp" />
<ClCompile Include="..\game\shared\animation.cpp" />
<ClCompile Include="..\inputsystem\inputsystem.cpp" />
<ClCompile Include="..\launcher\IApplication.cpp" />
@ -194,6 +195,7 @@
<ClInclude Include="..\game\client\c_baseplayer.h" />
<ClInclude Include="..\game\client\enginesprite.h" />
<ClInclude Include="..\game\client\hud.h" />
<ClInclude Include="..\game\client\view.h" />
<ClInclude Include="..\game\shared\animation.h" />
<ClInclude Include="..\inputsystem\ButtonCode.h" />
<ClInclude Include="..\inputsystem\inputsystem.h" />

View File

@ -558,6 +558,9 @@
<ClCompile Include="..\game\client\c_baseentity.cpp">
<Filter>sdk\game\client</Filter>
</ClCompile>
<ClCompile Include="..\game\client\view.cpp">
<Filter>sdk\game\client</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -1640,6 +1643,9 @@
<ClInclude Include="..\public\include\ivscript.h">
<Filter>sdk\public\include</Filter>
</ClInclude>
<ClInclude Include="..\game\client\view.h">
<Filter>sdk\game\client</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">

View File

@ -55,6 +55,7 @@
<ClCompile Include="..\gameui\IBrowser.cpp" />
<ClCompile Include="..\game\client\c_baseentity.cpp" />
<ClCompile Include="..\game\client\spritemodel.cpp" />
<ClCompile Include="..\game\client\view.cpp" />
<ClCompile Include="..\game\server\ai_network.cpp" />
<ClCompile Include="..\game\server\ai_networkmanager.cpp" />
<ClCompile Include="..\game\server\ai_utility.cpp" />
@ -205,6 +206,7 @@
<ClInclude Include="..\game\client\c_baseplayer.h" />
<ClInclude Include="..\game\client\enginesprite.h" />
<ClInclude Include="..\game\client\hud.h" />
<ClInclude Include="..\game\client\view.h" />
<ClInclude Include="..\game\server\ai_network.h" />
<ClInclude Include="..\game\server\ai_networkmanager.h" />
<ClInclude Include="..\game\server\ai_node.h" />

View File

@ -594,6 +594,9 @@
<ClCompile Include="..\game\client\c_baseentity.cpp">
<Filter>sdk\game\client</Filter>
</ClCompile>
<ClCompile Include="..\game\client\view.cpp">
<Filter>sdk\game\client</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -1724,6 +1727,9 @@
<ClInclude Include="..\public\include\ivscript.h">
<Filter>sdk\public\include</Filter>
</ClInclude>
<ClInclude Include="..\game\client\view.h">
<Filter>sdk\game\client</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">