1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

- fixed shutdown crash

- fixed makefile for linux

--HG--
branch : sourcemm-1.6.0
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.6.0%40440
This commit is contained in:
David Anderson 2007-09-29 15:01:32 +00:00
parent 73f5615aa3
commit 337e319616
6 changed files with 44 additions and 8 deletions

View File

@ -53,7 +53,7 @@ all:
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
ln -sf $(SMM_ROOT)/sourcehook/sourcehook.cpp sourcehook.cpp
$(MAKE) sourcemm
$(MAKE) -f Makefile.ep1 sourcemm
rm -rf $(BINARY)
ln -sf $(BIN_DIR)/$(BINARY) $(BINARY)
@ -61,7 +61,7 @@ sourcemm: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
debug:
$(MAKE) all DEBUG=true
$(MAKE) -f Makefile.ep1 all DEBUG=true
default: all

View File

@ -80,6 +80,37 @@ void SMConVarAccessor::MarkCommandsAsGameDLL()
}
}
void SMConVarAccessor::UnregisterGameDLLCommands()
{
ConCommandBase *begin = icvar->GetCommands();
ConCommandBase *iter = begin;
ConCommandBase *prev = NULL;
while (iter)
{
/* Watch out for the ETERNAL COMMAND! */
if (iter != &s_EternalCommand && iter->IsBitSet(FCVAR_GAMEDLL))
{
/* Remove it! */
if (iter == begin)
{
s_EternalCommand.BringToFront();
iter = const_cast<ConCommandBase*>(iter->GetNext());
s_EternalCommand.SetNext(iter);
prev = &s_EternalCommand;
continue;
}
else
{
iter = const_cast<ConCommandBase*>(iter->GetNext());
prev->SetNext(iter);
continue;
}
}
prev = iter;
iter = const_cast<ConCommandBase*>(iter->GetNext());
}
}
void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
{
ConCommandBase *ptr = icvar->GetCommands();

View File

@ -85,6 +85,12 @@ void BaseProvider::Notify_DLLInit_Pre(void *gamedll,
ConCommandBaseMgr::OneTimeInit(&g_SMConVarAccessor);
}
void BaseProvider::Notify_DLLShutdown_Pre()
{
g_SMConVarAccessor.MarkCommandsAsGameDLL();
g_SMConVarAccessor.UnregisterGameDLLCommands();
}
bool BaseProvider::IsRemotePrintingAvailable()
{
return (echo_msg_func != NULL);

View File

@ -28,6 +28,7 @@ public:
virtual void Notify_DLLInit_Pre(void *gamedll,
CreateInterfaceFn engineFactory,
CreateInterfaceFn serverFactory);
void Notify_DLLShutdown_Pre();
virtual void ServerCommand(const char *cmd);
virtual ConVar *CreateConVar(const char *name,
const char *defval,

View File

@ -54,7 +54,6 @@ struct game_dll_t
CreateInterfaceFn factory;
};
SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
String mod_path;
String metamod_path;
String full_bin_path;
@ -662,8 +661,6 @@ bool Handler_DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsF
physics_factory = physicsFactory;
gpGlobals = pGlobals;
g_GameDllPatch = SH_GET_CALLCLASS(server);
provider->Notify_DLLInit_Pre(server, engineFactory, gamedll_info.factory);
metamod_version = provider->CreateConVar("metamod_version",
@ -724,10 +721,9 @@ void Handler_DLLShutdown()
/* Unload plugins */
g_PluginMngr.UnloadAll();
SH_CALL(g_GameDllPatch, &IServerGameDLL::DLLShutdown)();
provider->Notify_DLLShutdown_Pre();
SH_RELEASE_CALLCLASS(g_GameDllPatch);
g_GameDllPatch = NULL;
SH_CALL(server, &IServerGameDLL::DLLShutdown)();
g_SourceHook.CompleteShutdown();

View File

@ -163,6 +163,8 @@ namespace SourceMM
CreateInterfaceFn engineFactory,
CreateInterfaceFn serverFactory) =0;
virtual void Notify_DLLShutdown_Pre() =0;
/**
* @brief Wrapper around IVEngineServer::ServerCommand()
*