mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-03-22 13:19:40 +01:00
combining everything into one binary again now that api is separated
--HG-- branch : sourcemm-1.6.0 rename : sourcemm/oslink.cpp => sourcemm/metamod_oslink.cpp rename : sourcemm/oslink.h => sourcemm/metamod_oslink.h extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.6.0%40434
This commit is contained in:
parent
cc18058a51
commit
6cfff6ed91
@ -18,7 +18,7 @@
|
||||
|
||||
#include <interface.h>
|
||||
#include <eiface.h>
|
||||
#include <sourcehook/sourcehook.h>
|
||||
#include <sourcehook.h>
|
||||
#include "IPluginManager.h"
|
||||
|
||||
#if defined __GNUC__
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <interface.h>
|
||||
#include <sourcehook/sourcehook.h>
|
||||
#include <sourcehook.h>
|
||||
#include "ISmmAPI.h"
|
||||
|
||||
#define PLAPI_VERSION 12
|
||||
|
111
sourcemm/episode1/console.cpp
Normal file
111
sourcemm/episode1/console.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
#include "console.h"
|
||||
#include "provider_ep1.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
|
||||
SMConVarAccessor g_SMConVarAccessor;
|
||||
|
||||
class CAlwaysRegisterableCommand : public ConCommandBase
|
||||
{
|
||||
public:
|
||||
CAlwaysRegisterableCommand()
|
||||
{
|
||||
Create("metamod_eternal", NULL, FCVAR_UNREGISTERED|FCVAR_GAMEDLL);
|
||||
}
|
||||
bool IsRegistered( void ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void BringToFront()
|
||||
{
|
||||
// First, let's try to find us!
|
||||
ConCommandBase *pPtr = icvar->GetCommands();
|
||||
|
||||
if (pPtr == this)
|
||||
{
|
||||
// We are already at the beginning; Nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
while (pPtr)
|
||||
{
|
||||
if (pPtr == this)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ConCommandBase *pPrev = NULL;
|
||||
while (pPtr)
|
||||
{
|
||||
if (pPtr == this)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pPrev = pPtr;
|
||||
pPtr = const_cast<ConCommandBase*>(pPtr->GetNext());
|
||||
}
|
||||
if (pPrev && pPtr == this)
|
||||
{
|
||||
pPrev->SetNext(m_pNext); // Remove us from the list
|
||||
}
|
||||
// Now, register us
|
||||
SetNext(NULL);
|
||||
icvar->RegisterConCommandBase(this);
|
||||
}
|
||||
}
|
||||
} s_EternalCommand;
|
||||
|
||||
bool SMConVarAccessor::RegisterConCommandBase(ConCommandBase *pCommand)
|
||||
{
|
||||
m_RegisteredCommands.push_back(pCommand);
|
||||
pCommand->SetNext(NULL);
|
||||
icvar->RegisterConCommandBase(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SMConVarAccessor::Register(ConCommandBase *pCommand)
|
||||
{
|
||||
pCommand->SetNext(NULL);
|
||||
icvar->RegisterConCommandBase(pCommand);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SMConVarAccessor::MarkCommandsAsGameDLL()
|
||||
{
|
||||
for (List<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
|
||||
iter != m_RegisteredCommands.end(); ++iter)
|
||||
{
|
||||
(*iter)->AddFlags(FCVAR_GAMEDLL);
|
||||
}
|
||||
}
|
||||
|
||||
void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
|
||||
{
|
||||
ConCommandBase *ptr = icvar->GetCommands();
|
||||
|
||||
if (ptr == pCommand)
|
||||
{
|
||||
s_EternalCommand.BringToFront();
|
||||
s_EternalCommand.SetNext(const_cast<ConCommandBase *>(pCommand->GetNext()));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Find us and unregister us */
|
||||
ConCommandBase *pPrev = NULL;
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr == pCommand)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pPrev = ptr;
|
||||
ptr = const_cast<ConCommandBase *>(ptr->GetNext());
|
||||
}
|
||||
if (pPrev && ptr == pCommand)
|
||||
{
|
||||
pPrev->SetNext(const_cast<ConCommandBase *>(pCommand->GetNext()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
24
sourcemm/episode1/console.h
Normal file
24
sourcemm/episode1/console.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef _INCLUDE_CONSOLE_MMS_H_
|
||||
#define _INCLUDE_CONSOLE_MMS_H_
|
||||
|
||||
#include <interface.h>
|
||||
#include <eiface.h>
|
||||
#include "convar_smm.h"
|
||||
#include <sh_list.h>
|
||||
|
||||
class SMConVarAccessor : public IConCommandBaseAccessor
|
||||
{
|
||||
public:
|
||||
bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||
bool Register(ConCommandBase *pCommand);
|
||||
void MarkCommandsAsGameDLL();
|
||||
void Unregister(ConCommandBase *pCommand);
|
||||
void UnregisterGameDLLCommands();
|
||||
private:
|
||||
SourceHook::List<ConCommandBase*> m_RegisteredCommands;
|
||||
};
|
||||
|
||||
extern SMConVarAccessor g_SMConVarAccessor;
|
||||
|
||||
#endif //_INCLUDE_CONSOLE_MMS_H_
|
||||
|
523
sourcemm/episode1/convar_smm.h
Normal file
523
sourcemm/episode1/convar_smm.h
Normal file
@ -0,0 +1,523 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $Workfile: $
|
||||
// $Date: 2007-02-08 04:19:19 -0500 (Thu, 08 Feb 2007) $
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef CONVAR_H
|
||||
#define CONVAR_H
|
||||
#if _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier0/dbg.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif _LINUX
|
||||
#define FORCEINLINE_CVAR __inline__ FORCEINLINE
|
||||
#else
|
||||
#error "implement me"
|
||||
#endif
|
||||
|
||||
// The default, no flags at all
|
||||
#define FCVAR_NONE 0
|
||||
|
||||
// Command to ConVars and ConCommands
|
||||
// ConVar Systems
|
||||
#define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc.
|
||||
#define FCVAR_LAUNCHER (1<<1) // defined by launcher
|
||||
#define FCVAR_GAMEDLL (1<<2) // defined by the game DLL
|
||||
#define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL
|
||||
#define FCVAR_MATERIAL_SYSTEM (1<<4) // Defined by the material system.
|
||||
#define FCVAR_DATACACHE (1<<19) // Defined by the datacache system.
|
||||
#define FCVAR_STUDIORENDER (1<<15) // Defined by the studiorender system.
|
||||
#define FCVAR_FILESYSTEM (1<<21) // Defined by the file system.
|
||||
#define FCVAR_PLUGIN (1<<18) // Defined by a 3rd party plugin.
|
||||
#define FCVAR_TOOLSYSTEM (1<<20) // Defined by an IToolSystem library
|
||||
#define FCVAR_SOUNDSYSTEM (1<<23) // Defined by the soundsystem library
|
||||
#define FCVAR_INPUTSYSTEM (1<<25) // Defined by the inputsystem dll
|
||||
#define FCVAR_NETWORKSYSTEM (1<<26) // Defined by the network system
|
||||
// NOTE!! if you add a cvar system, add it here too!!!!
|
||||
// the engine lacks a cvar flag, but needs it for xbox
|
||||
// an engine cvar is thus a cvar not marked with any other system
|
||||
#define FCVAR_NON_ENGINE ((FCVAR_LAUNCHER|FCVAR_GAMEDLL|FCVAR_CLIENTDLL|FCVAR_MATERIAL_SYSTEM|FCVAR_DATACACHE|FCVAR_STUDIORENDER|FCVAR_FILESYSTEM|FCVAR_PLUGIN|FCVAR_TOOLSYSTEM|FCVAR_SOUNDSYSTEM|FCVAR_INPUTSYSTEM|FCVAR_NETWORKSYSTEM))
|
||||
|
||||
// ConVar only
|
||||
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc
|
||||
#define FCVAR_NOTIFY (1<<8) // notifies players when changed
|
||||
#define FCVAR_USERINFO (1<<9) // changes the client's info string
|
||||
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
|
||||
|
||||
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar
|
||||
|
||||
// It's a ConVar that's shared between the client and the server.
|
||||
// At signon, the values of all such ConVars are sent from the server to the client (skipped for local
|
||||
// client, of course )
|
||||
// If a change is requested it must come from the console (i.e., no remote client changes)
|
||||
// If a value is changed while a server is active, it's replicated to all connected clients
|
||||
#define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time
|
||||
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
|
||||
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
|
||||
|
||||
#define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server
|
||||
|
||||
#define FCVAR_ARCHIVE_XBOX (1<<24) // cvar written to config.cfg on the Xbox
|
||||
|
||||
|
||||
// #define FCVAR_AVAILABLE (1<<27)
|
||||
// #define FCVAR_AVAILABLE (1<<28)
|
||||
// #define FCVAR_AVAILABLE (1<<29)
|
||||
// #define FCVAR_AVAILABLE (1<<30)
|
||||
// #define FCVAR_AVAILABLE (1<<31)
|
||||
|
||||
|
||||
class ConVar;
|
||||
class ConCommand;
|
||||
class ConCommandBase;
|
||||
|
||||
// Any executable that wants to use ConVars need to implement one of
|
||||
// these to hook up access to console variables.
|
||||
class IConCommandBaseAccessor
|
||||
{
|
||||
public:
|
||||
// Flags is a combination of FCVAR flags in cvar.h.
|
||||
// hOut is filled in with a handle to the variable.
|
||||
virtual bool RegisterConCommandBase( ConCommandBase *pVar )=0;
|
||||
};
|
||||
|
||||
|
||||
// You don't have to instantiate one of these, just call its
|
||||
// OneTimeInit function when your executable is initializing.
|
||||
class ConCommandBaseMgr
|
||||
{
|
||||
public:
|
||||
// Call this ONCE when the executable starts up.
|
||||
static void OneTimeInit( IConCommandBaseAccessor *pAccessor );
|
||||
#ifdef _XBOX
|
||||
static bool Fixup( ConCommandBase* pConCommandBase );
|
||||
#ifndef _RETAIL
|
||||
static void PublishCommands( bool bForce );
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
// Called when a ConVar changes value
|
||||
typedef void ( *FnChangeCallback )( ConVar *var, char const *pOldString );
|
||||
|
||||
// Called when a ConCommand needs to execute
|
||||
typedef void ( *FnCommandCallback )( void );
|
||||
|
||||
#define COMMAND_COMPLETION_MAXITEMS 64
|
||||
#define COMMAND_COMPLETION_ITEM_LENGTH 64
|
||||
|
||||
// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings
|
||||
typedef int ( *FnCommandCompletionCallback )( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: The base console invoked command/cvar interface
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConCommandBase
|
||||
{
|
||||
friend class ConCommandBaseMgr;
|
||||
friend class CCvar;
|
||||
friend class ConVar;
|
||||
friend class ConCommand;
|
||||
|
||||
public:
|
||||
ConCommandBase( void );
|
||||
ConCommandBase( char const *pName, char const *pHelpString = 0,
|
||||
int flags = 0 );
|
||||
|
||||
virtual ~ConCommandBase( void );
|
||||
|
||||
virtual bool IsCommand( void ) const;
|
||||
|
||||
// Check flag
|
||||
virtual bool IsBitSet( int flag ) const;
|
||||
// Set flag
|
||||
virtual void AddFlags( int flags );
|
||||
|
||||
// Return name of cvar
|
||||
virtual char const *GetName( void ) const;
|
||||
|
||||
// Return help text for cvar
|
||||
virtual char const *GetHelpText( void ) const;
|
||||
|
||||
// Deal with next pointer
|
||||
const ConCommandBase *GetNext( void ) const;
|
||||
void SetNext( ConCommandBase *next );
|
||||
|
||||
virtual bool IsRegistered( void ) const;
|
||||
|
||||
// Global methods
|
||||
static ConCommandBase const *GetCommands( void );
|
||||
static void AddToList( ConCommandBase *var );
|
||||
static void RemoveFlaggedCommands( int flag );
|
||||
static void RevertFlaggedCvars( int flag );
|
||||
static ConCommandBase const *FindCommand( char const *name );
|
||||
|
||||
protected:
|
||||
virtual void Create( char const *pName, char const *pHelpString = 0,
|
||||
int flags = 0 );
|
||||
|
||||
// Used internally by OneTimeInit to initialize.
|
||||
virtual void Init();
|
||||
|
||||
// Internal copy routine ( uses new operator from correct module )
|
||||
char *CopyString( char const *from );
|
||||
|
||||
// Next ConVar in chain
|
||||
ConCommandBase *m_pNext;
|
||||
|
||||
private:
|
||||
// Has the cvar been added to the global list?
|
||||
bool m_bRegistered;
|
||||
|
||||
// Static data
|
||||
char const *m_pszName;
|
||||
char const *m_pszHelpString;
|
||||
|
||||
// ConVar flags
|
||||
int m_nFlags;
|
||||
|
||||
protected:
|
||||
|
||||
// ConVars add themselves to this list for the executable. Then ConVarMgr::Init() runs through
|
||||
// all the console variables and registers them.
|
||||
static ConCommandBase *s_pConCommandBases;
|
||||
|
||||
// ConVars in this executable use this 'global' to access values.
|
||||
static IConCommandBaseAccessor *s_pAccessor;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: The console invoked command
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConCommand : public ConCommandBase
|
||||
{
|
||||
friend class ConCommandBaseMgr;
|
||||
friend class CCvar;
|
||||
#ifdef _STATIC_LINKED
|
||||
friend class G_ConCommand;
|
||||
friend class C_ConCommand;
|
||||
friend class M_ConCommand;
|
||||
friend class S_ConCommand;
|
||||
friend class D_ConCommand;
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef ConCommandBase BaseClass;
|
||||
|
||||
ConCommand( void );
|
||||
ConCommand( char const *pName, FnCommandCallback callback,
|
||||
char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||
|
||||
virtual ~ConCommand( void );
|
||||
|
||||
virtual bool IsCommand( void ) const;
|
||||
|
||||
virtual int AutoCompleteSuggest( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] );
|
||||
|
||||
virtual bool CanAutoComplete( void );
|
||||
|
||||
// Invoke the function
|
||||
virtual void Dispatch( void );
|
||||
private:
|
||||
virtual void Create( char const *pName, FnCommandCallback callback,
|
||||
char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||
|
||||
// Call this function when executing the command
|
||||
FnCommandCallback m_fnCommandCallback;
|
||||
|
||||
FnCommandCompletionCallback m_fnCompletionCallback;
|
||||
bool m_bHasCompletionCallback;
|
||||
public:
|
||||
FnCommandCallback GetCallback() { return m_fnCommandCallback; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: A console variable
|
||||
//-----------------------------------------------------------------------------
|
||||
class ConVar : public ConCommandBase
|
||||
{
|
||||
friend class ConCommandBaseMgr;
|
||||
friend class CCvar;
|
||||
friend class CDefaultCvar;
|
||||
#ifdef _STATIC_LINKED
|
||||
friend class G_ConVar;
|
||||
friend class C_ConVar;
|
||||
friend class M_ConVar;
|
||||
friend class S_ConVar;
|
||||
friend class D_ConVar;
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef ConCommandBase BaseClass;
|
||||
|
||||
ConVar( char const *pName, char const *pDefaultValue, int flags = 0);
|
||||
|
||||
ConVar( char const *pName, char const *pDefaultValue, int flags,
|
||||
char const *pHelpString );
|
||||
ConVar( char const *pName, char const *pDefaultValue, int flags,
|
||||
char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax );
|
||||
ConVar( char const *pName, char const *pDefaultValue, int flags,
|
||||
char const *pHelpString, FnChangeCallback callback );
|
||||
ConVar( char const *pName, char const *pDefaultValue, int flags,
|
||||
char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax,
|
||||
FnChangeCallback callback );
|
||||
|
||||
virtual ~ConVar( void );
|
||||
|
||||
virtual bool IsBitSet( int flag ) const;
|
||||
virtual char const* GetHelpText( void ) const;
|
||||
virtual bool IsRegistered( void ) const;
|
||||
virtual char const *GetName( void ) const;
|
||||
virtual void AddFlags( int flags );
|
||||
virtual bool IsCommand( void ) const;
|
||||
|
||||
// Install a change callback (there shouldn't already be one....)
|
||||
void InstallChangeCallback( FnChangeCallback callback );
|
||||
|
||||
// Retrieve value
|
||||
FORCEINLINE_CVAR float GetFloat( void ) const;
|
||||
FORCEINLINE_CVAR int GetInt( void ) const;
|
||||
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
|
||||
FORCEINLINE_CVAR char const *GetString( void ) const;
|
||||
|
||||
// Any function that allocates/frees memory needs to be virtual or else you'll have crashes
|
||||
// from alloc/free across dll/exe boundaries.
|
||||
|
||||
// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).
|
||||
virtual void SetValue( char const *value );
|
||||
virtual void SetValue( float value );
|
||||
virtual void SetValue( int value );
|
||||
|
||||
// Reset to default value
|
||||
void Revert( void );
|
||||
|
||||
// True if it has a min/max setting
|
||||
bool GetMin( float& minVal ) const;
|
||||
bool GetMax( float& maxVal ) const;
|
||||
char const *GetDefault( void ) const;
|
||||
|
||||
static void RevertAll( void );
|
||||
private:
|
||||
// Called by CCvar when the value of a var is changing.
|
||||
virtual void InternalSetValue(char const *value);
|
||||
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||
virtual void InternalSetFloatValue( float fNewValue );
|
||||
virtual void InternalSetIntValue( int nValue );
|
||||
|
||||
virtual bool ClampValue( float& value );
|
||||
virtual void ChangeStringValue( char const *tempVal );
|
||||
|
||||
virtual void Create( char const *pName, char const *pDefaultValue, int flags = 0,
|
||||
char const *pHelpString = 0, bool bMin = false, float fMin = 0.0,
|
||||
bool bMax = false, float fMax = false, FnChangeCallback callback = 0 );
|
||||
|
||||
// Used internally by OneTimeInit to initialize.
|
||||
virtual void Init();
|
||||
|
||||
private:
|
||||
|
||||
// This either points to "this" or it points to the original declaration of a ConVar.
|
||||
// This allows ConVars to exist in separate modules, and they all use the first one to be declared.
|
||||
// m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar).
|
||||
ConVar *m_pParent;
|
||||
|
||||
// Static data
|
||||
char const *m_pszDefaultValue;
|
||||
|
||||
// Value
|
||||
// Dynamically allocated
|
||||
char *m_pszString;
|
||||
int m_StringLength;
|
||||
|
||||
// Values
|
||||
float m_fValue;
|
||||
int m_nValue;
|
||||
|
||||
// Min/Max values
|
||||
bool m_bHasMin;
|
||||
float m_fMinVal;
|
||||
bool m_bHasMax;
|
||||
float m_fMaxVal;
|
||||
|
||||
// Call this function when ConVar changes
|
||||
FnChangeCallback m_fnChangeCallback;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Return ConVar value as a float
|
||||
// Output : float
|
||||
//-----------------------------------------------------------------------------
|
||||
FORCEINLINE_CVAR float ConVar::GetFloat( void ) const
|
||||
{
|
||||
return m_pParent->m_fValue;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Return ConVar value as an int
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
FORCEINLINE_CVAR int ConVar::GetInt( void ) const
|
||||
{
|
||||
return m_pParent->m_nValue;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
|
||||
// Output : char const *
|
||||
//-----------------------------------------------------------------------------
|
||||
FORCEINLINE_CVAR char const *ConVar::GetString( void ) const
|
||||
{
|
||||
if ( m_nFlags & FCVAR_NEVER_AS_STRING )
|
||||
{
|
||||
return "FCVAR_NEVER_AS_STRING";
|
||||
}
|
||||
|
||||
return ( m_pParent->m_pszString ) ? m_pParent->m_pszString : "";
|
||||
}
|
||||
|
||||
|
||||
#ifdef _STATIC_LINKED
|
||||
// identifies subsystem via piggybacking constructors with flags
|
||||
class G_ConCommand : public ConCommand
|
||||
{
|
||||
public:
|
||||
G_ConCommand(char const *pName, FnCommandCallback callback, char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ) : ConCommand(pName, callback, pHelpString, flags|FCVAR_GAMEDLL, completionFunc) {}
|
||||
};
|
||||
|
||||
class C_ConCommand : public ConCommand
|
||||
{
|
||||
public:
|
||||
C_ConCommand(char const *pName, FnCommandCallback callback, char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ) : ConCommand(pName, callback, pHelpString, flags|FCVAR_CLIENTDLL, completionFunc) {}
|
||||
};
|
||||
|
||||
class M_ConCommand : public ConCommand
|
||||
{
|
||||
public:
|
||||
M_ConCommand(char const *pName, FnCommandCallback callback, char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ) : ConCommand(pName, callback, pHelpString, flags|FCVAR_MATERIAL_SYSTEM, completionFunc) {}
|
||||
};
|
||||
|
||||
class S_ConCommand : public ConCommand
|
||||
{
|
||||
public:
|
||||
S_ConCommand(char const *pName, FnCommandCallback callback, char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ) : ConCommand(pName, callback, pHelpString, flags|FCVAR_STUDIORENDER, completionFunc) {}
|
||||
};
|
||||
|
||||
class D_ConCommand : public ConCommand
|
||||
{
|
||||
public:
|
||||
D_ConCommand(char const *pName, FnCommandCallback callback, char const *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ) : ConCommand(pName, callback, pHelpString, flags|FCVAR_DATACACHE, completionFunc) {}
|
||||
};
|
||||
|
||||
typedef void ( *G_FnChangeCallback )( G_ConVar *var, char const *pOldString );
|
||||
typedef void ( *C_FnChangeCallback )( C_ConVar *var, char const *pOldString );
|
||||
typedef void ( *M_FnChangeCallback )( M_ConVar *var, char const *pOldString );
|
||||
typedef void ( *S_FnChangeCallback )( S_ConVar *var, char const *pOldString );
|
||||
typedef void ( *D_FnChangeCallback )( D_ConVar *var, char const *pOldString );
|
||||
|
||||
class G_ConVar : public ConVar
|
||||
{
|
||||
public:
|
||||
G_ConVar( char const *pName, char const *pDefaultValue, int flags = 0) : ConVar(pName, pDefaultValue, flags|FCVAR_GAMEDLL) {}
|
||||
G_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString ) : ConVar(pName, pDefaultValue, flags|FCVAR_GAMEDLL, pHelpString ) {}
|
||||
G_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax ) : ConVar(pName, pDefaultValue, flags|FCVAR_GAMEDLL, pHelpString, bMin, fMin, bMax, fMax) {}
|
||||
G_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, G_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_GAMEDLL, pHelpString, (FnChangeCallback)callback ) {}
|
||||
G_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax, G_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_GAMEDLL, pHelpString, bMin, fMin, bMax, fMax, (FnChangeCallback)callback ) {}
|
||||
};
|
||||
|
||||
class C_ConVar : public ConVar
|
||||
{
|
||||
public:
|
||||
C_ConVar( char const *pName, char const *pDefaultValue, int flags = 0) : ConVar(pName, pDefaultValue, flags|FCVAR_CLIENTDLL) {}
|
||||
C_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString ) : ConVar(pName, pDefaultValue, flags|FCVAR_CLIENTDLL, pHelpString ) {}
|
||||
C_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax ) : ConVar(pName, pDefaultValue, flags|FCVAR_CLIENTDLL, pHelpString, bMin, fMin, bMax, fMax) {}
|
||||
C_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, C_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_CLIENTDLL, pHelpString, (FnChangeCallback)callback ) {}
|
||||
C_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax, C_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_CLIENTDLL, pHelpString, bMin, fMin, bMax, fMax, (FnChangeCallback)callback ) {}
|
||||
};
|
||||
|
||||
class M_ConVar : public ConVar
|
||||
{
|
||||
public:
|
||||
M_ConVar( char const *pName, char const *pDefaultValue, int flags = 0) : ConVar(pName, pDefaultValue, flags|FCVAR_MATERIAL_SYSTEM) {}
|
||||
M_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString ) : ConVar(pName, pDefaultValue, flags|FCVAR_MATERIAL_SYSTEM, pHelpString ) {}
|
||||
M_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax ) : ConVar(pName, pDefaultValue, flags|FCVAR_MATERIAL_SYSTEM, pHelpString, bMin, fMin, bMax, fMax) {}
|
||||
M_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, M_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_MATERIAL_SYSTEM, pHelpString, (FnChangeCallback)callback ) {}
|
||||
M_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax, M_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_MATERIAL_SYSTEM, pHelpString, bMin, fMin, bMax, fMax, (FnChangeCallback)callback ) {}
|
||||
};
|
||||
|
||||
class S_ConVar : public ConVar
|
||||
{
|
||||
public:
|
||||
S_ConVar( char const *pName, char const *pDefaultValue, int flags = 0) : ConVar(pName, pDefaultValue, flags|FCVAR_STUDIORENDER) {}
|
||||
S_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString ) : ConVar(pName, pDefaultValue, flags|FCVAR_STUDIORENDER, pHelpString ) {}
|
||||
S_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax ) : ConVar(pName, pDefaultValue, flags|FCVAR_STUDIORENDER, pHelpString, bMin, fMin, bMax, fMax) {}
|
||||
S_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, M_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_STUDIORENDER, pHelpString, (FnChangeCallback)callback ) {}
|
||||
S_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax, S_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_STUDIORENDER, pHelpString, bMin, fMin, bMax, fMax, (FnChangeCallback)callback ) {}
|
||||
};
|
||||
|
||||
class D_ConVar : public ConVar
|
||||
{
|
||||
public:
|
||||
D_ConVar( char const *pName, char const *pDefaultValue, int flags = 0) : ConVar(pName, pDefaultValue, flags|FCVAR_DATACACHE) {}
|
||||
D_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString ) : ConVar(pName, pDefaultValue, flags|FCVAR_DATACACHE, pHelpString ) {}
|
||||
D_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax ) : ConVar(pName, pDefaultValue, flags|FCVAR_DATACACHE, pHelpString, bMin, fMin, bMax, fMax) {}
|
||||
D_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, M_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_DATACACHE, pHelpString, (FnChangeCallback)callback ) {}
|
||||
D_ConVar( char const *pName, char const *pDefaultValue, int flags, char const *pHelpString, bool bMin, float fMin, bool bMax, float fMax, D_FnChangeCallback callback ) : ConVar(pName, pDefaultValue, flags|FCVAR_DATACACHE, pHelpString, bMin, fMin, bMax, fMax, (FnChangeCallback)callback ) {}
|
||||
};
|
||||
|
||||
// redirect these declarations to their specific subsystem
|
||||
#ifdef GAME_DLL
|
||||
#define ConCommand G_ConCommand
|
||||
#define ConVar G_ConVar
|
||||
#endif
|
||||
#ifdef CLIENT_DLL
|
||||
#define ConCommand C_ConCommand
|
||||
#define ConVar C_ConVar
|
||||
#endif
|
||||
#ifdef MATERIALSYSTEM_DLL
|
||||
#define ConCommand M_ConCommand
|
||||
#define ConVar M_ConVar
|
||||
#endif
|
||||
#ifdef STUDIORENDER_DLL
|
||||
#define ConCommand S_ConCommand
|
||||
#define ConVar S_ConVar
|
||||
#endif
|
||||
#ifdef DATACACHE_DLL
|
||||
#define ConCommand D_ConCommand
|
||||
#define ConVar D_ConVar
|
||||
#endif
|
||||
#endif // _STATIC_LINKED
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Utility to quicky generate a simple console command
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_COMMAND( name, description ) \
|
||||
static void name(); \
|
||||
static ConCommand name##_command( #name, name, description ); \
|
||||
static void name()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Utility to quicky generate a simple console command
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_COMMAND_F( name, description, flags ) \
|
||||
static void name(); \
|
||||
static ConCommand name##_command( #name, name, description, flags ); \
|
||||
static void name()
|
||||
|
||||
|
||||
#endif // CONVAR_H
|
553
sourcemm/episode1/provider_ep1.cpp
Normal file
553
sourcemm/episode1/provider_ep1.cpp
Normal file
@ -0,0 +1,553 @@
|
||||
#include <sourcehook.h>
|
||||
#include "convar_smm.h"
|
||||
#include <eiface.h>
|
||||
#include <tier0/icommandline.h>
|
||||
#include <tier1/utldict.h>
|
||||
#include <sh_vector.h>
|
||||
#include <sh_string.h>
|
||||
#include "../metamod_util.h"
|
||||
#include "provider_ep1.h"
|
||||
#include "console.h"
|
||||
#include "metamod_console.h"
|
||||
|
||||
/* Types */
|
||||
typedef void (*CONPRINTF_FUNC)(const char *, ...);
|
||||
struct UsrMsgInfo
|
||||
{
|
||||
int size;
|
||||
String name;
|
||||
};
|
||||
/* Imports */
|
||||
#undef CommandLine
|
||||
DLL_IMPORT ICommandLine *CommandLine();
|
||||
/* Functions */
|
||||
CONPRINTF_FUNC ExtractRemotePrinter();
|
||||
bool CacheUserMessages();
|
||||
void ClientCommand(edict_t *pEdict);
|
||||
void _ServerCommand();
|
||||
/* Variables */
|
||||
bool usermsgs_extracted = false;
|
||||
CVector<UsrMsgInfo> usermsgs_list;
|
||||
CONPRINTF_FUNC echo_msg_func = NULL;
|
||||
ICvar *icvar = NULL;
|
||||
ISmmAPI *metamod_api = NULL;
|
||||
IVEngineServer *engine = NULL;
|
||||
IServerGameClients *gameclients = NULL;
|
||||
BaseProvider g_Ep1Provider;
|
||||
IMetamodSourceProvider *provider = &g_Ep1Provider;
|
||||
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||
|
||||
void BaseProvider::ConsolePrint(const char *str)
|
||||
{
|
||||
if (echo_msg_func != NULL)
|
||||
{
|
||||
echo_msg_func("%s", str);
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg("%s", str);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseProvider::Notify_DLLInit_Pre(void *gamedll,
|
||||
CreateInterfaceFn engineFactory,
|
||||
CreateInterfaceFn serverFactory)
|
||||
{
|
||||
server = (IServerGameDLL *)gamedll;
|
||||
engine = (IVEngineServer *)((engineFactory)(INTERFACEVERSION_VENGINESERVER, NULL));
|
||||
if (!engine)
|
||||
{
|
||||
Error("Could not find IVEngineServer! Metamod cannot load.");
|
||||
return;
|
||||
}
|
||||
icvar = (ICvar *)((engineFactory)(VENGINE_CVAR_INTERFACE_VERSION, NULL));
|
||||
if (!icvar)
|
||||
{
|
||||
Error("Could not find ICvar! Metamod cannot load.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((gameclients = (IServerGameClients *)(serverFactory("ServerGameClients003", NULL)))
|
||||
== NULL)
|
||||
{
|
||||
gameclients = (IServerGameClients *)(serverFactory("ServerGameClients004", NULL));
|
||||
}
|
||||
|
||||
echo_msg_func = ExtractRemotePrinter();
|
||||
usermsgs_extracted = CacheUserMessages();
|
||||
|
||||
if (gameclients)
|
||||
{
|
||||
SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, gameclients, ClientCommand, false);
|
||||
}
|
||||
|
||||
ConCommandBaseMgr::OneTimeInit(&g_SMConVarAccessor);
|
||||
}
|
||||
|
||||
bool BaseProvider::IsRemotePrintingAvailable()
|
||||
{
|
||||
return (echo_msg_func != NULL);
|
||||
}
|
||||
|
||||
void BaseProvider::ClientConsolePrint(edict_t *client, const char *message)
|
||||
{
|
||||
engine->ClientPrintf(client, message);
|
||||
}
|
||||
|
||||
void BaseProvider::ServerCommand(const char *cmd)
|
||||
{
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
|
||||
const char *BaseProvider::GetConVarString(ConVar *convar)
|
||||
{
|
||||
return convar->GetString();
|
||||
}
|
||||
|
||||
bool BaseProvider::IsConCommandBaseACommand(ConCommandBase *pCommand)
|
||||
{
|
||||
return pCommand->IsCommand();
|
||||
}
|
||||
|
||||
|
||||
bool BaseProvider::IsSourceEngineBuildCompatible(int build)
|
||||
{
|
||||
return (build == SOURCE_ENGINE_ORIGINAL
|
||||
|| build == SOURCE_ENGINE_EPISODEONE);
|
||||
}
|
||||
|
||||
const char *BaseProvider::GetCommandLineValue(const char *key, const char *defval)
|
||||
{
|
||||
if (key[0] == '-' || key[0] == '+')
|
||||
{
|
||||
return CommandLine()->ParmValue(key, defval);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *val;
|
||||
if ((val = icvar->GetCommandLineValue(key)) == NULL)
|
||||
{
|
||||
return defval;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
int BaseProvider::TryServerGameDLL(const char *iface)
|
||||
{
|
||||
if (strncmp(iface, "ServerGameDLL", 13) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return atoi(&iface[13]);
|
||||
}
|
||||
|
||||
bool BaseProvider::LogMessage(const char *buffer)
|
||||
{
|
||||
if (!engine)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
engine->LogPrint(buffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseProvider::GetHookInfo(ProvidedHooks hook, SourceHook::MemFuncInfo *pInfo)
|
||||
{
|
||||
SourceHook::MemFuncInfo mfi = {true, -1, 0, 0};
|
||||
|
||||
if (hook == ProvidedHook_LevelInit)
|
||||
{
|
||||
SourceHook::GetFuncInfo(&IServerGameDLL::LevelInit, mfi);
|
||||
}
|
||||
else if (hook == ProvidedHook_LevelShutdown)
|
||||
{
|
||||
SourceHook::GetFuncInfo(&IServerGameDLL::LevelShutdown, mfi);
|
||||
}
|
||||
else if (hook == ProvidedHook_GameInit)
|
||||
{
|
||||
SourceHook::GetFuncInfo(&IServerGameDLL::GameInit, mfi);
|
||||
}
|
||||
else if (hook == ProvidedHook_DLLShutdown)
|
||||
{
|
||||
SourceHook::GetFuncInfo(&IServerGameDLL::DLLShutdown, mfi);
|
||||
}
|
||||
else if (hook == ProvidedHook_DLLInit)
|
||||
{
|
||||
SourceHook::GetFuncInfo(&IServerGameDLL::DLLInit, mfi);
|
||||
}
|
||||
|
||||
*pInfo = mfi;
|
||||
|
||||
return (mfi.thisptroffs >= 0);
|
||||
}
|
||||
|
||||
void BaseProvider::DisplayError(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[2048];
|
||||
|
||||
va_start(ap, fmt);
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
Error(buffer);
|
||||
}
|
||||
|
||||
void BaseProvider::DisplayWarning(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[2048];
|
||||
|
||||
va_start(ap, fmt);
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
Warning(buffer);
|
||||
}
|
||||
|
||||
IConCommandBaseAccessor *BaseProvider::GetConCommandBaseAccessor()
|
||||
{
|
||||
return &g_SMConVarAccessor;
|
||||
}
|
||||
|
||||
bool BaseProvider::RegisterConCommandBase(ConCommandBase *pCommand)
|
||||
{
|
||||
return g_SMConVarAccessor.Register(pCommand);
|
||||
}
|
||||
|
||||
void BaseProvider::UnregisterConCommandBase(ConCommandBase *pCommand)
|
||||
{
|
||||
return g_SMConVarAccessor.Unregister(pCommand);
|
||||
}
|
||||
|
||||
int BaseProvider::GetUserMessageCount()
|
||||
{
|
||||
if (!usermsgs_extracted)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (int)usermsgs_list.size();
|
||||
}
|
||||
|
||||
int BaseProvider::FindUserMessage(const char *name, int *size)
|
||||
{
|
||||
for (size_t i = 0; i < usermsgs_list.size(); i++)
|
||||
{
|
||||
if (usermsgs_list[i].name.compare(name) == 0)
|
||||
{
|
||||
if (size)
|
||||
{
|
||||
*size = usermsgs_list[i].size;
|
||||
}
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *BaseProvider::GetUserMessage(int index, int *size)
|
||||
{
|
||||
if (!usermsgs_extracted || index < 0 || index >= (int)usermsgs_list.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size)
|
||||
{
|
||||
*size = usermsgs_list[index].size;
|
||||
}
|
||||
|
||||
return usermsgs_list[index].name.c_str();
|
||||
}
|
||||
|
||||
const char *BaseProvider::GetGameDescription()
|
||||
{
|
||||
return server->GetGameDescription();
|
||||
}
|
||||
|
||||
ConVar *BaseProvider::CreateConVar(const char *name,
|
||||
const char *defval,
|
||||
const char *help,
|
||||
int flags)
|
||||
{
|
||||
int newflags = 0;
|
||||
if (flags & ConVarFlag_Notify)
|
||||
{
|
||||
newflags |= FCVAR_NOTIFY;
|
||||
}
|
||||
if (flags & ConVarFlag_Replicated)
|
||||
{
|
||||
newflags |= FCVAR_REPLICATED;
|
||||
}
|
||||
if (flags & ConVarFlag_SpOnly)
|
||||
{
|
||||
newflags |= FCVAR_SPONLY;
|
||||
}
|
||||
|
||||
return new ConVar(name, defval, newflags, help);
|
||||
}
|
||||
|
||||
IServerPluginCallbacks *BaseProvider::GetVSPCallbacks(const char *iface)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
class GlobCommand : public IMetamodSourceCommandInfo
|
||||
{
|
||||
public:
|
||||
unsigned int GetArgCount()
|
||||
{
|
||||
return engine->Cmd_Argc() - 1;
|
||||
}
|
||||
|
||||
const char *GetArg(unsigned int num)
|
||||
{
|
||||
return engine->Cmd_Argv(num);
|
||||
}
|
||||
|
||||
const char *GetArgString()
|
||||
{
|
||||
return engine->Cmd_Args();
|
||||
}
|
||||
};
|
||||
|
||||
CON_COMMAND(meta, "Metamod:Source control commands")
|
||||
{
|
||||
GlobCommand cmd;
|
||||
Command_Meta(&cmd);
|
||||
}
|
||||
|
||||
void ClientCommand(edict_t *pEdict)
|
||||
{
|
||||
GlobCommand cmd;
|
||||
|
||||
if (strcmp(cmd.GetArg(0), "meta") == 0)
|
||||
{
|
||||
Command_ClientMeta(pEdict, &cmd);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//THERE BE HAX HERE!!!! DON'T TELL ALFRED, BUT GABE WANTED IT THAT WAY. //
|
||||
// (note: you can find the offset by looking for the text //
|
||||
// "Echo text to console", you'll find the callback cmd pushed on the //
|
||||
// stack.) //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SIGLEN 8
|
||||
#define ENGINE486_SIG "\x55\x89\xE5\x53\x83\xEC\x14\xBB"
|
||||
#define ENGINE486_OFFS 40
|
||||
#define ENGINE686_SIG "\x53\x83\xEC\x08\xBB\x01\x00\x00"
|
||||
#define ENGINE686_OFFS 50
|
||||
#define ENGINEAMD_SIG "\x53\x51\xBB\x01\x00\x00\x00\x51"
|
||||
#define ENGINEAMD_OFFS 47
|
||||
#define ENGINEW32_SIG "\xA1\x2A\x2A\x2A\x2A\x56\xBE\x01"
|
||||
#define ENGINEW32_OFFS 38
|
||||
#define IA32_CALL 0xE8
|
||||
|
||||
bool vcmp(const void *_addr1, const void *_addr2, size_t len)
|
||||
{
|
||||
unsigned char *addr1 = (unsigned char *)_addr1;
|
||||
unsigned char *addr2 = (unsigned char *)_addr2;
|
||||
|
||||
for (size_t i=0; i<len; i++)
|
||||
{
|
||||
if (addr2[i] == '*')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (addr1[i] != addr2[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Thanks to fysh for the idea of extracting info from "echo" and for
|
||||
// having the original offsets at hand!
|
||||
CONPRINTF_FUNC ExtractRemotePrinter()
|
||||
{
|
||||
ConCommandBase *pBase = icvar->GetCommands();
|
||||
unsigned char *ptr = NULL;
|
||||
FnCommandCallback callback = NULL;
|
||||
int offs = 0;
|
||||
|
||||
while (pBase)
|
||||
{
|
||||
if (strcmp(pBase->GetName(), "echo") == 0)
|
||||
{
|
||||
callback = ((ConCommand *)pBase)->GetCallback();
|
||||
ptr = (unsigned char *)callback;
|
||||
#ifdef OS_LINUX
|
||||
if (vcmp(ptr, ENGINE486_SIG, SIGLEN))
|
||||
{
|
||||
offs = ENGINE486_OFFS;
|
||||
}
|
||||
else if (vcmp(ptr, ENGINE686_SIG, SIGLEN))
|
||||
{
|
||||
offs = ENGINE686_OFFS;
|
||||
}
|
||||
else if (vcmp(ptr, ENGINEAMD_SIG, SIGLEN))
|
||||
{
|
||||
offs = ENGINEAMD_OFFS;
|
||||
}
|
||||
#elif defined OS_WIN32 // Only one Windows engine binary so far...
|
||||
if (vcmp(ptr, ENGINEW32_SIG, SIGLEN))
|
||||
{
|
||||
offs = ENGINEW32_OFFS;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!offs || ptr[offs - 1] != IA32_CALL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
//get the relative offset
|
||||
void *addr = *((void **)(ptr + offs));
|
||||
//add the base offset, to the ip (which is the address+offset + 4 bytes for next instruction)
|
||||
return (CONPRINTF_FUNC)((unsigned long)addr + (unsigned long)(ptr + offs) + 4);
|
||||
}
|
||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EVEN MORE HACKS HERE! YOU HAVE BEEN WARNED! //
|
||||
// Signatures necessary in finding the pointer to the CUtlDict that //
|
||||
// stores user message information. //
|
||||
// IServerGameDLL::GetUserMessageInfo() normally crashes with bad //
|
||||
// message indices. This is our answer to it. Yuck! <:-( //
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifdef OS_WIN32
|
||||
/* General Windows sig */
|
||||
#define MSGCLASS_SIGLEN 7
|
||||
#define MSGCLASS_SIG "\x8B\x0D\x2A\x2A\x2A\x2A\x56"
|
||||
#define MSGCLASS_OFFS 2
|
||||
|
||||
/* Dystopia Wimdows hack */
|
||||
#define MSGCLASS2_SIGLEN 16
|
||||
#define MSGCLASS2_SIG "\x56\x8B\x74\x24\x2A\x85\xF6\x7C\x2A\x3B\x35\x2A\x2A\x2A\x2A\x7D"
|
||||
#define MSGCLASS2_OFFS 11
|
||||
|
||||
/* Windows frame pointer sig */
|
||||
#define MSGCLASS3_SIGLEN 18
|
||||
#define MSGCLASS3_SIG "\x55\x8B\xEC\x51\x89\x2A\x2A\x8B\x2A\x2A\x50\x8B\x0D\x2A\x2A\x2A\x2A\xE8"
|
||||
#define MSGCLASS3_OFFS 13
|
||||
#elif defined OS_LINUX
|
||||
/* No frame pointer sig */
|
||||
#define MSGCLASS_SIGLEN 14
|
||||
#define MSGCLASS_SIG "\x53\x83\xEC\x2A\x8B\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x89"
|
||||
#define MSGCLASS_OFFS 9
|
||||
|
||||
/* Frame pointer sig */
|
||||
#define MSGCLASS2_SIGLEN 16
|
||||
#define MSGCLASS2_SIG "\x55\x89\xE5\x53\x83\xEC\x2A\x8B\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x89"
|
||||
#define MSGCLASS2_OFFS 11
|
||||
#endif
|
||||
|
||||
struct UserMessage
|
||||
{
|
||||
int size;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
typedef CUtlDict<UserMessage *, int> UserMsgDict;
|
||||
|
||||
/* This is the ugliest function in all of SourceMM */
|
||||
bool CacheUserMessages()
|
||||
{
|
||||
/* Get address of original GetUserMessageInfo() */
|
||||
char *vfunc = (char *)SH_GET_ORIG_VFNPTR_ENTRY(server, &IServerGameDLL::GetUserMessageInfo);
|
||||
|
||||
/* Oh dear, we have a relative jump on our hands
|
||||
* PVK II on Windows made me do this, but I suppose it doesn't hurt to check this on Linux too...
|
||||
*/
|
||||
if (*vfunc == '\xE9')
|
||||
{
|
||||
/* Get address from displacement...
|
||||
*
|
||||
* Add 5 because it's relative to next instruction:
|
||||
* Opcode <1 byte> + 32-bit displacement <4 bytes>
|
||||
*/
|
||||
vfunc += *reinterpret_cast<int *>(vfunc + 1) + 5;
|
||||
}
|
||||
|
||||
CUtlDict<UserMessage *, int> *dict = NULL;
|
||||
|
||||
if (vcmp(vfunc, MSGCLASS_SIG, MSGCLASS_SIGLEN))
|
||||
{
|
||||
/* Get address of CUserMessages instance */
|
||||
char **userMsgClass = *reinterpret_cast<char ***>(vfunc + MSGCLASS_OFFS);
|
||||
|
||||
/* Get address of CUserMessages::m_UserMessages */
|
||||
dict = reinterpret_cast<UserMsgDict *>(*userMsgClass);
|
||||
}
|
||||
else if (vcmp(vfunc, MSGCLASS2_SIG, MSGCLASS2_SIGLEN))
|
||||
{
|
||||
#ifdef OS_WIN32
|
||||
/* If we get here, the code is possibly inlined like in Dystopia */
|
||||
|
||||
/* Get the address of the CUtlRBTree */
|
||||
char *rbtree = *reinterpret_cast<char **>(vfunc + MSGCLASS2_OFFS);
|
||||
|
||||
/* CUtlDict should be 8 bytes before the CUtlRBTree (hacktacular!) */
|
||||
dict = reinterpret_cast<UserMsgDict *>(rbtree - 8);
|
||||
#elif defined OS_LINUX
|
||||
/* Get address of CUserMessages instance */
|
||||
char **userMsgClass = *reinterpret_cast<char ***>(vfunc + MSGCLASS2_OFFS);
|
||||
|
||||
/* Get address of CUserMessages::m_UserMessages */
|
||||
dict = reinterpret_cast<UserMsgDict *>(*userMsgClass);
|
||||
#endif
|
||||
#ifdef OS_WIN32
|
||||
}
|
||||
else if (vcmp(vfunc, MSGCLASS3_SIG, MSGCLASS3_SIGLEN))
|
||||
{
|
||||
/* Get address of CUserMessages instance */
|
||||
char **userMsgClass = *reinterpret_cast<char ***>(vfunc + MSGCLASS3_OFFS);
|
||||
|
||||
/* Get address of CUserMessages::m_UserMessages */
|
||||
dict = reinterpret_cast<UserMsgDict *>(*userMsgClass);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dict)
|
||||
{
|
||||
int msg_count = dict->Count();
|
||||
|
||||
/* Ensure that count is within bounds of an unsigned byte, because that's what engine supports */
|
||||
if (msg_count < 0 || msg_count > 255)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UserMessage *msg;
|
||||
UsrMsgInfo u_msg;
|
||||
|
||||
/* Cache messages in our CUtlDict */
|
||||
for (int i = 0; i < msg_count; i++)
|
||||
{
|
||||
msg = dict->Element(i);
|
||||
u_msg.name = msg->name;
|
||||
u_msg.size = msg->size;
|
||||
usermsgs_list.push_back(u_msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
53
sourcemm/episode1/provider_ep1.h
Normal file
53
sourcemm/episode1/provider_ep1.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_
|
||||
#define _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_
|
||||
|
||||
#include <sourcehook.h>
|
||||
#include <sh_memfuncinfo.h>
|
||||
#include <iserverplugin.h>
|
||||
#include "ISmmAPI.h"
|
||||
#include "metamod_provider.h"
|
||||
#include "metamod_oslink.h"
|
||||
|
||||
using namespace SourceMM;
|
||||
using namespace SourceHook;
|
||||
|
||||
class BaseProvider : public IMetamodSourceProvider
|
||||
{
|
||||
public:
|
||||
virtual bool IsSourceEngineBuildCompatible(int build);
|
||||
virtual bool GetHookInfo(ProvidedHooks hook, SourceHook::MemFuncInfo *pInfo);
|
||||
virtual bool LogMessage(const char *buffer);
|
||||
virtual const char *GetCommandLineValue(const char *key, const char *defval);
|
||||
virtual void ConsolePrint(const char *msg);
|
||||
virtual bool IsRemotePrintingAvailable();
|
||||
virtual void ClientConsolePrint(edict_t *client, const char *msg);
|
||||
virtual IServerPluginCallbacks *GetVSPCallbacks(const char *iface);
|
||||
virtual void DisplayError(const char *fmt, ...);
|
||||
virtual void DisplayWarning(const char *fmt, ...);
|
||||
virtual int TryServerGameDLL(const char *iface);
|
||||
virtual void Notify_DLLInit_Pre(void *gamedll,
|
||||
CreateInterfaceFn engineFactory,
|
||||
CreateInterfaceFn serverFactory);
|
||||
virtual void ServerCommand(const char *cmd);
|
||||
virtual ConVar *CreateConVar(const char *name,
|
||||
const char *defval,
|
||||
const char *help,
|
||||
int flags);
|
||||
virtual const char *GetConVarString(ConVar *convar);
|
||||
virtual const char *GetGameDescription();
|
||||
virtual IConCommandBaseAccessor *GetConCommandBaseAccessor();
|
||||
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||
virtual void UnregisterConCommandBase(ConCommandBase *pCommand);
|
||||
virtual bool IsConCommandBaseACommand(ConCommandBase *pCommand);
|
||||
virtual int GetUserMessageCount();
|
||||
virtual int FindUserMessage(const char *name, int *size=NULL);
|
||||
virtual const char *GetUserMessage(int index, int *size=NULL);
|
||||
};
|
||||
|
||||
extern IVEngineServer *engine;
|
||||
extern IServerGameDLL *server;
|
||||
extern IServerGameClients *gameclients;
|
||||
extern ICvar *icvar;
|
||||
|
||||
#endif //_INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_
|
||||
|
@ -33,7 +33,6 @@ using namespace SourceHook;
|
||||
* @brief Implementation of main SourceMM GameDLL functionality
|
||||
* @file sourcemm.cpp
|
||||
*/
|
||||
IMetamodSourceProvider *provider = NULL;
|
||||
|
||||
SH_DECL_MANUALHOOK4(SGD_DLLInit, 0, 0, 0, bool, CreateInterfaceFn, CreateInterfaceFn, CreateInterfaceFn, CGlobalVars *);
|
||||
SH_DECL_MANUALHOOK0(SGD_GameInit, 0, 0, 0, bool);
|
||||
@ -665,7 +664,7 @@ bool Handler_DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsF
|
||||
|
||||
g_GameDllPatch = SH_GET_CALLCLASS(server);
|
||||
|
||||
provider->Notify_DLLInit_Pre();
|
||||
provider->Notify_DLLInit_Pre(server, engineFactory, gamedll_info.factory);
|
||||
|
||||
metamod_version = provider->CreateConVar("metamod_version",
|
||||
SOURCEMM_VERSION,
|
||||
@ -681,9 +680,6 @@ bool Handler_DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn physicsF
|
||||
"Metamod:Source Plugins File",
|
||||
ConVarFlag_SpOnly);
|
||||
|
||||
provider->CreateCommand("meta", Command_Meta, "Metamod:Source Menu");
|
||||
provider->SetClientCommandHandler(Command_ClientMeta);
|
||||
|
||||
const char *pluginFile = provider->GetCommandLineValue("mm_pluginsfile", NULL);
|
||||
if (!pluginFile)
|
||||
{
|
||||
@ -1151,11 +1147,37 @@ void MetamodSource::UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCo
|
||||
{
|
||||
if (provider->IsConCommandBaseACommand(pCommand))
|
||||
{
|
||||
g_PluginMngr.AddPluginCmd(plugin, pCommand);
|
||||
g_PluginMngr.RemovePluginCmd(plugin, pCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_PluginMngr.AddPluginCvar(plugin, pCommand);
|
||||
g_PluginMngr.RemovePluginCvar(plugin, pCommand);
|
||||
}
|
||||
|
||||
PluginIter iter;
|
||||
CPluginManager::CPlugin *pPlugin;
|
||||
List<IMetamodListener *>::iterator event;
|
||||
IMetamodListener *pML;
|
||||
CPluginManager::CPlugin *pOrig = g_PluginMngr.FindByAPI(plugin);
|
||||
for (iter=g_PluginMngr._begin(); iter!=g_PluginMngr._end(); iter++)
|
||||
{
|
||||
pPlugin = (*iter);
|
||||
if (pPlugin->m_Status < Pl_Paused)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Only valid for plugins >= 12 (v1:6, SourceMM 1.5) */
|
||||
if (pPlugin->m_API->GetApiVersion() < 12)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (event=pPlugin->m_Events.begin();
|
||||
event!=pPlugin->m_Events.end();
|
||||
event++)
|
||||
{
|
||||
pML = (*event);
|
||||
pML->OnUnlinkConCommandBase(pOrig ? pOrig->m_Id : 0, pCommand);
|
||||
}
|
||||
}
|
||||
|
||||
return provider->UnregisterConCommandBase(pCommand);
|
||||
|
@ -79,10 +79,7 @@ public:
|
||||
void LogMessage(const char *msg, ...);
|
||||
int LoadPluginsFromFile(const char *_file);
|
||||
|
||||
extern PluginId g_PLID;
|
||||
extern SourceHook::ISourceHook *g_SHPtr;
|
||||
extern SourceHook::CSourceHookImpl g_SourceHook;
|
||||
extern MetamodSource g_Metamod;
|
||||
extern IMetamodSourceProvider *provider;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMM_H
|
||||
|
@ -33,7 +33,7 @@ using namespace SourceHook;
|
||||
#define CONMSG g_Metamod.ConPrintf
|
||||
#define CLIENT_CONMSG g_Metamod.ClientConPrintf
|
||||
|
||||
bool Command_Meta(edict_t *pEdict, IMetamodSourceCommandInfo *info)
|
||||
bool Command_Meta(IMetamodSourceCommandInfo *info)
|
||||
{
|
||||
unsigned int args = info->GetArgCount();
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "metamod_provider.h"
|
||||
|
||||
bool Command_Meta(edict_t *pEdict, IMetamodSourceCommandInfo *info);
|
||||
bool Command_Meta(IMetamodSourceCommandInfo *info);
|
||||
bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info);
|
||||
|
||||
#endif //_INCLUDE_CONCOMMANDS_H
|
||||
|
@ -13,7 +13,7 @@
|
||||
* @file oslink.cpp
|
||||
*/
|
||||
|
||||
#include "oslink.h"
|
||||
#include "metamod_oslink.h"
|
||||
#include <malloc.h>
|
||||
#ifdef __linux
|
||||
#include <errno.h>
|
@ -21,7 +21,7 @@
|
||||
#include <sh_list.h>
|
||||
#include <sh_string.h>
|
||||
#include "IPluginManager.h"
|
||||
#include "oslink.h"
|
||||
#include "metamod_oslink.h"
|
||||
|
||||
/**
|
||||
* History of plugin versions: (M=min, C=current)
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef _INCLUDE_METAMOD_SOURCE_SUPPORT_H_
|
||||
#define _INCLUDE_METAMOD_SOURCE_SUPPORT_H_
|
||||
|
||||
#include <sourcehook/sourcehook.h>
|
||||
#include <sourcehook/sh_memfuncinfo.h>
|
||||
#include <iserverplugin.h>
|
||||
|
||||
namespace SourceMM
|
||||
{
|
||||
enum
|
||||
@ -55,8 +51,6 @@ namespace SourceMM
|
||||
virtual const char *GetArgString() =0;
|
||||
};
|
||||
|
||||
typedef bool (*METAMOD_COMMAND)(edict_t *pEdict, IMetamodSourceCommandInfo *info);
|
||||
|
||||
class IMetamodSourceProvider
|
||||
{
|
||||
public:
|
||||
@ -165,7 +159,9 @@ namespace SourceMM
|
||||
/**
|
||||
* @brief Notifies the provider that the DLLInit pre-hook is almost done.
|
||||
*/
|
||||
virtual void Notify_DLLInit_Pre() =0;
|
||||
virtual void Notify_DLLInit_Pre(void *gamedll,
|
||||
CreateInterfaceFn engineFactory,
|
||||
CreateInterfaceFn serverFactory) =0;
|
||||
|
||||
/**
|
||||
* @brief Wrapper around IVEngineServer::ServerCommand()
|
||||
@ -196,24 +192,6 @@ namespace SourceMM
|
||||
*/
|
||||
virtual const char *GetConVarString(ConVar *convar) =0;
|
||||
|
||||
/**
|
||||
* @brief Creates a console command.
|
||||
*
|
||||
* @param name Command name.
|
||||
* @param callback Callback pointer.
|
||||
* @param help Help text.
|
||||
*/
|
||||
virtual void CreateCommand(const char *name,
|
||||
METAMOD_COMMAND callback,
|
||||
const char *help) =0;
|
||||
|
||||
/**
|
||||
* @brief Sets the ClientCommand handler.
|
||||
*
|
||||
* @param callback Callback pointer.
|
||||
*/
|
||||
virtual void SetClientCommandHandler(METAMOD_COMMAND callback) =0;
|
||||
|
||||
/**
|
||||
* @brief Retrieves the game description.
|
||||
*
|
||||
@ -279,5 +257,9 @@ namespace SourceMM
|
||||
};
|
||||
};
|
||||
|
||||
extern PluginId g_PLID;
|
||||
extern SourceHook::ISourceHook *g_SHPtr;
|
||||
extern SourceMM::IMetamodSourceProvider *provider;
|
||||
|
||||
#endif //_INCLUDE_METAMOD_SOURCE_SUPPORT_H_
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "metamod_util.h"
|
||||
#include "oslink.h"
|
||||
#include "metamod_oslink.h"
|
||||
|
||||
/**
|
||||
* @brief Utility functions
|
||||
|
@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemm", "sourcemm.vcproj", "{F7D47743-73B3-49B5-9D76-2333C5DFD565}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,336 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="sourcemm"
|
||||
ProjectGUID="{F7D47743-73B3-49B5-9D76-2333C5DFD565}"
|
||||
RootNamespace="sourcemm"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;..\..;..\..\sourcehook"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMM_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/server.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="libc.lib;libcd.lib;libcmt.lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/sourcemm.pdb"
|
||||
SubSystem="2"
|
||||
EnableCOMDATFolding="1"
|
||||
ImportLibrary="$(OutDir)/sourcemm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMM_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="tier0.lib tier1.lib vstdlib.lib"
|
||||
OutputFile="$(OutDir)/server.dll"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="libc.lib;libcd.lib;libcmtd.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/sourcemm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\metamod.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_console.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_plugins.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\oslink.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\metamod.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_console.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_plugins.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\oslink.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\version.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Interfaces"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\IPluginManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ISmmAPI.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ISmmPlugin.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\metamod_provider.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="SourceHook"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_list.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_stack.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_string.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_tinyhash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_vector.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Headers"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\FastDelegate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_memfuncinfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sh_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sourcehook.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sourcehook.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sourcehook\sourcehook_impl.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="HL2SDK"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\convar_smm.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Loading…
x
Reference in New Issue
Block a user