More mac/linux compile fixes.

This commit is contained in:
Nicholas Hastings 2012-02-25 16:41:00 -05:00
parent 5f67a600fc
commit 0c75229250
3 changed files with 17 additions and 12 deletions

View File

@ -41,15 +41,23 @@
#include "LibrarySys.h" #include "LibrarySys.h"
#include "logic_bridge.h" #include "logic_bridge.h"
typedef ICommandLine *(*FakeGetCommandLine)();
#if defined _WIN32 #if defined _WIN32
#define TIER0_NAME "tier0.dll" #define TIER0_NAME "tier0.dll"
#define VSTDLIB_NAME "vstdlib.dll" #define VSTDLIB_NAME "vstdlib.dll"
#elif defined __APPLE__ #elif defined __APPLE__
#define TIER0_NAME "libtier0.dylib" #define TIER0_NAME "libtier0.dylib"
#define VSTDLIB_NAME "libvstdlib.dylib" #define VSTDLIB_NAME "libvstdlib.dylib"
#elif defined __linux__ #elif defined __linux__
#define TIER0_NAME LIB_PREFIX "tier0" LIB_SUFFIX #if SOURCE_ENGINE == SE_EPISODE1 || SOURCE_ENGINE == ORANGEBOX || SOURCE_ENGINE == SE_LEFT4DEAD
#define VSTDLIB_NAME LIB_PREFIX "vstdlib" LIB_SUFFIX #define TIER0_NAME "tier0_i486.so"
#define VSTDLIB_NAME "vstdlib_i486.so"
#else
#define TIER0_NAME "libtier0.so"
#define VSTDLIB_NAME "libvstdlib.so"
#endif
#endif #endif
CHalfLife2 g_HL2; CHalfLife2 g_HL2;
@ -228,12 +236,12 @@ void CHalfLife2::InitCommandLine()
} }
ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error)); ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error));
m_pGetCommandLine = (GetCommandLine)lib->GetSymbolAddress("CommandLine_Tier0"); m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
/* '_Tier0' dropped on Alien Swarm version */ /* '_Tier0' dropped on Alien Swarm version */
if (m_pGetCommandLine == NULL) if (m_pGetCommandLine == NULL)
{ {
m_pGetCommandLine = (GetCommandLine)lib->GetSymbolAddress("CommandLine"); m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
} }
if (m_pGetCommandLine == NULL) if (m_pGetCommandLine == NULL)
@ -253,7 +261,7 @@ void CHalfLife2::InitCommandLine()
return; return;
} }
m_pGetCommandLine = (GetCommandLine)lib->GetSymbolAddress("CommandLine"); m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
if (m_pGetCommandLine == NULL) if (m_pGetCommandLine == NULL)
{ {
@ -269,7 +277,7 @@ ICommandLine *CHalfLife2::GetValveCommandLine()
if (!m_pGetCommandLine) if (!m_pGetCommandLine)
return NULL; return NULL;
return m_pGetCommandLine(); return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))();
} }
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 #if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11

View File

@ -46,10 +46,6 @@
#include <ihandleentity.h> #include <ihandleentity.h>
#include <tier0/icommandline.h> #include <tier0/icommandline.h>
#undef GetCommandLine
typedef ICommandLine *(*GetCommandLine)();
class CCommand; class CCommand;
using namespace SourceHook; using namespace SourceHook;
@ -172,7 +168,7 @@ private:
CStack<DelayedFakeCliCmd *> m_FreeCmds; CStack<DelayedFakeCliCmd *> m_FreeCmds;
CStack<CachedCommandInfo> m_CommandStack; CStack<CachedCommandInfo> m_CommandStack;
Queue<DelayedKickInfo> m_DelayedKicks; Queue<DelayedKickInfo> m_DelayedKicks;
GetCommandLine m_pGetCommandLine; void *m_pGetCommandLine;
}; };
extern CHalfLife2 g_HL2; extern CHalfLife2 g_HL2;

View File

@ -56,3 +56,4 @@ snail
rum ham rum ham
scrambled eggs scrambled eggs
EXCEPTION EXCEPTION
asher make me touch this