mirror of
https://github.com/rehlds/metamod-r.git
synced 2024-12-26 06:35:33 +03:00
Removed some macros
This commit is contained in:
parent
ccea6516cb
commit
ca8d4e0bcf
@ -18,11 +18,11 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@ -45,7 +45,7 @@
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>$(ProjectName)_mm</TargetName>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
@ -78,6 +78,7 @@
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@ -141,6 +142,7 @@
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -351,7 +351,7 @@ void cmd_doplug(PLUG_CMD pcmd)
|
||||
{
|
||||
if (findp && findp->status >= PL_RUNNING)
|
||||
{
|
||||
META_DEBUG(3, ("Required plugin '%s' found loaded and running.", arg));
|
||||
META_DEBUG(3, "Required plugin '%s' found loaded and running.", arg);
|
||||
return;
|
||||
}
|
||||
// Output to both places, because we don't want the admin
|
||||
|
@ -71,20 +71,20 @@ bool MConfig::set(option_t* setp, const char* setstr)
|
||||
setstr);
|
||||
return false;
|
||||
}
|
||||
META_DEBUG(3, ("set config bool: %s = %s", setp->name, *optval ? "true" : "false"));
|
||||
META_DEBUG(3, "set config bool: %s = %s", setp->name, *optval ? "true" : "false");
|
||||
break;
|
||||
case CF_STR:
|
||||
if (*optstr)
|
||||
Q_free(*optstr);
|
||||
*optstr = Q_strdup(setstr);
|
||||
META_DEBUG(3, ("set config string: %s = %s", setp->name, *optstr));
|
||||
META_DEBUG(3, "set config string: %s = %s", setp->name, *optstr);
|
||||
break;
|
||||
case CF_PATH:
|
||||
if (*optstr)
|
||||
Q_free(*optstr);
|
||||
full_gamedir_path(setstr, pathbuf);
|
||||
*optstr = Q_strdup(pathbuf);
|
||||
META_DEBUG(3, ("set config path: %s = %s", setp->name, *optstr));
|
||||
META_DEBUG(3, "set config path: %s = %s", setp->name, *optstr);
|
||||
break;
|
||||
default:
|
||||
META_ERROR("unrecognized config type '%d'", setp->type);
|
||||
@ -114,7 +114,7 @@ bool MConfig::load(const char* fn)
|
||||
return false;
|
||||
}
|
||||
|
||||
META_DEBUG(2, ("Loading from config file: %s", loadfile));
|
||||
META_DEBUG(2, "Loading from config file: %s", loadfile);
|
||||
for (ln = 1; !feof(fp) && fgets(line, sizeof(line), fp); ln++)
|
||||
{
|
||||
if (line[0] == '#' || line[0] == ';' || !Q_strncmp(line, "//", 2))
|
||||
|
@ -50,7 +50,7 @@ bool install_gamedll(char *from, const char *to)
|
||||
int fd = open(to, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
|
||||
if (fd < 0)
|
||||
{
|
||||
META_DEBUG(3, ("Installing gamedll from cache: Failed to create file %s: %s", to, strerror(errno)) );
|
||||
META_DEBUG(3, "Installing gamedll from cache: Failed to create file %s: %s", to, strerror(errno));
|
||||
FREE_FILE(cachefile);
|
||||
return false;
|
||||
}
|
||||
@ -62,7 +62,7 @@ bool install_gamedll(char *from, const char *to)
|
||||
// Writing the file was not successfull
|
||||
if (length_out != length_in)
|
||||
{
|
||||
META_DEBUG(3, ("Installing gamedll from chache: Failed to write all %d bytes to file, only %d written: %s", length_in, length_out, strerror(errno)));
|
||||
META_DEBUG(3, "Installing gamedll from chache: Failed to write all %d bytes to file, only %d written: %s", length_in, length_out, strerror(errno));
|
||||
|
||||
// Let's not leave a mess but clean up nicely.
|
||||
if (length_out >= 0)
|
||||
@ -75,7 +75,7 @@ bool install_gamedll(char *from, const char *to)
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(3, ("Failed to install gamedll from cache: file %s not found in cache.", from));
|
||||
META_DEBUG(3, "Failed to install gamedll from cache: file %s not found in cache.", from);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ bool setup_gamedll(gamedll_t *gamedll)
|
||||
knownfn = known->linux_so;
|
||||
#endif
|
||||
|
||||
META_DEBUG(4, ("Checking for old version game DLL name '%s'.\n", knownfn));
|
||||
META_DEBUG(4, "Checking for old version game DLL name '%s'.\n", knownfn);
|
||||
Q_snprintf(gamedll->pathname, sizeof(gamedll->pathname), "dlls/%s", knownfn);
|
||||
|
||||
// Check if the gamedll file exists. If not, try to install it from the cache.
|
||||
|
@ -7,13 +7,13 @@ void do_link_ent(ENTITY_FN *pfnEntity, int *missing, const char *entStr, entvars
|
||||
{
|
||||
if (*missing)
|
||||
{
|
||||
META_DEBUG(9, ("Skipping entity '%s'; was previously found missing", entStr));
|
||||
META_DEBUG(9, "Skipping entity '%s'; was previously found missing", entStr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!*pfnEntity)
|
||||
{
|
||||
META_DEBUG(9, ("Looking up game entity '%s'", entStr));
|
||||
META_DEBUG(9, "Looking up game entity '%s'", entStr);
|
||||
*pfnEntity = (ENTITY_FN)GameDLL.sys_module.getsym(entStr);
|
||||
}
|
||||
|
||||
@ -24,6 +24,6 @@ void do_link_ent(ENTITY_FN *pfnEntity, int *missing, const char *entStr, entvars
|
||||
return;
|
||||
}
|
||||
|
||||
META_DEBUG(8, ("Linking game entity '%s'", entStr));
|
||||
META_DEBUG(8, "Linking game entity '%s'", entStr);
|
||||
(*pfnEntity)(pev);
|
||||
}
|
||||
|
@ -71,6 +71,18 @@ void META_LOG(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void NOINLINE META_DEBUG_(int level, const char* fmt, ...)
|
||||
{
|
||||
char buf[MAX_LOGMSG_LEN];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
Q_vsnprintf(buf, sizeof buf, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
ALERT(at_logged, "[META] (debug:%i) %s\n", level, buf);
|
||||
}
|
||||
|
||||
// Print to client.
|
||||
void META_CLIENT(edict_t *pEntity, const char *fmt, ...)
|
||||
{
|
||||
|
@ -13,9 +13,8 @@ extern cvar_t meta_debug;
|
||||
template<typename ...t_args>
|
||||
void META_DEBUG(int level, const char* fmt, t_args... args)
|
||||
{
|
||||
if (meta_debug.value < level)
|
||||
return;
|
||||
ALERT(at_logged, "[META] (debug:%i) %s\n", level, args...); // TODO
|
||||
if (unlikely(meta_debug.value >= level))
|
||||
META_DEBUG_(level, fmt, args...);
|
||||
}
|
||||
|
||||
void META_CONS(const char *fmt, ...);
|
||||
@ -24,6 +23,7 @@ void META_INFO(const char *fmt, ...);
|
||||
void META_WARNING(const char *fmt, ...);
|
||||
void META_ERROR(const char *fmt, ...);
|
||||
void META_LOG(const char *fmt, ...);
|
||||
void META_DEBUG_(int level, const char* fmt, ...);
|
||||
void META_CLIENT(edict_t *pEntity, const char *fmt, ...);
|
||||
|
||||
void flush_ALERT_buffer(void);
|
||||
|
@ -70,6 +70,7 @@ void metamod_startup()
|
||||
|
||||
// Init default values
|
||||
g_config->init(global_options);
|
||||
|
||||
// Find config file
|
||||
cfile = CONFIG_INI;
|
||||
if ((cp = LOCALINFO("mm_configfile")) && *cp != '\0')
|
||||
@ -84,7 +85,7 @@ void metamod_startup()
|
||||
if (valid_gamedir_file(cfile))
|
||||
g_config->load(cfile);
|
||||
else
|
||||
META_DEBUG(2, ("No config.ini file found: %s", CONFIG_INI));
|
||||
META_DEBUG(2, "No config.ini file found: %s", CONFIG_INI);
|
||||
|
||||
// Now, override config options with localinfo commandline options.
|
||||
if ((cp = LOCALINFO("mm_debug")) && *cp != '\0')
|
||||
@ -180,10 +181,7 @@ void metamod_startup()
|
||||
// Exit on failure here? Dunno...
|
||||
}
|
||||
|
||||
#ifdef UNFINISHED
|
||||
// Start up the log parsing thread.
|
||||
startup_logparse_thread();
|
||||
#endif
|
||||
meta_init_rehlds_api();
|
||||
|
||||
// Allow for commands to metamod plugins at startup. Autoexec.cfg is
|
||||
// read too early, and server.cfg is read too late.
|
||||
@ -207,7 +205,7 @@ void metamod_startup()
|
||||
{
|
||||
char cmd[NAME_MAX];
|
||||
META_LOG("Exec'ing metamod exec.cfg: %s...", mmfile);
|
||||
Q_snprintf(cmd, sizeof(cmd), "exec %s\n", mmfile);
|
||||
Q_snprintf(cmd, sizeof cmd, "exec %s\n", mmfile);
|
||||
SERVER_COMMAND(cmd);
|
||||
}
|
||||
}
|
||||
@ -241,13 +239,13 @@ bool meta_init_gamedll(void)
|
||||
// Old style; GET_GAME_DIR returned full pathname. Copy this into
|
||||
// our gamedir, and truncate to get the game name.
|
||||
// (note check for both linux and win32 full pathname.)
|
||||
Q_strncpy(GameDLL.gamedir, gamedir, sizeof(GameDLL.gamedir) - 1);
|
||||
GameDLL.gamedir[sizeof(GameDLL.gamedir) - 1] = '\0';
|
||||
Q_strncpy(GameDLL.gamedir, gamedir, sizeof GameDLL.gamedir - 1);
|
||||
GameDLL.gamedir[sizeof GameDLL.gamedir - 1] = '\0';
|
||||
|
||||
cp = Q_strrchr(gamedir, '/') + 1;
|
||||
|
||||
Q_strncpy(GameDLL.name, cp, sizeof(GameDLL.name) - 1);
|
||||
GameDLL.name[sizeof(GameDLL.name) - 1] = '\0';
|
||||
Q_strncpy(GameDLL.name, cp, sizeof GameDLL.name - 1);
|
||||
GameDLL.name[sizeof GameDLL.name - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -265,10 +263,52 @@ bool meta_init_gamedll(void)
|
||||
GameDLL.name[sizeof(GameDLL.name) - 1] = '\0';
|
||||
}
|
||||
|
||||
META_DEBUG(3, ("Game: %s", GameDLL.name));
|
||||
META_DEBUG(3, "Game: %s", GameDLL.name);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename ifvers_t, typename table_t>
|
||||
bool get_function_table(const char* ifname, int ifvers_mm, table_t*& table, size_t table_size = sizeof(table_t))
|
||||
{
|
||||
typedef int (*getfunc_t)(table_t *pFunctionTable, ifvers_t interfaceVersion);
|
||||
|
||||
auto pfnGetFuncs = (getfunc_t)GameDLL.sys_module.getsym(ifname);
|
||||
|
||||
if (pfnGetFuncs) {
|
||||
table = (table_t *)Q_calloc(1, table_size);
|
||||
|
||||
int ifvers_gamedll = ifvers_mm;
|
||||
|
||||
if (pfnGetFuncs(table, ifvers_gamedll)) {
|
||||
META_DEBUG(3, "dll: Game '%s': Found %s", GameDLL.name, ifname);
|
||||
return true;
|
||||
}
|
||||
|
||||
META_ERROR("dll: Failure calling %s in game '%s'", ifname, GameDLL.name);
|
||||
Q_free(table);
|
||||
table = nullptr;
|
||||
|
||||
if (ifvers_gamedll != ifvers_mm) {
|
||||
META_ERROR("dll: Interface version didn't match; we wanted %d, they had %d", ifvers_mm, ifvers_gamedll);
|
||||
META_CONS("==================");
|
||||
META_CONS("Game DLL version mismatch");
|
||||
META_CONS("DLL version is %d, engine version is %d", ifvers_gamedll, ifvers_mm);
|
||||
if (ifvers_gamedll > ifvers_mm)
|
||||
META_CONS("g_engine appears to be outdated, check for updates");
|
||||
else
|
||||
META_CONS("The game DLL for %s appears to be outdated, check for updates", GameDLL.name);
|
||||
META_CONS("==================");
|
||||
ALERT(at_error, "Exiting...\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
META_DEBUG(5, "dll: Game '%s': No %s", GameDLL.name, ifname);
|
||||
table = nullptr;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load game DLL.
|
||||
// meta_errno values:
|
||||
// - ME_DLOPEN couldn't dlopen game dll file
|
||||
@ -276,14 +316,6 @@ bool meta_init_gamedll(void)
|
||||
// (GiveFnptrsToDll, GetEntityAPI, GetEntityAPI2)
|
||||
bool meta_load_gamedll(void)
|
||||
{
|
||||
int iface_vers;
|
||||
int found = 0;
|
||||
|
||||
GIVE_ENGINE_FUNCTIONS_FN pfn_give_engfuncs;
|
||||
GETNEWDLLFUNCTIONS_FN pfn_getapinew;
|
||||
GETENTITYAPI2_FN pfn_getapi2;
|
||||
GETENTITYAPI_FN pfn_getapi;
|
||||
|
||||
if (!setup_gamedll(&GameDLL))
|
||||
{
|
||||
META_ERROR("dll: Unrecognized game: %s", GameDLL.name);
|
||||
@ -305,10 +337,12 @@ bool meta_load_gamedll(void)
|
||||
// wanted to catch one of the functions, but now that plugins are
|
||||
// dynamically loadable at any time, we have to always pass our table,
|
||||
// so that any plugin loaded later can catch what they need to.
|
||||
if ((pfn_give_engfuncs = (GIVE_ENGINE_FUNCTIONS_FN)GameDLL.sys_module.getsym("GiveFnptrsToDll")))
|
||||
auto pfn_give_engfuncs = (GIVE_ENGINE_FUNCTIONS_FN)GameDLL.sys_module.getsym("GiveFnptrsToDll");
|
||||
|
||||
if (pfn_give_engfuncs)
|
||||
{
|
||||
pfn_give_engfuncs(&meta_engfuncs, gpGlobals);
|
||||
META_DEBUG(3, ("dll: Game '%s': Called GiveFnptrsToDll", GameDLL.name));
|
||||
META_DEBUG(3, "dll: Game '%s': Called GiveFnptrsToDll", GameDLL.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -316,62 +350,20 @@ bool meta_load_gamedll(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Yes...another macro.
|
||||
#define GET_FUNC_TABLE_FROM_GAME(gamedll, pfnGetFuncs, STR_GetFuncs, struct_field, API_TYPE, TABLE_TYPE, vers_pass, vers_int, vers_want, gotit) \
|
||||
if ((pfnGetFuncs = (API_TYPE)gamedll.sys_module.getsym(STR_GetFuncs))) { \
|
||||
gamedll.funcs.struct_field = (TABLE_TYPE *)Q_calloc(1, sizeof(TABLE_TYPE)); \
|
||||
if (!gamedll.funcs.struct_field) {\
|
||||
META_ERROR("malloc failed for gamedll struct_field: %s", STR_GetFuncs); \
|
||||
} \
|
||||
else if (pfnGetFuncs(gamedll.funcs.struct_field, vers_pass)) { \
|
||||
META_DEBUG(3, ("dll: Game '%s': Found %s", gamedll.name, STR_GetFuncs)); \
|
||||
gotit = 1; \
|
||||
} \
|
||||
else { \
|
||||
META_ERROR("dll: Failure calling %s in game '%s'", STR_GetFuncs, gamedll.name); \
|
||||
Q_free(gamedll.funcs.struct_field); \
|
||||
gamedll.funcs.struct_field = NULL; \
|
||||
if (vers_int != vers_want) { \
|
||||
META_ERROR("dll: Interface version didn't match; we wanted %d, they had %d", vers_want, vers_int); \
|
||||
/* reproduce error from engine */ \
|
||||
META_CONS("=================="); \
|
||||
META_CONS("Game DLL version mismatch"); \
|
||||
META_CONS("DLL version is %d, engine version is %d", vers_int, vers_want); \
|
||||
if (vers_int > vers_want) \
|
||||
META_CONS("g_engine appears to be outdated, check for updates"); \
|
||||
else \
|
||||
META_CONS("The game DLL for %s appears to be outdated, check for updates", GameDLL.name); \
|
||||
META_CONS("=================="); \
|
||||
ALERT(at_error, "Exiting...\n"); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
META_DEBUG(5, ("dll: Game '%s': No %s", gamedll.name, STR_GetFuncs)); \
|
||||
gamedll.funcs.struct_field = NULL; \
|
||||
}
|
||||
|
||||
// Look for API-NEW interface in Game dll. We do this before API2/API, because
|
||||
// that's what the engine appears to do..
|
||||
iface_vers = NEW_DLL_FUNCTIONS_VERSION;
|
||||
GET_FUNC_TABLE_FROM_GAME(GameDLL, pfn_getapinew, "GetNewDLLFunctions", newapi_table, GETNEWDLLFUNCTIONS_FN, meta_new_dll_functions_t, &iface_vers, iface_vers, NEW_DLL_FUNCTIONS_VERSION, found);
|
||||
get_function_table<int&>("GetNewDLLFunctions", NEW_DLL_FUNCTIONS_VERSION, GameDLL.funcs.newapi_table);
|
||||
|
||||
// Look for API2 interface in plugin; preferred over API-1.
|
||||
found = 0;
|
||||
iface_vers = INTERFACE_VERSION;
|
||||
GET_FUNC_TABLE_FROM_GAME(GameDLL, pfn_getapi2, "GetEntityAPI2", dllapi_table, GETENTITYAPI2_FN, DLL_FUNCTIONS, &iface_vers, iface_vers, INTERFACE_VERSION, found);
|
||||
bool found = get_function_table<int&>("GetEntityAPI2", INTERFACE_VERSION, GameDLL.funcs.dllapi_table);
|
||||
|
||||
// Look for API-1 in plugin, if API2 interface wasn't found.
|
||||
if (!found)
|
||||
{
|
||||
found = 0;
|
||||
GET_FUNC_TABLE_FROM_GAME(GameDLL, pfn_getapi, "GetEntityAPI", dllapi_table, GETENTITYAPI_FN, DLL_FUNCTIONS, INTERFACE_VERSION, INTERFACE_VERSION, INTERFACE_VERSION, found);
|
||||
if (!found) {
|
||||
found = get_function_table<int>("GetEntityAPI", INTERFACE_VERSION, GameDLL.funcs.dllapi_table);
|
||||
}
|
||||
|
||||
// If didn't find either, return failure.
|
||||
if (!found)
|
||||
{
|
||||
if (!found) {
|
||||
META_ERROR("dll: Couldn't find either GetEntityAPI nor GetEntityAPI2 in game DLL '%s'", GameDLL.name);
|
||||
return false;
|
||||
}
|
||||
|
@ -83,23 +83,23 @@ MPlugin *MPluginList::find(const char* findpath)
|
||||
if (!findpath)
|
||||
return NULL;
|
||||
|
||||
META_DEBUG(8, ("Looking for loaded plugin with dlfnamepath: %s", findpath));
|
||||
META_DEBUG(8, "Looking for loaded plugin with dlfnamepath: %s", findpath);
|
||||
|
||||
for (int i = 0; i < max_loaded_count; i++)
|
||||
{
|
||||
META_DEBUG(9, ("Looking at: plugin %s loadedpath: %s", plist[i].file, plist[i].pathname));
|
||||
META_DEBUG(9, "Looking at: plugin %s loadedpath: %s", plist[i].file, plist[i].pathname);
|
||||
|
||||
if (plist[i].status < PL_VALID)
|
||||
continue;
|
||||
|
||||
if (!Q_strcmp(plist[i].pathname, findpath))
|
||||
{
|
||||
META_DEBUG(8, ("Found loaded plugin %s", plist[i].file));
|
||||
META_DEBUG(8, "Found loaded plugin %s", plist[i].file);
|
||||
return &plist[i];
|
||||
}
|
||||
}
|
||||
|
||||
META_DEBUG(8, ("No loaded plugin found with path: %s", findpath));
|
||||
META_DEBUG(8, "No loaded plugin found with path: %s", findpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ MPlugin* MPluginList::plugin_addload(plid_t plid, const char* fname, PLUG_LOADTI
|
||||
|
||||
if (!(pl_loader = find(plid)))
|
||||
{
|
||||
META_DEBUG(1, ("Couldn't find plugin that gave this loading request!"));
|
||||
META_DEBUG(1, "Couldn't find plugin that gave this loading request!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -241,20 +241,19 @@ MPlugin* MPluginList::plugin_addload(plid_t plid, const char* fname, PLUG_LOADTI
|
||||
|
||||
if (pl_temp.resolve() != true)
|
||||
{
|
||||
META_DEBUG(1, ("Couldn't resolve given path into a file: %s", pl_temp.file));
|
||||
META_DEBUG(1, "Couldn't resolve given path into a file: %s", pl_temp.file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((pl_found = find(pl_temp.pathname)))
|
||||
{
|
||||
META_DEBUG(1, ("Plugin '%s' already in current list; file=%s desc='%s'",
|
||||
pl_temp.file, pl_found->file, pl_found->desc));
|
||||
META_DEBUG(1, "Plugin '%s' already in current list; file=%s desc='%s'", pl_temp.file, pl_found->file, pl_found->desc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(pl_added = add(&pl_temp)))
|
||||
{
|
||||
META_DEBUG(1, ("Couldn't add plugin '%s' to list; see log", pl_temp.desc));
|
||||
META_DEBUG(1, "Couldn't add plugin '%s' to list; see log", pl_temp.desc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -263,21 +262,21 @@ MPlugin* MPluginList::plugin_addload(plid_t plid, const char* fname, PLUG_LOADTI
|
||||
{
|
||||
if (1/*meta_errno == ME_NOTALLOWED || meta_errno == ME_DELAYED*/)
|
||||
{
|
||||
META_DEBUG(1, ("Plugin '%s' couldn't attach; only allowed %s", pl_added->desc, pl_added->str_loadable(SL_ALLOWED)));
|
||||
META_DEBUG(1, "Plugin '%s' couldn't attach; only allowed %s", pl_added->desc, pl_added->str_loadable(SL_ALLOWED));
|
||||
pl_added->clear();
|
||||
}
|
||||
else if (pl_added->status == PL_OPENED)
|
||||
{
|
||||
META_DEBUG(1, ("Opened plugin '%s', but failed to attach; see log", pl_added->desc));
|
||||
META_DEBUG(1, "Opened plugin '%s', but failed to attach; see log", pl_added->desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(1, ("Couldn't load plugin '%s'; see log", pl_added->desc));
|
||||
META_DEBUG(1, "Couldn't load plugin '%s'; see log", pl_added->desc);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
META_DEBUG(1, ("Loaded plugin '%s' successfully", pl_added->desc));
|
||||
META_DEBUG(1, "Loaded plugin '%s' successfully", pl_added->desc);
|
||||
|
||||
return pl_added;
|
||||
}
|
||||
@ -518,7 +517,7 @@ bool MPluginList::ini_refresh()
|
||||
// Newer file on disk.
|
||||
else if (pl_found->status >= PL_OPENED)
|
||||
{
|
||||
META_DEBUG(2, ("ini: Plugin '%s' has newer file on disk", pl_found->desc));
|
||||
META_DEBUG(2, "ini: Plugin '%s' has newer file on disk", pl_found->desc);
|
||||
pl_found->action = PA_RELOAD;
|
||||
}
|
||||
else
|
||||
@ -679,19 +678,19 @@ bool MPluginList::refresh(PLUG_LOADTIME now)
|
||||
switch (iplug->action)
|
||||
{
|
||||
case PA_KEEP:
|
||||
META_DEBUG(1, ("Keeping plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Keeping plugin '%s'", iplug->desc);
|
||||
iplug->action = PA_NONE;
|
||||
nkept++;
|
||||
break;
|
||||
case PA_LOAD:
|
||||
META_DEBUG(1, ("Loading plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Loading plugin '%s'", iplug->desc);
|
||||
if (iplug->load(now))
|
||||
nloaded++;
|
||||
else if (1/*meta_errno == ME_DELAYED*/)
|
||||
ndelayed++;
|
||||
break;
|
||||
case PA_RELOAD:
|
||||
META_DEBUG(1, ("Reloading plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Reloading plugin '%s'", iplug->desc);
|
||||
if (iplug->reload(now, PNL_FILE_NEWER))
|
||||
nreloaded++;
|
||||
else if (1/*meta_errno == ME_DELAYED*/)
|
||||
@ -701,7 +700,7 @@ bool MPluginList::refresh(PLUG_LOADTIME now)
|
||||
// If previously loaded from ini, but apparently removed from new ini.
|
||||
if (iplug->source == PS_INI && iplug->status >= PL_RUNNING)
|
||||
{
|
||||
META_DEBUG(1, ("Unloading plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Unloading plugin '%s'", iplug->desc);
|
||||
iplug->action = PA_UNLOAD;
|
||||
if (iplug->unload(now, PNL_INI_DELETED, PNL_INI_DELETED))
|
||||
nunloaded++;
|
||||
@ -711,7 +710,7 @@ bool MPluginList::refresh(PLUG_LOADTIME now)
|
||||
break;
|
||||
case PA_ATTACH:
|
||||
// Previously requested attach, but was delayed?
|
||||
META_DEBUG(1, ("Retrying attach plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Retrying attach plugin '%s'", iplug->desc);
|
||||
if (iplug->retry(now, PNL_DELAYED))
|
||||
nloaded++;
|
||||
else if (1/*meta_errno == ME_DELAYED*/)
|
||||
@ -719,7 +718,7 @@ bool MPluginList::refresh(PLUG_LOADTIME now)
|
||||
break;
|
||||
case PA_UNLOAD:
|
||||
// Previously requested unload, but was delayed?
|
||||
META_DEBUG(1, ("Retrying unload plugin '%s'", iplug->desc));
|
||||
META_DEBUG(1, "Retrying unload plugin '%s'", iplug->desc);
|
||||
if (iplug->retry(now, PNL_DELAYED))
|
||||
nunloaded++;
|
||||
else if (1/*meta_errno == ME_DELAYED*/)
|
||||
|
@ -21,13 +21,13 @@ bool MPlugin::ini_parseline(char *line)
|
||||
// skip empty lines
|
||||
if (line[0] == '\0')
|
||||
{
|
||||
META_DEBUG(7, ("ini: Ignoring empty line: %s", line));
|
||||
META_DEBUG(7, "ini: Ignoring empty line: %s", line);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (line[0] == '#' || line[0] == ';' || Q_strstr(line, "//") == line)
|
||||
{
|
||||
META_DEBUG(7, ("ini: Ignoring commented line: %s", line));
|
||||
META_DEBUG(7, "ini: Ignoring commented line: %s", line);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ bool MPlugin::ini_parseline(char *line)
|
||||
else
|
||||
{
|
||||
// plugin is not for this OS
|
||||
META_DEBUG(7, ("ini: Ignoring entry for %s", token));
|
||||
META_DEBUG(7, "ini: Ignoring entry for %s", token);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ bool MPlugin::plugin_unload(plid_t plid, PLUG_LOADTIME now, PL_UNLOAD_REASON rea
|
||||
if (0/*meta_errno == ME_DELAYED*/)
|
||||
{
|
||||
action = old_action;
|
||||
META_DEBUG(2, ("dll: Failed unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(PT_ANYTIME, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Failed unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(PT_ANYTIME, SL_SIMPLE));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -306,11 +306,11 @@ bool MPlugin::resolve(void)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
META_DEBUG(2, ("Couldn't resolve '%s' to file", filename));
|
||||
META_DEBUG(2, "Couldn't resolve '%s' to file", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
META_DEBUG(2, ("Resolved '%s' to file '%s'", filename, found));
|
||||
META_DEBUG(2, "Resolved '%s' to file '%s'", filename, found);
|
||||
|
||||
// store pathname: the resolved path (should be absolute)
|
||||
Q_strncpy(pathname, found, sizeof pathname - 1);
|
||||
@ -610,12 +610,12 @@ bool MPlugin::load(PLUG_LOADTIME now)
|
||||
if (info->loadable > PT_STARTUP)
|
||||
{
|
||||
// will try to attach again at next opportunity
|
||||
META_DEBUG(2, ("dll: Delaying load plugin '%s'; can't attach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Delaying load plugin '%s'; can't attach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(2, ("dll: Failed load plugin '%s'; can't attach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Failed load plugin '%s'; can't attach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE));
|
||||
// don't try to attach again later
|
||||
action = PA_NONE;
|
||||
return false;
|
||||
@ -718,11 +718,11 @@ bool MPlugin::query(void)
|
||||
if (pfn_init)
|
||||
{
|
||||
pfn_init();
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Called Meta_Init()", desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Called Meta_Init()", desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(5, ("dll: no Meta_Init present in plugin '%s'", desc));
|
||||
META_DEBUG(5, "dll: no Meta_Init present in plugin '%s'", desc);
|
||||
// don't return; not an error
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ bool MPlugin::query(void)
|
||||
return false;
|
||||
}
|
||||
pfn_give_engfuncs(g_engine.pl_funcs, g_engine.globals);
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Called GiveFnptrsToDll()", desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Called GiveFnptrsToDll()", desc);
|
||||
|
||||
// Call plugin's Meta_Query(), to pass our meta interface version, and get
|
||||
// plugin's info structure.
|
||||
@ -752,8 +752,7 @@ bool MPlugin::query(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Called Meta_Query() successfully",
|
||||
desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Called Meta_Query() successfully", desc);
|
||||
}
|
||||
|
||||
// Check for interface differences... Generally, a difference in major
|
||||
@ -768,7 +767,7 @@ bool MPlugin::query(void)
|
||||
if (info && !FStrEq(info->ifvers, META_INTERFACE_VERSION))
|
||||
{
|
||||
int mmajor = 0, mminor = 0, pmajor = 0, pminor = 0;
|
||||
META_DEBUG(3, ("dll: Note: Plugin '%s' interface version didn't match; expected %s, found %s", desc, META_INTERFACE_VERSION, info->ifvers));
|
||||
META_DEBUG(3, "dll: Note: Plugin '%s' interface version didn't match; expected %s, found %s", desc, META_INTERFACE_VERSION, info->ifvers);
|
||||
sscanf(META_INTERFACE_VERSION, "%d:%d", &mmajor, &mminor);
|
||||
sscanf(info->ifvers, "%d:%d", &pmajor, &pminor);
|
||||
// If plugin has later interface version, it's incompatible
|
||||
@ -816,7 +815,7 @@ bool MPlugin::query(void)
|
||||
desc[sizeof desc - 1] = '\0';
|
||||
}
|
||||
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Query successful", desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Query successful", desc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -887,7 +886,7 @@ bool MPlugin::attach(PLUG_LOADTIME now)
|
||||
return false;
|
||||
}
|
||||
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Called Meta_Attach() successfully", desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Called Meta_Attach() successfully", desc);
|
||||
|
||||
// Rather than duplicate code, we use another ugly macro. Again,
|
||||
// a function isn't an option since we have varying types.
|
||||
@ -896,7 +895,7 @@ bool MPlugin::attach(PLUG_LOADTIME now)
|
||||
if (!struct_field) \
|
||||
struct_field = (TABLE_TYPE *)Q_calloc(1, sizeof(TABLE_TYPE)); \
|
||||
if (meta_table.pfnGetFuncs(struct_field, vers_pass)) { \
|
||||
META_DEBUG(3, ("dll: Plugin '%s': Found %s", desc, STR_GetFuncs)); \
|
||||
META_DEBUG(3, "dll: Plugin '%s': Found %s", desc, STR_GetFuncs); \
|
||||
} \
|
||||
else { \
|
||||
META_ERROR("dll: Failure calling %s in plugin '%s'", STR_GetFuncs, desc); \
|
||||
@ -905,7 +904,7 @@ bool MPlugin::attach(PLUG_LOADTIME now)
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
META_DEBUG(5, ("dll: Plugin '%s': No %s", desc, STR_GetFuncs)); \
|
||||
META_DEBUG(5, "dll: Plugin '%s': No %s", desc, STR_GetFuncs); \
|
||||
if (struct_field) \
|
||||
Q_free(struct_field); \
|
||||
struct_field = NULL; \
|
||||
@ -1011,20 +1010,20 @@ bool MPlugin::unload(PLUG_LOADTIME now, PL_UNLOAD_REASON reason, PL_UNLOAD_REASO
|
||||
{
|
||||
if (reason == PNL_CMD_FORCED)
|
||||
{
|
||||
META_DEBUG(2, ("dll: Forced unload plugin '%s' overriding allowed times: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Forced unload plugin '%s' overriding allowed times: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->unloadable > PT_STARTUP)
|
||||
{
|
||||
META_DEBUG(2, ("dll: Delaying unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Delaying unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE));
|
||||
// caller should give message to user
|
||||
// try to unload again at next opportunity
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(2, ("dll: Failed unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Failed unload plugin '%s'; can't detach now: allowed=%s; now=%s", desc, str_unloadable(), str_loadtime(now, SL_SIMPLE));
|
||||
// don't try to unload again later
|
||||
action = PA_NONE;
|
||||
return false;
|
||||
@ -1042,11 +1041,11 @@ bool MPlugin::unload(PLUG_LOADTIME now, PL_UNLOAD_REASON reason, PL_UNLOAD_REASO
|
||||
{
|
||||
if (reason == PNL_RELOAD)
|
||||
{
|
||||
META_DEBUG(2, ("dll: Reload plugin '%s' overriding failed detach", desc));
|
||||
META_DEBUG(2, "dll: Reload plugin '%s' overriding failed detach", desc);
|
||||
}
|
||||
else if (reason == PNL_CMD_FORCED)
|
||||
{
|
||||
META_DEBUG(2, ("dll: Forced unload plugin '%s' overriding failed detach"));
|
||||
META_DEBUG(2, "dll: Forced unload plugin '%s' overriding failed detach");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1124,7 +1123,7 @@ bool MPlugin::detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
return false;
|
||||
}
|
||||
|
||||
META_DEBUG(6, ("dll: Plugin '%s': Called Meta_Detach() successfully", desc));
|
||||
META_DEBUG(6, "dll: Plugin '%s': Called Meta_Detach() successfully", desc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1147,14 +1146,14 @@ bool MPlugin::reload(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
{
|
||||
if (info->loadable > PT_STARTUP)
|
||||
{
|
||||
META_DEBUG(2, ("dll: Delaying reload plugin '%s'; would not be able to reattach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Delaying reload plugin '%s'; would not be able to reattach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE));
|
||||
// caller should give message to user
|
||||
// try to reload again at next opportunity
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
META_DEBUG(2, ("dll: Failed reload plugin '%s'; would not be able to reattach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE)));
|
||||
META_DEBUG(2, "dll: Failed reload plugin '%s'; would not be able to reattach now: allowed=%s; now=%s", desc, str_loadable(), str_loadtime(now, SL_SIMPLE));
|
||||
// don't try to reload again later
|
||||
action = PA_NONE;
|
||||
return false;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
MRegCmd::MRegCmd(char* cmd_name, REG_CMD_FN cmd_handler, MPlugin* cmd_plugin) : m_pfunction(cmd_handler), m_status(RG_VALID), m_plugid(cmd_plugin->index)
|
||||
MRegCmd::MRegCmd(char* cmd_name, REG_CMD_FN cmd_handler, MPlugin* cmd_plugin) : m_pfunction(cmd_handler), m_plugid(cmd_plugin->index), m_status(RG_VALID)
|
||||
{
|
||||
m_name = _strdup(m_name);
|
||||
m_name = _strdup(cmd_name);
|
||||
}
|
||||
|
||||
bool MRegCmd::call() const
|
||||
|
@ -174,7 +174,7 @@ void EXT_FUNC mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms, const c
|
||||
// Jussi Kivilinna.
|
||||
qboolean EXT_FUNC mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev)
|
||||
{
|
||||
META_DEBUG(8, ("Looking up game entity '%s' for plugin '%s'", entStr, plid->name));
|
||||
META_DEBUG(8, "Looking up game entity '%s' for plugin '%s'", entStr, plid->name);
|
||||
ENTITY_FN pfnEntity = (ENTITY_FN)GameDLL.sys_module.getsym(entStr);
|
||||
|
||||
if (!pfnEntity)
|
||||
@ -183,7 +183,7 @@ qboolean EXT_FUNC mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_
|
||||
return false;
|
||||
}
|
||||
|
||||
META_DEBUG(7, ("Calling game entity '%s' for plugin '%s'", entStr, plid->name));
|
||||
META_DEBUG(7, "Calling game entity '%s' for plugin '%s'", entStr, plid->name);
|
||||
(*pfnEntity)(pev);
|
||||
return true;
|
||||
}
|
||||
|
@ -7,12 +7,18 @@
|
||||
#define PLATFORM "mswin"
|
||||
#define PLATFORM_SPC "win32"
|
||||
#define PLATFORM_DLEXT ".dll"
|
||||
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#else
|
||||
#define UNUSED __attribute__((unused))
|
||||
|
||||
#define PLATFORM "linux"
|
||||
#define PLATFORM_SPC "lin32"
|
||||
#define PLATFORM_DLEXT ".so"
|
||||
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#endif
|
||||
|
||||
#include "mreg.h"
|
||||
|
@ -30,7 +30,7 @@ void EXT_FUNC meta_AddServerCommand(char *cmd_name, void (*function)())
|
||||
{
|
||||
MPlugin *plug = g_plugins->find_memloc(function);
|
||||
|
||||
META_DEBUG(4, ("called: meta_AddServerCommand; cmd_name=%s, function=%d, plugin=%s", cmd_name, function, plug ? plug->file : "unknown"));
|
||||
META_DEBUG(4, "called: meta_AddServerCommand; cmd_name=%s, function=%d, plugin=%s", cmd_name, function, plug ? plug->file : "unknown");
|
||||
|
||||
if (!plug) {
|
||||
META_ERROR("Failed to find memloc for regcmd '%s'", cmd_name);
|
||||
|
@ -16,10 +16,9 @@ void __declspec(noreturn) do_exit(int exitval)
|
||||
// Special-case-recognize "/dev/null" as a valid file.
|
||||
int valid_gamedir_file(const char* path)
|
||||
{
|
||||
char buf[PATH_MAX ];
|
||||
struct stat st;
|
||||
int ret, reg, size;
|
||||
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (!path)
|
||||
return FALSE;
|
||||
|
||||
@ -32,26 +31,26 @@ int valid_gamedir_file(const char* path)
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
}
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/%s", GameDLL.gamedir, path);
|
||||
snprintf(buf, sizeof buf, "%s/%s", GameDLL.gamedir, path);
|
||||
|
||||
ret = stat(buf, &st);
|
||||
int ret = stat(buf, &st);
|
||||
if (ret != 0)
|
||||
{
|
||||
META_DEBUG(5, ("Unable to stat '%s': %s", buf, strerror(errno)));
|
||||
META_DEBUG(5, "Unable to stat '%s': %s", buf, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
reg = S_ISREG(st.st_mode);
|
||||
int reg = S_ISREG(st.st_mode);
|
||||
if (!reg)
|
||||
{
|
||||
META_DEBUG(5, ("Not a regular file: %s", buf));
|
||||
META_DEBUG(5, "Not a regular file: %s", buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size = st.st_size;
|
||||
int size = st.st_size;
|
||||
if (!size)
|
||||
{
|
||||
META_DEBUG(5, ("Empty file: %s", buf));
|
||||
META_DEBUG(5, "Empty file: %s", buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -83,7 +82,7 @@ char* full_gamedir_path(const char* path, char* fullpath)
|
||||
// Remove relative path components, if possible.
|
||||
if (!realpath(buf, fullpath))
|
||||
{
|
||||
META_DEBUG(4, ("Unable to get realpath for '%s': %s", buf, str_os_error()));
|
||||
META_DEBUG(4, "Unable to get realpath for '%s': %s", buf, str_os_error());
|
||||
Q_strncpy(fullpath, path, sizeof(fullpath) - 1);
|
||||
fullpath[sizeof(fullpath) - 1] = '\0';
|
||||
}
|
||||
|
@ -106,13 +106,10 @@ void normalize_pathname(char *path)
|
||||
#ifdef _WIN32
|
||||
char *cp;
|
||||
|
||||
META_DEBUG(8, ("normalize: %s", path));
|
||||
for (cp = path; *cp; cp++) {
|
||||
if (isupper(*cp)) *cp = tolower(*cp);
|
||||
if (*cp == '\\') *cp = '/';
|
||||
}
|
||||
|
||||
META_DEBUG(8, ("normalized: %s", path));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user