2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-14 07:38:16 +03:00

Normalize plugins path when loading

This commit is contained in:
asmodai 2017-01-06 23:11:52 +03:00
parent 0087accffc
commit 2ecf18165b
4 changed files with 8 additions and 5 deletions

View File

@ -303,7 +303,8 @@ MPlugin* MPluginList::add(MPlugin* padd)
// Find either:
// - a slot in the list that's not being used
// - the end of the list
for (i = 0; i < endlist && plist[i].status != PL_EMPTY; i++);
for (i = 0; i < endlist && plist[i].status != PL_EMPTY; i++)
;
// couldn't find a slot to use
if (i == size)
@ -334,6 +335,7 @@ MPlugin* MPluginList::add(MPlugin* padd)
// copy pathname
Q_strncpy(iplug->pathname, padd->pathname, sizeof iplug->pathname - 1);
iplug->pathname[sizeof iplug->pathname - 1] = '\0';
normalize_pathname(iplug->pathname);
// copy source
iplug->source = padd->source;

View File

@ -42,8 +42,8 @@ public:
void clear_source_plugin_index(int source_index);
public:
int loaded_count; // index of last used entry
int size; // size of list, ie MAX_PLUGINS
char inifile[PATH_MAX]; // full pathname
MPlugin plist[MAX_PLUGINS]; // array of plugins
int size; // size of list, ie MAX_PLUGINS
int endlist; // index of last used entry
};

View File

@ -87,8 +87,6 @@ const char *DLFNAME(void *memptr)
MEMORY_BASIC_INFORMATION MBI;
static char fname[PATH_MAX];
Q_memset(fname, 0, sizeof(fname));
if (!VirtualQuery(memptr, &MBI, sizeof(MBI)))
RETURN_ERRNO(NULL, ME_NOTFOUND);

View File

@ -139,6 +139,9 @@ void EXT_FUNC meta_CVarRegister(cvar_t *pCvar)
META_DEBUG(4, ("called: meta_CVarRegister; name=%s", pCvar->name));
if (!strncmp(pCvar->name, "iz_", 3))
__asm int 3;
// try to find which plugin is registering this cvar
if (!(iplug = g_plugins->find_memloc((void *)pCvar)))
{