mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-26 19:54:14 +01:00
Added unload logic for core and core-legacy; no crash on exit anymore
This commit is contained in:
parent
a08dc6056a
commit
08a462ac61
@ -1,5 +1,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "sourcemm.h"
|
#include "sourcemm.h"
|
||||||
|
#include "concommands.h"
|
||||||
#include <loader_bridge.h>
|
#include <loader_bridge.h>
|
||||||
|
|
||||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
@ -63,6 +64,19 @@ class VspBridge : public IVspBridge
|
|||||||
|
|
||||||
virtual void Unload()
|
virtual void Unload()
|
||||||
{
|
{
|
||||||
|
if (g_bIsTryingToUnload)
|
||||||
|
{
|
||||||
|
Error("Metamod:Source cannot be unloaded from VSP mode. Use \"meta unload\" to unload specific plugins.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (g_plugin_unload != NULL)
|
||||||
|
{
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads, false);
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads_Post, true);
|
||||||
|
g_plugin_unload = NULL;
|
||||||
|
}
|
||||||
|
g_SMConVarAccessor.UnloadMetamodCommands();
|
||||||
|
UnloadMetamod(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char *GetDescription()
|
virtual const char *GetDescription()
|
||||||
|
@ -92,6 +92,18 @@ public:
|
|||||||
|
|
||||||
virtual void Unload()
|
virtual void Unload()
|
||||||
{
|
{
|
||||||
|
if (g_bIsTryingToUnload)
|
||||||
|
{
|
||||||
|
Error("Metamod:Source cannot be unloaded from VSP mode. Use \"meta unload\" to unload specific plugins.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (g_plugin_unload != NULL)
|
||||||
|
{
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads, false);
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads_Post, true);
|
||||||
|
g_plugin_unload = NULL;
|
||||||
|
}
|
||||||
|
mm_UnloadMetamod();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char *GetDescription()
|
virtual const char *GetDescription()
|
||||||
|
@ -162,6 +162,7 @@ public:
|
|||||||
if (bridge == NULL)
|
if (bridge == NULL)
|
||||||
return;
|
return;
|
||||||
bridge->Unload();
|
bridge->Unload();
|
||||||
|
mm_UnloadMetamodLibrary();
|
||||||
}
|
}
|
||||||
virtual void Pause()
|
virtual void Pause()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user