removed MM-1.18 compat

This commit is contained in:
David Anderson 2006-02-08 21:59:02 +00:00
parent 1e4c71e8e3
commit 3507155189
5 changed files with 22 additions and 224 deletions

View File

@ -3506,12 +3506,6 @@ static cell AMX_NATIVE_CALL query_client_cvar(AMX *amx, cell *params)
return 0;
#endif
if (g_mm_vers < 13)
{
LogError(amx, AMX_ERR_NATIVE, "[AMXX] Client CVAR querying is not enabled - MM version out of date.");
return 0;
}
if (!g_NewDLL_Available)
{
LogError(amx, AMX_ERR_NATIVE, "Client CVAR querying is not enabled - check MM version!");

View File

@ -41,7 +41,6 @@
#include "string.h"
#include <extdll.h>
#include <meta_api.h>
#include "mm_pextensions.h" // metamod-p extensions
#ifdef MEMORY_TEST
#include "mmgr/mmgr.h"
@ -140,8 +139,6 @@ struct fakecmd_t
bool fake;
};
extern bool g_IsNewMM;
extern pextension_funcs_t *gpMetaPExtFuncs;
extern CLog g_log;
extern CPluginMngr g_plugins;
extern CTaskMngr g_tasksMngr;
@ -309,7 +306,6 @@ extern int FF_InconsistentFile;
extern int FF_ClientAuthorized;
extern int FF_ChangeLevel;
extern bool g_coloredmenus;
extern int g_mm_vers;
#define MM_CVAR2_VERS 13

View File

@ -33,40 +33,22 @@
int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now)
{
if (gpMetaPExtFuncs)
{
if(PEXT_LOAD_PLUGIN_BY_NAME(PLID, path, now, handle) || !*handle)
{
LOG_MESSAGE(PLID, "Can't Attach metamod-module \"%s\".", path);
return 0;
}
return 1;
} else if (g_IsNewMM) {
int err = 0;
if ( (err = LOAD_PLUGIN(PLID, path, now, handle)) || !*handle)
{
LOG_MESSAGE(PLID, "Can't Attach Module \"%s\".", path);
return 0;
}
return 1;
}
return 0;
}
int UnloadMetamodPlugin(void *handle)
{
if (gpMetaPExtFuncs)
{
if(PEXT_UNLOAD_PLUGIN_BY_HANDLE(PLID, (void*)handle, PT_ANYTIME, PNL_PLUGIN)) {
return 0;
}
return 1;
} else if (g_IsNewMM) {
if (UNLOAD_PLUGIN_BY_HANDLE(PLID, (void *)handle, PT_ANYTIME, PNL_PLUGIN))
{
return 0;
}
return 1;
}
return 0;
}

View File

@ -40,11 +40,9 @@
#include "newmenus.h"
#include "natives.h"
#define MIN_COMPAT_MM_VERS "5:11"
plugin_info_t Plugin_info =
{
MIN_COMPAT_MM_VERS, // ifvers
META_INTERFACE_VERSION, // ifvers
"AMX Mod X", // name
AMX_VERSION, // version
__DATE__, // date
@ -60,7 +58,6 @@ gamedll_funcs_t *gpGamedllFuncs;
mutil_funcs_t *gpMetaUtilFuncs;
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
pextension_funcs_t *gpMetaPExtFuncs;
funEventCall modMsgsEnd[MAX_REG_MSGS];
funEventCall modMsgs[MAX_REG_MSGS];
@ -104,12 +101,9 @@ float g_task_time;
float g_auth_time;
bool g_initialized = false;
bool g_IsNewMM = false;
bool g_NeedsP = false;
bool g_coloredmenus;
bool g_activated = false;
bool g_NewDLL_Available = false;
int g_mm_vers = 0;
#ifdef MEMORY_TEST
float g_next_memreport_time;
@ -1127,10 +1121,9 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
sscanf(ifvers, "%d:%d", &mmajor, &mminor);
sscanf(Plugin_info.ifvers, "%d:%d", &pmajor, &pminor);
g_mm_vers = mminor;
if (strcmp(ifvers, Plugin_info.ifvers))
{
LOG_MESSAGE(PLID, "warning: ifvers mismatch (pl \"%s\") (mm \"%s\")", Plugin_info.ifvers, ifvers);
if (pmajor > mmajor)
{
LOG_ERROR(PLID, "metamod version is too old for this plugin; update metamod");
@ -1139,59 +1132,20 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
return (FALSE);
} else if (pmajor == mmajor) {
//wait it out... pminor should never be greater than 11 as of 1.65
// so mminor should be 10 at most.
if (pminor > mminor)
{
//we need at least Metamod-p now
if (mminor == 10)
{
//wait for P extensions
g_NeedsP = true;
LOG_MESSAGE(PLID, "warning! old metamod detecting, expecting metamod-p");
} else {
//if we have less than 1.17, there's no hope.
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
return FALSE;
}
} else if (pminor < mminor) {
//there's a later version of MM.
//if we have 1.19, tell MM that we're okay.
//NOTE: ifvers 5:11 did not exist.
if (mminor <= 13)
{
static char newvers[16];
snprintf(newvers, sizeof(newvers)-1, "%d:%d", mmajor, mminor);
Plugin_info.ifvers = newvers;
LOG_MESSAGE(PLID, "warning: there may be a newer version of metamod available");
}
}
}
}
if (!g_NeedsP)
g_IsNewMM = true;
// We can set this to null here because Meta_PExtGiveFnptrs is called after this
gpMetaPExtFuncs = NULL;
// :NOTE: Don't call modules query here (g_FakeMeta.Meta_Query), because we don't know modules yet. Do it in Meta_Attach
return (TRUE);
}
// evilspy's patch for mm-p ext support
// this is called right after Meta_Query
C_DLLEXPORT int Meta_PExtGiveFnptrs(int interfaceVersion, pextension_funcs_t *pMetaPExtFuncs)
{
if (interfaceVersion < META_PEXT_VERSION)
{
return (META_PEXT_VERSION);
}
gpMetaPExtFuncs = pMetaPExtFuncs;
return (META_PEXT_VERSION);
}
static META_FUNCTIONS gMetaFunctionTable;
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
{
@ -1201,12 +1155,6 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
return (FALSE);
}
if (g_NeedsP && !gpMetaPExtFuncs)
{
LOG_ERROR(PLID, "You need Metamod-P or Metamod-1.18+ to use AMX Mod X %s!", AMX_VERSION);
return (FALSE);
}
gpMetaGlobals = pMGlobals;
gMetaFunctionTable.pfnGetEntityAPI2 = GetEntityAPI2;
gMetaFunctionTable.pfnGetEntityAPI2_Post = GetEntityAPI2_Post;
@ -1483,14 +1431,8 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *in
// If pfnQueryClientCvarValue is not available, the newdllfunctions table will probably
// not have the pfnCvarValue member -> better don't write there to avoid corruption
if (g_mm_vers >= 13)
{
if (g_engfuncs.pfnQueryClientCvarValue2)
gNewDLLFunctionTable.pfnCvarValue2 = C_CvarValue2;
memcpy(pNewFunctionTable, &gNewDLLFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
} else {
memcpy(pNewFunctionTable, &gNewDLLFunctionTable, sizeof(NEW_DLL_FUNCTIONS) - sizeof(void *));
}
return 1;
}

View File

@ -1,116 +0,0 @@
/*
* Copyright (c) 2004 Jussi Kivilinna
*
* This file is part of "Metamod All-Mod-Support"-patch for Metamod.
*
* Metamod is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Metamod is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Metamod; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef MM_PEXTENSIONS_H
#define MM_PEXTENSIONS_H
#include "plinfo.h" // plid_t
#include "meta_api.h" // PLUG_LOADTIME
/*
How to use:
1. Add new export function 'Meta_PExtGiveFnptrs' to your plugin file.
'Meta_PExtGiveFnptrs' will be called right after 'Meta_Query' call.
2. Meta_PExtGiveFnptrs is called with interface version 'META_PEXT_VERSION'
and pointer to extension function table.
3. Meta_PExtGiveFnptrs should return plugin's interface version.
4. !NOTE! Metamod will not stop loading plugin even if plugin returns
interface version greater than current. Plugin should disable itself in
this kind of situation.
Example:
#include "mm_pextensions.h"
pextension_funcs_t *gpMetaPExtFuncs;
int Meta_PExtGiveFnptrs(int interfaceVersion, pextension_funcs_t *pMetaPExtFuncs) {
if(interfaceVersion < META_PEXT_VERSION) {
LOG_DEVELOPER(PLID, "Error! Metamod is too old, please update!");
gpMetaPExtFuncs = NULL;
return(META_PEXT_VERSION);
}
gpMetaPExtFuncs = pMetaPExtFuncs;
return(META_PEXT_VERSION);
}
Callback functions:
- int PEXT_LOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
Parses 'cmdline' as metamod would parse 'meta load <cmdline>' and loads found
plugin. If 'plugin_handle' is set, metamod writes module handle of loaded
plugin at it.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
- int PEXT_UNLOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
Parses 'cmdline' as metamod would parse 'meta unload <cmdline>' and
unloads found plugin.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
- int PEXT_UNLOAD_PLUGIN_BY_HANDLE(PLID, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
Unloads plugin with 'plugin_handle'.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
!NOTE! Plugin cannot unload itself!
*/
// Interface version
// 1: first version. Used in p13
// 2: Complete remake (p14):
// pfnLoadMetaPluginByName
// pfnUnloadMetaPluginByName
// pfnUnloadMetaPluginByHandle
// v2 is locked now. Don't modify old functions. If you add new functions, increase META_PEXT_VERSION.
#define META_PEXT_VERSION 2
// Meta PExtension Function table type.
typedef struct pextension_funcs_s {
int (*pfnLoadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
int (*pfnUnloadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
int (*pfnUnloadMetaPluginByHandle)(plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
} pextension_funcs_t;
// Convenience macros for MetaPExtension functions.
#define PEXT_LOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnLoadMetaPluginByName)
#define PEXT_UNLOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnUnloadMetaPluginByName)
#define PEXT_UNLOAD_PLUGIN_BY_HANDLE (*gpMetaPExtFuncs->pfnUnloadMetaPluginByHandle)
// Give plugin extension function table.
C_DLLEXPORT int Meta_PExtGiveFnptrs(int interfaceVersion,
pextension_funcs_t *pMetaPExtFuncs);
typedef int (*META_GIVE_PEXT_FUNCTIONS_FN) (int interfaceVersion,
pextension_funcs_t *pMetaPExtFuncs);
#endif /* MM_PEXTENSIONS_H */