1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

Add support for Source SDK Base 2013 (bug 5916, r=asherkin).

This commit is contained in:
Nicholas Hastings 2013-10-08 21:01:53 -04:00
parent 17ae4f0c49
commit 1af37d530f
7 changed files with 82 additions and 54 deletions

View File

@ -24,22 +24,25 @@ class MMS:
self.possibleSdks['dods'] = {'sdk': 'HL2SDKDODS', 'ext': '2.dods', 'def': '8',
'name': 'DODS', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-dods'}
self.possibleSdks['tf2'] = {'sdk': 'HL2SDKTF2', 'ext': '2.tf2', 'def': '9',
self.possibleSdks['sdk2013'] = {'sdk': 'HL2SDK2013', 'ext': '2.sdk2013', 'def': '9',
'name': 'SDK2013', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-2013'}
self.possibleSdks['tf2'] = {'sdk': 'HL2SDKTF2', 'ext': '2.tf2', 'def': '10',
'name': 'TF2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-tf2'}
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '10',
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '11',
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d'}
self.possibleSdks['nd'] = {'sdk': 'HL2SDKND', 'ext': '2.nd', 'def': '11',
self.possibleSdks['nd'] = {'sdk': 'HL2SDKND', 'ext': '2.nd', 'def': '12',
'name': 'NUCLEARDAWN', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-nd'}
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '12',
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '13',
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d2'}
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH', 'platform': ['windows'],
'dir': 'hl2sdk-darkm'}
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '13',
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '14',
'name': 'ALIENSWARM', 'platform': ['windows'],
'dir': 'hl2sdk-swarm'}
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
@ -48,15 +51,15 @@ class MMS:
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
'name': 'EYE', 'platform': ['windows'],
'dir': 'hl2sdk-eye'}
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '15',
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '16',
'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-csgo'}
self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '16',
self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '17',
'name': 'DOTA', 'platform': ['windows'],
'dir': 'hl2sdk-dota'}
# self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '14',
# 'name': 'PORTAL2', 'platform': ['windows'],
# 'dir': 'hl2sdk-portal2'}
self.possibleSdks['portal2'] = {'sdk': 'HL2SDKPORTAL2','ext': '2.portal2', 'def': '15',
'name': 'PORTAL2', 'platform': [],
'dir': 'hl2sdk-portal2'}
self.sdkInfo = { }
@ -266,22 +269,23 @@ class MMS:
if AMBuild.target['platform'] == 'linux':
if sdk == 'ep1':
staticLibs = os.path.join(sdkPath, 'linux_sdk')
elif sdk == 'sdk2013':
staticLibs = os.path.join(sdkPath, 'lib', 'public', 'linux32')
else:
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
libs = []
if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
libs = ['tier1_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif sdk in ['l4d', 'nd', 'csgo']:
libs = ['tier1_i486.a', 'libvstdlib.so', 'libtier0.so']
if sdk == 'csgo':
libs.insert(0, 'interfaces_i486.a')
elif sdk == 'sdk2013':
libs = ['tier1.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
else:
libs = ['tier1_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
@ -289,18 +293,14 @@ class MMS:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
else:
for i in ['tier1_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'darwin':
if sdk == 'sdk2013':
staticLibs = os.path.join(sdkPath, 'lib', 'public', 'osx32')
libs = ['tier1.a', 'libvstdlib.dylib', 'libtier0.dylib']
else:
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
libs = ['tier1_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
if sdk == 'csgo':
libs.append('interfaces_i486.a')
for lib in libs:
@ -321,7 +321,11 @@ class MMS:
def PostSetupHL2Job(self, job, builder, sdk):
if AMBuild.target['platform'] in ['linux', 'darwin']:
if sdk == 'sdk2013':
builder.AddObjectFiles(['tier1.a'])
else:
builder.AddObjectFiles(['tier1_i486.a'])
if( sdk in ['csgo', 'dota'] ):
builder.AddObjectFiles(['interfaces_i486.a'])
@ -335,10 +339,6 @@ class MMS:
info = self.possibleSdks
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
# We don't build for Portal 2 (yet?, ever?), but using this define in code as
# it saves trouble if we ever need to
compiler['CDEFINES'].append('SE_PORTAL2=14')
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
['public', 'tier0'], ['public', 'tier1']]
if sdk == 'ep1' or sdk == 'darkm':
@ -354,28 +354,44 @@ class MMS:
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
if sdk == 'sdk2013' and isinstance(compiler.cxx, Cpp.CompatGCC):
# The 2013 SDK already has these in public/tier0/basetypes.h
compiler['CDEFINES'].remove('stricmp=strcasecmp')
compiler['CDEFINES'].remove('_stricmp=strcasecmp')
compiler['CDEFINES'].remove('_snprintf=snprintf')
compiler['CDEFINES'].remove('_vsnprintf=vsnprintf')
if sdk in ['swarm', 'csgo', 'dota']:
if AMBuild.target['platform'] == 'windows':
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
else:
compiler['CDEFINES'].extend(['COMPILER_GCC'])
if sdk in ['css','hl2dm','dods','sdk2013','tf2','l4d2']:
if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
compiler['CDEFINES'].append('NO_MALLOC_OVERRIDE')
if AMBuild.target['platform'] == 'linux':
if sdk == 'ep1':
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'linux_sdk')
elif sdk == 'sdk2013':
staticLibs = os.path.join(sdkPath, 'lib', 'public', 'linux32')
else:
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
elif AMBuild.target['platform'] == 'darwin':
if sdk == 'sdk2013':
staticLibs = os.path.join(sdkPath, 'lib', 'public', 'osx32')
else:
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
for i in paths:
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
if not noLink:
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'l4d2']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
elif sdk in ['l4d', 'nd', 'csgo']:

View File

@ -61,6 +61,7 @@ enum
#define SOURCE_ENGINE_DODS 16 /**< Day of Defeat: Source */
#define SOURCE_ENGINE_TF2 17 /**< Team Fortress 2 */
#define SOURCE_ENGINE_NUCLEARDAWN 18 /**< Nuclear Dawn */
#define SOURCE_ENGINE_SDK2013 19 /**< Source SDK 2013 */
#define METAMOD_PLAPI_VERSION 15 /**< Version of this header file */
#define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */

View File

@ -129,6 +129,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
CONMSG(" Engine: Half-Life 2 Deathmatch (Valve Orange Box)\n");
#elif SOURCE_ENGINE == SE_DODS
CONMSG(" Engine: Day of Defeat: Source (Valve Orange Box)\n");
#elif SOURCE_ENGINE == SE_SDK2013
CONMSG(" Engine: Source SDK 2013 (2013)\n");
#elif SOURCE_ENGINE == SE_TF2
CONMSG(" Engine: Team Fortress 2 (Valve Orange Box)\n");
#elif SOURCE_ENGINE == SE_DARKMESSIAH

View File

@ -323,7 +323,7 @@ bool UTIL_Relatize(char buffer[],
size_t len, total = 0;
while (numLevels--)
{
len = _snprintf(&buffer[total], maxlength - total, ".." PATH_SEP_STR);
len = snprintf(&buffer[total], maxlength - total, ".." PATH_SEP_STR);
if (len >= maxlength - total)
{
/* Not enough space in the buffer */
@ -333,7 +333,7 @@ bool UTIL_Relatize(char buffer[],
}
/* Add the absolute path. */
len = _snprintf(&buffer[total], maxlength - total, "%s", &rootFrom[1]);
len = snprintf(&buffer[total], maxlength - total, "%s", &rootFrom[1]);
if (len >= maxlength - total)
{
return false;

View File

@ -389,6 +389,8 @@ int BaseProvider::DetermineSourceEngine(const char *game)
return SOURCE_ENGINE_HL2DM;
#elif SOURCE_ENGINE == SE_DODS
return SOURCE_ENGINE_DODS;
#elif SOURCE_ENGINE == SE_SDK2013
return SOURCE_ENGINE_SDK2013;
#elif SOURCE_ENGINE == SE_TF2
return SOURCE_ENGINE_TF2;
#elif SOURCE_ENGINE == SE_DARKMESSIAH

View File

@ -85,6 +85,7 @@ static const char *backend_names[] =
"2.dods",
"2.tf2",
"2.nd",
"2.sdk2013",
};
#if defined _WIN32
@ -339,6 +340,10 @@ mm_DetermineBackend(QueryValveInterface engineFactory, const char *game_name)
{
return MMBackend_HL2DM;
}
else
{
return MMBackend_SDK2013;
}
}
}
/* Check for Episode One/Old Engine */

View File

@ -97,6 +97,8 @@ enum MetamodBackend
MMBackend_DODS,
MMBackend_TF2,
MMBackend_NuclearDawn,
MMBackend_SDK2013,
MMBackend_UNKNOWN
};