2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
2022-02-19 02:31:16 +01:00
|
|
|
#include "engine/common.h"
|
2023-05-10 00:05:38 +02:00
|
|
|
#include "public/appframework/IAppSystem.h"
|
|
|
|
#include "public/appframework/IAppSystemGroup.h"
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
class CSourceAppSystemGroup : public CAppSystemGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static bool StaticPreInit(CSourceAppSystemGroup* pSourceAppSystemGroup);
|
|
|
|
static bool StaticCreate(CSourceAppSystemGroup* pSourceAppSystemGroup);
|
|
|
|
|
|
|
|
private:
|
|
|
|
CFileSystem_Stdio* m_pFileSystem;
|
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
class CModAppSystemGroup : public CAppSystemGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static int StaticMain(CModAppSystemGroup* pModAppSystemGroup);
|
|
|
|
static bool StaticCreate(CModAppSystemGroup* pModAppSystemGroup);
|
|
|
|
static void InitPluginSystem(CModAppSystemGroup* pModAppSystemGroup);
|
|
|
|
|
2023-06-18 22:06:25 +02:00
|
|
|
inline bool IsServerOnly(void) const
|
2023-05-10 00:05:38 +02:00
|
|
|
{
|
|
|
|
return m_bServerOnly;
|
|
|
|
}
|
2023-06-18 22:06:25 +02:00
|
|
|
inline void SetServerOnly(void)
|
2023-05-10 00:05:38 +02:00
|
|
|
{
|
|
|
|
m_bServerOnly = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_bServerOnly;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ==== CAPPSYSTEMGROUP ================================================================================================================================================= */
|
2024-01-02 15:21:36 +01:00
|
|
|
inline int(*CModAppSystemGroup__Main)(CModAppSystemGroup* pModAppSystemGroup);
|
|
|
|
inline bool(*CModAppSystemGroup__Create)(CModAppSystemGroup* pModAppSystemGroup);
|
2023-07-02 23:01:29 +02:00
|
|
|
inline bool(*CSourceAppSystemGroup__PreInit)(CSourceAppSystemGroup* pModAppSystemGroup);
|
|
|
|
inline bool(*CSourceAppSystemGroup__Create)(CSourceAppSystemGroup* pModAppSystemGroup);
|
2023-05-10 00:05:38 +02:00
|
|
|
|
|
|
|
inline bool g_bAppSystemInit = false;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
/* ==== UTILITY ========================================================================================================================================================= */
|
2023-07-02 23:01:29 +02:00
|
|
|
inline int(*Sys_Error_Internal)(char* fmt, va_list args);
|
2022-02-19 02:31:16 +01:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline bool* gfExtendedError = nullptr;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
int HSys_Error_Internal(char* fmt, va_list args);
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VSys_Dll : public IDetour
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
LogFunAdr("CModAppSystemGroup::Main", CModAppSystemGroup__Main);
|
|
|
|
LogFunAdr("CModAppSystemGroup::Create", CModAppSystemGroup__Create);
|
|
|
|
LogFunAdr("CSourceAppSystemGroup::PreInit", CSourceAppSystemGroup__PreInit);
|
|
|
|
LogFunAdr("CSourceAppSystemGroup::Create", CSourceAppSystemGroup__Create);
|
|
|
|
LogFunAdr("Sys_Error_Internal", Sys_Error_Internal);
|
|
|
|
LogVarAdr("gfExtendedError", gfExtendedError);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 80 B9 ?? ?? ?? ?? ?? BB ?? ?? ?? ??").GetPtr(CModAppSystemGroup__Main);
|
|
|
|
g_GameDll.FindPatternSIMD("48 8B C4 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60").GetPtr(CModAppSystemGroup__Create);
|
2023-05-10 00:05:38 +02:00
|
|
|
|
2024-01-02 15:21:36 +01:00
|
|
|
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F9 E8 ?? ?? ?? ?? 33 C9").GetPtr(CSourceAppSystemGroup__Create);
|
|
|
|
g_GameDll.FindPatternSIMD("48 89 74 24 ?? 55 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ??").GetPtr(CSourceAppSystemGroup__PreInit);
|
2023-05-10 00:05:38 +02:00
|
|
|
|
2024-01-02 15:21:36 +01:00
|
|
|
g_GameDll.FindPatternSIMD("48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 ?? ?? 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48").GetPtr(Sys_Error_Internal);
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
gfExtendedError = CMemory(v_COM_ExplainDisconnection).Offset(0x0)
|
|
|
|
.FindPatternSelf("C6 05", CMemory::Direction::DOWN, 300).ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
2023-11-26 13:21:20 +01:00
|
|
|
virtual void Detour(const bool bAttach) const;
|
2021-12-25 22:36:38 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|