mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Detour 'Physics_RunThinkFunctions'
Hook will be used to run simulation for bots.
This commit is contained in:
parent
e7522ce0d6
commit
82c914c2fd
@ -109,6 +109,7 @@
|
||||
#include "game/server/fairfight_impl.h"
|
||||
#include "game/server/gameinterface.h"
|
||||
#include "game/server/movehelper_server.h"
|
||||
#include "game/server/physics_main.h"
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
#include "game/client/viewrender.h"
|
||||
@ -212,6 +213,8 @@ void Systems_Init()
|
||||
Persistence_Attach();
|
||||
IVEngineServer_Attach();
|
||||
CServerGameDLL_Attach();
|
||||
|
||||
Physics_Main_Attach();
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
SQAPI_Attach();
|
||||
@ -347,6 +350,8 @@ void Systems_Shutdown()
|
||||
Persistence_Detach();
|
||||
IVEngineServer_Detach();
|
||||
CServerGameDLL_Detach();
|
||||
|
||||
Physics_Main_Detach();
|
||||
#endif // !CLIENT_DLL
|
||||
SQAPI_Detach();
|
||||
SQVM_Detach();
|
||||
|
28
r5dev/game/server/physics_main.cpp
Normal file
28
r5dev/game/server/physics_main.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||
//
|
||||
// Purpose: Physics simulation for non-havok/ipion objects
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "core/stdafx.h"
|
||||
#include "player.h"
|
||||
#include "physics_main.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Runs the main physics simulation loop against all entities ( except players )
|
||||
//-----------------------------------------------------------------------------
|
||||
void Physics_RunThinkFunctions(bool bSimulating)
|
||||
{
|
||||
v_Physics_RunThinkFunctions(bSimulating);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void Physics_Main_Attach()
|
||||
{
|
||||
DetourAttach(&v_Physics_RunThinkFunctions, &Physics_RunThinkFunctions);
|
||||
}
|
||||
|
||||
void Physics_Main_Detach()
|
||||
{
|
||||
DetourDetach(&v_Physics_RunThinkFunctions, &Physics_RunThinkFunctions);
|
||||
}
|
36
r5dev/game/server/physics_main.h
Normal file
36
r5dev/game/server/physics_main.h
Normal file
@ -0,0 +1,36 @@
|
||||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#ifndef PHYSICS_MAIN_H
|
||||
#define PHYSICS_MAIN_H
|
||||
|
||||
inline CMemory p_Physics_RunThinkFunctions;
|
||||
inline auto v_Physics_RunThinkFunctions = p_Physics_RunThinkFunctions.RCast<void (*)(bool bSimulating)>();
|
||||
|
||||
void Physics_Main_Attach();
|
||||
void Physics_Main_Detach();
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VPhysics_Main : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
spdlog::debug("| FUN: Physics_RunThinkFunctions : {:#18x} |\n", p_Physics_RunThinkFunctions.GetPtr());
|
||||
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
p_Physics_RunThinkFunctions = g_GameDll.FindPatternSIMD("88 4C 24 08 55 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ??");
|
||||
v_Physics_RunThinkFunctions = p_Physics_RunThinkFunctions.RCast<void (*)(bool)>();
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(VPhysics_Main);
|
||||
#endif // PHYSICS_MAIN_H
|
@ -187,6 +187,7 @@
|
||||
<ClInclude Include="..\game\server\gameinterface.h" />
|
||||
<ClInclude Include="..\game\server\movehelper_server.h" />
|
||||
<ClInclude Include="..\game\server\networkproperty.h" />
|
||||
<ClInclude Include="..\game\server\physics_main.h" />
|
||||
<ClInclude Include="..\game\server\player.h" />
|
||||
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
||||
<ClInclude Include="..\game\shared\animation.h" />
|
||||
@ -556,6 +557,7 @@
|
||||
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
||||
<ClCompile Include="..\game\server\movehelper_server.cpp" />
|
||||
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
||||
<ClCompile Include="..\game\server\physics_main.cpp" />
|
||||
<ClCompile Include="..\game\server\player.cpp" />
|
||||
<ClCompile Include="..\game\shared\animation.cpp" />
|
||||
<ClCompile Include="..\game\shared\collisionproperty.cpp" />
|
||||
|
@ -1371,6 +1371,9 @@
|
||||
<ClInclude Include="..\game\shared\imovehelper.h">
|
||||
<Filter>sdk\game\shared</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\server\physics_main.h">
|
||||
<Filter>sdk\game\server</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common\opcodes.cpp">
|
||||
@ -1730,6 +1733,9 @@
|
||||
<ClCompile Include="..\game\server\movehelper_server.cpp">
|
||||
<Filter>sdk\game\server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\game\server\physics_main.cpp">
|
||||
<Filter>sdk\game\server</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Dedicated.def" />
|
||||
|
@ -72,6 +72,7 @@
|
||||
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
||||
<ClCompile Include="..\game\server\movehelper_server.cpp" />
|
||||
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
||||
<ClCompile Include="..\game\server\physics_main.cpp" />
|
||||
<ClCompile Include="..\game\server\player.cpp" />
|
||||
<ClCompile Include="..\game\shared\ai_utility_shared.cpp" />
|
||||
<ClCompile Include="..\game\shared\animation.cpp" />
|
||||
@ -265,6 +266,7 @@
|
||||
<ClInclude Include="..\game\server\gameinterface.h" />
|
||||
<ClInclude Include="..\game\server\movehelper_server.h" />
|
||||
<ClInclude Include="..\game\server\networkproperty.h" />
|
||||
<ClInclude Include="..\game\server\physics_main.h" />
|
||||
<ClInclude Include="..\game\server\player.h" />
|
||||
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
||||
<ClInclude Include="..\game\shared\ai_utility_shared.h" />
|
||||
|
@ -717,6 +717,9 @@
|
||||
<ClCompile Include="..\game\client\movehelper_client.cpp">
|
||||
<Filter>sdk\game\client</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\game\server\physics_main.cpp">
|
||||
<Filter>sdk\game\server</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -2093,6 +2096,9 @@
|
||||
<ClInclude Include="..\game\client\movehelper_client.h">
|
||||
<Filter>sdk\game\client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\game\server\physics_main.h">
|
||||
<Filter>sdk\game\server</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user