Add 'CAppSystemGroup::Destroy' callback

* Add hook for 'CAppSystemGroup::Destroy'.
* Moved 'IAppSystem.h' header file to public.
This commit is contained in:
Kawe Mazidjatari 2023-01-30 21:22:17 +01:00
parent c84622cfd6
commit f0512d7f92
13 changed files with 117 additions and 17 deletions

View File

@ -7,7 +7,7 @@
#ifndef ENGINE_LAUNCHER_APIH
#define ENGINE_LAUNCHER_APIH
#include "appframework/iappsystem.h"
#include "public/appframework/IAppSystem.h"
struct StartupInfo_t
{

View File

@ -116,6 +116,7 @@ bool CModAppSystemGroup::Create(CModAppSystemGroup* pModAppSystemGroup)
return CModAppSystemGroup_Create(pModAppSystemGroup);
}
//-----------------------------------------------------------------------------
// Purpose: Initialize plugin system
//-----------------------------------------------------------------------------

View File

@ -1,10 +1,11 @@
#pragma once
#include "appframework/iappsystem.h"
#include "public/appframework/IAppSystem.h"
#include "public/appframework/IAppSystemGroup.h"
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class CModAppSystemGroup
class CModAppSystemGroup : public CAppSystemGroup
{
public:
static int Main(CModAppSystemGroup* pModAppSystemGroup);
@ -19,8 +20,8 @@ public:
{
m_bServerOnly = true;
}
private:
char pad[0xA8];
bool m_bServerOnly;
};

View File

@ -0,0 +1,27 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: Defines a group of app systems that all have the same lifetime
// that need to be connected/initialized, etc. in a well-defined order
//
// $Revision: $
// $NoKeywords: $
//===========================================================================//
#include "core/stdafx.h"
#include "IAppSystemGroup.h"
//-----------------------------------------------------------------------------
// Purpose: Initialize plugin system
//-----------------------------------------------------------------------------
void CAppSystemGroup::Destroy(CAppSystemGroup* pModAppSystemGroup)
{
CAppSystemGroup_Destroy(pModAppSystemGroup);
}
void VAppSystemGroup::Attach(void) const
{
DetourAttach(&CAppSystemGroup_Destroy, &CAppSystemGroup::Destroy);
}
void VAppSystemGroup::Detach(void) const
{
DetourDetach(&CAppSystemGroup_Destroy, &CAppSystemGroup::Destroy);
}

View File

@ -0,0 +1,38 @@
#ifndef APPSYSTEMGROUP_H
#define APPSYSTEMGROUP_H
class CAppSystemGroup
{
public:
static void Destroy(CAppSystemGroup* pAppSystemGroup);
protected:
char pad[0xA8];
};
inline CMemory p_CAppSystemGroup_Destroy;
inline auto CAppSystemGroup_Destroy = p_CAppSystemGroup_Destroy.RCast<void(*)(CAppSystemGroup* pAppSystemGroup)>();
///////////////////////////////////////////////////////////////////////////////
class VAppSystemGroup : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("CAppSystemGroup::Destroy", p_CAppSystemGroup_Destroy.GetPtr());
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_CAppSystemGroup_Destroy = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 83 EC 20 8B 81 ?? ?? ?? ??");
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_CAppSystemGroup_Destroy = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 8B 81 ?? ?? ?? ?? 48 8B F9");
#endif
CAppSystemGroup_Destroy = p_CAppSystemGroup_Destroy.RCast<void(*)(CAppSystemGroup*)>();
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const;
virtual void Detach(void) const;
};
#endif // APPSYSTEMGROUP_H

View File

@ -3,8 +3,8 @@
#include <tier0/annotations.h>
#include <tier0/threadtools.h>
#include <appframework/iappsystem.h>
#include <public/ipackedstore.h>
#include <public/appframework/iappsystem.h>
typedef void* FileHandle_t;
typedef void* FileNameHandle_t; // !TODO: Check if this is 4 or 8 bytes (model_t was 4 bytes in mem).

View File

@ -105,6 +105,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp" />
<ClCompile Include="..\public\datamap.cpp" />
<ClCompile Include="..\public\dt_recv.cpp" />
<ClCompile Include="..\public\networkvar.cpp" />
@ -170,7 +171,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\appframework\engine_launcher_api.h" />
<ClInclude Include="..\appframework\iappsystem.h" />
<ClInclude Include="..\bsplib\bsplib.h" />
<ClInclude Include="..\client\cdll_engine_int.h" />
<ClInclude Include="..\client\vengineclient_impl.h" />
@ -290,6 +290,8 @@
<ClInclude Include="..\protoc\cl_rcon.pb.h" />
<ClInclude Include="..\protoc\sig_map.pb.h" />
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\appframework\IAppSystem.h" />
<ClInclude Include="..\public\appframework\IAppSystemGroup.h" />
<ClInclude Include="..\public\avi\iavi.h" />
<ClInclude Include="..\public\avi\ibik.h" />
<ClInclude Include="..\public\basehandle.h" />

View File

@ -241,6 +241,9 @@
<Filter Include="sdk\public\engine">
<UniqueIdentifier>{c785a075-5583-4bb4-bdac-5f7419ee64ab}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\public\appframework">
<UniqueIdentifier>{87c9d891-5df4-445a-941a-b479d8ce0436}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\client\cdll_engine_int.cpp">
@ -675,6 +678,9 @@
<ClCompile Include="..\tier1\NetAdr.cpp">
<Filter>sdk\tier1</Filter>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp">
<Filter>sdk\public\appframework</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -1220,9 +1226,6 @@
<ClInclude Include="..\common\netmessages.h">
<Filter>sdk\common</Filter>
</ClInclude>
<ClInclude Include="..\appframework\iappsystem.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
<ClInclude Include="..\appframework\engine_launcher_api.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
@ -1985,6 +1988,12 @@
<ClInclude Include="..\tier1\NetAdr.h">
<Filter>sdk\tier1</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystemGroup.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystem.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">

View File

@ -125,7 +125,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\appframework\engine_launcher_api.h" />
<ClInclude Include="..\appframework\iappsystem.h" />
<ClInclude Include="..\bsplib\bsplib.h" />
<ClInclude Include="..\client\cdll_engine_int.h" />
<ClInclude Include="..\common\igameserverdata.h" />
@ -237,6 +236,8 @@
<ClInclude Include="..\protoc\cl_rcon.pb.h" />
<ClInclude Include="..\protoc\sig_map.pb.h" />
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\appframework\IAppSystem.h" />
<ClInclude Include="..\public\appframework\IAppSystemGroup.h" />
<ClInclude Include="..\public\basehandle.h" />
<ClInclude Include="..\public\bspflags.h" />
<ClInclude Include="..\public\cmodel.h" />
@ -609,6 +610,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp" />
<ClCompile Include="..\public\datamap.cpp" />
<ClCompile Include="..\public\networkvar.cpp" />
<ClCompile Include="..\public\utility\binstream.cpp" />

View File

@ -196,6 +196,9 @@
<Filter Include="sdk\public\engine">
<UniqueIdentifier>{3760be6a-7ccb-4ad7-bba8-608dcc60a6b5}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\public\appframework">
<UniqueIdentifier>{55c87120-310f-4eb5-81b9-3d8912b1dfb4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\opcodes.h">
@ -672,9 +675,6 @@
<ClInclude Include="..\common\netmessages.h">
<Filter>sdk\common</Filter>
</ClInclude>
<ClInclude Include="..\appframework\iappsystem.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
<ClInclude Include="..\appframework\engine_launcher_api.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
@ -1386,6 +1386,12 @@
<ClInclude Include="..\tier1\NetAdr.h">
<Filter>sdk\tier1</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystemGroup.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystem.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common\opcodes.cpp">
@ -1769,6 +1775,9 @@
<ClCompile Include="..\tier1\NetAdr.cpp">
<Filter>sdk\tier1</Filter>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp">
<Filter>sdk\public\appframework</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\Dedicated.def" />

View File

@ -122,6 +122,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp" />
<ClCompile Include="..\public\datamap.cpp" />
<ClCompile Include="..\public\dt_recv.cpp" />
<ClCompile Include="..\public\networkvar.cpp" />
@ -189,7 +190,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\appframework\engine_launcher_api.h" />
<ClInclude Include="..\appframework\iappsystem.h" />
<ClInclude Include="..\bsplib\bsplib.h" />
<ClInclude Include="..\client\cdll_engine_int.h" />
<ClInclude Include="..\client\vengineclient_impl.h" />
@ -336,6 +336,8 @@
<ClInclude Include="..\protoc\cl_rcon.pb.h" />
<ClInclude Include="..\protoc\sig_map.pb.h" />
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\appframework\IAppSystem.h" />
<ClInclude Include="..\public\appframework\IAppSystemGroup.h" />
<ClInclude Include="..\public\avi\iavi.h" />
<ClInclude Include="..\public\avi\ibik.h" />
<ClInclude Include="..\public\basehandle.h" />

View File

@ -250,6 +250,9 @@
<Filter Include="sdk\public\engine">
<UniqueIdentifier>{027d27a1-089a-4ea1-b764-1b436c6d20a2}</UniqueIdentifier>
</Filter>
<Filter Include="sdk\public\appframework">
<UniqueIdentifier>{0c992b91-3491-4337-a630-c789e2654bc2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\client\vengineclient_impl.cpp">
@ -741,6 +744,9 @@
<ClCompile Include="..\engine\server\sv_rcon.cpp">
<Filter>sdk\engine\server</Filter>
</ClCompile>
<ClCompile Include="..\public\appframework\IAppSystemGroup.cpp">
<Filter>sdk\public\appframework</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -1292,9 +1298,6 @@
<ClInclude Include="..\common\netmessages.h">
<Filter>sdk\common</Filter>
</ClInclude>
<ClInclude Include="..\appframework\iappsystem.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
<ClInclude Include="..\appframework\engine_launcher_api.h">
<Filter>sdk\appframework</Filter>
</ClInclude>
@ -2156,6 +2159,12 @@
<ClInclude Include="..\engine\server\sv_rcon.h">
<Filter>sdk\engine\server</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystemGroup.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
<ClInclude Include="..\public\appframework\IAppSystem.h">
<Filter>sdk\public\appframework</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">