From 50c4e75c65aafee906bacc6798fc41988823ae69 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 19 Apr 2020 03:50:14 +0000 Subject: [PATCH] Stop some plugins from failing/crashing. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5670 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- plugins/bullet/bulletplug.cpp | 5 +++-- plugins/jabber/jabberclient.c | 14 +++++++++++--- plugins/qi/qi.c | 2 -- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/bullet/bulletplug.cpp b/plugins/bullet/bulletplug.cpp index 2f1675432..ba333f28b 100644 --- a/plugins/bullet/bulletplug.cpp +++ b/plugins/bullet/bulletplug.cpp @@ -1788,7 +1788,7 @@ static bool World_Bullet_DoInit(void) if (!rbefuncs || !rbefuncs->RegisterPhysicsEngine) { rbefuncs = nullptr; - Con_Printf("Bullet plugin failed: Engine doesn't support physics engine plugins.\n"); + Con_Printf("Bullet plugin failed: Engine is incompatible.\n"); } else if (!rbefuncs->RegisterPhysicsEngine("Bullet", World_Bullet_Start)) Con_Printf("Bullet plugin failed: Engine already has a physics plugin active.\n"); @@ -1803,7 +1803,8 @@ static bool World_Bullet_DoInit(void) extern "C" qboolean Plug_Init(void) { rbefuncs = (rbeplugfuncs_t*)plugfuncs->GetEngineInterface("RBE", sizeof(*rbefuncs)); - if (rbefuncs && rbefuncs->version < RBEPLUGFUNCS_VERSION) + if (rbefuncs && ( rbefuncs->version < RBEPLUGFUNCS_VERSION || + rbefuncs->wedictsize != sizeof(wedict_t))) rbefuncs = nullptr; plugfuncs->ExportFunction("Shutdown", (funcptr_t)World_Bullet_Shutdown); diff --git a/plugins/jabber/jabberclient.c b/plugins/jabber/jabberclient.c index 71ea9bb17..a09118b87 100644 --- a/plugins/jabber/jabberclient.c +++ b/plugins/jabber/jabberclient.c @@ -904,7 +904,14 @@ qboolean Plug_Init(void) { jclient_needreadconfig = true; - if (plugfuncs->ExportFunction("Tick", JCL_Frame) && + confuncs = (plugsubconsolefuncs_t*)plugfuncs->GetEngineInterface(plugsubconsolefuncs_name, sizeof(*confuncs)); + drawfuncs = (plug2dfuncs_t*)plugfuncs->GetEngineInterface(plug2dfuncs_name, sizeof(*drawfuncs)); + netfuncs = (plugnetfuncs_t*)plugfuncs->GetEngineInterface(plugnetfuncs_name, sizeof(*netfuncs)); + filefuncs = (plugfsfuncs_t*)plugfuncs->GetEngineInterface(plugfsfuncs_name, sizeof(*filefuncs)); + clientfuncs = (plugclientfuncs_t*)plugfuncs->GetEngineInterface(plugclientfuncs_name, sizeof(*clientfuncs)); + + if (netfuncs && filefuncs && + plugfuncs->ExportFunction("Tick", JCL_Frame) && plugfuncs->ExportFunction("Shutdown", JCL_Shutdown) && plugfuncs->ExportFunction("ExecuteCommand", JCL_ExecuteCommand)) { @@ -912,9 +919,10 @@ qboolean Plug_Init(void) plugfuncs->ExportFunction("UpdateVideo", JCL_UpdateVideo); plugfuncs->ExportFunction("ConsoleLink", JCL_ConsoleLink); - plugfuncs->ExportFunction("ConsoleLinkMouseOver", JCL_ConsoleLinkMouseOver); + if (drawfuncs) + plugfuncs->ExportFunction("ConsoleLinkMouseOver", JCL_ConsoleLinkMouseOver); - if (!plugfuncs->ExportFunction("ConExecuteCommand", JCL_ConExecuteCommand)) + if (!confuncs || !plugfuncs->ExportFunction("ConExecuteCommand", JCL_ConExecuteCommand)) { Con_Printf("XMPP plugin in single-console mode\n"); Con_TrySubPrint = Fallback_ConPrint; diff --git a/plugins/qi/qi.c b/plugins/qi/qi.c index e1cd61854..34fca04ee 100644 --- a/plugins/qi/qi.c +++ b/plugins/qi/qi.c @@ -663,8 +663,6 @@ static int QDECL QI_ConExecuteCommand(qboolean isinsecure) static qboolean QI_ExecuteCommand(qboolean isinsecure) { char cmd[256]; - if (isinsecure) - return false; cmdfuncs->Argv(0, cmd, sizeof(cmd)); if (!strcmp(cmd, "qi") || !strcmp(cmd, "quaddicted")) {