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