mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-27 15:25:36 +03:00
Load gamerules address and offsets
This commit is contained in:
parent
f31e0e405f
commit
483ef98af3
@ -40,6 +40,18 @@
|
|||||||
"read" "2"
|
"read" "2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"g_pGameRules"
|
||||||
|
{
|
||||||
|
"signature" "g_pGameRules"
|
||||||
|
|
||||||
|
"windows"
|
||||||
|
{
|
||||||
|
"read" "2"
|
||||||
|
}
|
||||||
|
|
||||||
|
"read" "0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"Signatures"
|
"Signatures"
|
||||||
@ -66,6 +78,14 @@
|
|||||||
"linux" "@realtime"
|
"linux" "@realtime"
|
||||||
"mac" "@realtime"
|
"mac" "@realtime"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"g_pGameRules" // CGameRules *g_pGameRules
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x8B\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\xFF\x2A\x2A\xA1" // StartFrame()
|
||||||
|
"linux" "@g_pGameRules"
|
||||||
|
"mac" "@g_pGameRules"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,12 @@
|
|||||||
#include "sh_stack.h"
|
#include "sh_stack.h"
|
||||||
|
|
||||||
IGameConfig *CommonConfig;
|
IGameConfig *CommonConfig;
|
||||||
|
IGameConfig *GamerulesConfig;
|
||||||
IGameConfigManager *ConfigManager;
|
IGameConfigManager *ConfigManager;
|
||||||
|
|
||||||
HLTypeConversion TypeConversion;
|
HLTypeConversion TypeConversion;
|
||||||
|
void *GameRulesReferenceAddress;
|
||||||
|
void *GameRulesAddress;
|
||||||
|
|
||||||
void OnAmxxAttach()
|
void OnAmxxAttach()
|
||||||
{
|
{
|
||||||
@ -39,13 +42,25 @@ void OnAmxxAttach()
|
|||||||
|
|
||||||
ConfigManager = MF_GetConfigManager();
|
ConfigManager = MF_GetConfigManager();
|
||||||
|
|
||||||
char error[256];
|
char error[256] = "";
|
||||||
error[0] = '\0';
|
|
||||||
|
|
||||||
if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof(error)) && error[0] != '\0')
|
if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof(error)) && error[0] != '\0')
|
||||||
{
|
{
|
||||||
MF_Log("Could not read common.games gamedata: %s", error);
|
MF_Log("get/set_ent_data* natives have been disabled because common.games gamedata could not be read: %s", error);
|
||||||
MF_Log("get/set/find_ent_data* natives have been disabled");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*error = '\0';
|
||||||
|
|
||||||
|
if (!ConfigManager->LoadGameConfigFile("common.games/gamerules.games", &GamerulesConfig, error, sizeof(error)) && error[0] != '\0')
|
||||||
|
{
|
||||||
|
MF_Log("get/set_gamerules_* natives have been disabled because common.games/gamerules.games gamedata could not be read: %s", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CommonConfig->GetAddress("g_pGameRules", &GameRulesReferenceAddress) || !GameRulesReferenceAddress)
|
||||||
|
{
|
||||||
|
MF_Log("get/set_gamerules_* natives have been disabled because g_pGameRules address could not be found. ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +78,9 @@ extern ke::Vector<KVD_Wrapper *> g_FreeKVDWs;
|
|||||||
|
|
||||||
void OnAmxxDetach()
|
void OnAmxxDetach()
|
||||||
{
|
{
|
||||||
|
ConfigManager->CloseGameConfigFile(CommonConfig);
|
||||||
|
ConfigManager->CloseGameConfigFile(GamerulesConfig);
|
||||||
|
|
||||||
while (!g_FreeTRs.empty())
|
while (!g_FreeTRs.empty())
|
||||||
{
|
{
|
||||||
delete g_FreeTRs.front();
|
delete g_FreeTRs.front();
|
||||||
@ -78,6 +96,11 @@ void OnAmxxDetach()
|
|||||||
|
|
||||||
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||||
{
|
{
|
||||||
|
if (GameRulesReferenceAddress)
|
||||||
|
{
|
||||||
|
GameRulesAddress = **reinterpret_cast<void***>(GameRulesReferenceAddress);
|
||||||
|
}
|
||||||
|
|
||||||
g_pFunctionTable_Post->pfnServerDeactivate = FMH_ServerDeactivate_Post;
|
g_pFunctionTable_Post->pfnServerDeactivate = FMH_ServerDeactivate_Post;
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,11 @@ extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
|||||||
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||||
|
|
||||||
extern IGameConfig *CommonConfig;
|
extern IGameConfig *CommonConfig;
|
||||||
|
extern IGameConfig *GamerulesConfig;
|
||||||
extern IGameConfigManager *ConfigManager;
|
extern IGameConfigManager *ConfigManager;
|
||||||
|
|
||||||
extern HLTypeConversion TypeConversion;
|
extern HLTypeConversion TypeConversion;
|
||||||
|
extern void *GameRulesAddress;
|
||||||
|
|
||||||
#endif //_FAKEMETA_INCLUDE_H
|
#endif //_FAKEMETA_INCLUDE_H
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user