fixed amb193
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40694
This commit is contained in:
parent
7b74745ceb
commit
f3da8efe10
@ -45,6 +45,7 @@ IdentityToken_t *g_pCoreIdent = NULL;
|
||||
float g_LastTime = 0.0f;
|
||||
float g_LastAuthCheck = 0.0f;
|
||||
IForward *g_pOnGameFrame = NULL;
|
||||
bool g_Loaded = false;
|
||||
|
||||
typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *);
|
||||
typedef unsigned int (*GETEXPORTCOUNT)();
|
||||
@ -188,15 +189,20 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t err_max, bool late)
|
||||
return false;
|
||||
}
|
||||
|
||||
StartSourceMod(late);
|
||||
/* Hook this now so we can detect startup without calling StartSourceMod() */
|
||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
|
||||
/* Only load if we're not late */
|
||||
if (!late)
|
||||
{
|
||||
StartSourceMod(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SourceModBase::StartSourceMod(bool late)
|
||||
{
|
||||
/* First initialize the global hooks we need */
|
||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
|
||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
|
||||
|
||||
@ -224,10 +230,20 @@ void SourceModBase::StartSourceMod(bool late)
|
||||
|
||||
/* Add us now... */
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
|
||||
/* We're loaded! */
|
||||
g_Loaded = true;
|
||||
}
|
||||
|
||||
bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
|
||||
{
|
||||
/* If we're not loaded... */
|
||||
if (!g_Loaded)
|
||||
{
|
||||
/* Do all global initialization now */
|
||||
StartSourceMod(true);
|
||||
}
|
||||
|
||||
m_IsMapLoading = true;
|
||||
m_ExecPluginReload = true;
|
||||
g_LastTime = 0.0f;
|
||||
@ -357,6 +373,10 @@ size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, c
|
||||
}
|
||||
|
||||
void SourceModBase::CloseSourceMod()
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
|
||||
if (g_Loaded)
|
||||
{
|
||||
if (g_pOnGameFrame)
|
||||
{
|
||||
@ -401,9 +421,9 @@ void SourceModBase::CloseSourceMod()
|
||||
gamedllPatch = NULL;
|
||||
}
|
||||
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SourceModBase::LevelInit, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
|
||||
}
|
||||
|
||||
/* Rest In Peace */
|
||||
ShutdownJIT();
|
||||
|
Loading…
Reference in New Issue
Block a user