mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Renamed 'r5apexsdkd64.dll' to 'gamesdk.dll'. * Added required dedicated parameters to code instead. * Bug fixes around CCommandLine class (fixed misaligned VTable indexes). * SDK now supports being directly launched by the game executable. The SDK launcher will pass '-launcher' to the game, which indicated its being launched by the launcher. If the game does not receive '-launcher', it assumes its being launched directly from the game executable, which will instead load 'startup_(dedi_)default.cfg'. The sdk dll's are now added to the game's IAT by their dummy exports allowing for them to be loaded when the exe is loaded (the dll's do everything on init).
70 lines
2.3 KiB
C++
70 lines
2.3 KiB
C++
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//===========================================================================//
|
|
|
|
#include "core/stdafx.h"
|
|
#include "tier1/cmd.h"
|
|
#include "tier1/cvar.h"
|
|
#include "engine/sys_dll.h"
|
|
#include "engine/sys_dll2.h"
|
|
#include "engine/sys_utils.h"
|
|
#include "client/vengineclient_impl.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Figure out if we're running a Valve mod or not.
|
|
//-----------------------------------------------------------------------------
|
|
static bool IsValveMod(const char* pModName)
|
|
{
|
|
return (_stricmp(pModName, "cstrike") == 0 ||
|
|
_stricmp(pModName, "dod") == 0 ||
|
|
_stricmp(pModName, "hl1mp") == 0 ||
|
|
_stricmp(pModName, "tf") == 0 ||
|
|
_stricmp(pModName, "hl2mp") == 0 ||
|
|
_stricmp(pModName, "csgo") == 0);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Figure out if we're running a Respawn mod or not.
|
|
//-----------------------------------------------------------------------------
|
|
static bool IsRespawnMod(const char* pModName)
|
|
{
|
|
return (_stricmp(pModName, "platform") == 0 ||
|
|
_stricmp(pModName, "r1") == 0 ||
|
|
_stricmp(pModName, "r2") == 0 ||
|
|
_stricmp(pModName, "r5") == 0);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Initialization, shutdown of a mod.
|
|
//-----------------------------------------------------------------------------
|
|
bool CEngineAPI::ModInit(CEngineAPI* pEngineAPI, const char* pModName, const char* pGameDir)
|
|
{
|
|
g_pConCommand->InitShipped();
|
|
g_pConCommand->PurgeShipped();
|
|
g_pConVar->InitShipped();
|
|
g_pConVar->PurgeShipped();
|
|
|
|
bool results = CEngineAPI_ModInit(pEngineAPI, pModName, pGameDir);
|
|
if (!IsValveMod(pModName) && IsRespawnMod(pModName))
|
|
{
|
|
*m_bRestrictServerCommands = true; // Restrict commands.
|
|
|
|
ConCommandBase* disconnect = g_pCVar->FindCommandBase("disconnect");
|
|
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
|
|
}
|
|
return results;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void SysDll2_Attach()
|
|
{
|
|
DetourAttach((LPVOID*)&CEngineAPI_ModInit, &CEngineAPI::ModInit);
|
|
}
|
|
|
|
void SysDll2_Detach()
|
|
{
|
|
DetourDetach((LPVOID*)&CEngineAPI_ModInit, &CEngineAPI::ModInit);
|
|
} |