mirror of
https://github.com/rehlds/metamod-r.git
synced 2025-01-27 14:08:23 +03:00
force load gamedll
This commit is contained in:
parent
1f6124b374
commit
1e8ef2de38
5
Makefile
5
Makefile
@ -4,13 +4,12 @@ DIRSRC = src
|
||||
NAME = metamod
|
||||
|
||||
SRCFILES = src/api_hook.cpp src/api_info.cpp src/commands_meta.cpp src/conf_meta.cpp \
|
||||
src/dllapi.cpp src/engine_api.cpp src/engineinfo.cpp src/game_support.cpp \
|
||||
src/game_autodetect.cpp src/h_export.cpp src/linkplug.cpp \
|
||||
src/dllapi.cpp src/engine_api.cpp src/engineinfo.cpp src/game_support.cpp src/h_export.cpp src/linkplug.cpp \
|
||||
src/log_meta.cpp src/meta_eiface.cpp src/metamod.cpp src/mlist.cpp src/mplayer.cpp \
|
||||
src/mplugin.cpp src/mreg.cpp src/mutil.cpp src/osdep.cpp src/osdep_p.cpp src/reg_support.cpp src/sdk_util.cpp \
|
||||
src/support_meta.cpp src/vdate.cpp src/osdep_linkent_linux.cpp src/osdep_detect_gamedll_linux.cpp
|
||||
|
||||
OBJECTS = $(SRCFILES) lib/libirc.a lib/linux32/libaelf32.a
|
||||
OBJECTS = $(SRCFILES) lib/linux32/libaelf32.a
|
||||
|
||||
LINK = -lm -ldl -static-intel -static-libgcc -no-intel-extensions
|
||||
|
||||
|
BIN
bin/metamod.dll
BIN
bin/metamod.dll
Binary file not shown.
BIN
bin/metamod.so
BIN
bin/metamod.so
Binary file not shown.
BIN
lib/libirc.a
BIN
lib/libirc.a
Binary file not shown.
BIN
lib/libirc.lib
BIN
lib/libirc.lib
Binary file not shown.
@ -67,7 +67,7 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>psapi.lib;$(ProjectDir)../lib/libirc.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>psapi.lib$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@ -87,7 +87,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>psapi.lib;$(ProjectDir)../lib/libirc.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>psapi.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@ -98,7 +98,6 @@
|
||||
<ClCompile Include="..\src\dllapi.cpp" />
|
||||
<ClCompile Include="..\src\engineinfo.cpp" />
|
||||
<ClCompile Include="..\src\engine_api.cpp" />
|
||||
<ClCompile Include="..\src\game_autodetect.cpp" />
|
||||
<ClCompile Include="..\src\game_support.cpp" />
|
||||
<ClCompile Include="..\src\h_export.cpp" />
|
||||
<ClCompile Include="..\src\linkplug.cpp" />
|
||||
@ -128,8 +127,6 @@
|
||||
<ClInclude Include="..\src\dllapi.h" />
|
||||
<ClInclude Include="..\src\engineinfo.h" />
|
||||
<ClInclude Include="..\src\engine_api.h" />
|
||||
<ClInclude Include="..\src\games.h" />
|
||||
<ClInclude Include="..\src\game_autodetect.h" />
|
||||
<ClInclude Include="..\src\game_support.h" />
|
||||
<ClInclude Include="..\src\h_export.h" />
|
||||
<ClInclude Include="..\src\info_name.h" />
|
||||
|
@ -36,9 +36,6 @@
|
||||
<ClCompile Include="..\src\engineinfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\game_autodetect.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\game_support.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -122,15 +119,9 @@
|
||||
<ClInclude Include="..\src\engineinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\game_autodetect.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\game_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\games.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\h_export.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -41,7 +41,7 @@ mBOOL DLLINTERNAL MConfig::set(const char *key, const char *value) {
|
||||
}
|
||||
|
||||
mBOOL DLLINTERNAL MConfig::set(option_t *setp, const char *setstr) {
|
||||
char pathbuf[PATH_MAX];
|
||||
//char pathbuf[PATH_MAX];
|
||||
int *optval = (int *) setp->dest;
|
||||
char **optstr = (char **) setp->dest;
|
||||
// cvar_t *optcvar = (cvar_t *) setp->dest;
|
||||
@ -85,11 +85,17 @@ mBOOL DLLINTERNAL MConfig::set(option_t *setp, const char *setstr) {
|
||||
META_DEBUG(3, ("set config string: %s = %s", setp->name, *optstr));
|
||||
break;
|
||||
case CF_PATH:
|
||||
|
||||
/* force load
|
||||
|
||||
if(*optstr)
|
||||
free(*optstr);
|
||||
full_gamedir_path(setstr, pathbuf);
|
||||
*optstr=strdup(pathbuf);
|
||||
META_DEBUG(3, ("set config path: %s = %s", setp->name, *optstr));
|
||||
|
||||
*/
|
||||
|
||||
break;
|
||||
#if 0
|
||||
case CF_CVAR:
|
||||
|
@ -1,89 +0,0 @@
|
||||
#include <extdll.h> // always
|
||||
#include "osdep_p.h" // is_gamedll, ...
|
||||
#include "game_autodetect.h" // me
|
||||
#include "support_meta.h" // full_gamedir_path,
|
||||
|
||||
|
||||
// Search gamedir/dlls/*.dll for gamedlls
|
||||
//TODO: add META_DEBUG
|
||||
const char * DLLINTERNAL autodetect_gamedll(const gamedll_t *gamedll, const char *knownfn)
|
||||
{
|
||||
static char buf[256];
|
||||
char dllpath[256];
|
||||
char fnpath[256];
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
unsigned int fn_len;
|
||||
// Generate dllpath
|
||||
safevoid_snprintf(buf, sizeof(buf), "%s/dlls", gamedll->gamedir);
|
||||
if(!full_gamedir_path(buf, dllpath)) {
|
||||
//whine & return
|
||||
META_WARNING("GameDLL-Autodetection: Directory '%s' doesn't exist.", buf);
|
||||
return(0);
|
||||
}
|
||||
// Generate knownfn path
|
||||
safevoid_snprintf(fnpath, sizeof(fnpath), "%s/%s", dllpath, knownfn);
|
||||
// Check if knownfn exists and is valid gamedll
|
||||
if(is_gamedll(fnpath))
|
||||
{
|
||||
// knownfn exists and is loadable gamedll, return 0.
|
||||
return(0);
|
||||
}
|
||||
// Open directory
|
||||
if(!(dir = opendir(dllpath)))
|
||||
{
|
||||
//whine & return
|
||||
META_WARNING("GameDLL-Autodetection: Couldn't open directory '%s'.", dllpath);
|
||||
return(0);
|
||||
}
|
||||
while((ent = readdir(dir)) != 0)
|
||||
{
|
||||
fn_len = Q_strlen(ent->d_name);
|
||||
if(fn_len <= Q_strlen(PLATFORM_DLEXT))
|
||||
{
|
||||
// Filename is too short
|
||||
continue;
|
||||
}
|
||||
// Compare end of filename with PLATFORM_DLEXT
|
||||
if(!strcasematch(&ent->d_name[fn_len - Q_strlen(PLATFORM_DLEXT)], PLATFORM_DLEXT))
|
||||
{
|
||||
// File isn't dll
|
||||
continue;
|
||||
}
|
||||
// Exclude all metamods
|
||||
if(strncasematch(ent->d_name, "metamod", Q_strlen("metamod")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Exclude all bots
|
||||
STRNCPY(buf, ent->d_name, sizeof(buf));
|
||||
strlwr(buf);
|
||||
if(Q_strstr(buf, "bot."))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#ifdef linux
|
||||
//bot_iX86.so, bot_amd64.so, bot_x86_64.so
|
||||
if(Q_strstr(buf, "bot_i") || Q_strstr(buf, "bot_amd64.so") || Q_strstr(buf, "bot_x86"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
// Generate full path
|
||||
safevoid_snprintf(fnpath, sizeof(fnpath), "%s/%s", dllpath, ent->d_name);
|
||||
// Check if dll is gamedll
|
||||
if(is_gamedll(fnpath))
|
||||
{
|
||||
META_DEBUG(8, ("is_gamedll(%s): ok.", fnpath));
|
||||
//gamedll detected
|
||||
STRNCPY(buf, ent->d_name, sizeof(buf));
|
||||
closedir(dir);
|
||||
return(buf);
|
||||
}
|
||||
META_DEBUG(8, ("is_gamedll(%s): failed.", fnpath));
|
||||
}
|
||||
//not found
|
||||
META_WARNING("GameDLL-Autodetection: Couldn't find gamedll in '%s'.", dllpath);
|
||||
closedir(dir);
|
||||
return(0);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#ifndef GAME_AUTODETECT_H
|
||||
#define GAME_AUTODETECT_H
|
||||
|
||||
#include "metamod.h"
|
||||
const char * DLLINTERNAL autodetect_gamedll(const gamedll_t *gamedll, const char *knownfn);
|
||||
|
||||
#endif /*GAME_AUTODETECT_H*/
|
@ -4,7 +4,6 @@
|
||||
#include "log_meta.h" // META_LOG, etc
|
||||
#include "types_meta.h" // mBOOL
|
||||
#include "osdep.h" // win32 snprintf, etc
|
||||
#include "game_autodetect.h" // autodetect_gamedll
|
||||
#include "support_meta.h" // MIN
|
||||
|
||||
// Adapted from adminmod h_export.cpp:
|
||||
@ -18,7 +17,10 @@ const game_modlist_t known_games = {
|
||||
// separate file, generated based on game information stored in a
|
||||
// convenient db.
|
||||
//
|
||||
#include "games.h"
|
||||
|
||||
{ "cstrike", "cs.so", "mp.dll", "Counter-Strike" },
|
||||
{ "czero", "cs.so", "mp.dll", "Counter-Strike:Condition Zero" },
|
||||
|
||||
// End of list terminator:
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
@ -200,19 +202,15 @@ mBOOL DLLINTERNAL setup_gamedll(gamedll_t *gamedll) {
|
||||
}
|
||||
}
|
||||
|
||||
// Then, autodetect gamedlls in "gamedir/dlls/"
|
||||
// autodetect_gamedll returns 0 if knownfn exists and is valid gamedll.
|
||||
if(Config->autodetect && (autofn=autodetect_gamedll(gamedll, knownfn))) {
|
||||
// If knownfn is set and autodetect_gamedll returns non-null
|
||||
// then knownfn doesn't exists and we should use autodetected
|
||||
// dll instead.
|
||||
if(knownfn) {
|
||||
// Whine loud about fact that known-list dll doesn't exists!
|
||||
//META_LOG(plapla);
|
||||
knownfn = autofn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//force load
|
||||
#ifdef linux
|
||||
knownfn = "cs.so";
|
||||
#else
|
||||
knownfn = "mp.dll";
|
||||
#endif
|
||||
|
||||
|
||||
// Neither override nor known-list nor auto-detect found a gamedll.
|
||||
if(!known && !Config->gamedll && !autofn)
|
||||
RETURN_ERRNO(mFALSE, ME_NOTFOUND);
|
||||
|
99
src/games.h
99
src/games.h
@ -1,99 +0,0 @@
|
||||
|
||||
// This list is now kept in a separate file to facilitate generating the
|
||||
// list from game data stored in a convenient db.
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64__)
|
||||
# define MODARCH "_amd64"
|
||||
#else
|
||||
# define MODARCH "_i386"
|
||||
#endif
|
||||
/*
|
||||
{"action", "ahl"MODARCH".so", "ahl.dll", "Action Half-Life"},
|
||||
{"ag", "ag"MODARCH".so", "ag.dll", "Adrenaline Gamer Steam"},
|
||||
{"ag3", "hl"MODARCH".so", "hl.dll", "Adrenalinegamer 3.x"},
|
||||
{"aghl", "ag"MODARCH".so", "ag.dll", "Adrenalinegamer 4.x"},
|
||||
{"arg", "arg"MODARCH".so", "hl.dll", "Arg!"},
|
||||
{"asheep", "hl"MODARCH".so", "hl.dll", "Azure Sheep"},
|
||||
{"bg", "bg"MODARCH".so", "bg.dll", "The Battle Grounds"},
|
||||
{"bot", "bot"MODARCH".so", "bot.dll", "Bot"},
|
||||
{"brainbread", "bb"MODARCH".so", "bb.dll", "Brain Bread"},
|
||||
{"bumpercars", "hl"MODARCH".so", "hl.dll", "Bumper Cars"},
|
||||
{"buzzybots", "bb"MODARCH".so", "bb.dll", "BuzzyBots"},
|
||||
{"cs13", "cs"MODARCH".so", "mp.dll", "Counter-Strike 1.3"},
|
||||
*/
|
||||
{"cstrike", "cs"MODARCH".so", "mp.dll", "Counter-Strike"},
|
||||
//{"csv15", "cs"MODARCH".so", "mp.dll", "CS 1.5 for Steam"},
|
||||
{"czero", "cs"MODARCH".so", "mp.dll", "Counter-Strike:Condition Zero"},
|
||||
/*
|
||||
{"dcrisis", "dc"MODARCH".so", "dc.dll", "Desert Crisis"},
|
||||
{"dmc", "dmc"MODARCH".so", "dmc.dll", "Deathmatch Classic"},
|
||||
{"dod", "dod"MODARCH".so", "dod.dll", "Day of Defeat"},
|
||||
{"dpb", "pb.i386.so", "pb.dll", "Digital Paintball"},
|
||||
{"dragonmodz", "hl"MODARCH".so", "mp.dll", "Dragon Mod Z"},
|
||||
{"esf", "hl"MODARCH".so", "hl.dll", "Earth's Special Forces"},
|
||||
{"existence", "ex"MODARCH".so", "existence.dll", "Existence"},
|
||||
{"firearms", "fa"MODARCH".so", "firearms.dll", "Firearms"},
|
||||
{"firearms25", "fa"MODARCH".so", "firearms.dll", "Retro Firearms"},
|
||||
{"freeze", "mp"MODARCH".so", "mp.dll", "Freeze"},
|
||||
{"frontline", "front"MODARCH".so", "frontline.dll", "Frontline Force"},
|
||||
{"gangstawars", "gangsta"MODARCH".so", "gwars27.dll", "Gangsta Wars"},
|
||||
{"gangwars", "mp"MODARCH".so", "mp.dll", "Gangwars"},
|
||||
{"gearbox", "opfor"MODARCH".so", "opfor.dll", "Opposing Force"},
|
||||
{"globalwarfare", "gw"MODARCH".so", "mp.dll", "Global Warfare"},
|
||||
{"goldeneye", "golden"MODARCH".so", "mp.dll", "Goldeneye"},
|
||||
{"hl15we", "hl"MODARCH".so", "hl.dll", "Half-Life 1.5: Weapon Edition"},
|
||||
{"hlrally", "hlr"MODARCH".so", "hlrally.dll", "HL-Rally"},
|
||||
{"holywars", "hl"MODARCH".so", "holywars.dll", "Holy Wars"},
|
||||
{"hostileintent", "hl"MODARCH".so", "hl.dll", "Hostile Intent"},
|
||||
{"ios", "ios"MODARCH".so", "ios.dll", "International Online Soccer"},
|
||||
{"judgedm", "judge"MODARCH".so", "mp.dll", "Judgement"},
|
||||
{"kanonball", "hl"MODARCH".so", "kanonball.dll", "Kanonball"},
|
||||
{"monkeystrike", "ms"MODARCH".so", "monkey.dll", "Monkeystrike"},
|
||||
{"MorbidPR", "morbid"MODARCH".so", "morbid.dll", "Morbid Inclination"},
|
||||
{"movein", "hl"MODARCH".so", "hl.dll", "Move In!"},
|
||||
{"ns", "ns"MODARCH".so", "ns.dll", "Natural Selection"},
|
||||
{"nsp", "ns"MODARCH".so", "ns.dll", "Natural Selection Beta"},
|
||||
{"oel", "hl"MODARCH".so", "hl.dll", "OeL Half-Life"},
|
||||
{"og", "og"MODARCH".so", "og.dll", "Over Ground"},
|
||||
{"ol", "ol"MODARCH".so", "hl.dll", "Outlawsmod"},
|
||||
{"ops1942", "spirit"MODARCH".so", "spirit.dll", "Operations 1942"},
|
||||
{"osjb", "osjb"MODARCH".so", "jail.dll", "Open-Source Jailbreak"},
|
||||
{"outbreak", "none", "hl.dll", "Out Break"},
|
||||
{"oz", "mp"MODARCH".so", "mp.dll", "Oz Deathmatch"},
|
||||
{"paintball", "pb"MODARCH".so", "mp.dll", "Paintball"},
|
||||
{"penemy", "pe"MODARCH".so", "pe.dll", "Public Enemy"},
|
||||
{"phineas", "phineas"MODARCH".so", "phineas.dll", "Phineas Bot"},
|
||||
{"ponreturn", "ponr"MODARCH".so", "mp.dll", "Point of No Return"},
|
||||
{"pvk", "hl"MODARCH".so", "hl.dll", "Pirates, Vikings and Knights"},
|
||||
{"rc2", "rc2"MODARCH".so", "rc2.dll", "Rocket Crowbar 2"},
|
||||
{"retrocs", "rcs"MODARCH".so", "rcs.dll", "Retro Counter-Strike"},
|
||||
{"rewolf", "hl"MODARCH".so", "gunman.dll", "Gunman Chronicles"},
|
||||
{"ricochet", "ricochet"MODARCH".so", "mp.dll", "Ricochet"},
|
||||
{"rockcrowbar", "rc"MODARCH".so", "rc.dll", "Rocket Crowbar"},
|
||||
{"rspecies", "hl"MODARCH".so", "hl.dll", "Rival Species"},
|
||||
{"scihunt", "shunt.so", "shunt.dll", "Scientist Hunt"},
|
||||
{"sdm", "sdmmod"MODARCH".so", "sdmmod.dll", "Special Death Match"},
|
||||
{"Ship", "ship"MODARCH".so", "ship.dll", "The Ship"},
|
||||
{"si", "si"MODARCH".so", "si.dll", "Science & Industry"},
|
||||
{"snow", "snow"MODARCH".so", "snow.dll", "Snow-War"},
|
||||
{"stargatetc", "hl"MODARCH".so", "hl.dll", "StargateTC"},
|
||||
{"svencoop", "hl"MODARCH".so", "hl.dll", "Sven Coop"},
|
||||
{"swarm", "swarm"MODARCH".so", "swarm.dll", "Swarm"},
|
||||
{"tfc", "tfc"MODARCH".so", "tfc.dll", "Team Fortress Classic"},
|
||||
{"thewastes", "thewastes"MODARCH".so", "thewastes.dll", "The Wastes"},
|
||||
{"timeless", "pt"MODARCH".so", "timeless.dll", "Project Timeless"},
|
||||
{"tod", "hl"MODARCH".so", "hl.dll", "Tour of Duty"},
|
||||
{"trainhunters", "th"MODARCH".so", "th.dll", "Train Hunters"},
|
||||
{"trevenge", "trevenge.so", "trevenge.dll", "The Terrorist Revenge"},
|
||||
{"TS", "ts"MODARCH".so", "mp.dll", "The Specialists"},
|
||||
{"tt", "tt"MODARCH".so", "tt.dll", "The Trenches"},
|
||||
{"underworld", "uw"MODARCH".so", "uw.dll", "Underworld Bloodline"},
|
||||
{"valve", "hl"MODARCH".so", "hl.dll", "Half-Life Deathmatch"},
|
||||
{"vs", "vs"MODARCH".so", "mp.dll", "VampireSlayer"},
|
||||
{"wantedhl", "hl"MODARCH".so", "wanted.dll", "Wanted!"},
|
||||
{"wasteland", "whl_linux.so", "mp.dll", "Wasteland"},
|
||||
{"weapon_wars", "ww"MODARCH".so", "hl.dll", "Weapon Wars"},
|
||||
{"wizwars", "mp"MODARCH".so", "hl.dll", "Wizard Wars"},
|
||||
{"wormshl", "wormshl_i586.so", "wormshl.dll", "WormsHL"},
|
||||
{"zp", "none", "mp.dll", "Zombie Panic"},
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user