Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5813, r=asherkin).

--HG--
extra : rebase_source : 89a3d9703bbb0f5c3225ce8f5da85ce1fabafeaa
This commit is contained in:
Nicholas Hastings
2013-07-21 11:53:56 -04:00
parent 9fe2d9c1cf
commit 7ede8e0924
32 changed files with 278 additions and 140 deletions
+6 -2
View File
@@ -76,8 +76,12 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
#define GAMEFIX "2.eye"
#elif SOURCE_ENGINE == SE_CSS
#define GAMEFIX "2.css"
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
#define GAMEFIX "2.ep2v"
#elif SOURCE_ENGINE == SE_HL2DM
#define GAMEFIX "2.hl2dm"
#elif SOURCE_ENGINE == SE_DODS
#define GAMEFIX "2.dods"
#elif SOURCE_ENGINE == SE_TF2
#define GAMEFIX "2.tf2"
#elif SOURCE_ENGINE == SE_DARKMESSIAH
#define GAMEFIX "2.darkm"
#elif SOURCE_ENGINE == SE_PORTAL2
+1 -1
View File
@@ -56,7 +56,7 @@ typedef ICommandLine *(*FakeGetCommandLine)();
#define TIER0_NAME "libtier0.dylib"
#define VSTDLIB_NAME "libvstdlib.dylib"
#elif defined __linux__
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2
#if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_LEFT4DEAD2
#define TIER0_NAME "libtier0_srv.so"
#define VSTDLIB_NAME "libvstdlib_srv.so"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
+1 -1
View File
@@ -337,7 +337,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
#endif
0,
PITCH_NORM,
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
0,
#endif
&pos);
+6 -16
View File
@@ -249,7 +249,7 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
static ConVar *tv_enable = icvar->FindVar("tv_enable");
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_TF2
static ConVar *replay_enable = icvar->FindVar("replay_enable");
#endif
@@ -259,7 +259,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
ICommandLine *commandLine = g_HL2.GetValveCommandLine();
m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && (!commandLine || commandLine->FindParm("-nohltv") == 0));
m_bIsReplayActive = false;
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_TF2
m_bIsReplayActive = (replay_enable && replay_enable->GetBool());
#endif
m_PlayersSinceActive = 0;
@@ -580,17 +580,14 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
int newCount = m_PlayersSinceActive + 1;
int userId = engine->GetPlayerUserId(pEntity);
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2)
#if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2)
static ConVar *tv_name = icvar->FindVar("tv_name");
#endif
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_TF2
static ConVar *replay_name = icvar->FindVar("replay_name");
#endif
#if SOURCE_ENGINE == SE_LEFT4DEAD2
static bool bIsNuclearDawn = (strcmp(g_SourceMod.GetGameFolderName(), "nucleardawn") == 0);
#endif
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_TF2
if (m_bIsReplayActive && newCount == 1
&& (m_ReplayUserId == userId
|| (replay_name && strcmp(playername, replay_name->GetString()) == 0) || (replay_name && replay_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
@@ -608,15 +605,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
&& (m_SourceTVUserId == userId
#if SOURCE_ENGINE == SE_CSGO
|| strcmp(playername, "GOTV") == 0
#elif (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|| (bIsNuclearDawn && ( true
#endif // SE_LEFT4DEAD2
#elif (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN)
|| (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
#if SOURCE_ENGINE == SE_LEFT4DEAD2
))
|| (!bIsNuclearDawn && strcmp(playername, "SourceTV") == 0)
#endif // SE_LEFT4DEAD2
#else
|| strcmp(playername, "SourceTV") == 0
#endif
+1 -1
View File
@@ -386,7 +386,7 @@ public:
virtual void SetValue( const char *value );
virtual void SetValue( float value );
virtual void SetValue( int value );
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
#if SOURCE_ENGINE >= SE_NUCLEARDAWN
virtual void SetValue( Color value );
#endif
+70 -31
View File
@@ -54,6 +54,7 @@ IGameConfig *g_pGameConf = NULL;
static char g_Game[256];
static char g_GameDesc[256] = {'!', '\0'};
static char g_GameName[256] = {'$', '\0'};
static const char *g_pParseEngine = NULL;
#define PSTATE_NONE 0
#define PSTATE_GAMES 1
@@ -112,10 +113,10 @@ static bool DoesGameMatch(const char *value)
static bool DoesEngineMatch(const char *value)
{
return strcmp(value, smcore.GetSourceEngineName()) == 0;
return strcmp(value, g_pParseEngine) == 0;
}
CGameConfig::CGameConfig(const char *file)
CGameConfig::CGameConfig(const char *file, const char *engine)
{
strncopy(m_File, file, sizeof(m_File));
m_pAddresses = new KTrie<AddressConf>();
@@ -124,6 +125,16 @@ CGameConfig::CGameConfig(const char *file)
m_CustomLevel = 0;
m_CustomHandler = NULL;
if (!engine)
m_pEngine = smcore.GetSourceEngineName();
else
m_pEngine = engine;
if (strcmp(m_pEngine, "css") == 0 || strcmp(m_pEngine, "dods") == 0 || strcmp(m_pEngine, "hl2dm") == 0 || strcmp(m_pEngine, "tf2") == 0)
this->SetBaseEngine("orangebox_valve");
else
this->SetBaseEngine(NULL);
}
CGameConfig::~CGameConfig()
@@ -772,19 +783,29 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
SMCStates state = {0, 0};
List<String> fileList;
master_reader.fileList = &fileList;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
if (err != SMCError_Okay)
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
const char *msg = textparsers->GetSMCErrorString(err);
if (pEngine[iter] == NULL)
{
continue;
}
smcore.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
return false;
this->SetParseEngine(pEngine[iter]);
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
if (err != SMCError_Okay)
{
const char *msg = textparsers->GetSMCErrorString(err);
smcore.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
return false;
}
}
/* Go through each file we found and parse it. */
@@ -850,35 +871,53 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
m_IgnoreLevel = 0;
bShouldBeReadingDefault = true;
m_ParseState = PSTATE_NONE;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
!= SMCError_Okay)
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
const char *msg;
msg = textparsers->GetSMCErrorString(err);
smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
if (pEngine[iter] == NULL)
{
//error occurred while parsing a custom section
m_CustomHandler->ReadSMC_ParseEnd(true, true);
m_CustomHandler = NULL;
m_CustomLevel = 0;
continue;
}
return false;
this->SetParseEngine(pEngine[iter]);
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
!= SMCError_Okay)
{
const char *msg = textparsers->GetSMCErrorString(err);
smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
{
//error occurred while parsing a custom section
m_CustomHandler->ReadSMC_ParseEnd(true, true);
m_CustomHandler = NULL;
m_CustomLevel = 0;
}
return false;
}
}
return true;
}
void CGameConfig::SetBaseEngine(const char *engine)
{
m_pBaseEngine = engine;
}
void CGameConfig::SetParseEngine(const char *engine)
{
g_pParseEngine = engine;
}
bool CGameConfig::GetOffset(const char *key, int *value)
{
int *pvalue;
+5 -1
View File
@@ -50,11 +50,13 @@ class CGameConfig :
{
friend class GameConfigManager;
public:
CGameConfig(const char *file);
CGameConfig(const char *file, const char *engine = NULL);
~CGameConfig();
public:
bool Reparse(char *error, size_t maxlength);
bool EnterFile(const char *file, char *error, size_t maxlength);
void SetBaseEngine(const char *engine);
void SetParseEngine(const char *engine);
public: //ITextListener_SMC
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
@@ -111,6 +113,8 @@ private:
int m_AddressReadCount;
int m_AddressRead[8];
KTrie<AddressConf> *m_pAddresses;
const char *m_pEngine;
const char *m_pBaseEngine;
};
class GameConfigManager :
+9 -3
View File
@@ -180,10 +180,16 @@ static const char *get_source_engine_name()
return "eye";
#elif SOURCE_ENGINE == SE_CSS
return "css";
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
return "orangebox_valve";
#elif SOURCE_ENGINE == SE_HL2DM
return "hl2dm";
#elif SOURCE_ENGINE == SE_DODS
return "dods";
#elif SOURCE_ENGINE == SE_TF2
return "tf2";
#elif SOURCE_ENGINE == SE_LEFT4DEAD
return "left4dead";
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
return "nucleardawn";
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
return "left4dead2";
#elif SOURCE_ENGINE == SE_ALIENSWARM
@@ -197,7 +203,7 @@ static const char *get_source_engine_name()
static bool symbols_are_hidden()
{
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO)
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_HL2DM) || (SOURCE_ENGINE == SE_DODS) || (SOURCE_ENGINE == SE_TF2) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_NUCLEARDAWN) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO)
return true;
#else
return false;
+3 -3
View File
@@ -913,7 +913,7 @@ cell_t g_ServerCommandBufferLength;
bool g_ShouldCatchSpew = false;
#if SOURCE_ENGINE < SE_LEFT4DEAD2
#if SOURCE_ENGINE < SE_NUCLEARDAWN
SpewOutputFunc_t g_OriginalSpewOutputFunc = NULL;
SpewRetval_t SourcemodSpewOutputFunc(SpewType_t spewType, tchar const *pMsg)
@@ -952,7 +952,7 @@ CON_COMMAND(sm_conhook_start, "")
return;
}
#if SOURCE_ENGINE < SE_LEFT4DEAD2
#if SOURCE_ENGINE < SE_NUCLEARDAWN
g_OriginalSpewOutputFunc = GetSpewOutputFunc();
SpewOutputFunc(SourcemodSpewOutputFunc);
#else
@@ -973,7 +973,7 @@ CON_COMMAND(sm_conhook_stop, "")
return;
}
#if SOURCE_ENGINE < SE_LEFT4DEAD2
#if SOURCE_ENGINE < SE_NUCLEARDAWN
SpewOutputFunc(g_OriginalSpewOutputFunc);
#else
LoggingSystem_PopLoggingState(false);
+4 -4
View File
@@ -1208,7 +1208,7 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params)
is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED);
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (pProp->GetFlags() & SPROP_VARINT)
{
bit_count = sizeof(int) * 8;
@@ -1306,7 +1306,7 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
FIND_PROP_SEND(DPT_Int, "integer");
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (pProp->GetFlags() & SPROP_VARINT)
{
bit_count = sizeof(int) * 8;
@@ -2030,7 +2030,7 @@ static int32_t SDKEntFlagToSMEntFlag(int flag)
#if SOURCE_ENGINE == SE_ALIENSWARM
case FL_FREEZING:
return ENTFLAG_FREEZING;
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS
#elif SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
case FL_EP2V_UNKNOWN:
return ENTFLAG_EP2V_UNKNOWN1;
#endif
@@ -2108,7 +2108,7 @@ static int32_t SMEntFlagToSDKEntFlag(int32_t flag)
#if SOURCE_ENGINE == SE_ALIENSWARM
case ENTFLAG_FREEZING:
return FL_FREEZING;
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS
#elif SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
case ENTFLAG_EP2V_UNKNOWN1:
return FL_EP2V_UNKNOWN;
#endif
+11 -2
View File
@@ -73,7 +73,7 @@ static cell_t IsDedicatedServer(IPluginContext *pContext, const cell_t *params)
static cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params)
{
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
#if SOURCE_ENGINE >= SE_NUCLEARDAWN
float fTime = Plat_FloatTime();
#else
float fTime = engine->Time();
@@ -475,10 +475,13 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 33;
case SOURCE_ENGINE_CSS:
return 34;
case SOURCE_ENGINE_ORANGEBOXVALVE:
case SOURCE_ENGINE_HL2DM:
case SOURCE_ENGINE_DODS:
case SOURCE_ENGINE_TF2:
return 35;
case SOURCE_ENGINE_LEFT4DEAD:
return 40;
case SOURCE_ENGINE_NUCLEARDAWN:
case SOURCE_ENGINE_LEFT4DEAD2:
return 50;
case SOURCE_ENGINE_ALIENSWARM:
@@ -503,6 +506,11 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 0;
}
static cell_t GetEngineVersion(IPluginContext *pContext, const cell_t *params)
{
return g_SMAPI->GetSourceEngineBuild();
}
static cell_t IndexToReference(IPluginContext *pContext, const cell_t *params)
{
if (params[1] >= NUM_ENT_ENTRIES || params[1] < 0)
@@ -554,6 +562,7 @@ REGISTER_NATIVES(halflifeNatives)
{"ShowVGUIPanel", ShowVGUIPanel},
{"IsPlayerAlive", smn_IsPlayerAlive},
{"GuessSDKVersion", GuessSDKVersion},
{"GetEngineVersion", GetEngineVersion},
{"EntIndexToEntRef", IndexToReference},
{"EntRefToEntIndex", ReferenceToIndex},
{"MakeCompatEntRef", ReferenceToBCompatRef},