1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-03 16:13:22 +08:00

Added reverse-engineered interfaces lib code and hacked up tier1 and mathlib to build against the newer headers.

This commit is contained in:
Scott Ehlert 2012-05-21 02:49:35 -05:00
parent d0b0a7a9dd
commit f2185a5cfb
78 changed files with 2756 additions and 434 deletions

View File

@ -96,8 +96,14 @@ typedef enum
// XVRB_ALL, // XVRB_ALL,
//} xverbose_e; //} xverbose_e;
#ifdef POSIX
#ifndef WORD
typedef unsigned short WORD; typedef unsigned short WORD;
typedef unsigned long DWORD; #endif
#ifndef DWORD
typedef unsigned int DWORD;
#endif
#endif
#ifndef POSIX #ifndef POSIX
typedef void* HANDLE; typedef void* HANDLE;
@ -115,7 +121,7 @@ typedef int32 COLORREF;
/* /*
* Internet address (old style... should be updated) * Internet address (old style... should be updated)
*/ */
#ifdef _POSIX #ifdef POSIX
struct ip4_addr { struct ip4_addr {
union { union {
struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b; struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
@ -321,7 +327,7 @@ enum XUSER_SIGNIN_STATE
eXUserSigninState_SignedInToLive, eXUserSigninState_SignedInToLive,
}; };
#if (defined(_POSIX)) #if (defined(POSIX))
typedef size_t ULONG_PTR; typedef size_t ULONG_PTR;
#else #else
typedef _W64 unsigned long ULONG_PTR; typedef _W64 unsigned long ULONG_PTR;
@ -332,7 +338,7 @@ typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
typedef void * PXOVERLAPPED_COMPLETION_ROUTINE; typedef void * PXOVERLAPPED_COMPLETION_ROUTINE;
#ifndef _POSIX #ifndef POSIX
typedef struct _XOVERLAPPED { typedef struct _XOVERLAPPED {
ULONG_PTR InternalLow; ULONG_PTR InternalLow;
ULONG_PTR InternalHigh; ULONG_PTR InternalHigh;

230
interfaces/interfaces.cpp Normal file
View File

@ -0,0 +1,230 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//=============================================================================//
/* This is totally reverse-engineered code and may be wrong */
#include "interfaces/interfaces.h"
#include "tier0/dbg.h"
ICvar *cvar, *g_pCVar;
IEventSystem *g_pEventSystem;
IProcessUtils *g_pProcessUtils;
IPhysics2 *g_pPhysics2;
IPhysics2ActorManager *g_pPhysics2ActorManager;
IPhysics2ResourceManager *g_pPhysics2ResourceManager;
IFileSystem *g_pFullFileSystem;
IAsyncFileSystem *g_pAsyncFileSystem;
IResourceSystem *g_pResourceSystem;
IMaterialSystem *materials, *g_pMaterialSystem;
IMaterialSystem2 *g_pMaterialSystem2;
IInputSystem *g_pInputSystem;
IInputStackSystem *g_pInputStackSystem;
INetworkSystem *g_pNetworkSystem;
IRenderDeviceMgr *g_pRenderDeviceMgr;
IMaterialSystemHardwareConfig *g_pMaterialSystemHardwareConfig;
ISoundSystem *g_pSoundSystem;
IDebugTextureInfo *g_pMaterialSystemDebugTextureInfo;
IVBAllocTracker *g_VBAllocTracker;
IColorCorrectionSystem *colorcorrection;
IP4 *p4;
IMdlLib *mdllib;
IQueuedLoader *g_pQueuedLoader;
IResourceAccessControl *g_pResourceAccessControl;
IPrecacheSystem *g_pPrecacheSystem;
IStudioRender *g_pStudioRender, *studiorender;
vgui::IVGui *g_pVGui;
vgui::IInput *g_pVGuiInput;
vgui::IPanel *g_pVGuiPanel;
vgui::ISurface *g_pVGuiSurface;
vgui::ISchemeManager *g_pVGuiSchemeManager;
vgui::ISystem *g_pVGuiSystem;
ILocalize *g_pLocalize;
vgui::ILocalize *g_pVGuiLocalize;
IMatSystemSurface *g_pMatSystemSurface;
IDataCache *g_pDataCache;
IMDLCache *g_pMDLCache, *mdlcache;
IAvi *g_pAVI;
IBik *g_pBIK;
IDmeMakefileUtils *g_pDmeMakefileUtils;
IPhysicsCollision *g_pPhysicsCollision;
ISoundEmitterSystemBase *g_pSoundEmitterSystem;
IMeshSystem *g_pMeshSystem;
IRenderDevice *g_pRenderDevice;
IRenderHardwareConfig *g_pRenderHardwareConfig;
ISceneSystem *g_pSceneSystem;
IWorldRendererMgr *g_pWorldRendererMgr;
IVGuiRenderSurface *g_pVGuiRenderSurface;
IMatchFramework *g_pMatchFramework;
IGameUISystemMgr *g_pGameUISystemMgr;
struct InterfaceGlobals_t
{
const char *m_pInterfaceName;
void *m_ppGlobal;
};
struct ConnectionRegistration_t
{
void *m_ppGlobalStorage;
int m_nConnectionPhase;
};
static const InterfaceGlobals_t g_pInterfaceGlobals[] =
{
{ CVAR_INTERFACE_VERSION, cvar },
{ CVAR_INTERFACE_VERSION, g_pCVar },
{ EVENTSYSTEM_INTERFACE_VERSION, g_pEventSystem },
{ PROCESS_UTILS_INTERFACE_VERSION, g_pProcessUtils },
{ VPHYSICS2_INTERFACE_VERSION, g_pPhysics2 },
{ VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION, g_pPhysics2ActorManager },
{ VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION, g_pPhysics2ResourceManager },
{ FILESYSTEM_INTERFACE_VERSION, g_pFullFileSystem },
{ ASYNCFILESYSTEM_INTERFACE_VERSION, g_pAsyncFileSystem },
{ RESOURCESYSTEM_INTERFACE_VERSION, g_pResourceSystem },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, materials },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, g_pMaterialSystem },
{ MATERIAL_SYSTEM2_INTERFACE_VERSION, g_pMaterialSystem2 },
{ INPUTSYSTEM_INTERFACE_VERSION, g_pInputSystem },
{ INPUTSTACKSYSTEM_INTERFACE_VERSION, g_pInputStackSystem },
{ NETWORKSYSTEM_INTERFACE_VERSION, g_pNetworkSystem },
{ RENDER_DEVICE_MGR_INTERFACE_VERSION, g_pRenderDeviceMgr },
{ MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, g_pMaterialSystemHardwareConfig },
{ SOUNDSYSTEM_INTERFACE_VERSION, g_pSoundSystem },
{ DEBUG_TEXTURE_INFO_VERSION, g_pMaterialSystemDebugTextureInfo },
{ VB_ALLOC_TRACKER_INTERFACE_VERSION, g_VBAllocTracker },
{ COLORCORRECTION_INTERFACE_VERSION, colorcorrection },
{ P4_INTERFACE_VERSION, p4 },
{ MDLLIB_INTERFACE_VERSION, mdllib },
{ QUEUEDLOADER_INTERFACE_VERSION, g_pQueuedLoader },
{ RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION, g_pResourceAccessControl },
{ PRECACHE_SYSTEM_INTERFACE_VERSION, g_pPrecacheSystem },
{ STUDIO_RENDER_INTERFACE_VERSION, g_pStudioRender },
{ STUDIO_RENDER_INTERFACE_VERSION, studiorender },
{ VGUI_IVGUI_INTERFACE_VERSION, g_pVGui },
{ VGUI_INPUT_INTERFACE_VERSION, g_pVGuiInput },
{ VGUI_PANEL_INTERFACE_VERSION, g_pVGuiPanel },
{ VGUI_SURFACE_INTERFACE_VERSION, g_pVGuiSurface },
{ VGUI_SCHEME_INTERFACE_VERSION, g_pVGuiSchemeManager },
{ VGUI_SYSTEM_INTERFACE_VERSION, g_pVGuiSystem },
{ LOCALIZE_INTERFACE_VERSION, g_pLocalize },
{ LOCALIZE_INTERFACE_VERSION, g_pVGuiLocalize },
{ MAT_SYSTEM_SURFACE_INTERFACE_VERSION, g_pMatSystemSurface },
{ DATACACHE_INTERFACE_VERSION, g_pDataCache },
{ MDLCACHE_INTERFACE_VERSION, g_pMDLCache },
{ MDLCACHE_INTERFACE_VERSION, mdlcache },
{ AVI_INTERFACE_VERSION, g_pAVI },
{ BIK_INTERFACE_VERSION, g_pBIK },
{ DMEMAKEFILE_UTILS_INTERFACE_VERSION, g_pDmeMakefileUtils },
{ VPHYSICS_COLLISION_INTERFACE_VERSION, g_pPhysicsCollision },
{ SOUNDEMITTERSYSTEM_INTERFACE_VERSION, g_pSoundEmitterSystem },
{ MESHSYSTEM_INTERFACE_VERSION, g_pMeshSystem },
{ RENDER_DEVICE_INTERFACE_VERSION, g_pRenderDevice },
{ RENDER_HARDWARECONFIG_INTERFACE_VERSION, g_pRenderHardwareConfig },
{ SCENESYSTEM_INTERFACE_VERSION, g_pSceneSystem },
{ WORLD_RENDERER_MGR_INTERFACE_VERSION, g_pWorldRendererMgr },
{ RENDER_SYSTEM_SURFACE_INTERFACE_VERSION, g_pVGuiRenderSurface },
{ MATCHFRAMEWORK_INTERFACE_VERSION, g_pMatchFramework },
{ GAMEUISYSTEMMGR_INTERFACE_VERSION, g_pGameUISystemMgr }
};
static const int NUM_INTERFACES = sizeof(g_pInterfaceGlobals) / sizeof(InterfaceGlobals_t);
static int s_nConnectionCount;
static int s_nRegistrationCount;
static ConnectionRegistration_t s_pConnectionRegistration[NUM_INTERFACES + 1];
void ReconnectInterface(CreateInterfaceFn factory, char const *pInterfaceName, void **w);
void ConnectInterfaces(CreateInterfaceFn *pFactoryList, int nFactoryCount)
{
if (s_nRegistrationCount < 0)
{
Error("APPSYSTEM: In ConnectInterfaces(), s_nRegistrationCount is %d!\n", s_nRegistrationCount);
s_nConnectionCount++;
return;
}
if (s_nRegistrationCount)
{
for (int i = 0; i < nFactoryCount; i++)
{
for (int j = 0; j < NUM_INTERFACES; j++)
{
ReconnectInterface(pFactoryList[i], g_pInterfaceGlobals[j].m_pInterfaceName, (void **)g_pInterfaceGlobals[j].m_ppGlobal);
}
}
s_nConnectionCount++;
return;
}
for (int i = 0; i < nFactoryCount; i++)
{
for (int j = 0; j < NUM_INTERFACES; j++)
{
const InterfaceGlobals_t &iface = g_pInterfaceGlobals[j];
if (!(*(void **)iface.m_ppGlobal))
{
void *ptr = pFactoryList[i](iface.m_pInterfaceName, NULL);
*(void **)iface.m_ppGlobal = ptr;
if (ptr)
{
ConnectionRegistration_t &reg = s_pConnectionRegistration[s_nRegistrationCount++];
reg.m_ppGlobalStorage = iface.m_ppGlobal;
reg.m_nConnectionPhase = s_nConnectionCount;
}
}
}
}
s_nConnectionCount++;
}
void DisconnectInterfaces()
{
if (--s_nConnectionCount >= 0)
{
for (int i = 0; i < s_nRegistrationCount; i++)
{
ConnectionRegistration_t &reg = s_pConnectionRegistration[i];
if (reg.m_nConnectionPhase == s_nConnectionCount)
reg.m_ppGlobalStorage = NULL;
}
}
}
void ReconnectInterface(CreateInterfaceFn factory, char const *pInterfaceName, void **ppGlobal)
{
bool got = false;
*ppGlobal = factory(pInterfaceName, NULL);
for (int i = 0; i < s_nRegistrationCount; i++)
{
if (s_pConnectionRegistration[i].m_ppGlobalStorage == ppGlobal)
got = true;
}
if ((s_nRegistrationCount <= 0 || !got) && *ppGlobal)
{
ConnectionRegistration_t &reg = s_pConnectionRegistration[s_nRegistrationCount++];
reg.m_ppGlobalStorage = ppGlobal;
reg.m_nConnectionPhase = s_nConnectionCount;
}
}
void ReconnectInterface(CreateInterfaceFn factory, const char *pInterfaceName)
{
for (int i = 0; i < NUM_INTERFACES; i++)
{
const InterfaceGlobals_t &iface = g_pInterfaceGlobals[i];
if (strcmp(iface.m_pInterfaceName, pInterfaceName) == 0)
ReconnectInterface(factory, iface.m_pInterfaceName, (void **)iface.m_ppGlobal);
}
}

20
interfaces/interfaces.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interfaces", "interfaces.vcxproj", "{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.ActiveCfg = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.Build.0 = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.ActiveCfg = Release|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>interfaces</ProjectName>
<ProjectGuid>{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}</ProjectGuid>
<RootNamespace>tier1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PostBuildEventUseInBuild>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>
</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\interfaces;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\public\tier1\bitbuf.h" />
<ClInclude Include="..\public\tier1\byteswap.h" />
<ClInclude Include="..\public\tier1\callqueue.h" />
<ClInclude Include="..\public\tier1\characterset.h" />
<ClInclude Include="..\public\tier1\checksum_crc.h" />
<ClInclude Include="..\public\tier1\checksum_md5.h" />
<ClInclude Include="..\public\tier1\CommandBuffer.h" />
<ClInclude Include="..\public\tier1\convar.h" />
<ClInclude Include="..\public\tier1\datamanager.h" />
<ClInclude Include="..\public\datamap.h" />
<ClInclude Include="..\public\tier1\delegates.h" />
<ClInclude Include="..\public\tier1\diff.h" />
<ClInclude Include="..\public\tier1\fmtstr.h" />
<ClInclude Include="..\public\tier1\functors.h" />
<ClInclude Include="..\public\tier1\generichash.h" />
<ClInclude Include="..\public\tier1\iconvar.h" />
<ClInclude Include="..\public\tier1\interface.h" />
<ClInclude Include="..\public\tier1\KeyValues.h" />
<ClInclude Include="..\public\tier1\lzmaDecoder.h" />
<ClInclude Include="..\public\tier1\lzss.h" />
<ClInclude Include="..\public\tier1\mempool.h" />
<ClInclude Include="..\public\tier1\memstack.h" />
<ClInclude Include="..\public\tier1\netadr.h" />
<ClInclude Include="..\public\tier1\processor_detect.h" />
<ClInclude Include="..\public\tier1\rangecheckedvar.h" />
<ClInclude Include="..\public\tier1\refcount.h" />
<ClInclude Include="..\public\tier1\smartptr.h" />
<ClInclude Include="..\public\tier1\stringpool.h" />
<ClInclude Include="..\public\tier1\strtools.h" />
<ClInclude Include="..\public\tier1\tier1.h" />
<ClInclude Include="..\public\tier1\uniqueid.h" />
<ClInclude Include="..\public\tier1\utlbidirectionalset.h" />
<ClInclude Include="..\public\tier1\utlblockmemory.h" />
<ClInclude Include="..\public\tier1\utlbuffer.h" />
<ClInclude Include="..\public\tier1\utlbufferutil.h" />
<ClInclude Include="..\public\tier1\utldict.h" />
<ClInclude Include="..\public\tier1\utlenvelope.h" />
<ClInclude Include="..\public\tier1\utlfixedmemory.h" />
<ClInclude Include="..\public\tier1\utlhandletable.h" />
<ClInclude Include="..\public\tier1\utlhash.h" />
<ClInclude Include="..\public\tier1\utllinkedlist.h" />
<ClInclude Include="..\public\tier1\utlmap.h" />
<ClInclude Include="..\public\tier1\utlmemory.h" />
<ClInclude Include="..\public\tier1\utlmultilist.h" />
<ClInclude Include="..\public\tier1\utlpriorityqueue.h" />
<ClInclude Include="..\public\tier1\utlqueue.h" />
<ClInclude Include="..\public\tier1\utlrbtree.h" />
<ClInclude Include="..\public\tier1\UtlSortVector.h" />
<ClInclude Include="..\public\tier1\utlstack.h" />
<ClInclude Include="..\public\tier1\utlstring.h" />
<ClInclude Include="..\public\tier1\UtlStringMap.h" />
<ClInclude Include="..\public\tier1\utlsymbol.h" />
<ClInclude Include="..\public\tier1\utlvector.h" />
<ClInclude Include="..\common\xbox\xboxstubs.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="interfaces.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{aba1d919-d95c-4c3f-a495-be0375bab184}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{0295d938-2af6-4393-9785-4b7b122313c9}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\tier1\bitbuf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\byteswap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\callqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\characterset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\checksum_crc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\checksum_md5.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\CommandBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\convar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\datamanager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\datamap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\delegates.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\diff.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\fmtstr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\functors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\generichash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\iconvar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\interface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\KeyValues.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\lzmaDecoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\lzss.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\mempool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\memstack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\netadr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\processor_detect.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\rangecheckedvar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\refcount.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\smartptr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\stringpool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\strtools.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\tier1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\uniqueid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbidirectionalset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlblockmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbufferutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utldict.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlenvelope.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlfixedmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlhandletable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlhash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utllinkedlist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmultilist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlpriorityqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlrbtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\UtlSortVector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlstack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlstring.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\UtlStringMap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlsymbol.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlvector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common\xbox\xboxstubs.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="interfaces.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

BIN
lib/linux/interfaces_i486.a Normal file

Binary file not shown.

BIN
lib/linux/libtier0.so Normal file

Binary file not shown.

BIN
lib/linux/libvstdlib.so Normal file

Binary file not shown.

BIN
lib/linux/mathlib_i486.a Normal file

Binary file not shown.

BIN
lib/linux/tier1_i486.a Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -63,13 +63,13 @@ LIB_DIR = $(SRC_DIR)/lib/linux
# the CPU target for the build, must be i486 for now # the CPU target for the build, must be i486 for now
ARCH = i486 ARCH = i486
ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -m32 ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -m32
DEFINES = -D_LINUX -DLINUX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \ DEFINES = -D_LINUX -DLINUX -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \
-D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wconversion -Wno-non-virtual-dtor -Wno-invalid-offsetof BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-non-virtual-dtor -Wno-invalid-offsetof
SHLIBEXT = so SHLIBEXT = so
SHLIBCFLAGS = -fPIC SHLIBCFLAGS = -fPIC
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl
@ -100,6 +100,7 @@ MAKE_VCPM = Makefile.vcpm
MAKE_PLUGIN = Makefile.plugin MAKE_PLUGIN = Makefile.plugin
MAKE_TIER1 = Makefile.tier1 MAKE_TIER1 = Makefile.tier1
MAKE_MATH = Makefile.mathlib MAKE_MATH = Makefile.mathlib
MAKE_IFACE = Makefile.interfaces
MAKE_CHOREO = Makefile.choreo MAKE_CHOREO = Makefile.choreo
all: check vcpm mod all: check vcpm mod
@ -131,6 +132,9 @@ tier1:
mathlib: mathlib:
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) $(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES)
interfaces:
$(MAKE) -f $(MAKE_IFACE) $(BASE_DEFINES)
choreo: choreo:
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) $(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES)
@ -147,4 +151,5 @@ clean:
$(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_IFACE) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean

View File

@ -0,0 +1,51 @@
#
# Tier1 Static Library Makefile
#
override NAME = interfaces
LIB_SRC_DIR = $(SRC_DIR)/$(NAME)
PUBLIC_SRC_DIR = $(SRC_DIR)/public
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
LIB_OBJ_DIR=$(BUILD_OBJ_DIR)/$(NAME)_$(ARCH)
# Extension of linux static library
override SHLIBEXT = a
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -D_LIB
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
ifeq "$(DEBUG)" "true"
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
else
DO_CC += -DNDEBUG $(CFLAGS)
endif
DO_CC += -o $@ -c $<
#####################################################################
LIB_OBJS= \
$(LIB_OBJ_DIR)/interfaces.o \
all: dirs $(NAME)_$(ARCH).$(SHLIBEXT)
dirs:
-mkdir -p $(BUILD_OBJ_DIR)
-mkdir -p $(LIB_OBJ_DIR)
$(NAME)_$(ARCH).$(SHLIBEXT): $(LIB_OBJS)
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
$(DO_CC)
install:
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(LIB_DIR)/$(NAME)_$(ARCH).$(SHLIBEXT)
clean:
-rm -rf $(LIB_OBJ_DIR)

View File

@ -30,7 +30,6 @@ DO_CC += -o $@ -c $<
##################################################################### #####################################################################
LIB_OBJS= \ LIB_OBJS= \
$(LIB_OBJ_DIR)/3dnow.o \
$(LIB_OBJ_DIR)/anorms.o \ $(LIB_OBJ_DIR)/anorms.o \
$(LIB_OBJ_DIR)/bumpvects.o \ $(LIB_OBJ_DIR)/bumpvects.o \
$(LIB_OBJ_DIR)/color_conversion.o \ $(LIB_OBJ_DIR)/color_conversion.o \

View File

@ -50,7 +50,6 @@ LIB_OBJS= \
$(LIB_OBJ_DIR)/stringpool.o \ $(LIB_OBJ_DIR)/stringpool.o \
$(LIB_OBJ_DIR)/strtools.o \ $(LIB_OBJ_DIR)/strtools.o \
$(LIB_OBJ_DIR)/tier1.o \ $(LIB_OBJ_DIR)/tier1.o \
$(LIB_OBJ_DIR)/tokenreader.o \
$(LIB_OBJ_DIR)/undiff.o \ $(LIB_OBJ_DIR)/undiff.o \
$(LIB_OBJ_DIR)/uniqueid.o \ $(LIB_OBJ_DIR)/uniqueid.o \
$(LIB_OBJ_DIR)/utlbuffer.o \ $(LIB_OBJ_DIR)/utlbuffer.o \

View File

@ -6,6 +6,7 @@
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB) #if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
#include "mathlib/mathlib.h"
#include "mathlib/vector.h" #include "mathlib/vector.h"
#include "mathlib/anorms.h" #include "mathlib/anorms.h"

View File

@ -5,6 +5,7 @@
//=====================================================================================// //=====================================================================================//
#include <halton.h> #include <halton.h>
#include "mathlib/mathlib.h"
HaltonSequenceGenerator_t::HaltonSequenceGenerator_t(int b) HaltonSequenceGenerator_t::HaltonSequenceGenerator_t(int b)
{ {

View File

@ -6,6 +6,7 @@
// //
//=============================================================================// //=============================================================================//
#include <quantize.h> #include <quantize.h>
#include "tier0/basetypes.h"
#define N_EXTRAVALUES 1 #define N_EXTRAVALUES 1
#define N_DIMENSIONS (3+N_EXTRAVALUES) #define N_DIMENSIONS (3+N_EXTRAVALUES)

View File

@ -27,12 +27,12 @@ void LightDesc_t::RecalculateDerivedValues(void)
{ {
// note - this quantity is very sensitive to round off error. the sse // note - this quantity is very sensitive to round off error. the sse
// reciprocal approximation won't cut it here. // reciprocal approximation won't cut it here.
OneOver_ThetaDot_Minus_PhiDot=1.0/spread; m_OneOverThetaDotMinusPhiDot=1.0/spread;
} }
else else
{ {
// hard falloff instead of divide by zero // hard falloff instead of divide by zero
OneOver_ThetaDot_Minus_PhiDot=1.0; m_OneOverThetaDotMinusPhiDot=1.0;
} }
} }
if (m_Type==MATERIAL_LIGHT_DIRECTIONAL) if (m_Type==MATERIAL_LIGHT_DIRECTIONAL)
@ -140,7 +140,7 @@ void LightDesc_t::ComputeLightAtPoints( const FourVectors &pos, const FourVector
fltx4 dot2=SubSIMD(Four_Zeros,delta*m_Direction); // dot position with spot light dir for cone falloff fltx4 dot2=SubSIMD(Four_Zeros,delta*m_Direction); // dot position with spot light dir for cone falloff
fltx4 cone_falloff_scale=MulSIMD(ReplicateX4(OneOver_ThetaDot_Minus_PhiDot), fltx4 cone_falloff_scale=MulSIMD(ReplicateX4(m_OneOverThetaDotMinusPhiDot),
SubSIMD(dot2,ReplicateX4(m_PhiDot))); SubSIMD(dot2,ReplicateX4(m_PhiDot)));
cone_falloff_scale=MinSIMD(cone_falloff_scale,Four_Ones); cone_falloff_scale=MinSIMD(cone_falloff_scale,Four_Ones);
@ -236,7 +236,7 @@ void LightDesc_t::ComputeNonincidenceLightAtPoints( const FourVectors &pos, Four
fltx4 dot2=SubSIMD(Four_Zeros,delta*m_Direction); // dot position with spot light dir for cone falloff fltx4 dot2=SubSIMD(Four_Zeros,delta*m_Direction); // dot position with spot light dir for cone falloff
fltx4 cone_falloff_scale=MulSIMD(ReplicateX4(OneOver_ThetaDot_Minus_PhiDot), fltx4 cone_falloff_scale=MulSIMD(ReplicateX4(m_OneOverThetaDotMinusPhiDot),
SubSIMD(dot2,ReplicateX4(m_PhiDot))); SubSIMD(dot2,ReplicateX4(m_PhiDot)));
cone_falloff_scale=MinSIMD(cone_falloff_scale,Four_Ones); cone_falloff_scale=MinSIMD(cone_falloff_scale,Four_Ones);

20
mathlib/mathlib.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib.vcxproj", "{884C66F2-7F84-4570-AE6C-B634C1113D69}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.ActiveCfg = Debug|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.Build.0 = Debug|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.ActiveCfg = Release|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

407
mathlib/mathlib.vcproj Normal file
View File

@ -0,0 +1,407 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mathlib"
ProjectGUID="{884C66F2-7F84-4570-AE6C-B634C1113D69}"
RootNamespace="mathlib"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UseUnicodeResponseFiles="false"
Optimization="0"
AdditionalIncludeDirectories="..\public;..\public\tier0;..\public\tier1;..\public\mathlib"
PreprocessorDefinitions="WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
BufferSecurityCheck="false"
FloatingPointModel="2"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
OpenMP="false"
UsePrecompiledHeader="0"
ExpandAttributedSource="false"
AssemblerOutput="0"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/"
GenerateXMLDocumentationFiles="false"
BrowseInformation="0"
BrowseInformationFile="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="2"
ErrorReporting="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCLibrarianTool"
UseUnicodeResponseFiles="false"
OutputFile="..\lib\public\mathlib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/mathlib.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="false"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UseUnicodeResponseFiles="false"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\public;..\public\tier0;..\public\tier1;..\public\mathlib"
PreprocessorDefinitions="WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
OpenMP="false"
UsePrecompiledHeader="0"
ExpandAttributedSource="false"
AssemblerOutput="0"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/"
GenerateXMLDocumentationFiles="false"
BrowseInformation="0"
BrowseInformationFile="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="1"
CompileAs="2"
ErrorReporting="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine=""
ExcludedFromBuild="false"
/>
<Tool
Name="VCLibrarianTool"
UseUnicodeResponseFiles="false"
OutputFile="..\lib\public\mathlib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/mathlib.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="false"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\3dnow.cpp"
>
</File>
<File
RelativePath=".\anorms.cpp"
>
</File>
<File
RelativePath=".\bumpvects.cpp"
>
</File>
<File
RelativePath=".\color_conversion.cpp"
>
</File>
<File
RelativePath=".\halton.cpp"
>
</File>
<File
RelativePath=".\IceKey.cpp"
>
</File>
<File
RelativePath=".\imagequant.cpp"
>
</File>
<File
RelativePath=".\lightdesc.cpp"
>
</File>
<File
RelativePath=".\mathlib_base.cpp"
>
</File>
<File
RelativePath=".\polyhedron.cpp"
>
</File>
<File
RelativePath=".\powsse.cpp"
>
</File>
<File
RelativePath=".\quantize.cpp"
>
</File>
<File
RelativePath=".\randsse.cpp"
>
</File>
<File
RelativePath=".\simdvectormatrix.cpp"
>
</File>
<File
RelativePath=".\sparse_convolution_noise.cpp"
>
</File>
<File
RelativePath=".\sse.cpp"
>
</File>
<File
RelativePath=".\sseconst.cpp"
>
</File>
<File
RelativePath=".\ssenoise.cpp"
>
</File>
<File
RelativePath=".\vector.cpp"
>
</File>
<File
RelativePath=".\vmatrix.cpp"
>
</File>
</Filter>
<Filter
Name="Public Header Files"
Filter="h"
>
<File
RelativePath="..\public\mathlib\amd3dx.h"
>
</File>
<File
RelativePath="..\public\mathlib\anorms.h"
>
</File>
<File
RelativePath="..\public\mathlib\bumpvects.h"
>
</File>
<File
RelativePath="..\public\mathlib\compressed_3d_unitvec.h"
>
</File>
<File
RelativePath="..\public\mathlib\compressed_light_cube.h"
>
</File>
<File
RelativePath="..\public\mathlib\compressed_vector.h"
>
</File>
<File
RelativePath="..\public\mathlib\halton.h"
>
</File>
<File
RelativePath="..\public\mathlib\IceKey.H"
>
</File>
<File
RelativePath="..\public\mathlib\lightdesc.h"
>
</File>
<File
RelativePath="..\public\mathlib\math_pfns.h"
>
</File>
<File
RelativePath="..\public\mathlib\mathlib.h"
>
</File>
<File
RelativePath="..\public\mathlib\noise.h"
>
</File>
<File
RelativePath="..\public\mathlib\polyhedron.h"
>
</File>
<File
RelativePath="..\public\mathlib\quantize.h"
>
</File>
<File
RelativePath="..\public\mathlib\simdvectormatrix.h"
>
</File>
<File
RelativePath="..\public\mathlib\ssemath.h"
>
</File>
<File
RelativePath="..\public\mathlib\ssequaternion.h"
>
</File>
<File
RelativePath="..\public\mathlib\vector.h"
>
</File>
<File
RelativePath="..\public\mathlib\vector2d.h"
>
</File>
<File
RelativePath="..\public\mathlib\vector4d.h"
>
</File>
<File
RelativePath="..\public\mathlib\vmatrix.h"
>
</File>
<File
RelativePath="..\public\mathlib\vplane.h"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\3dnow.h"
>
</File>
<File
RelativePath=".\noisedata.h"
>
</File>
<File
RelativePath=".\sse.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

212
mathlib/mathlib.vcxproj Normal file
View File

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{884C66F2-7F84-4570-AE6C-B634C1113D69}</ProjectGuid>
<RootNamespace>mathlib</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PostBuildEventUseInBuild>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\mathlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>
</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)mathlib.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\mathlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)mathlib.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="anorms.cpp" />
<ClCompile Include="bumpvects.cpp" />
<ClCompile Include="color_conversion.cpp" />
<ClCompile Include="halton.cpp" />
<ClCompile Include="IceKey.cpp" />
<ClCompile Include="imagequant.cpp" />
<ClCompile Include="lightdesc.cpp" />
<ClCompile Include="mathlib_base.cpp" />
<ClCompile Include="polyhedron.cpp" />
<ClCompile Include="powsse.cpp" />
<ClCompile Include="quantize.cpp" />
<ClCompile Include="randsse.cpp" />
<ClCompile Include="simdvectormatrix.cpp" />
<ClCompile Include="sparse_convolution_noise.cpp" />
<ClCompile Include="sse.cpp" />
<ClCompile Include="sseconst.cpp" />
<ClCompile Include="ssenoise.cpp" />
<ClCompile Include="vector.cpp" />
<ClCompile Include="vmatrix.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\mathlib\amd3dx.h" />
<ClInclude Include="..\public\mathlib\anorms.h" />
<ClInclude Include="..\public\mathlib\bumpvects.h" />
<ClInclude Include="..\public\mathlib\compressed_3d_unitvec.h" />
<ClInclude Include="..\public\mathlib\compressed_light_cube.h" />
<ClInclude Include="..\public\mathlib\compressed_vector.h" />
<ClInclude Include="..\public\mathlib\halton.h" />
<ClInclude Include="..\public\mathlib\IceKey.H" />
<ClInclude Include="..\public\mathlib\lightdesc.h" />
<ClInclude Include="..\public\mathlib\math_pfns.h" />
<ClInclude Include="..\public\mathlib\mathlib.h" />
<ClInclude Include="..\public\mathlib\noise.h" />
<ClInclude Include="..\public\mathlib\polyhedron.h" />
<ClInclude Include="..\public\mathlib\quantize.h" />
<ClInclude Include="..\public\mathlib\simdvectormatrix.h" />
<ClInclude Include="..\public\mathlib\ssemath.h" />
<ClInclude Include="..\public\mathlib\ssequaternion.h" />
<ClInclude Include="..\public\mathlib\vector.h" />
<ClInclude Include="..\public\mathlib\vector2d.h" />
<ClInclude Include="..\public\mathlib\vector4d.h" />
<ClInclude Include="..\public\mathlib\vmatrix.h" />
<ClInclude Include="..\public\mathlib\vplane.h" />
<ClInclude Include="3dnow.h" />
<ClInclude Include="noisedata.h" />
<ClInclude Include="sse.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{00f9c713-dc8b-4f56-b6a8-0f7252d1a270}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Public Header Files">
<UniqueIdentifier>{c9fa2f3a-719d-4fab-aa39-714cf6391317}</UniqueIdentifier>
<Extensions>h</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{7f621938-4fe8-4d3f-a1b1-e00a41531e16}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="anorms.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bumpvects.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="color_conversion.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="halton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IceKey.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="imagequant.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lightdesc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mathlib_base.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="polyhedron.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="powsse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="quantize.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="randsse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="simdvectormatrix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sparse_convolution_noise.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sseconst.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ssenoise.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vector.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vmatrix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\mathlib\amd3dx.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\anorms.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\bumpvects.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\compressed_3d_unitvec.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\compressed_light_cube.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\compressed_vector.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\halton.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\IceKey.H">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\lightdesc.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\math_pfns.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\mathlib.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\noise.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\polyhedron.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\quantize.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\simdvectormatrix.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\ssemath.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\ssequaternion.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\vector.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\vector2d.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\vector4d.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\vmatrix.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\mathlib\vplane.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="3dnow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="noisedata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sse.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -24,13 +24,12 @@
#include "mathlib/mathlib.h" #include "mathlib/mathlib.h"
#include "mathlib/vector.h" #include "mathlib/vector.h"
#if !defined( _X360 ) #if !defined( _X360 )
#include "mathlib/amd3dx.h"
#include "3dnow.h"
#include "sse.h" #include "sse.h"
#endif #endif
#include "mathlib/ssemath.h" #include "mathlib/ssemath.h"
#include "mathlib/ssequaternion.h" #include "mathlib/ssequaternion.h"
#include "mathlib/vplane.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
@ -42,7 +41,6 @@ bool s_bMathlibInitialized = false;
void Sys_Error (char *error, ...); void Sys_Error (char *error, ...);
#endif #endif
const Vector vec3_origin(0,0,0);
const QAngle vec3_angle(0,0,0); const QAngle vec3_angle(0,0,0);
const Vector vec3_invalid( FLT_MAX, FLT_MAX, FLT_MAX ); const Vector vec3_invalid( FLT_MAX, FLT_MAX, FLT_MAX );
const int nanmask = 255<<23; const int nanmask = 255<<23;
@ -63,10 +61,10 @@ float _rsqrtf(float x)
return 1.f / _sqrtf( x ); return 1.f / _sqrtf( x );
} }
float FASTCALL _VectorNormalize (Vector& vec) float VectorNormalize (Vector& vec)
{ {
#ifdef _VPROF_MATHLIB #ifdef _VPROF_MATHLIB
VPROF_BUDGET( "_VectorNormalize", "Mathlib" ); VPROF_BUDGET( "VectorNormalize", "Mathlib" );
#endif #endif
Assert( s_bMathlibInitialized ); Assert( s_bMathlibInitialized );
float radius = sqrtf(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z); float radius = sqrtf(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z);
@ -81,6 +79,8 @@ float FASTCALL _VectorNormalize (Vector& vec)
return radius; return radius;
} }
// TODO: Add fast C VectorNormalizeFast. // TODO: Add fast C VectorNormalizeFast.
// Perhaps use approximate rsqrt trick, if the accuracy isn't too bad. // Perhaps use approximate rsqrt trick, if the accuracy isn't too bad.
void FASTCALL _VectorNormalizeFast (Vector& vec) void FASTCALL _VectorNormalizeFast (Vector& vec)
@ -109,7 +109,6 @@ float _InvRSquared(const float* v)
float (*pfSqrt)(float x) = _sqrtf; float (*pfSqrt)(float x) = _sqrtf;
float (*pfRSqrt)(float x) = _rsqrtf; float (*pfRSqrt)(float x) = _rsqrtf;
float (*pfRSqrtFast)(float x) = _rsqrtf; float (*pfRSqrtFast)(float x) = _rsqrtf;
float (FASTCALL *pfVectorNormalize)(Vector& v) = _VectorNormalize;
void (FASTCALL *pfVectorNormalizeFast)(Vector& v) = _VectorNormalizeFast; void (FASTCALL *pfVectorNormalizeFast)(Vector& v) = _VectorNormalizeFast;
float (*pfInvRSquared)(const float* v) = _InvRSquared; float (*pfInvRSquared)(const float* v) = _InvRSquared;
void (*pfFastSinCos)(float x, float* s, float* c) = SinCos; void (*pfFastSinCos)(float x, float* s, float* c) = SinCos;
@ -382,9 +381,9 @@ void MatrixInvert( const matrix3x4_t& in, matrix3x4_t& out )
Assert( s_bMathlibInitialized ); Assert( s_bMathlibInitialized );
if ( &in == &out ) if ( &in == &out )
{ {
swap(out[0][1],out[1][0]); V_swap(out[0][1],out[1][0]);
swap(out[0][2],out[2][0]); V_swap(out[0][2],out[2][0]);
swap(out[1][2],out[2][1]); V_swap(out[1][2],out[2][1]);
} }
else else
{ {
@ -1266,18 +1265,18 @@ bool SolveInverseQuadraticMonotonic( float x1, float y1, float x2, float y2, flo
// first, sort parameters // first, sort parameters
if (x1>x2) if (x1>x2)
{ {
swap(x1,x2); V_swap(x1,x2);
swap(y1,y2); V_swap(y1,y2);
} }
if (x2>x3) if (x2>x3)
{ {
swap(x2,x3); V_swap(x2,x3);
swap(y2,y3); V_swap(y2,y3);
} }
if (x1>x2) if (x1>x2)
{ {
swap(x1,x2); V_swap(x1,x2);
swap(y1,y2); V_swap(y1,y2);
} }
// this code is not fast. what it does is when the curve would be non-monotonic, slowly shifts // this code is not fast. what it does is when the curve would be non-monotonic, slowly shifts
// the center point closer to the linear line between the endpoints. Should anyone need htis // the center point closer to the linear line between the endpoints. Should anyone need htis
@ -3198,7 +3197,6 @@ bool CalcLineToLineIntersectionSegment(
#pragma optimize( "", on ) #pragma optimize( "", on )
#endif #endif
static bool s_b3DNowEnabled = false;
static bool s_bMMXEnabled = false; static bool s_bMMXEnabled = false;
static bool s_bSSEEnabled = false; static bool s_bSSEEnabled = false;
static bool s_bSSE2Enabled = false; static bool s_bSSE2Enabled = false;
@ -3218,7 +3216,6 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
pfSqrt = _sqrtf; pfSqrt = _sqrtf;
pfRSqrt = _rsqrtf; pfRSqrt = _rsqrtf;
pfRSqrtFast = _rsqrtf; pfRSqrtFast = _rsqrtf;
pfVectorNormalize = _VectorNormalize;
pfVectorNormalizeFast = _VectorNormalizeFast; pfVectorNormalizeFast = _VectorNormalizeFast;
pfInvRSquared = _InvRSquared; pfInvRSquared = _InvRSquared;
pfFastSinCos = SinCos; pfFastSinCos = SinCos;
@ -3235,31 +3232,11 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
s_bMMXEnabled = false; s_bMMXEnabled = false;
} }
// SSE Generally performs better than 3DNow when present, so this is placed
// first to allow SSE to override these settings.
if ( bAllow3DNow && pi.m_b3DNow )
{
s_b3DNowEnabled = true;
// Select the 3DNow specific routines if available;
pfVectorNormalize = _3DNow_VectorNormalize;
pfVectorNormalizeFast = _3DNow_VectorNormalizeFast;
pfInvRSquared = _3DNow_InvRSquared;
pfSqrt = _3DNow_Sqrt;
pfRSqrt = _3DNow_RSqrt;
pfRSqrtFast = _3DNow_RSqrt;
}
else
{
s_b3DNowEnabled = false;
}
if ( bAllowSSE && pi.m_bSSE ) if ( bAllowSSE && pi.m_bSSE )
{ {
s_bSSEEnabled = true; s_bSSEEnabled = true;
// Select the SSE specific routines if available // Select the SSE specific routines if available
pfVectorNormalize = _VectorNormalize;
pfVectorNormalizeFast = _SSE_VectorNormalizeFast; pfVectorNormalizeFast = _SSE_VectorNormalizeFast;
pfInvRSquared = _SSE_InvRSquared; pfInvRSquared = _SSE_InvRSquared;
pfSqrt = _SSE_Sqrt; pfSqrt = _SSE_Sqrt;
@ -3295,12 +3272,6 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
BuildGammaTable( gamma, texGamma, brightness, overbright ); BuildGammaTable( gamma, texGamma, brightness, overbright );
} }
bool MathLib_3DNowEnabled( void )
{
Assert( s_bMathlibInitialized );
return s_b3DNowEnabled;
}
bool MathLib_MMXEnabled( void ) bool MathLib_MMXEnabled( void )
{ {
Assert( s_bMathlibInitialized ); Assert( s_bMathlibInitialized );
@ -3319,20 +3290,6 @@ bool MathLib_SSE2Enabled( void )
return s_bSSE2Enabled; return s_bSSE2Enabled;
} }
float Approach( float target, float value, float speed )
{
float delta = target - value;
if ( delta > speed )
value += speed;
else if ( delta < -speed )
value -= speed;
else
value = target;
return value;
}
// BUGBUG: Why doesn't this call angle diff?!?!? // BUGBUG: Why doesn't this call angle diff?!?!?
float ApproachAngle( float target, float value, float speed ) float ApproachAngle( float target, float value, float speed )
{ {
@ -3816,8 +3773,8 @@ void GeneratePerspectiveFrustum( const Vector& origin, const Vector &forward,
float flIntercept = DotProduct( origin, forward ); float flIntercept = DotProduct( origin, forward );
// Setup the near and far planes. // Setup the near and far planes.
frustum.SetPlane( FRUSTUM_FARZ, PLANE_ANYZ, -forward, -flZFar - flIntercept ); frustum.SetPlane( FRUSTUM_FARZ, -forward, -flZFar - flIntercept );
frustum.SetPlane( FRUSTUM_NEARZ, PLANE_ANYZ, forward, flZNear + flIntercept ); frustum.SetPlane( FRUSTUM_NEARZ, forward, flZNear + flIntercept );
flFovX *= 0.5f; flFovX *= 0.5f;
flFovY *= 0.5f; flFovY *= 0.5f;
@ -3834,8 +3791,8 @@ void GeneratePerspectiveFrustum( const Vector& origin, const Vector &forward,
VectorNormalize( normalPos ); VectorNormalize( normalPos );
VectorNormalize( normalNeg ); VectorNormalize( normalNeg );
frustum.SetPlane( FRUSTUM_LEFT, PLANE_ANYZ, normalPos, normalPos.Dot( origin ) ); frustum.SetPlane( FRUSTUM_LEFT, normalPos, normalPos.Dot( origin ) );
frustum.SetPlane( FRUSTUM_RIGHT, PLANE_ANYZ, normalNeg, normalNeg.Dot( origin ) ); frustum.SetPlane( FRUSTUM_RIGHT,normalNeg, normalNeg.Dot( origin ) );
VectorMA( up, flTanY, forward, normalPos ); VectorMA( up, flTanY, forward, normalPos );
VectorMA( normalPos, -2.0f, up, normalNeg ); VectorMA( normalPos, -2.0f, up, normalNeg );
@ -3843,8 +3800,8 @@ void GeneratePerspectiveFrustum( const Vector& origin, const Vector &forward,
VectorNormalize( normalPos ); VectorNormalize( normalPos );
VectorNormalize( normalNeg ); VectorNormalize( normalNeg );
frustum.SetPlane( FRUSTUM_BOTTOM, PLANE_ANYZ, normalPos, normalPos.Dot( origin ) ); frustum.SetPlane( FRUSTUM_BOTTOM, normalPos, normalPos.Dot( origin ) );
frustum.SetPlane( FRUSTUM_TOP, PLANE_ANYZ, normalNeg, normalNeg.Dot( origin ) ); frustum.SetPlane( FRUSTUM_TOP, normalNeg, normalNeg.Dot( origin ) );
} }
@ -3859,23 +3816,40 @@ void GeneratePerspectiveFrustum( const Vector& origin, const QAngle &angles, flo
GeneratePerspectiveFrustum( origin, vecForward, vecRight, vecUp, flZNear, flZFar, flFovX, flFovY, frustum ); GeneratePerspectiveFrustum( origin, vecForward, vecRight, vecUp, flZNear, flZFar, flFovX, flFovY, frustum );
} }
inline cplane_t *ToPlane(cplane_t *out, const Frustum_t &frustum, int type)
{
Vector vecNormal;
float dist;
frustum.GetPlane(type, &vecNormal, &dist);
out->normal = vecNormal;
out->dist = dist;
out->type = PLANE_ANYZ;
out->signbits = SignbitsForPlane(out);
return out;
}
bool R_CullBox( const Vector& mins, const Vector& maxs, const Frustum_t &frustum ) bool R_CullBox( const Vector& mins, const Vector& maxs, const Frustum_t &frustum )
{ {
return (( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_RIGHT) ) == 2 ) || cplane_t p;
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_LEFT) ) == 2 ) || return (( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_RIGHT) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_TOP) ) == 2 ) || ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_LEFT) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_BOTTOM) ) == 2 ) || ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_TOP) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_NEARZ) ) == 2 ) || ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_BOTTOM) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_FARZ) ) == 2 ) ); ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_NEARZ) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_FARZ) ) == 2 ) );
} }
bool R_CullBoxSkipNear( const Vector& mins, const Vector& maxs, const Frustum_t &frustum ) bool R_CullBoxSkipNear( const Vector& mins, const Vector& maxs, const Frustum_t &frustum )
{ {
return (( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_RIGHT) ) == 2 ) || cplane_t p;
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_LEFT) ) == 2 ) || return (( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_RIGHT) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_TOP) ) == 2 ) || ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_LEFT) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_BOTTOM) ) == 2 ) || ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_TOP) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, frustum.GetPlane(FRUSTUM_FARZ) ) == 2 ) ); ( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_BOTTOM) ) == 2 ) ||
( BoxOnPlaneSide( mins, maxs, ToPlane(&p, frustum, FRUSTUM_FARZ) ) == 2 ) );
} }
@ -4088,3 +4062,208 @@ void GetInterpolationData( float const *pKnotPositions,
*pInterpolationValue = FLerp( 0, 1, 0, flSizeOfGap, flOffsetFromStartOfGap ); *pInterpolationValue = FLerp( 0, 1, 0, flSizeOfGap, flOffsetFromStartOfGap );
return; return;
} }
/* Reverse engineered code ahead */
void fourplanes_t::ComputeSignbits()
{
xSign = CmpLtSIMD(nX, Four_Zeros);
ySign = CmpLtSIMD(nY, Four_Zeros);
zSign = CmpLtSIMD(nZ, Four_Zeros);
nXAbs = fabs(nX);
nYAbs = fabs(nY);
nZAbs = fabs(nZ);
}
void fourplanes_t::Set4Planes( const VPlane *pPlanes )
{
nX = *(fltx4 *)pPlanes;
nY = *(fltx4 *)++pPlanes;
nZ = *(fltx4 *)++pPlanes;
dist = *(fltx4 *)++pPlanes;
TransposeSIMD(nX, nY, nZ, dist);
ComputeSignbits();
}
void fourplanes_t::Set2Planes( const VPlane *pPlanes )
{
nX = *(fltx4 *)pPlanes;
nY = *(fltx4 *)++pPlanes;
nZ = Four_Zeros;
dist = Four_Zeros;
TransposeSIMD(nX, nY, nZ, dist);
ComputeSignbits();
}
void fourplanes_t::Get4Planes( VPlane *pPlanesOut )
{
fltx4 tempX = nX;
fltx4 tempY = nY;
fltx4 tempZ = nZ;
fltx4 tempDist = dist;
TransposeSIMD(tempX, tempY, tempZ, tempDist);
*(fltx4 *)pPlanesOut = tempX;
*(fltx4 *)++pPlanesOut = tempY;
*(fltx4 *)++pPlanesOut = tempZ;
*(fltx4 *)++pPlanesOut = tempDist;
}
void fourplanes_t::Get2Planes( VPlane *pPlanesOut )
{
fltx4 tempX = nX;
fltx4 tempY = nY;
fltx4 tempZ = nZ;
fltx4 tempDist = dist;
TransposeSIMD(tempX, tempY, tempZ, tempDist);
*(fltx4 *)pPlanesOut = tempX;
*(fltx4 *)++pPlanesOut = tempY;
}
void fourplanes_t::GetPlane( int index, Vector *pNormal, float *pDist ) const
{
pNormal->x = SubFloat(nX, index);
pNormal->y = SubFloat(nY, index);
pNormal->z = SubFloat(nZ, index);
*pDist = SubFloat(dist, index);
}
void fourplanes_t::SetPlane( int index, const Vector &vecNormal, float planeDist )
{
SubFloat(nX, index) = vecNormal.x;
SubFloat(nY, index) = vecNormal.y;
SubFloat(nZ, index) = vecNormal.z;
SubFloat(dist, index) = planeDist;
ComputeSignbits();
}
Frustum_t::Frustum_t()
{
memset(planes, 0, sizeof(planes));
}
void Frustum_t::SetPlane( int i, const Vector &vecNormal, float dist )
{
if (i < 4)
planes[0].SetPlane(i, vecNormal, dist);
else
planes[1].SetPlane(i - 4, vecNormal, dist);
}
void Frustum_t::GetPlane( int i, Vector *pNormalOut, float *pDistOut) const
{
if (i < 4)
planes[0].GetPlane(i, pNormalOut, pDistOut);
else
planes[1].GetPlane(i - 4, pNormalOut, pDistOut);
}
void Frustum_t::SetPlanes( const VPlane *pPlanes )
{
planes[0].Set4Planes(pPlanes);
planes[1].Set2Planes(pPlanes + 4);
}
void Frustum_t::GetPlanes( VPlane *pPlanesOut )
{
planes[0].Get4Planes(pPlanesOut);
planes[1].Get2Planes(pPlanesOut + 4);
}
bool Frustum_t::CullBox( const Vector &mins, const Vector &maxs ) const
{
fltx4 mins4 = LoadUnalignedSIMD(&mins);
fltx4 maxs4 = LoadUnalignedSIMD(&maxs);
fltx4 minX = SplatXSIMD(mins4);
fltx4 minY = SplatYSIMD(mins4);
fltx4 minZ = SplatZSIMD(mins4);
fltx4 maxX = SplatXSIMD(maxs4);
fltx4 maxY = SplatYSIMD(maxs4);
fltx4 maxZ = SplatZSIMD(maxs4);
for (int i = 0; i < 2; i++)
{
fltx4 xTotalBack = MulSIMD(planes[i].nX, MaskedAssign(planes[i].xSign, minX, maxX));
fltx4 yTotalBack = MulSIMD(planes[i].nY, MaskedAssign(planes[i].ySign, minY, maxY));
fltx4 zTotalBack = MulSIMD(planes[i].nZ, MaskedAssign(planes[i].zSign, minZ, maxZ));
fltx4 dotBack = AddSIMD(xTotalBack, AddSIMD(yTotalBack, zTotalBack));
if (IsAnyNegative(CmpLtSIMD(dotBack, planes[i].dist)))
return true;
}
return false;
}
bool Frustum_t::CullBoxCenterExtents( const Vector &center, const Vector &extents ) const
{
fltx4 center4 = LoadUnalignedSIMD(&center);
fltx4 extents4 = LoadUnalignedSIMD(&extents);
fltx4 centerX = SplatXSIMD(center4);
fltx4 centerY = SplatYSIMD(center4);
fltx4 centerZ = SplatZSIMD(center4);
fltx4 extentsX = SplatXSIMD(extents4);
fltx4 extentsY = SplatYSIMD(extents4);
fltx4 extentsZ = SplatZSIMD(extents4);
for (int i = 0; i < 2; i++)
{
fltx4 xTotalBack = AddSIMD(MulSIMD(planes[i].nX, centerX), MulSIMD(planes[i].nXAbs, extentsX));
fltx4 yTotalBack = AddSIMD(MulSIMD(planes[i].nY, centerY), MulSIMD(planes[i].nYAbs, extentsY));
fltx4 zTotalBack = AddSIMD(MulSIMD(planes[i].nZ, centerZ), MulSIMD(planes[i].nZAbs, extentsZ));
fltx4 dotBack = AddSIMD(xTotalBack, AddSIMD(yTotalBack, zTotalBack));
if (IsAnyNegative(CmpLtSIMD(dotBack, planes[i].dist)))
return true;
}
return false;
}
bool Frustum_t::CullBox( const fltx4 &fl4Mins, const fltx4 &fl4Maxs ) const
{
fltx4 minX = SplatXSIMD(fl4Mins);
fltx4 minY = SplatYSIMD(fl4Mins);
fltx4 minZ = SplatZSIMD(fl4Mins);
fltx4 maxX = SplatXSIMD(fl4Maxs);
fltx4 maxY = SplatYSIMD(fl4Maxs);
fltx4 maxZ = SplatZSIMD(fl4Maxs);
for (int i = 0; i < 2; i++)
{
fltx4 xTotalBack = MulSIMD(planes[i].nX, MaskedAssign(planes[i].xSign, minX, maxX));
fltx4 yTotalBack = MulSIMD(planes[i].nY, MaskedAssign(planes[i].ySign, minY, maxY));
fltx4 zTotalBack = MulSIMD(planes[i].nZ, MaskedAssign(planes[i].zSign, minZ, maxZ));
fltx4 dotBack = AddSIMD(xTotalBack, AddSIMD(yTotalBack, zTotalBack));
if (IsAnyNegative(CmpLtSIMD(dotBack, planes[i].dist)))
return true;
}
return false;
}
bool Frustum_t::CullBoxCenterExtents( const fltx4 &fl4Center, const fltx4 &fl4Extents ) const
{
fltx4 centerX = SplatXSIMD(fl4Center);
fltx4 centerY = SplatYSIMD(fl4Center);
fltx4 centerZ = SplatZSIMD(fl4Center);
fltx4 extentsX = SplatXSIMD(fl4Extents);
fltx4 extentsY = SplatYSIMD(fl4Extents);
fltx4 extentsZ = SplatZSIMD(fl4Extents);
for (int i = 0; i < 2; i++)
{
fltx4 xTotalBack = AddSIMD(MulSIMD(planes[i].nX, centerX), MulSIMD(planes[i].nXAbs, extentsX));
fltx4 yTotalBack = AddSIMD(MulSIMD(planes[i].nY, centerY), MulSIMD(planes[i].nYAbs, extentsY));
fltx4 zTotalBack = AddSIMD(MulSIMD(planes[i].nZ, centerZ), MulSIMD(planes[i].nZAbs, extentsZ));
fltx4 dotBack = AddSIMD(xTotalBack, AddSIMD(yTotalBack, zTotalBack));
if (IsAnyNegative(CmpLtSIMD(dotBack, planes[i].dist)))
return true;
}
return false;
}

View File

@ -21,6 +21,8 @@
#include <math.h> #include <math.h>
#include "tier0/basetypes.h"
static int current_ndims; static int current_ndims;
static struct QuantizedValue *current_root; static struct QuantizedValue *current_root;
static int current_ssize; static int current_ssize;

View File

@ -172,7 +172,7 @@ float _SSE_RSqrtFast(float x)
{ {
Assert( s_bMathlibInitialized ); Assert( s_bMathlibInitialized );
float rroot; float rroot = 0.0f;
#ifdef _WIN32 #ifdef _WIN32
_asm _asm
{ {

View File

@ -6,7 +6,8 @@
// //
//=============================================================================// //=============================================================================//
#include "mathlib/mathlib.h"
#include "mathlib/vector.h" #include "mathlib/vector.h"
Vector vec3_origin(0,0,0); const Vector vec3_origin(0,0,0);

View File

@ -11,6 +11,7 @@
#include "basetypes.h" #include "basetypes.h"
#include "mathlib/vmatrix.h" #include "mathlib/vmatrix.h"
#include "mathlib/mathlib.h" #include "mathlib/mathlib.h"
#include "mathlib/ssemath.h"
#include <string.h> #include <string.h>
#include "mathlib/vector4d.h" #include "mathlib/vector4d.h"
#include "tier0/dbg.h" #include "tier0/dbg.h"
@ -1177,27 +1178,27 @@ void FrustumPlanesFromMatrix( const VMatrix &clipToWorld, Frustum_t &frustum )
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 0.0f, 0.0f, 0.0f ), Vector( 1.0f, 0.0f, 0.0f ), Vector( 0.0f, 1.0f, 0.0f ), normal, dist ); Vector( 0.0f, 0.0f, 0.0f ), Vector( 1.0f, 0.0f, 0.0f ), Vector( 0.0f, 1.0f, 0.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_NEARZ, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_NEARZ, normal, dist );
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 0.0f, 0.0f, 1.0f ), Vector( 0.0f, 1.0f, 1.0f ), Vector( 1.0f, 0.0f, 1.0f ), normal, dist ); Vector( 0.0f, 0.0f, 1.0f ), Vector( 0.0f, 1.0f, 1.0f ), Vector( 1.0f, 0.0f, 1.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_FARZ, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_FARZ, normal, dist );
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 1.0f, 0.0f, 0.0f ), Vector( 1.0f, 1.0f, 1.0f ), Vector( 1.0f, 1.0f, 0.0f ), normal, dist ); Vector( 1.0f, 0.0f, 0.0f ), Vector( 1.0f, 1.0f, 1.0f ), Vector( 1.0f, 1.0f, 0.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_RIGHT, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_RIGHT, normal, dist );
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 0.0f, 0.0f, 0.0f ), Vector( 0.0f, 1.0f, 1.0f ), Vector( 0.0f, 0.0f, 1.0f ), normal, dist ); Vector( 0.0f, 0.0f, 0.0f ), Vector( 0.0f, 1.0f, 1.0f ), Vector( 0.0f, 0.0f, 1.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_LEFT, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_LEFT, normal, dist );
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 1.0f, 1.0f, 0.0f ), Vector( 1.0f, 1.0f, 1.0f ), Vector( 0.0f, 1.0f, 1.0f ), normal, dist ); Vector( 1.0f, 1.0f, 0.0f ), Vector( 1.0f, 1.0f, 1.0f ), Vector( 0.0f, 1.0f, 1.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_TOP, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_TOP, normal, dist );
FrustumPlanesFromMatrixHelper( clipToWorld, FrustumPlanesFromMatrixHelper( clipToWorld,
Vector( 1.0f, 0.0f, 0.0f ), Vector( 0.0f, 0.0f, 1.0f ), Vector( 1.0f, 0.0f, 1.0f ), normal, dist ); Vector( 1.0f, 0.0f, 0.0f ), Vector( 0.0f, 0.0f, 1.0f ), Vector( 1.0f, 0.0f, 1.0f ), normal, dist );
frustum.SetPlane( FRUSTUM_BOTTOM, PLANE_ANYZ, normal, dist ); frustum.SetPlane( FRUSTUM_BOTTOM, normal, dist );
} }
void MatrixBuildOrtho( VMatrix& dst, double left, double top, double right, double bottom, double zNear, double zFar ) void MatrixBuildOrtho( VMatrix& dst, double left, double top, double right, double bottom, double zNear, double zFar )

View File

@ -33,7 +33,9 @@ typedef enum DXGI_FORMAT;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// don't bitch that inline functions aren't used!!!! // don't bitch that inline functions aren't used!!!!
#ifdef _MSC_VER
#pragma warning(disable : 4514) #pragma warning(disable : 4514)
#endif
enum ImageFormat enum ImageFormat
{ {
@ -170,7 +172,9 @@ typedef enum _D3DFORMAT
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Color structures // Color structures
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning ( disable : 4293 ) #pragma warning ( disable : 4293 )
#endif
template< int nBitCount > FORCEINLINE int ConvertTo10Bit( int x ) template< int nBitCount > FORCEINLINE int ConvertTo10Bit( int x )
{ {
switch ( nBitCount ) switch ( nBitCount )
@ -184,10 +188,15 @@ template< int nBitCount > FORCEINLINE int ConvertTo10Bit( int x )
case 4: case 4:
return ( x << 6 ) | ( x << 2 ) | ( x >> 2 ); return ( x << 6 ) | ( x << 2 ) | ( x >> 2 );
default: default:
return ( x << ( 10 - nBitCount ) ) | ( x >> ( nBitCount - ( 10 - nBitCount ) ) ); {
int rshift = ( nBitCount - ( 10 - nBitCount ) );
return ( x << ( 10 - nBitCount ) ) | ( x >> rshift );
}
} }
} }
#ifdef _MSC_VER
#pragma warning ( default : 4293 ) #pragma warning ( default : 4293 )
#endif
template< int nBitCount > FORCEINLINE int ConvertFrom10Bit( int x ) template< int nBitCount > FORCEINLINE int ConvertFrom10Bit( int x )
{ {
@ -622,7 +631,7 @@ namespace ImageLoader
struct ResampleInfo_t struct ResampleInfo_t
{ {
ResampleInfo_t() : m_nFlags(0), m_flAlphaThreshhold(0.4f), m_flAlphaHiFreqThreshhold(0.4f), m_nSrcDepth(1), m_nDestDepth(1) ResampleInfo_t() : m_nSrcDepth(1), m_nDestDepth(1), m_flAlphaThreshhold(0.4f), m_flAlphaHiFreqThreshhold(0.4f), m_nFlags(0)
{ {
m_flColorScale[0] = 1.0f, m_flColorScale[1] = 1.0f, m_flColorScale[2] = 1.0f, m_flColorScale[3] = 1.0f; m_flColorScale[0] = 1.0f, m_flColorScale[1] = 1.0f, m_flColorScale[2] = 1.0f, m_flColorScale[3] = 1.0f;
m_flColorGoal[0] = 0.0f, m_flColorGoal[1] = 0.0f, m_flColorGoal[2] = 0.0f, m_flColorGoal[3] = 0.0f; m_flColorGoal[0] = 0.0f, m_flColorGoal[1] = 0.0f, m_flColorGoal[2] = 0.0f, m_flColorGoal[3] = 0.0f;

View File

@ -882,7 +882,9 @@ struct dfaceid_t
#if defined( _X360 ) #if defined( _X360 )
#pragma bitfield_order( push, lsb_to_msb ) #pragma bitfield_order( push, lsb_to_msb )
#endif #endif
#ifdef _MSC_VER
#pragma warning( disable:4201 ) // C4201: nonstandard extension used: nameless struct/union #pragma warning( disable:4201 ) // C4201: nonstandard extension used: nameless struct/union
#endif
struct dleaf_version_0_t struct dleaf_version_0_t
{ {
DECLARE_BYTESWAP_DATADESC(); DECLARE_BYTESWAP_DATADESC();
@ -936,7 +938,9 @@ struct dleaf_t
// Precaculated light info for entities. // Precaculated light info for entities.
// CompressedLightCube m_AmbientLighting; // CompressedLightCube m_AmbientLighting;
}; };
#ifdef _MSC_VER
#pragma warning( default:4201 ) // C4201: nonstandard extension used: nameless struct/union #pragma warning( default:4201 ) // C4201: nonstandard extension used: nameless struct/union
#endif
#if defined( _X360 ) #if defined( _X360 )
#pragma bitfield_order( pop ) #pragma bitfield_order( pop )
#endif #endif

View File

@ -16,7 +16,7 @@
#include "tier0/dbg.h" #include "tier0/dbg.h"
#include "appframework/iappsystem.h" #include "appframework/IAppSystem.h"
#include "tier3/tier3.h" #include "tier3/tier3.h"
class IDataCache; class IDataCache;

View File

@ -19,7 +19,7 @@
#pragma once #pragma once
#endif #endif
#include "appframework/iappsystem.h" #include "appframework/IAppSystem.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Forward declarations // Forward declarations

View File

@ -138,7 +138,7 @@ public:
switch ( m_Type ) switch ( m_Type )
{ {
case DPT_Int : case DPT_Int :
Q_snprintf( text, sizeof(text), "%i", m_Int ); Q_snprintf( text, sizeof(text), "%i", (int)m_Int );
break; break;
case DPT_Float : case DPT_Float :
Q_snprintf( text, sizeof(text), "%.3f", m_Float ); Q_snprintf( text, sizeof(text), "%.3f", m_Float );
@ -170,7 +170,7 @@ public:
Q_snprintf( text, sizeof(text), "DataTable" ); Q_snprintf( text, sizeof(text), "DataTable" );
break; break;
case DPT_Int64: case DPT_Int64:
Q_snprintf( text, sizeof(text), "%I64d", m_Int64 ); Q_snprintf( text, sizeof(text), "%lld", m_Int64 );
break; break;
default : default :
Q_snprintf( text, sizeof(text), "DVariant type %i unknown", m_Type ); Q_snprintf( text, sizeof(text), "DVariant type %i unknown", m_Type );

View File

@ -20,7 +20,7 @@
#include "tier1/interface.h" #include "tier1/interface.h"
#include "tier1/utlsymbol.h" #include "tier1/utlsymbol.h"
#include "tier1/utlstring.h" #include "tier1/utlstring.h"
#include "tier1/functors.h" //#include "tier1/functors.h"
#include "tier1/checksum_crc.h" #include "tier1/checksum_crc.h"
#include "tier1/utlqueue.h" #include "tier1/utlqueue.h"
#include "appframework/IAppSystem.h" #include "appframework/IAppSystem.h"
@ -539,7 +539,7 @@ public:
) = 0; ) = 0;
virtual void FindFileAbsoluteList( virtual void FindFileAbsoluteList(
CUtlVector<CUtlString, CUtlMemory<CUtlString, int>> &output, CUtlVector<CUtlString> &output,
const char *pWildCard, const char *pWildCard,
const char *pPathID const char *pPathID
) = 0; ) = 0;

View File

@ -166,7 +166,7 @@ public:
FileFindHandle_t *pHandle FileFindHandle_t *pHandle
) { return m_pFileSystemPassThru->FindFirstEx( pWildCard, pPathID, pHandle ); } ) { return m_pFileSystemPassThru->FindFirstEx( pWildCard, pPathID, pHandle ); }
virtual void FindFileAbsoluteList( virtual void FindFileAbsoluteList(
CUtlVector<CUtlString, CUtlMemory<CUtlString, int>> &output, CUtlVector<CUtlString> &output,
const char *pWildCard, const char *pWildCard,
const char *pPathID const char *pPathID
) { m_pFileSystemPassThru->FindFileAbsoluteList( output, pWildCard, pPathID ); } ) { m_pFileSystemPassThru->FindFileAbsoluteList( output, pWildCard, pPathID ); }

View File

@ -61,7 +61,7 @@ public:
virtual bool SendNetMsg(INetMessage &msg, bool bForceReliable = false, bool bVoice = false ) = 0; virtual bool SendNetMsg(INetMessage &msg, bool bForceReliable = false, bool bVoice = false ) = 0;
#ifdef POSIX #ifdef POSIX
FORCEINLINE bool SendNetMsg(INetMessage const &msg, bool bForceReliable = false, bool bVoice = false ) { SendNetMsg( *( (INetMessage *) &msg ), bForceReliable, bVoice ); } FORCEINLINE bool SendNetMsg(INetMessage const &msg, bool bForceReliable = false, bool bVoice = false ) { return SendNetMsg( *( (INetMessage *) &msg ), bForceReliable, bVoice ); }
#endif #endif
virtual bool SendData(bf_write &msg, bool bReliable = true) = 0; virtual bool SendData(bf_write &msg, bool bReliable = true) = 0;
virtual bool SendFile(const char *filename, unsigned int transferID, bool isReplayDemo) = 0; virtual bool SendFile(const char *filename, unsigned int transferID, bool isReplayDemo) = 0;

View File

@ -2844,6 +2844,7 @@ FORCEINLINE fltx4 LoadAndConvertUint16SIMD( const uint16 *pInts )
SubFloat( retval, 1 ) = pInts[1]; SubFloat( retval, 1 ) = pInts[1];
SubFloat( retval, 2 ) = pInts[2]; SubFloat( retval, 2 ) = pInts[2];
SubFloat( retval, 3 ) = pInts[3]; SubFloat( retval, 3 ) = pInts[3];
return retval;
#else #else
__m128i inA = _mm_loadl_epi64( (__m128i const*) pInts); // Load the lower 64 bits of the value pointed to by p into the lower 64 bits of the result, zeroing the upper 64 bits of the result. __m128i inA = _mm_loadl_epi64( (__m128i const*) pInts); // Load the lower 64 bits of the value pointed to by p into the lower 64 bits of the result, zeroing the upper 64 bits of the result.
inA = _mm_unpacklo_epi16( inA, _mm_setzero_si128() ); // unpack unsigned 16's to signed 32's inA = _mm_unpacklo_epi16( inA, _mm_setzero_si128() ); // unpack unsigned 16's to signed 32's
@ -4057,7 +4058,7 @@ public:
FORCEINLINE void Init( void ) FORCEINLINE void Init( void )
{ {
for( int i = 0; i < ARRAYSIZE( m_Mins ); i++ ) for( int i = 0; i < (int)ARRAYSIZE( m_Mins ); i++ )
{ {
m_Mins[i] = Four_FLT_MAX; m_Mins[i] = Four_FLT_MAX;
m_Maxes[i] = Four_Negative_FLT_MAX; m_Maxes[i] = Four_Negative_FLT_MAX;

View File

@ -811,7 +811,7 @@ FORCEINLINE FourQuaternions FourQuaternions::ScaleAngle( const fltx4 &scale ) co
{ {
FourQuaternions ret; FourQuaternions ret;
static const fltx4 OneMinusEpsilon = {1.0f - 0.000001f, 1.0f - 0.000001f, 1.0f - 0.000001f, 1.0f - 0.000001f }; static const fltx4 OneMinusEpsilon = {1.0f - 0.000001f, 1.0f - 0.000001f, 1.0f - 0.000001f, 1.0f - 0.000001f };
static const fltx4 tiny = { 0.00001f, 0.00001f, 0.00001f, 0.00001f }; //static const fltx4 tiny = { 0.00001f, 0.00001f, 0.00001f, 0.00001f };
const fltx4 Zero = Four_Zeros; const fltx4 Zero = Four_Zeros;
fltx4 signMask = LoadAlignedSIMD( (float *) g_SIMD_signmask ); fltx4 signMask = LoadAlignedSIMD( (float *) g_SIMD_signmask );
// work out if there are any tiny scales or angles, which are unstable // work out if there are any tiny scales or angles, which are unstable

View File

@ -2716,7 +2716,7 @@ public:
// ctor // ctor
CActivityToSequenceMapping( void ) CActivityToSequenceMapping( void )
: m_pSequenceTuples(NULL), m_iSequenceTuplesCount(0), m_ActToSeqHash(8,0,0), m_expectedVModel(NULL), m_pStudioHdr(NULL) : m_pSequenceTuples(NULL), m_iSequenceTuplesCount(0), m_ActToSeqHash(8,0,0), m_pStudioHdr(NULL), m_expectedVModel(NULL)
{}; {};
// dtor -- not virtual because this class has no inheritors // dtor -- not virtual because this class has no inheritors

View File

@ -352,11 +352,12 @@ PLATFORM_INTERFACE void _AssertValidReadPtr( void* ptr, int count = 1 );
PLATFORM_INTERFACE void _AssertValidWritePtr( void* ptr, int count = 1 ); PLATFORM_INTERFACE void _AssertValidWritePtr( void* ptr, int count = 1 );
PLATFORM_INTERFACE void _AssertValidReadWritePtr( void* ptr, int count = 1 ); PLATFORM_INTERFACE void _AssertValidReadWritePtr( void* ptr, int count = 1 );
PLATFORM_INTERFACE void AssertValidStringPtr( const tchar* ptr, int maxchar = 0xFFFFFF ); PLATFORM_INTERFACE void _AssertValidStringPtr( const tchar* ptr, int maxchar = 0xFFFFFF );
template<class T> inline void AssertValidReadPtr( T* ptr, int count = 1 ) { _AssertValidReadPtr( (void*)ptr, count ); } template<class T> inline void AssertValidReadPtr( T* ptr, int count = 1 ) { _AssertValidReadPtr( (void*)ptr, count ); }
template<class T> inline void AssertValidWritePtr( T* ptr, int count = 1 ) { _AssertValidWritePtr( (void*)ptr, count ); } template<class T> inline void AssertValidWritePtr( T* ptr, int count = 1 ) { _AssertValidWritePtr( (void*)ptr, count ); }
template<class T> inline void AssertValidReadWritePtr( T* ptr, int count = 1 ) { _AssertValidReadWritePtr( (void*)ptr, count ); } template<class T> inline void AssertValidReadWritePtr( T* ptr, int count = 1 ) { _AssertValidReadWritePtr( (void*)ptr, count ); }
#define AssertValidThis() AssertValidReadWritePtr(this,sizeof(*this)) #define AssertValidThis() AssertValidReadWritePtr(this,sizeof(*this))
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -293,8 +293,10 @@ inline void CCycleCount::Init( uint64 cycles )
m_Int64 = cycles; m_Int64 = cycles;
} }
#ifdef COMPILER_MSVC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4189) // warning C4189: local variable is initialized but not referenced #pragma warning(disable : 4189) // warning C4189: local variable is initialized but not referenced
#endif
inline void CCycleCount::Sample() inline void CCycleCount::Sample()
{ {
@ -341,7 +343,9 @@ inline void CCycleCount::Sample()
#endif #endif
} }
#ifdef COMPILER_MSVC
#pragma warning(pop) #pragma warning(pop)
#endif
inline CCycleCount& CCycleCount::operator+=( CCycleCount const &other ) inline CCycleCount& CCycleCount::operator+=( CCycleCount const &other )

View File

@ -14,7 +14,7 @@
#pragma once #pragma once
#endif #endif
#include "color.h" #include "Color.h"
#include "icommandline.h" #include "icommandline.h"
#include <stdio.h> #include <stdio.h>
@ -133,7 +133,7 @@ typedef int LoggingChannelID_t;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A sentinel value indicating an invalid logging channel ID. // A sentinel value indicating an invalid logging channel ID.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const LoggingChannelID_t INVALID_LOGGING_CHANNEL_ID = -1; static const LoggingChannelID_t INVALID_LOGGING_CHANNEL_ID = -1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// The severity of a logging operation. // The severity of a logging operation.
@ -337,7 +337,7 @@ public:
// A logging listener with Win32 console API color support which which prints // A logging listener with Win32 console API color support which which prints
// to stdout and the debug channel. // to stdout and the debug channel.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _X360 #if !defined _X360 && defined COMPILER_MSVC
class CColorizedLoggingListener : public CSimpleLoggingListener class CColorizedLoggingListener : public CSimpleLoggingListener
{ {
public: public:

View File

@ -101,7 +101,9 @@ typedef void * HINSTANCE;
#define IsPlatformOSX() false #define IsPlatformOSX() false
#define IsPlatformPS3() false #define IsPlatformPS3() false
#define IsPlatformWindows() true #define IsPlatformWindows() true
#ifndef PLATFORM_WINDOWS
#define PLATFORM_WINDOWS 1 #define PLATFORM_WINDOWS 1
#endif
#ifndef _X360 #ifndef _X360
#define IsPlatformX360() false #define IsPlatformX360() false
@ -136,16 +138,22 @@ typedef void * HINSTANCE;
#define IsPlatformWindowsPC64() false #define IsPlatformWindowsPC64() false
#define IsPlatformWindowsPC32() false #define IsPlatformWindowsPC32() false
#define IsPlatformPosix() true #define IsPlatformPosix() true
#ifndef PLATFORM_POSIX
#define PLATFORM_POSIX 1 #define PLATFORM_POSIX 1
#endif
#if defined( LINUX ) #if defined( LINUX )
#define IsPlatformLinux() true #define IsPlatformLinux() true
#define IsPlatformOSX() false #define IsPlatformOSX() false
#ifndef PLATFORM_LINUX
#define PLATFORM_LINUX 1 #define PLATFORM_LINUX 1
#endif
#elif defined ( OSX ) #elif defined ( OSX )
#define IsPlatformLinux() false #define IsPlatformLinux() false
#define IsPlatformOSX() true #define IsPlatformOSX() true
#ifndef PLATFORM_OSX
#define PLATFORM_OSX 1 #define PLATFORM_OSX 1
#endif
#else #else
#define IsPlatformLinux() false #define IsPlatformLinux() false
#define IsPlatformOSX() false #define IsPlatformOSX() false
@ -701,6 +709,7 @@ PLATFORM_INTERFACE void Plat_MessageBox( const char *pTitle, const tchar *pMessa
#define _putenv putenv #define _putenv putenv
#define _chdir chdir #define _chdir chdir
#define _access access #define _access access
#define _strtoi64 strtoll
#if !defined( _snprintf ) // some vpc's define this on the command line #if !defined( _snprintf ) // some vpc's define this on the command line
#define _snprintf snprintf #define _snprintf snprintf
@ -1596,9 +1605,15 @@ int V_strncasecmp (const char *s1, const char *s2, int n);
// returns <0 if strings do not match even in a case-insensitive way // returns <0 if strings do not match even in a case-insensitive way
int _V_stricmp_NegativeForUnequal ( const char *s1, const char *s2 ); int _V_stricmp_NegativeForUnequal ( const char *s1, const char *s2 );
#ifndef stricmp
#define stricmp(s1,s2) _V_stricmp(s1, s2) #define stricmp(s1,s2) _V_stricmp(s1, s2)
#endif
#ifndef strcmpi
#define strcmpi(s1,s2) _V_stricmp(s1, s2) #define strcmpi(s1,s2) _V_stricmp(s1, s2)
#endif
#ifndef strnicmp
#define strnicmp V_strncasecmp #define strnicmp V_strncasecmp
#endif #endif
#endif
#endif /* PLATFORM_H */ #endif /* PLATFORM_H */

View File

@ -1681,8 +1681,8 @@ FORCEINLINE bool CThreadSpinRWLock::TryLockForWrite( const uint32 threadId )
return false; return false;
} }
static const LockInfo_t oldValue = { 0, 0 }; static const LockInfo_t oldValue = {{ 0, 0 }};
LockInfo_t newValue = { threadId, 0 }; LockInfo_t newValue = {{ threadId, 0 }};
if ( AssignIf( newValue, oldValue ) ) if ( AssignIf( newValue, oldValue ) )
{ {
ThreadMemoryBarrier(); ThreadMemoryBarrier();

View File

@ -21,7 +21,7 @@
#endif #endif
#include "utlvector.h" #include "utlvector.h"
#include "color.h" #include "Color.h"
#include "exprevaluator.h" #include "exprevaluator.h"
class IBaseFileSystem; class IBaseFileSystem;

View File

@ -778,7 +778,7 @@ public:
} }
else else
{ {
StoreLittleDWord( m_pDataOut, 0, LoadLittleDWord(m_pDataOut,0) & ~s_nMaskTable[ 32 - m_nOutBitsAvail ] | m_nOutBufWord ); StoreLittleDWord( m_pDataOut, 0, (LoadLittleDWord(m_pDataOut,0) & ~s_nMaskTable[ 32 - m_nOutBitsAvail ]) | m_nOutBufWord );
} }
} }
m_bFlushed = true; m_bFlushed = true;

View File

@ -240,7 +240,7 @@ private:
Assert( "Invalid size in CByteswap::LowLevelByteSwap" && 0 ); Assert( "Invalid size in CByteswap::LowLevelByteSwap" && 0 );
} }
#else #else
for( int i = 0; i < sizeof(T); i++ ) for( size_t i = 0; i < sizeof(T); i++ )
{ {
((unsigned char* )&temp)[i] = ((unsigned char*)input)[sizeof(T)-(i+1)]; ((unsigned char* )&temp)[i] = ((unsigned char*)input)[sizeof(T)-(i+1)];
} }

View File

@ -37,7 +37,7 @@ extern void CharacterSetBuild( characterset_t *pSetBuffer, const char *pSetStrin
// character - character to lookup // character - character to lookup
// Output : int - 1 if the character was in the set // Output : int - 1 if the character was in the set
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define IN_CHARACTERSET( SetBuffer, character ) ((SetBuffer).set[(character)]) #define IN_CHARACTERSET( SetBuffer, character ) ((SetBuffer).set[static_cast<size_t>(character)])
#endif // CHARACTERSET_H #endif // CHARACTERSET_H

View File

@ -20,7 +20,7 @@
#include "tier1/iconvar.h" #include "tier1/iconvar.h"
#include "tier1/utlvector.h" #include "tier1/utlvector.h"
#include "tier1/utlstring.h" #include "tier1/utlstring.h"
#include "color.h" #include "Color.h"
#include "icvar.h" #include "icvar.h"
#ifdef _WIN32 #ifdef _WIN32
@ -874,7 +874,9 @@ void ConVar_PrintDescription( const ConCommandBase *pVar );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Utility class to quickly allow ConCommands to call member methods // Purpose: Utility class to quickly allow ConCommands to call member methods
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning (disable : 4355 ) #pragma warning (disable : 4355 )
#endif
template< class T > template< class T >
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
@ -921,8 +923,9 @@ private:
FnMemberCommandCompletionCallback_t m_CompletionFunc; FnMemberCommandCompletionCallback_t m_CompletionFunc;
}; };
#ifdef _MSC_VER
#pragma warning ( default : 4355 ) #pragma warning ( default : 4355 )
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Utility macros to quicky generate a simple console command // Purpose: Utility macros to quicky generate a simple console command

View File

@ -19,7 +19,7 @@
#include "tier0/dbg.h" #include "tier0/dbg.h"
#include "tier0/platform.h" #include "tier0/platform.h"
#include "tier1/strtools.h" #include "tier1/strtools.h"
#include "color.h" #include "Color.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@
#pragma once #pragma once
#endif #endif
#include "appframework/iappsystem.h" #include "appframework/IAppSystem.h"
#include "tier1/convar.h" #include "tier1/convar.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -21,8 +21,10 @@
#include "tier0/memalloc.h" #include "tier0/memalloc.h"
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
#ifdef _MSC_VER
#pragma warning (disable:4100) #pragma warning (disable:4100)
#pragma warning (disable:4514) #pragma warning (disable:4514)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@ public:
struct ConversionArray_t struct ConversionArray_t
{ {
char m_nActualChar; char m_nActualChar;
char *m_pReplacementString; const char *m_pReplacementString;
}; };
CUtlCharConversion( char nEscapeChar, const char *pDelimiter, int nCount, ConversionArray_t *pArray ); CUtlCharConversion( char nEscapeChar, const char *pDelimiter, int nCount, ConversionArray_t *pArray );
@ -60,7 +60,7 @@ protected:
struct ConversionInfo_t struct ConversionInfo_t
{ {
int m_nLength; int m_nLength;
char *m_pReplacementString; const char *m_pReplacementString;
}; };
char m_nEscapeChar; char m_nEscapeChar;
@ -110,13 +110,13 @@ typedef unsigned short ushort;
template < class A > template < class A >
static const char *GetFmtStr( int nRadix = 10, bool bPrint = true ) { Assert( 0 ); return ""; } static const char *GetFmtStr( int nRadix = 10, bool bPrint = true ) { Assert( 0 ); return ""; }
template <> static const char *GetFmtStr< short > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hd"; } template <> inline const char *GetFmtStr< short > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hd"; }
template <> static const char *GetFmtStr< ushort > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hu"; } template <> inline const char *GetFmtStr< ushort > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hu"; }
template <> static const char *GetFmtStr< int > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%d"; } template <> inline const char *GetFmtStr< int > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%d"; }
template <> static const char *GetFmtStr< uint > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 || nRadix == 16 ); return nRadix == 16 ? "%x" : "%u"; } template <> inline const char *GetFmtStr< uint > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 || nRadix == 16 ); return nRadix == 16 ? "%x" : "%u"; }
template <> static const char *GetFmtStr< int64 > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%I64d"; } template <> inline const char *GetFmtStr< int64 > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%lld"; }
template <> static const char *GetFmtStr< float > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%f"; } template <> inline const char *GetFmtStr< float > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%f"; }
template <> static const char *GetFmtStr< double > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return bPrint ? "%.15lf" : "%lf"; } // force Printf to print DBL_DIG=15 digits of precision for doubles - defaults to FLT_DIG=6 template <> inline const char *GetFmtStr< double > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return bPrint ? "%.15lf" : "%lf"; } // force Printf to print DBL_DIG=15 digits of precision for doubles - defaults to FLT_DIG=6
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -784,14 +784,14 @@ inline int64 StringToNumber( char *pString, char **ppEnd, int nRadix )
template <> template <>
inline float StringToNumber( char *pString, char **ppEnd, int nRadix ) inline float StringToNumber( char *pString, char **ppEnd, int nRadix )
{ {
/*UNUSED*/( nRadix ); // /*UNUSED*/( nRadix );
return ( float )strtod( pString, ppEnd ); return ( float )strtod( pString, ppEnd );
} }
template <> template <>
inline double StringToNumber( char *pString, char **ppEnd, int nRadix ) inline double StringToNumber( char *pString, char **ppEnd, int nRadix )
{ {
/*UNUSED*/( nRadix ); // /*UNUSED*/( nRadix );
return ( double )strtod( pString, ppEnd ); return ( double )strtod( pString, ppEnd );
} }
@ -1349,7 +1349,7 @@ inline void CUtlBuffer::Spew( )
while( IsValid() && GetBytesRemaining() ) while( IsValid() && GetBytesRemaining() )
{ {
V_memset( pTmpLine, 0, sizeof(pTmpLine) ); V_memset( pTmpLine, 0, sizeof(pTmpLine) );
Get( pTmpLine, MIN( GetBytesRemaining(), sizeof(pTmpLine-1) ) ); Get( pTmpLine, MIN( (unsigned int)GetBytesRemaining(), sizeof(pTmpLine-1) ) );
Msg( _T( "%s" ), pTmpLine ); Msg( _T( "%s" ), pTmpLine );
} }
} }

View File

@ -20,8 +20,10 @@
#include "tier0/memalloc.h" #include "tier0/memalloc.h"
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
#ifdef _MSC_VER
#pragma warning (disable:4100) #pragma warning (disable:4100)
#pragma warning (disable:4514) #pragma warning (disable:4514)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -198,7 +198,7 @@ public:
return false; return false;
#ifdef _DEBUG // it's safe to skip this here, since the only way to get indices after m_LastAlloc is to use MaxElementIndex #ifdef _DEBUG // it's safe to skip this here, since the only way to get indices after m_LastAlloc is to use MaxElementIndex
if ( Memory().IsIdxAfter( i, this->m_LastAlloc ) ) if ( this->Memory().IsIdxAfter( i, this->m_LastAlloc ) )
{ {
Assert( 0 ); Assert( 0 );
return false; // don't read values that have been allocated, but not constructed return false; // don't read values that have been allocated, but not constructed
@ -339,8 +339,10 @@ inline I CUtlLinkedList<T,S,ML,I,M>::Next( I i ) const
// Are nodes in the list or valid? // Are nodes in the list or valid?
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning( disable: 4310 ) // Allows "(I)(S)M::INVALID_INDEX" below #pragma warning( disable: 4310 ) // Allows "(I)(S)M::INVALID_INDEX" below
#endif
template <class T, class S, bool ML, class I, class M> template <class T, class S, bool ML, class I, class M>
inline bool CUtlLinkedList<T,S,ML,I,M>::IndexInRange( I index ) // Static method inline bool CUtlLinkedList<T,S,ML,I,M>::IndexInRange( I index ) // Static method
{ {
@ -359,7 +361,9 @@ inline bool CUtlLinkedList<T,S,ML,I,M>::IndexInRange( I index ) // Static method
return ( ( (S)index == index ) && ( (S)index != InvalidIndex() ) ); return ( ( (S)index == index ) && ( (S)index != InvalidIndex() ) );
} }
#ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif
template <class T, class S, bool ML, class I, class M> template <class T, class S, bool ML, class I, class M>
inline bool CUtlLinkedList<T,S,ML,I,M>::IsValidIndex( I i ) const inline bool CUtlLinkedList<T,S,ML,I,M>::IsValidIndex( I i ) const

View File

@ -21,9 +21,10 @@
#include "tier0/memalloc.h" #include "tier0/memalloc.h"
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
#ifdef _MSC_VER
#pragma warning (disable:4100) #pragma warning (disable:4100)
#pragma warning (disable:4514) #pragma warning (disable:4514)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -360,8 +360,8 @@ protected:
template < class T, class I, typename L, class M > template < class T, class I, typename L, class M >
inline CUtlRBTree<T, I, L, M>::CUtlRBTree( int growSize, int initSize, const LessFunc_t &lessfunc ) : inline CUtlRBTree<T, I, L, M>::CUtlRBTree( int growSize, int initSize, const LessFunc_t &lessfunc ) :
m_Elements( growSize, initSize ),
m_LessFunc( lessfunc ), m_LessFunc( lessfunc ),
m_Elements( growSize, initSize ),
m_Root( InvalidIndex() ), m_Root( InvalidIndex() ),
m_NumElements( 0 ), m_NumElements( 0 ),
m_FirstFree( InvalidIndex() ), m_FirstFree( InvalidIndex() ),
@ -372,8 +372,8 @@ m_LastAlloc( m_Elements.InvalidIterator() )
template < class T, class I, typename L, class M > template < class T, class I, typename L, class M >
inline CUtlRBTree<T, I, L, M>::CUtlRBTree( const LessFunc_t &lessfunc ) : inline CUtlRBTree<T, I, L, M>::CUtlRBTree( const LessFunc_t &lessfunc ) :
m_Elements( 0, 0 ),
m_LessFunc( lessfunc ), m_LessFunc( lessfunc ),
m_Elements( 0, 0 ),
m_Root( InvalidIndex() ), m_Root( InvalidIndex() ),
m_NumElements( 0 ), m_NumElements( 0 ),
m_FirstFree( InvalidIndex() ), m_FirstFree( InvalidIndex() ),
@ -648,8 +648,10 @@ inline void CUtlRBTree<T, I, L, M>::SetColor( I i, typename CUtlRBTree<T, I, L,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Allocates/ deallocates nodes // Allocates/ deallocates nodes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif
template < class T, class I, typename L, class M > template < class T, class I, typename L, class M >
I CUtlRBTree<T, I, L, M>::NewNode() I CUtlRBTree<T, I, L, M>::NewNode()
{ {
@ -694,7 +696,9 @@ I CUtlRBTree<T, I, L, M>::NewNode()
return elem; return elem;
} }
#ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif
template < class T, class I, typename L, class M > template < class T, class I, typename L, class M >
void CUtlRBTree<T, I, L, M>::FreeNode( I i ) void CUtlRBTree<T, I, L, M>::FreeNode( I i )

View File

@ -441,13 +441,13 @@ class CSOAAttributeReference;
// define binary op class to allow this construct without temps: // define binary op class to allow this construct without temps:
// dest( FBM_ATTR_RED ) = src( FBM_ATTR_BLUE ) + src( FBM_ATTR_GREEN ) // dest( FBM_ATTR_RED ) = src( FBM_ATTR_BLUE ) + src( FBM_ATTR_GREEN )
template<BINARYSIMDFUNCTION fn> class CSOAAttributeReferenceBinaryOp template<BINARYSIMDFUNCTION fn, class Ref> class CSOAAttributeReferenceBinaryOp
{ {
public: public:
CSOAAttributeReference m_opA; Ref m_opA;
CSOAAttributeReference m_opB; Ref m_opB;
CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const & b ) CSOAAttributeReferenceBinaryOp( Ref const &a, Ref const & b )
{ {
a.CopyTo( m_opA ); a.CopyTo( m_opA );
b.CopyTo( m_opB ); b.CopyTo( m_opB );
@ -456,9 +456,9 @@ public:
}; };
#define DEFINE_OP( opname, fnname ) \ #define DEFINE_OP( opname, fnname ) \
FORCEINLINE CSOAAttributeReferenceBinaryOp<fnname> operator opname( CSOAAttributeReference const &other ) const \ FORCEINLINE CSOAAttributeReferenceBinaryOp<fnname, CSOAAttributeReference> operator opname( CSOAAttributeReference const &other ) const \
{ \ { \
return CSOAAttributeReferenceBinaryOp<fnname>( *this, other ); \ return CSOAAttributeReferenceBinaryOp<fnname, CSOAAttributeReference>( *this, other ); \
} }
class CSOAAttributeReference class CSOAAttributeReference
@ -498,18 +498,18 @@ public:
DEFINE_OP( -, SubSIMD ); DEFINE_OP( -, SubSIMD );
DEFINE_OP( /, DivSIMD ); DEFINE_OP( /, DivSIMD );
template<BINARYSIMDFUNCTION fn> FORCEINLINE void operator =( CSOAAttributeReferenceBinaryOp<fn> const &op ); template<BINARYSIMDFUNCTION fn> FORCEINLINE void operator =( CSOAAttributeReferenceBinaryOp<fn, CSOAAttributeReference> const &op );
FORCEINLINE void CopyTo( CSOAAttributeReference &other ) const; // since operator= is over-ridden FORCEINLINE void CopyTo( CSOAAttributeReference &other ) const; // since operator= is over-ridden
}; };
template<BINARYSIMDFUNCTION fn> FORCEINLINE void CSOAAttributeReference::operator =( CSOAAttributeReferenceBinaryOp<fn> const &op ) template<BINARYSIMDFUNCTION fn> FORCEINLINE void CSOAAttributeReference::operator =( CSOAAttributeReferenceBinaryOp<fn, CSOAAttributeReference> const &op )
{ {
m_pContainer->AssertDataType( m_nAttributeID, ATTRDATATYPE_FLOAT ); m_pContainer->AssertDataType( m_nAttributeID, ATTRDATATYPE_FLOAT );
fltx4 *pOut = m_pContainer->RowPtr<fltx4>( m_nAttributeID, 0 ); fltx4 *pOut = m_pContainer->RowPtr<fltx4>( m_nAttributeID, 0 );
fltx4 *pInA = op.m_opA.m_pContainer->RowPtr<fltx4>( op.m_opA.m_nAttributeID, 0 ); fltx4 *pInA = op.m_opA.m_pContainer->template RowPtr<fltx4>( op.m_opA.m_nAttributeID, 0 );
fltx4 *pInB = op.m_opB.m_pContainer->RowPtr<fltx4>( op.m_opB.m_nAttributeID, 0 ); fltx4 *pInB = op.m_opB.m_pContainer->template RowPtr<fltx4>( op.m_opB.m_nAttributeID, 0 );
size_t nRowToRowStride = m_pContainer->RowToRowStep( m_nAttributeID ) / sizeof( fltx4 ); size_t nRowToRowStride = m_pContainer->RowToRowStep( m_nAttributeID ) / sizeof( fltx4 );
int nRowCtr = m_pContainer->NumRows() * m_pContainer->NumSlices(); int nRowCtr = m_pContainer->NumRows() * m_pContainer->NumSlices();
do do
@ -576,7 +576,8 @@ template<BINARYSIMDFUNCTION fn1, BINARYSIMDFUNCTION fn2> void CSOAContainer::App
int nColCtr = NumQuadsPerRow(); int nColCtr = NumQuadsPerRow();
do do
{ {
*( pOut++ ) = fn1( fn2( *pOut, fl4FnArg2 ), fl4FnArg1 ); *( pOut ) = fn1( fn2( *pOut, fl4FnArg2 ), fl4FnArg1 );
pOut++;
} while ( --nColCtr ); } while ( --nColCtr );
pOut += nRowToRowStride; pOut += nRowToRowStride;
} while ( --nRowCtr ); } while ( --nRowCtr );
@ -613,7 +614,8 @@ template<BINARYSIMDFUNCTION fn> void CSOAContainer::ApplyBinaryFunctionToAttr( i
int nColCtr = NumQuadsPerRow(); int nColCtr = NumQuadsPerRow();
do do
{ {
*(pOut++) = fn( *pOut, fl4FnArg1 ); *(pOut) = fn( *pOut, fl4FnArg1 );
pOut++;
} while ( --nColCtr ); } while ( --nColCtr );
pOut += nRowToRowStride; pOut += nRowToRowStride;
} while ( --nRowCtr ); } while ( --nRowCtr );

View File

@ -259,9 +259,11 @@ public:
// Especialy useful if you have a lot of vectors that are sparse, or if you're // Especialy useful if you have a lot of vectors that are sparse, or if you're
// carefully packing holders of vectors // carefully packing holders of vectors
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4200) // warning C4200: nonstandard extension used : zero-sized array in struct/union #pragma warning(disable : 4200) // warning C4200: nonstandard extension used : zero-sized array in struct/union
#pragma warning(disable : 4815 ) // warning C4815: 'staticData' : zero-sized array in stack object will have no elements #pragma warning(disable : 4815 ) // warning C4815: 'staticData' : zero-sized array in stack object will have no elements
#endif
class CUtlVectorUltraConservativeAllocator class CUtlVectorUltraConservativeAllocator
{ {
@ -499,8 +501,9 @@ private:
} }
}; };
#ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// The CCopyableUtlVector class: // The CCopyableUtlVector class:

View File

@ -12,7 +12,6 @@
#endif #endif
#include "appframework/iappsystem.h"
#include "appframework/IAppSystem.h" #include "appframework/IAppSystem.h"
#include "tier1/utlstring.h" #include "tier1/utlstring.h"
#include "tier1/utlbuffer.h" #include "tier1/utlbuffer.h"

View File

@ -16,8 +16,10 @@
#define NTAB 32 #define NTAB 32
#ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning( disable:4251 ) #pragma warning( disable:4251 )
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A generator of uniformly distributed random numbers // A generator of uniformly distributed random numbers
@ -102,8 +104,9 @@ VSTDLIB_INTERFACE float RandomGaussianFloat( float flMean = 0.0f, float flStdDev
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
VSTDLIB_INTERFACE void InstallUniformRandomStream( IUniformRandomStream *pStream ); VSTDLIB_INTERFACE void InstallUniformRandomStream( IUniformRandomStream *pStream );
#ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#endif
#endif // VSTDLIB_RANDOM_H #endif // VSTDLIB_RANDOM_H

View File

@ -275,7 +275,9 @@ KeyValues::KeyValues( const char *setName, const char *firstKey, int firstValue,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KeyValues::Init() void KeyValues::Init()
{ {
m_iKeyName = INVALID_KEY_SYMBOL; m_iKeyName = 0;
m_iKeyNameCaseSensitive1 = 0;
m_iKeyNameCaseSensitive2 = 0;
m_iDataType = TYPE_NONE; m_iDataType = TYPE_NONE;
m_pSub = NULL; m_pSub = NULL;
@ -287,9 +289,6 @@ void KeyValues::Init()
m_pValue = NULL; m_pValue = NULL;
m_bHasEscapeSequences = false; m_bHasEscapeSequences = false;
// for future proof
memset( unused, 0, sizeof(unused) );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -472,7 +471,7 @@ void KeyValues::UsesEscapeSequences(bool state)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Load keyValues from disk // Purpose: Load keyValues from disk
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool KeyValues::LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID ) bool KeyValues::LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID, GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
Assert(filesystem); Assert(filesystem);
#ifndef _LINUX #ifndef _LINUX
@ -500,7 +499,7 @@ bool KeyValues::LoadFromFile( IBaseFileSystem *filesystem, const char *resourceN
if ( bRetOK ) if ( bRetOK )
{ {
buffer[fileSize] = 0; // null terminate file as EOF buffer[fileSize] = 0; // null terminate file as EOF
bRetOK = LoadFromBuffer( resourceName, buffer, filesystem ); bRetOK = LoadFromBuffer( resourceName, buffer, filesystem, pathID, pfnEvaluateSymbolProc);
} }
((IFileSystem *)filesystem)->FreeOptimalReadBuffer( buffer ); ((IFileSystem *)filesystem)->FreeOptimalReadBuffer( buffer );
@ -676,7 +675,7 @@ void KeyValues::RecursiveSaveToFile( IBaseFileSystem *filesystem, FileHandle_t f
char buf[32]; char buf[32];
// write "0x" + 16 char 0-padded hex encoded 64 bit value // write "0x" + 16 char 0-padded hex encoded 64 bit value
Q_snprintf( buf, sizeof( buf ), "0x%016I64X", *( (uint64 *)dat->m_sValue ) ); Q_snprintf( buf, sizeof( buf ), "0x%016llX", *( (uint64 *)dat->m_sValue ) );
INTERNALWRITE(buf, Q_strlen(buf)); INTERNALWRITE(buf, Q_strlen(buf));
INTERNALWRITE("\"\n", 2); INTERNALWRITE("\"\n", 2);
@ -1136,7 +1135,7 @@ const char *KeyValues::GetString( const char *keyName, const char *defaultValue
SetString( keyName, buf ); SetString( keyName, buf );
break; break;
case TYPE_UINT64: case TYPE_UINT64:
Q_snprintf( buf, sizeof( buf ), "%I64i", *((uint64 *)(dat->m_sValue)) ); Q_snprintf( buf, sizeof( buf ), "%llu", *((uint64 *)(dat->m_sValue)) );
SetString( keyName, buf ); SetString( keyName, buf );
break; break;
@ -1225,9 +1224,9 @@ const wchar_t *KeyValues::GetWString( const char *keyName, const wchar_t *defaul
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Gets a color // Purpose: Gets a color
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Color KeyValues::GetColor( const char *keyName ) Color KeyValues::GetColor( const char *keyName, const Color &defaultColor )
{ {
Color color(0, 0, 0, 0); Color color = defaultColor;
KeyValues *dat = FindKey( keyName, false ); KeyValues *dat = FindKey( keyName, false );
if ( dat ) if ( dat )
{ {
@ -1701,7 +1700,8 @@ void KeyValues::AppendIncludedKeys( CUtlVector< KeyValues * >& includedKeys )
} }
void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoinclude, void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoinclude,
IBaseFileSystem* pFileSystem, const char *pPathID, CUtlVector< KeyValues * >& includedKeys ) IBaseFileSystem* pFileSystem, const char *pPathID, CUtlVector< KeyValues * >& includedKeys,
GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
Assert( resourceName ); Assert( resourceName );
Assert( filetoinclude ); Assert( filetoinclude );
@ -1747,7 +1747,7 @@ void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoi
newKV->UsesEscapeSequences( m_bHasEscapeSequences != 0 ); // use same format as parent newKV->UsesEscapeSequences( m_bHasEscapeSequences != 0 ); // use same format as parent
if ( newKV->LoadFromFile( pFileSystem, fullpath, pPathID ) ) if ( newKV->LoadFromFile( pFileSystem, fullpath, pPathID, pfnEvaluateSymbolProc ) )
{ {
includedKeys.AddToTail( newKV ); includedKeys.AddToTail( newKV );
} }
@ -1818,7 +1818,7 @@ void KeyValues::RecursiveMergeKeyValues( KeyValues *baseKV )
// Returns whether a keyvalues conditional evaluates to true or false // Returns whether a keyvalues conditional evaluates to true or false
// Needs more flexibility with conditionals, checking convars would be nice. // Needs more flexibility with conditionals, checking convars would be nice.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool EvaluateConditional( const char *str ) bool KeyValues::EvaluateConditional( const char *str, GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
bool bResult = false; bool bResult = false;
bool bXboxUI = IsX360(); bool bXboxUI = IsX360();
@ -1839,7 +1839,7 @@ bool EvaluateConditional( const char *str )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Read from a buffer... // Read from a buffer...
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBaseFileSystem* pFileSystem, const char *pPathID ) bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBaseFileSystem* pFileSystem, const char *pPathID, GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
KeyValues *pPreviousKey = NULL; KeyValues *pPreviousKey = NULL;
KeyValues *pCurrentKey = this; KeyValues *pCurrentKey = this;
@ -1868,7 +1868,7 @@ bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBase
} }
else else
{ {
ParseIncludedKeys( resourceName, s, pFileSystem, pPathID, includedKeys ); ParseIncludedKeys( resourceName, s, pFileSystem, pPathID, includedKeys, pfnEvaluateSymbolProc );
} }
continue; continue;
@ -1884,7 +1884,7 @@ bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBase
} }
else else
{ {
ParseIncludedKeys( resourceName, s, pFileSystem, pPathID, baseKeys ); ParseIncludedKeys( resourceName, s, pFileSystem, pPathID, baseKeys, pfnEvaluateSymbolProc );
} }
continue; continue;
@ -1912,7 +1912,7 @@ bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBase
if ( wasConditional ) if ( wasConditional )
{ {
bAccepted = EvaluateConditional( s ); bAccepted = EvaluateConditional( s, pfnEvaluateSymbolProc );
// Now get the '{' // Now get the '{'
s = ReadToken( buf, wasQuoted, wasConditional ); s = ReadToken( buf, wasQuoted, wasConditional );
@ -1921,7 +1921,7 @@ bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBase
if ( s && *s == '{' && !wasQuoted ) if ( s && *s == '{' && !wasQuoted )
{ {
// header is valid so load the file // header is valid so load the file
pCurrentKey->RecursiveLoadFromBuffer( resourceName, buf ); pCurrentKey->RecursiveLoadFromBuffer( resourceName, buf, pfnEvaluateSymbolProc );
} }
else else
{ {
@ -1974,20 +1974,20 @@ bool KeyValues::LoadFromBuffer( char const *resourceName, CUtlBuffer &buf, IBase
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Read from a buffer... // Read from a buffer...
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool KeyValues::LoadFromBuffer( char const *resourceName, const char *pBuffer, IBaseFileSystem* pFileSystem, const char *pPathID ) bool KeyValues::LoadFromBuffer( char const *resourceName, const char *pBuffer, IBaseFileSystem* pFileSystem, const char *pPathID, GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
if ( !pBuffer ) if ( !pBuffer )
return true; return true;
int nLen = Q_strlen( pBuffer ); int nLen = Q_strlen( pBuffer );
CUtlBuffer buf( pBuffer, nLen, CUtlBuffer::READ_ONLY | CUtlBuffer::TEXT_BUFFER ); CUtlBuffer buf( pBuffer, nLen, CUtlBuffer::READ_ONLY | CUtlBuffer::TEXT_BUFFER );
return LoadFromBuffer( resourceName, buf, pFileSystem, pPathID ); return LoadFromBuffer( resourceName, buf, pFileSystem, pPathID, pfnEvaluateSymbolProc );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &buf ) void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &buf, GetSymbolProc_t pfnEvaluateSymbolProc )
{ {
CKeyErrorContext errorReport(this); CKeyErrorContext errorReport(this);
bool wasQuoted; bool wasQuoted;
@ -2027,7 +2027,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
if ( wasConditional && value ) if ( wasConditional && value )
{ {
bAccepted = EvaluateConditional( value ); bAccepted = EvaluateConditional( value, pfnEvaluateSymbolProc );
// get the real value // get the real value
value = ReadToken( buf, wasQuoted, wasConditional ); value = ReadToken( buf, wasQuoted, wasConditional );
@ -2050,7 +2050,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
// this isn't a key, it's a section // this isn't a key, it's a section
errorKey.Reset( INVALID_KEY_SYMBOL ); errorKey.Reset( INVALID_KEY_SYMBOL );
// sub value list // sub value list
dat->RecursiveLoadFromBuffer( resourceName, buf ); dat->RecursiveLoadFromBuffer( resourceName, buf, pfnEvaluateSymbolProc );
} }
else else
{ {
@ -2125,7 +2125,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
const char *peek = ReadToken( buf, wasQuoted, wasConditional ); const char *peek = ReadToken( buf, wasQuoted, wasConditional );
if ( wasConditional ) if ( wasConditional )
{ {
bAccepted = EvaluateConditional( peek ); bAccepted = EvaluateConditional( peek, pfnEvaluateSymbolProc );
} }
else else
{ {

View File

@ -115,10 +115,10 @@ CBitWriteMasksInit g_BitWriteMasksInit;
// ---------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------- //
// old_bf_write // bf_write
// ---------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------- //
old_bf_write::old_bf_write() bf_write::bf_write()
{ {
m_pData = NULL; m_pData = NULL;
m_nDataBytes = 0; m_nDataBytes = 0;
@ -129,21 +129,21 @@ old_bf_write::old_bf_write()
m_pDebugName = NULL; m_pDebugName = NULL;
} }
old_bf_write::old_bf_write( const char *pDebugName, void *pData, int nBytes, int nBits ) bf_write::bf_write( void *pData, int nBytes, int nMaxBits )
{
m_bAssertOnOverflow = true;
m_pDebugName = pDebugName;
StartWriting( pData, nBytes, 0, nBits );
}
old_bf_write::old_bf_write( void *pData, int nBytes, int nBits )
{ {
m_bAssertOnOverflow = true; m_bAssertOnOverflow = true;
m_pDebugName = NULL; m_pDebugName = NULL;
StartWriting( pData, nBytes, 0, nBits ); StartWriting( pData, nBytes, 0, nMaxBits );
} }
void old_bf_write::StartWriting( void *pData, int nBytes, int iStartBit, int nBits ) bf_write::bf_write( const char *pDebugName, void *pData, int nBytes, int nMaxBits )
{
m_bAssertOnOverflow = true;
m_pDebugName = pDebugName;
StartWriting( pData, nBytes, 0, nMaxBits );
}
void bf_write::StartWriting( void *pData, int nBytes, int iStartBit, int nMaxBits )
{ {
// Make sure it's dword aligned and padded. // Make sure it's dword aligned and padded.
Assert( (nBytes % 4) == 0 ); Assert( (nBytes % 4) == 0 );
@ -155,53 +155,53 @@ void old_bf_write::StartWriting( void *pData, int nBytes, int iStartBit, int nBi
m_pData = (unsigned char*)pData; m_pData = (unsigned char*)pData;
m_nDataBytes = nBytes; m_nDataBytes = nBytes;
if ( nBits == -1 ) if ( nMaxBits == -1 )
{ {
m_nDataBits = nBytes << 3; m_nDataBits = nBytes << 3;
} }
else else
{ {
Assert( nBits <= nBytes*8 ); Assert( nMaxBits <= nBytes*8 );
m_nDataBits = nBits; m_nDataBits = nMaxBits;
} }
m_iCurBit = iStartBit; m_iCurBit = iStartBit;
m_bOverflow = false; m_bOverflow = false;
} }
void old_bf_write::Reset() void bf_write::Reset()
{ {
m_iCurBit = 0; m_iCurBit = 0;
m_bOverflow = false; m_bOverflow = false;
} }
void old_bf_write::SetAssertOnOverflow( bool bAssert ) void bf_write::SetAssertOnOverflow( bool bAssert )
{ {
m_bAssertOnOverflow = bAssert; m_bAssertOnOverflow = bAssert;
} }
const char* old_bf_write::GetDebugName() const char* bf_write::GetDebugName()
{ {
return m_pDebugName; return m_pDebugName;
} }
void old_bf_write::SetDebugName( const char *pDebugName ) void bf_write::SetDebugName( const char *pDebugName )
{ {
m_pDebugName = pDebugName; m_pDebugName = pDebugName;
} }
void old_bf_write::SeekToBit( int bitPos ) void bf_write::SeekToBit( int bitPos )
{ {
m_iCurBit = bitPos; m_iCurBit = bitPos;
} }
// Sign bit comes first // Sign bit comes first
void old_bf_write::WriteSBitLong( int data, int numbits ) void bf_write::WriteSBitLong( int data, int numbits )
{ {
// Do we have a valid # of bits to encode with? // Do we have a valid # of bits to encode with?
Assert( numbits >= 1 ); Assert( numbits >= 1 );
@ -250,7 +250,7 @@ inline unsigned int BitCountNeededToEncode(unsigned int data)
#endif // _WIN32 #endif // _WIN32
// writes an unsigned integer with variable bit length // writes an unsigned integer with variable bit length
void old_bf_write::WriteUBitVar( unsigned int data ) void bf_write::WriteUBitVar( unsigned int data )
{ {
if ( ( data &0xf ) == data ) if ( ( data &0xf ) == data )
{ {
@ -305,7 +305,7 @@ void old_bf_write::WriteUBitVar( unsigned int data )
#endif #endif
} }
void old_bf_write::WriteBitLong(unsigned int data, int numbits, bool bSigned) void bf_write::WriteBitLong(unsigned int data, int numbits, bool bSigned)
{ {
if(bSigned) if(bSigned)
WriteSBitLong((int)data, numbits); WriteSBitLong((int)data, numbits);
@ -313,10 +313,10 @@ void old_bf_write::WriteBitLong(unsigned int data, int numbits, bool bSigned)
WriteUBitLong(data, numbits); WriteUBitLong(data, numbits);
} }
bool old_bf_write::WriteBits(const void *pInData, int nBits) bool bf_write::WriteBits(const void *pInData, int nBits)
{ {
#if defined( BB_PROFILING ) #if defined( BB_PROFILING )
VPROF( "old_bf_write::WriteBits" ); VPROF( "bf_write::WriteBits" );
#endif #endif
unsigned char *pOut = (unsigned char*)pInData; unsigned char *pOut = (unsigned char*)pInData;
@ -403,7 +403,7 @@ bool old_bf_write::WriteBits(const void *pInData, int nBits)
} }
bool old_bf_write::WriteBitsFromBuffer( bf_read *pIn, int nBits ) bool bf_write::WriteBitsFromBuffer( bf_read *pIn, int nBits )
{ {
// This could be optimized a little by // This could be optimized a little by
while ( nBits > 32 ) while ( nBits > 32 )
@ -417,7 +417,7 @@ bool old_bf_write::WriteBitsFromBuffer( bf_read *pIn, int nBits )
} }
void old_bf_write::WriteBitAngle( float fAngle, int numbits ) void bf_write::WriteBitAngle( float fAngle, int numbits )
{ {
int d; int d;
unsigned int mask; unsigned int mask;
@ -432,14 +432,14 @@ void old_bf_write::WriteBitAngle( float fAngle, int numbits )
WriteUBitLong((unsigned int)d, numbits); WriteUBitLong((unsigned int)d, numbits);
} }
void old_bf_write::WriteBitCoordMP( const float f, bool bIntegral, bool bLowPrecision ) void bf_write::WriteBitCoordMP( const float f, EBitCoordType coordType )
{ {
#if defined( BB_PROFILING ) #if defined( BB_PROFILING )
VPROF( "old_bf_write::WriteBitCoordMP" ); VPROF( "bf_write::WriteBitCoordMP" );
#endif #endif
int signbit = (f <= -( bLowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION )); int signbit = (f <= -( coordType == kCW_LowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ));
int intval = (int)fabs(f); int intval = (int)fabs(f);
int fractval = bLowPrecision ? int fractval = coordType == kCW_LowPrecision ?
( abs((int)(f*COORD_DENOMINATOR_LOWPRECISION)) & (COORD_DENOMINATOR_LOWPRECISION-1) ) : ( abs((int)(f*COORD_DENOMINATOR_LOWPRECISION)) & (COORD_DENOMINATOR_LOWPRECISION-1) ) :
( abs((int)(f*COORD_DENOMINATOR)) & (COORD_DENOMINATOR-1) ); ( abs((int)(f*COORD_DENOMINATOR)) & (COORD_DENOMINATOR-1) );
@ -448,7 +448,7 @@ void old_bf_write::WriteBitCoordMP( const float f, bool bIntegral, bool bLowPrec
WriteOneBit( bInBounds ); WriteOneBit( bInBounds );
if ( bIntegral ) if ( coordType == kCW_Integral )
{ {
// Send the sign bit // Send the sign bit
WriteOneBit( intval ); WriteOneBit( intval );
@ -488,14 +488,35 @@ void old_bf_write::WriteBitCoordMP( const float f, bool bIntegral, bool bLowPrec
WriteUBitLong( (unsigned int)intval, COORD_INTEGER_BITS ); WriteUBitLong( (unsigned int)intval, COORD_INTEGER_BITS );
} }
} }
WriteUBitLong( (unsigned int)fractval, bLowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS ); WriteUBitLong( (unsigned int)fractval, coordType == kCW_LowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS );
} }
} }
void old_bf_write::WriteBitCoord (const float f) void bf_write::WriteBitCellCoord( const float f, int bits, EBitCoordType coordType )
{ {
#if defined( BB_PROFILING ) #if defined( BB_PROFILING )
VPROF( "old_bf_write::WriteBitCoord" ); VPROF( "bf_write::WriteCellBitCoordMP" );
#endif
int intval = (int)fabs(f);
int fractval = coordType == kCW_LowPrecision ?
( abs((int)(f*COORD_DENOMINATOR_LOWPRECISION)) & (COORD_DENOMINATOR_LOWPRECISION-1) ) :
( abs((int)(f*COORD_DENOMINATOR)) & (COORD_DENOMINATOR-1) );
if ( coordType == kCW_Integral )
{
WriteUBitLong( (unsigned int)intval, bits );
}
else
{
WriteUBitLong( (unsigned int)intval, bits );
WriteUBitLong( (unsigned int)fractval, coordType == kCW_LowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS );
}
}
void bf_write::WriteBitCoord (const float f)
{
#if defined( BB_PROFILING )
VPROF( "bf_write::WriteBitCoord" );
#endif #endif
int signbit = (f <= -COORD_RESOLUTION); int signbit = (f <= -COORD_RESOLUTION);
int intval = (int)fabs(f); int intval = (int)fabs(f);
@ -527,7 +548,7 @@ void old_bf_write::WriteBitCoord (const float f)
} }
} }
void old_bf_write::WriteBitFloat(float val) void bf_write::WriteBitFloat(float val)
{ {
long intVal; long intVal;
@ -538,7 +559,7 @@ void old_bf_write::WriteBitFloat(float val)
WriteUBitLong( intVal, 32 ); WriteUBitLong( intVal, 32 );
} }
void old_bf_write::WriteBitVec3Coord( const Vector& fa ) void bf_write::WriteBitVec3Coord( const Vector& fa )
{ {
int xflag, yflag, zflag; int xflag, yflag, zflag;
@ -558,7 +579,7 @@ void old_bf_write::WriteBitVec3Coord( const Vector& fa )
WriteBitCoord( fa[2] ); WriteBitCoord( fa[2] );
} }
void old_bf_write::WriteBitNormal( float f ) void bf_write::WriteBitNormal( float f )
{ {
int signbit = (f <= -NORMAL_RESOLUTION); int signbit = (f <= -NORMAL_RESOLUTION);
@ -576,7 +597,7 @@ void old_bf_write::WriteBitNormal( float f )
WriteUBitLong( fractval, NORMAL_FRACTIONAL_BITS ); WriteUBitLong( fractval, NORMAL_FRACTIONAL_BITS );
} }
void old_bf_write::WriteBitVec3Normal( const Vector& fa ) void bf_write::WriteBitVec3Normal( const Vector& fa )
{ {
int xflag, yflag; int xflag, yflag;
@ -596,39 +617,39 @@ void old_bf_write::WriteBitVec3Normal( const Vector& fa )
WriteOneBit( signbit ); WriteOneBit( signbit );
} }
void old_bf_write::WriteBitAngles( const QAngle& fa ) void bf_write::WriteBitAngles( const QAngle& fa )
{ {
// FIXME: // FIXME:
Vector tmp( fa.x, fa.y, fa.z ); Vector tmp( fa.x, fa.y, fa.z );
WriteBitVec3Coord( tmp ); WriteBitVec3Coord( tmp );
} }
void old_bf_write::WriteChar(int val) void bf_write::WriteChar(int val)
{ {
WriteSBitLong(val, sizeof(char) << 3); WriteSBitLong(val, sizeof(char) << 3);
} }
void old_bf_write::WriteByte(int val) void bf_write::WriteByte(unsigned int val)
{ {
WriteUBitLong(val, sizeof(unsigned char) << 3); WriteUBitLong(val, sizeof(unsigned char) << 3);
} }
void old_bf_write::WriteShort(int val) void bf_write::WriteShort(int val)
{ {
WriteSBitLong(val, sizeof(short) << 3); WriteSBitLong(val, sizeof(short) << 3);
} }
void old_bf_write::WriteWord(int val) void bf_write::WriteWord(unsigned int val)
{ {
WriteUBitLong(val, sizeof(unsigned short) << 3); WriteUBitLong(val, sizeof(unsigned short) << 3);
} }
void old_bf_write::WriteLong(long val) void bf_write::WriteLong(long val)
{ {
WriteSBitLong(val, sizeof(long) << 3); WriteSBitLong(val, sizeof(long) << 3);
} }
void old_bf_write::WriteLongLong(int64 val) void bf_write::WriteLongLong(int64 val)
{ {
uint *pLongs = (uint*)&val; uint *pLongs = (uint*)&val;
@ -639,7 +660,7 @@ void old_bf_write::WriteLongLong(int64 val)
WriteUBitLong(pLongs[*idx], sizeof(long) << 3); WriteUBitLong(pLongs[*idx], sizeof(long) << 3);
} }
void old_bf_write::WriteFloat(float val) void bf_write::WriteFloat(float val)
{ {
// Pre-swap the float, since WriteBits writes raw data // Pre-swap the float, since WriteBits writes raw data
LittleFloat( &val, &val ); LittleFloat( &val, &val );
@ -647,12 +668,12 @@ void old_bf_write::WriteFloat(float val)
WriteBits(&val, sizeof(val) << 3); WriteBits(&val, sizeof(val) << 3);
} }
bool old_bf_write::WriteBytes( const void *pBuf, int nBytes ) bool bf_write::WriteBytes( const void *pBuf, int nBytes )
{ {
return WriteBits(pBuf, nBytes << 3); return WriteBits(pBuf, nBytes << 3);
} }
bool old_bf_write::WriteString(const char *pStr) bool bf_write::WriteString(const char *pStr)
{ {
if(pStr) if(pStr)
{ {
@ -670,6 +691,25 @@ bool old_bf_write::WriteString(const char *pStr)
return !IsOverflowed(); return !IsOverflowed();
} }
bool bf_write::WriteString(const wchar_t *pStr)
{
if(pStr)
{
do
{
WriteSBitLong( *pStr, 16 );
++pStr;
} while ( (*pStr-1) != 0 );
}
else
{
WriteUBitLong( 0, 15 );
WriteOneBit( 0 );
}
return !IsOverflowed();
}
// ---------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------- //
// old_bf_read // old_bf_read
// ---------------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------------- //
@ -995,7 +1035,7 @@ float old_bf_read::ReadBitCoord (void)
return value; return value;
} }
float old_bf_read::ReadBitCoordMP( bool bIntegral, bool bLowPrecision ) float old_bf_read::ReadBitCoordMP( EBitCoordType coordType )
{ {
#if defined( BB_PROFILING ) #if defined( BB_PROFILING )
VPROF( "old_bf_write::ReadBitCoordMP" ); VPROF( "old_bf_write::ReadBitCoordMP" );
@ -1006,7 +1046,7 @@ float old_bf_read::ReadBitCoordMP( bool bIntegral, bool bLowPrecision )
bool bInBounds = ReadOneBit() ? true : false; bool bInBounds = ReadOneBit() ? true : false;
if ( bIntegral ) if ( coordType == kCW_Integral )
{ {
// Read the required integer and fraction flags // Read the required integer and fraction flags
intval = ReadOneBit(); intval = ReadOneBit();
@ -1050,10 +1090,10 @@ float old_bf_read::ReadBitCoordMP( bool bIntegral, bool bLowPrecision )
} }
// If there's a fraction, read it in // If there's a fraction, read it in
fractval = ReadUBitLong( bLowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS ); fractval = ReadUBitLong( coordType == kCW_LowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS );
// Calculate the correct floating point value // Calculate the correct floating point value
value = intval + ((float)fractval * ( bLowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ) ); value = intval + ((float)fractval * ( coordType == kCW_LowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ) );
} }
// Fixup the sign if negative. // Fixup the sign if negative.
@ -1250,7 +1290,7 @@ void old_bf_read::ExciseBits( int startbit, int bitstoremove )
int endbit = startbit + bitstoremove; int endbit = startbit + bitstoremove;
int remaining_to_end = m_nDataBits - endbit; int remaining_to_end = m_nDataBits - endbit;
old_bf_write temp; bf_write temp;
temp.StartWriting( (void *)m_pData, m_nDataBits << 3, startbit ); temp.StartWriting( (void *)m_pData, m_nDataBits << 3, startbit );
Seek( endbit ); Seek( endbit );

View File

@ -62,7 +62,7 @@ void CByteswap::SwapFieldToTargetEndian( void* pOutputBuffer, void *pData, typed
break; break;
default: default:
assert(0); Assert(0);
} }
} }

View File

@ -683,10 +683,10 @@ ConVar::ConVar( const char *pName, const char *pDefaultValue, int flags, const c
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ConVar::~ConVar( void ) ConVar::~ConVar( void )
{ {
if ( m_pszString ) if ( m_Value.m_pszString )
{ {
delete[] m_pszString; delete[] m_Value.m_pszString;
m_pszString = NULL; m_Value.m_pszString = NULL;
} }
} }
@ -694,15 +694,24 @@ ConVar::~ConVar( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Install a change callback (there shouldn't already be one....) // Install a change callback (there shouldn't already be one....)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ConVar::InstallChangeCallback( FnChangeCallback_t callback ) void ConVar::InstallChangeCallback( FnChangeCallback_t callback, bool bInvoke )
{ {
Assert( !m_pParent->m_fnChangeCallback || !callback ); if (callback)
m_pParent->m_fnChangeCallback = callback;
if ( m_pParent->m_fnChangeCallback )
{ {
// Call it immediately to set the initial value... if (m_fnChangeCallbacks.Find(callback) != -1)
m_pParent->m_fnChangeCallback( this, m_pszString, m_fValue ); {
m_fnChangeCallbacks.AddToTail(callback);
if (bInvoke)
callback(this, m_Value.m_pszString, m_Value.m_fValue);
}
else
{
Warning("InstallChangeCallback ignoring duplicate change callback!!!\n");
}
}
else
{
Warning("InstallChangeCallback called with NULL callback, ignoring!!!\n");
} }
} }
@ -780,7 +789,7 @@ void ConVar::InternalSetValue( const char *value )
Assert(m_pParent == this); // Only valid for root convars. Assert(m_pParent == this); // Only valid for root convars.
float flOldValue = m_fValue; float flOldValue = m_Value.m_fValue;
val = (char *)value; val = (char *)value;
fNewValue = ( float )atof( value ); fNewValue = ( float )atof( value );
@ -792,8 +801,8 @@ void ConVar::InternalSetValue( const char *value )
} }
// Redetermine value // Redetermine value
m_fValue = fNewValue; m_Value.m_fValue = fNewValue;
m_nValue = ( int )( m_fValue ); m_Value.m_nValue = ( int )( fNewValue );
if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) ) if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
{ {
@ -809,33 +818,32 @@ void ConVar::ChangeStringValue( const char *tempVal, float flOldValue )
{ {
Assert( !( m_nFlags & FCVAR_NEVER_AS_STRING ) ); Assert( !( m_nFlags & FCVAR_NEVER_AS_STRING ) );
char* pszOldValue = (char*)stackalloc( m_StringLength ); char* pszOldValue = (char*)stackalloc( m_Value.m_StringLength );
memcpy( pszOldValue, m_pszString, m_StringLength ); memcpy( pszOldValue, m_Value.m_pszString, m_Value.m_StringLength );
int len = Q_strlen(tempVal) + 1; int len = Q_strlen(tempVal) + 1;
if ( len > m_StringLength) if ( len > m_Value.m_StringLength)
{ {
if (m_pszString) if (m_Value.m_pszString)
{ {
delete[] m_pszString; delete[] m_Value.m_pszString;
} }
m_pszString = new char[len]; m_Value.m_pszString = new char[len];
m_StringLength = len; m_Value.m_StringLength = len;
} }
memcpy( m_pszString, tempVal, len ); memcpy( m_Value.m_pszString, tempVal, len );
// Invoke any necessary callback function // Invoke any necessary callback function
if ( m_fnChangeCallback ) for (int i = 0; i < m_fnChangeCallbacks.Count(); i++)
{ {
m_fnChangeCallback( this, pszOldValue, flOldValue ); m_fnChangeCallbacks[i]( this, pszOldValue, flOldValue );
} }
if (g_pCVar)
g_pCVar->CallGlobalChangeCallbacks( this, pszOldValue, flOldValue ); g_pCVar->CallGlobalChangeCallbacks( this, pszOldValue, flOldValue );
stackfree( pszOldValue );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -866,7 +874,7 @@ bool ConVar::ClampValue( float& value )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ConVar::InternalSetFloatValue( float fNewValue ) void ConVar::InternalSetFloatValue( float fNewValue )
{ {
if ( fNewValue == m_fValue ) if ( fNewValue == m_Value.m_fValue )
return; return;
Assert( m_pParent == this ); // Only valid for root convars. Assert( m_pParent == this ); // Only valid for root convars.
@ -875,19 +883,19 @@ void ConVar::InternalSetFloatValue( float fNewValue )
ClampValue( fNewValue ); ClampValue( fNewValue );
// Redetermine value // Redetermine value
float flOldValue = m_fValue; float flOldValue = m_Value.m_fValue;
m_fValue = fNewValue; m_Value.m_fValue = fNewValue;
m_nValue = ( int )m_fValue; m_Value.m_nValue = ( int )fNewValue;
if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) ) if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
{ {
char tempVal[ 32 ]; char tempVal[ 32 ];
Q_snprintf( tempVal, sizeof( tempVal), "%f", m_fValue ); Q_snprintf( tempVal, sizeof( tempVal), "%f", m_Value.m_fValue );
ChangeStringValue( tempVal, flOldValue ); ChangeStringValue( tempVal, flOldValue );
} }
else else
{ {
Assert( !m_fnChangeCallback ); Assert( m_fnChangeCallbacks.Count() == 0 );
} }
} }
@ -897,7 +905,7 @@ void ConVar::InternalSetFloatValue( float fNewValue )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ConVar::InternalSetIntValue( int nValue ) void ConVar::InternalSetIntValue( int nValue )
{ {
if ( nValue == m_nValue ) if ( nValue == m_Value.m_nValue )
return; return;
Assert( m_pParent == this ); // Only valid for root convars. Assert( m_pParent == this ); // Only valid for root convars.
@ -909,19 +917,19 @@ void ConVar::InternalSetIntValue( int nValue )
} }
// Redetermine value // Redetermine value
float flOldValue = m_fValue; float flOldValue = m_Value.m_fValue;
m_fValue = fValue; m_Value.m_fValue = fValue;
m_nValue = nValue; m_Value.m_nValue = nValue;
if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) ) if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) )
{ {
char tempVal[ 32 ]; char tempVal[ 32 ];
Q_snprintf( tempVal, sizeof( tempVal ), "%d", m_nValue ); Q_snprintf( tempVal, sizeof( tempVal ), "%d", m_Value.m_nValue );
ChangeStringValue( tempVal, flOldValue ); ChangeStringValue( tempVal, flOldValue );
} }
else else
{ {
Assert( !m_fnChangeCallback ); Assert( m_fnChangeCallbacks.Count() == 0 );
} }
} }
@ -950,31 +958,32 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*=
m_pszDefaultValue = pDefaultValue ? pDefaultValue : empty_string; m_pszDefaultValue = pDefaultValue ? pDefaultValue : empty_string;
Assert( m_pszDefaultValue ); Assert( m_pszDefaultValue );
m_StringLength = strlen( m_pszDefaultValue ) + 1; m_Value.m_StringLength = strlen( m_pszDefaultValue ) + 1;
m_pszString = new char[m_StringLength]; m_Value.m_pszString = new char[m_Value.m_StringLength];
memcpy( m_pszString, m_pszDefaultValue, m_StringLength ); memcpy( m_Value.m_pszString, m_pszDefaultValue, m_Value.m_StringLength );
m_bHasMin = bMin; m_bHasMin = bMin;
m_fMinVal = fMin; m_fMinVal = fMin;
m_bHasMax = bMax; m_bHasMax = bMax;
m_fMaxVal = fMax; m_fMaxVal = fMax;
m_fnChangeCallback = callback; if (callback)
m_fnChangeCallbacks.AddToTail(callback);
m_fValue = ( float )atof( m_pszString ); m_Value.m_fValue = ( float )atof( m_Value.m_pszString );
// Bounds Check, should never happen, if it does, no big deal // Bounds Check, should never happen, if it does, no big deal
if ( m_bHasMin && ( m_fValue < m_fMinVal ) ) if ( m_bHasMin && ( m_Value.m_fValue < m_fMinVal ) )
{ {
Assert( 0 ); Assert( 0 );
} }
if ( m_bHasMax && ( m_fValue > m_fMaxVal ) ) if ( m_bHasMax && ( m_Value.m_fValue > m_fMaxVal ) )
{ {
Assert( 0 ); Assert( 0 );
} }
m_nValue = ( int )m_fValue; m_Value.m_nValue = ( int )m_Value.m_fValue;
BaseClass::Create( pName, pHelpString, flags ); BaseClass::Create( pName, pHelpString, flags );
} }
@ -1205,7 +1214,7 @@ void ConVar_PrintDescription( const ConCommandBase *pVar )
float fMin, fMax; float fMin, fMax;
const char *pStr; const char *pStr;
assert( pVar ); Assert( pVar );
Color clr; Color clr;
clr.SetColor( 255, 100, 100, 255 ); clr.SetColor( 255, 100, 100, 255 );

View File

@ -142,7 +142,7 @@ unsigned FASTCALL HashInt( const int n )
odd = g_nRandomValues[((n >> 8) & 0xff)]; odd = g_nRandomValues[((n >> 8) & 0xff)];
even = g_nRandomValues[odd ^ (n >> 24)]; even = g_nRandomValues[odd ^ (n >> 24)];
odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)];
even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)];
odd = g_nRandomValues[even ^ (n & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)];
@ -163,7 +163,7 @@ unsigned FASTCALL Hash4( const void *pKey )
odd = g_nRandomValues[((n >> 8) & 0xff)]; odd = g_nRandomValues[((n >> 8) & 0xff)];
even = g_nRandomValues[odd ^ (n >> 24)]; even = g_nRandomValues[odd ^ (n >> 24)];
odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)];
even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)];
odd = g_nRandomValues[even ^ (n & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)];
@ -185,7 +185,7 @@ unsigned FASTCALL Hash8( const void *pKey )
odd = g_nRandomValues[((n >> 8) & 0xff)]; odd = g_nRandomValues[((n >> 8) & 0xff)];
even = g_nRandomValues[odd ^ (n >> 24)]; even = g_nRandomValues[odd ^ (n >> 24)];
odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)];
even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)];
odd = g_nRandomValues[even ^ (n & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)];
@ -213,7 +213,7 @@ unsigned FASTCALL Hash12( const void *pKey )
odd = g_nRandomValues[((n >> 8) & 0xff)]; odd = g_nRandomValues[((n >> 8) & 0xff)];
even = g_nRandomValues[odd ^ (n >> 24)]; even = g_nRandomValues[odd ^ (n >> 24)];
odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)];
even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)];
odd = g_nRandomValues[even ^ (n & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)];
@ -247,7 +247,7 @@ unsigned FASTCALL Hash16( const void *pKey )
odd = g_nRandomValues[((n >> 8) & 0xff)]; odd = g_nRandomValues[((n >> 8) & 0xff)];
even = g_nRandomValues[odd ^ (n >> 24)]; even = g_nRandomValues[odd ^ (n >> 24)];
odd = g_nRandomValues[even ^ (n >> 16) & 0xff]; odd = g_nRandomValues[even ^ ((n >> 16) & 0xff)];
even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)]; even = g_nRandomValues[odd ^ ((n >> 8) & 0xff)];
odd = g_nRandomValues[even ^ (n & 0xff)]; odd = g_nRandomValues[even ^ (n & 0xff)];

View File

@ -37,10 +37,14 @@
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
#if !defined COMPILER_MSVC && !defined HMODULE
#define HMODULE void *
#endif
// ------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------ //
// InterfaceReg. // InterfaceReg.
// ------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------ //
InterfaceReg *InterfaceReg::s_pInterfaceRegs = NULL; InterfaceReg *s_pInterfaceRegs = NULL;
InterfaceReg::InterfaceReg( InstantiateInterfaceFn fn, const char *pName ) : InterfaceReg::InterfaceReg( InstantiateInterfaceFn fn, const char *pName ) :
m_pName(pName) m_pName(pName)
@ -59,7 +63,7 @@ void* CreateInterface( const char *pName, int *pReturnCode )
{ {
InterfaceReg *pCur; InterfaceReg *pCur;
for (pCur=InterfaceReg::s_pInterfaceRegs; pCur; pCur=pCur->m_pNext) for (pCur=s_pInterfaceRegs; pCur; pCur=pCur->m_pNext)
{ {
if (strcmp(pCur->m_pName, pName) == 0) if (strcmp(pCur->m_pName, pName) == 0)
{ {
@ -201,7 +205,7 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName )
#endif #endif
unsigned int nTimeout = 0; unsigned int nTimeout = 0;
while( ThreadWaitForObject( h, true, nTimeout ) == TW_TIMEOUT ) while( WaitForSingleObject(h, nTimeout) == WAIT_TIMEOUT )
{ {
nTimeout = threadFunc(); nTimeout = threadFunc();
} }

View File

@ -19,13 +19,13 @@
// Should be last include // Should be last include
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
MemoryPoolReportFunc_t CMemoryPool::g_ReportFunc = 0; MemoryPoolReportFunc_t CUtlMemoryPool::g_ReportFunc = 0;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Error reporting... (debug only) // Error reporting... (debug only)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func ) void CUtlMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func )
{ {
g_ReportFunc = func; g_ReportFunc = func;
} }
@ -33,7 +33,7 @@ void CMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Constructor // Purpose: Constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CMemoryPool::CMemoryPool( int blockSize, int numElements, int growMode, const char *pszAllocOwner, int nAlignment ) CUtlMemoryPool::CUtlMemoryPool( int blockSize, int numElements, int growMode, const char *pszAllocOwner, int nAlignment )
{ {
#ifdef _X360 #ifdef _X360
if( numElements > 0 && growMode != GROW_NONE ) if( numElements > 0 && growMode != GROW_NONE )
@ -63,7 +63,7 @@ CMemoryPool::CMemoryPool( int blockSize, int numElements, int growMode, const ch
// any further use. // any further use.
// Input : *memPool - the mempool to shutdown // Input : *memPool - the mempool to shutdown
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CMemoryPool::~CMemoryPool() CUtlMemoryPool::~CUtlMemoryPool()
{ {
if (m_BlocksAllocated > 0) if (m_BlocksAllocated > 0)
{ {
@ -76,7 +76,7 @@ CMemoryPool::~CMemoryPool()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Resets the pool // Resets the pool
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::Init() void CUtlMemoryPool::Init()
{ {
m_NumBlobs = 0; m_NumBlobs = 0;
m_BlocksAllocated = 0; m_BlocksAllocated = 0;
@ -88,7 +88,7 @@ void CMemoryPool::Init()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Frees everything // Frees everything
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::Clear() void CUtlMemoryPool::Clear()
{ {
// Free everything.. // Free everything..
CBlob *pNext; CBlob *pNext;
@ -104,7 +104,7 @@ void CMemoryPool::Clear()
// Purpose: Reports memory leaks // Purpose: Reports memory leaks
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::ReportLeaks() void CUtlMemoryPool::ReportLeaks()
{ {
if (!g_ReportFunc) if (!g_ReportFunc)
return; return;
@ -155,7 +155,7 @@ void CMemoryPool::ReportLeaks()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::AddNewBlob() void CUtlMemoryPool::AddNewBlob()
{ {
MEM_ALLOC_CREDIT_(m_pszAllocOwner); MEM_ALLOC_CREDIT_(m_pszAllocOwner);
@ -172,7 +172,7 @@ void CMemoryPool::AddNewBlob()
// Can only have one allocation when we're in this mode // Can only have one allocation when we're in this mode
if( m_NumBlobs != 0 ) if( m_NumBlobs != 0 )
{ {
Assert( !"CMemoryPool::AddNewBlob: mode == GROW_NONE" ); Assert( !"CUtlMemoryPool::AddNewBlob: mode == GROW_NONE" );
return; return;
} }
} }
@ -210,13 +210,13 @@ void CMemoryPool::AddNewBlob()
} }
void* CMemoryPool::Alloc() void* CUtlMemoryPool::Alloc()
{ {
return Alloc( m_BlockSize ); return Alloc( m_BlockSize );
} }
void* CMemoryPool::AllocZero() void* CUtlMemoryPool::AllocZero()
{ {
return AllocZero( m_BlockSize ); return AllocZero( m_BlockSize );
} }
@ -226,7 +226,7 @@ void* CMemoryPool::AllocZero()
// Purpose: Allocs a single block of memory from the pool. // Purpose: Allocs a single block of memory from the pool.
// Input : amount - // Input : amount -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void *CMemoryPool::Alloc( size_t amount ) void *CUtlMemoryPool::Alloc( size_t amount )
{ {
void *returnBlock; void *returnBlock;
@ -238,7 +238,7 @@ void *CMemoryPool::Alloc( size_t amount )
// returning NULL is fine in GROW_NONE // returning NULL is fine in GROW_NONE
if( m_GrowMode == GROW_NONE ) if( m_GrowMode == GROW_NONE )
{ {
//Assert( !"CMemoryPool::Alloc: tried to make new blob with GROW_NONE" ); //Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with GROW_NONE" );
return NULL; return NULL;
} }
@ -248,7 +248,7 @@ void *CMemoryPool::Alloc( size_t amount )
// still failure, error out // still failure, error out
if( !m_pHeadOfFreeList ) if( !m_pHeadOfFreeList )
{ {
Assert( !"CMemoryPool::Alloc: ran out of memory" ); Assert( !"CUtlMemoryPool::Alloc: ran out of memory" );
return NULL; return NULL;
} }
} }
@ -267,7 +267,7 @@ void *CMemoryPool::Alloc( size_t amount )
// Purpose: Allocs a single block of memory from the pool, zeroes the memory before returning // Purpose: Allocs a single block of memory from the pool, zeroes the memory before returning
// Input : amount - // Input : amount -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void *CMemoryPool::AllocZero( size_t amount ) void *CUtlMemoryPool::AllocZero( size_t amount )
{ {
void *mem = Alloc( amount ); void *mem = Alloc( amount );
if ( mem ) if ( mem )
@ -281,7 +281,7 @@ void *CMemoryPool::AllocZero( size_t amount )
// Purpose: Frees a block of memory // Purpose: Frees a block of memory
// Input : *memBlock - the memory to free // Input : *memBlock - the memory to free
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CMemoryPool::Free( void *memBlock ) void CUtlMemoryPool::Free( void *memBlock )
{ {
if ( !memBlock ) if ( !memBlock )
return; // trying to delete NULL pointer, ignore return; // trying to delete NULL pointer, ignore

View File

@ -179,11 +179,11 @@ void CBitWrite::WriteBitCoord (const float f)
} }
} }
void CBitWrite::WriteBitCoordMP (const float f, bool bIntegral, bool bLowPrecision ) void CBitWrite::WriteBitCoordMP (const float f, EBitCoordType coordType )
{ {
int signbit = (f <= -( bLowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION )); int signbit = (f <= -( coordType == kCW_LowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ));
int intval = (int)fabs(f); int intval = (int)fabs(f);
int fractval = bLowPrecision ? int fractval = coordType == kCW_LowPrecision ?
( abs((int)(f*COORD_DENOMINATOR_LOWPRECISION)) & (COORD_DENOMINATOR_LOWPRECISION-1) ) : ( abs((int)(f*COORD_DENOMINATOR_LOWPRECISION)) & (COORD_DENOMINATOR_LOWPRECISION-1) ) :
( abs((int)(f*COORD_DENOMINATOR)) & (COORD_DENOMINATOR-1) ); ( abs((int)(f*COORD_DENOMINATOR)) & (COORD_DENOMINATOR-1) );
@ -191,7 +191,7 @@ void CBitWrite::WriteBitCoordMP (const float f, bool bIntegral, bool bLowPrecisi
WriteOneBit( bInBounds ); WriteOneBit( bInBounds );
if ( bIntegral ) if ( coordType == kCW_Integral )
{ {
// Send the sign bit // Send the sign bit
WriteOneBit( intval ); WriteOneBit( intval );
@ -232,7 +232,7 @@ void CBitWrite::WriteBitCoordMP (const float f, bool bIntegral, bool bLowPrecisi
WriteUBitLong( (unsigned int)intval, COORD_INTEGER_BITS ); WriteUBitLong( (unsigned int)intval, COORD_INTEGER_BITS );
} }
} }
WriteUBitLong( (unsigned int)fractval, bLowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS ); WriteUBitLong( (unsigned int)fractval, coordType == kCW_LowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS );
} }
} }
@ -575,14 +575,14 @@ float CBitRead::ReadBitCoord (void)
return value; return value;
} }
float CBitRead::ReadBitCoordMP( bool bIntegral, bool bLowPrecision ) float CBitRead::ReadBitCoordMP( EBitCoordType coordType )
{ {
int intval=0,fractval=0,signbit=0; int intval=0,fractval=0,signbit=0;
float value = 0.0; float value = 0.0;
bool bInBounds = ReadOneBit() ? true : false; bool bInBounds = ReadOneBit() ? true : false;
if ( bIntegral ) if ( coordType == kCW_Integral )
{ {
// Read the required integer and fraction flags // Read the required integer and fraction flags
intval = ReadOneBit(); intval = ReadOneBit();
@ -626,10 +626,10 @@ float CBitRead::ReadBitCoordMP( bool bIntegral, bool bLowPrecision )
} }
// If there's a fraction, read it in // If there's a fraction, read it in
fractval = ReadUBitLong( bLowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS ); fractval = ReadUBitLong( coordType == kCW_LowPrecision ? COORD_FRACTIONAL_BITS_MP_LOWPRECISION : COORD_FRACTIONAL_BITS );
// Calculate the correct floating point value // Calculate the correct floating point value
value = intval + ((float)fractval * ( bLowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ) ); value = intval + ((float)fractval * ( coordType == kCW_LowPrecision ? COORD_RESOLUTION_LOWPRECISION : COORD_RESOLUTION ) );
} }
// Fixup the sign if negative. // Fixup the sign if negative.

View File

@ -4,6 +4,7 @@
// //
//=============================================================================// //=============================================================================//
#include "mathlib/mathlib.h"
#include "rangecheckedvar.h" #include "rangecheckedvar.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!

View File

@ -18,16 +18,22 @@
// Purpose: Comparison function for string sorted associative data structures // Purpose: Comparison function for string sorted associative data structures
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool StrLess( const char * const &pszLeft, const char * const &pszRight ) bool StrLessSensitive( const char * const &pszLeft, const char * const &pszRight )
{
return ( Q_strcmp( pszLeft, pszRight) < 0 );
}
bool StrLessInsensitive( const char * const &pszLeft, const char * const &pszRight )
{ {
return ( Q_stricmp( pszLeft, pszRight) < 0 ); return ( Q_stricmp( pszLeft, pszRight) < 0 );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CStringPool::CStringPool() CStringPool::CStringPool( StringPoolCase_t caseSensitivity )
: m_Strings( 32, 256, StrLess ) : m_Strings( 32, 256, caseSensitivity == StringPoolCaseInsensitive ? StrLessInsensitive : StrLessSensitive )
{ {
} }
@ -94,7 +100,7 @@ void CStringPool::FreeAll()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CCountedStringPool::CCountedStringPool() CCountedStringPool::CCountedStringPool( StringPoolCase_t caseSensitivity )
{ {
MEM_ALLOC_CREDIT(); MEM_ALLOC_CREDIT();
m_HashTable.EnsureCount(HASH_TABLE_SIZE); m_HashTable.EnsureCount(HASH_TABLE_SIZE);
@ -109,6 +115,8 @@ CCountedStringPool::CCountedStringPool()
m_Elements[0].pString = NULL; m_Elements[0].pString = NULL;
m_Elements[0].nReferenceCount = 0; m_Elements[0].nReferenceCount = 0;
m_Elements[0].nNextElement = INVALID_ELEMENT; m_Elements[0].nNextElement = INVALID_ELEMENT;
m_caseSensitivity = caseSensitivity;
} }
CCountedStringPool::~CCountedStringPool() CCountedStringPool::~CCountedStringPool()
@ -154,7 +162,7 @@ unsigned short CCountedStringPool::FindStringHandle( const char* pIntrinsic )
if( pIntrinsic == NULL ) if( pIntrinsic == NULL )
return INVALID_ELEMENT; return INVALID_ELEMENT;
unsigned short nHashBucketIndex = (HashStringCaseless(pIntrinsic ) %HASH_TABLE_SIZE); unsigned short nHashBucketIndex = (m_caseSensitivity ? HashString( pIntrinsic ) : HashStringCaseless( pIntrinsic ) %HASH_TABLE_SIZE);
unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ]; unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ];
// Does the bucket already exist? // Does the bucket already exist?
@ -187,7 +195,7 @@ unsigned short CCountedStringPool::ReferenceStringHandle( const char* pIntrinsic
if( pIntrinsic == NULL ) if( pIntrinsic == NULL )
return INVALID_ELEMENT; return INVALID_ELEMENT;
unsigned short nHashBucketIndex = (HashStringCaseless( pIntrinsic ) % HASH_TABLE_SIZE); unsigned short nHashBucketIndex = (m_caseSensitivity ? HashString( pIntrinsic ) : HashStringCaseless( pIntrinsic ) % HASH_TABLE_SIZE);
unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ]; unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ];
// Does the bucket already exist? // Does the bucket already exist?
@ -244,7 +252,7 @@ void CCountedStringPool::DereferenceString( const char* pIntrinsic )
if (!pIntrinsic) if (!pIntrinsic)
return; return;
unsigned short nHashBucketIndex = (HashStringCaseless( pIntrinsic ) % m_HashTable.Count()); unsigned short nHashBucketIndex = (m_caseSensitivity ? HashString( pIntrinsic ) : HashStringCaseless( pIntrinsic ) % m_HashTable.Count());
unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ]; unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ];
// If there isn't anything in the bucket, just return. // If there isn't anything in the bucket, just return.
@ -292,6 +300,14 @@ char* CCountedStringPool::HandleToString( unsigned short handle )
return m_Elements[handle].pString; return m_Elements[handle].pString;
} }
unsigned CCountedStringPool::Hash( const char *pszKey )
{
if (m_caseSensitivity == StringPoolCaseSensitive)
return HashString( pszKey );
return HashStringCaseless( pszKey );
}
void CCountedStringPool::SpewStrings() void CCountedStringPool::SpewStrings()
{ {
int i; int i;

View File

@ -75,7 +75,7 @@
#endif #endif
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
void _V_memset (const char* file, int line, void *dest, int fill, int count) void _V_memset (void *dest, int fill, int count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidWritePtr( dest, count ); AssertValidWritePtr( dest, count );
@ -83,7 +83,7 @@ void _V_memset (const char* file, int line, void *dest, int fill, int count)
memset(dest,fill,count); memset(dest,fill,count);
} }
void _V_memcpy (const char* file, int line, void *dest, const void *src, int count) void _V_memcpy (void *dest, const void *src, int count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidReadPtr( src, count ); AssertValidReadPtr( src, count );
@ -92,7 +92,7 @@ void _V_memcpy (const char* file, int line, void *dest, const void *src, int cou
memcpy( dest, src, count ); memcpy( dest, src, count );
} }
void _V_memmove(const char* file, int line, void *dest, const void *src, int count) void _V_memmove(void *dest, const void *src, int count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidReadPtr( src, count ); AssertValidReadPtr( src, count );
@ -101,7 +101,7 @@ void _V_memmove(const char* file, int line, void *dest, const void *src, int cou
memmove( dest, src, count ); memmove( dest, src, count );
} }
int _V_memcmp (const char* file, int line, const void *m1, const void *m2, int count) int _V_memcmp (const void *m1, const void *m2, int count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidReadPtr( m1, count ); AssertValidReadPtr( m1, count );
@ -110,28 +110,28 @@ int _V_memcmp (const char* file, int line, const void *m1, const void *m2, int c
return memcmp( m1, m2, count ); return memcmp( m1, m2, count );
} }
int _V_strlen(const char* file, int line, const char *str) int _V_strlen(const char *str)
{ {
AssertValidStringPtr(str); _AssertValidStringPtr(str);
return strlen( str ); return strlen( str );
} }
void _V_strcpy (const char* file, int line, char *dest, const char *src) void _V_strcpy (char *dest, const char *src)
{ {
AssertValidWritePtr(dest); AssertValidWritePtr(dest);
AssertValidStringPtr(src); _AssertValidStringPtr(src);
strcpy( dest, src ); strcpy( dest, src );
} }
int _V_wcslen(const char* file, int line, const wchar_t *pwch) int _V_wcslen(const wchar_t *pwch)
{ {
return wcslen( pwch ); return wcslen( pwch );
} }
char *_V_strrchr(const char* file, int line, const char *s, char c) char *_V_strrchr(const char *s, char c)
{ {
AssertValidStringPtr( s ); _AssertValidStringPtr( s );
int len = V_strlen(s); int len = V_strlen(s);
s += len; s += len;
while (len--) while (len--)
@ -139,15 +139,15 @@ char *_V_strrchr(const char* file, int line, const char *s, char c)
return 0; return 0;
} }
int _V_strcmp (const char* file, int line, const char *s1, const char *s2) int _V_strcmp (const char *s1, const char *s2)
{ {
AssertValidStringPtr( s1 ); _AssertValidStringPtr( s1 );
AssertValidStringPtr( s2 ); _AssertValidStringPtr( s2 );
return strcmp( s1, s2 ); return strcmp( s1, s2 );
} }
int _V_wcscmp (const char* file, int line, const wchar_t *s1, const wchar_t *s2) int _V_wcscmp (const wchar_t *s1, const wchar_t *s2)
{ {
while (1) while (1)
{ {
@ -162,21 +162,23 @@ int _V_wcscmp (const char* file, int line, const wchar_t *s1, const wchar_t *s2)
return -1; return -1;
} }
#ifdef PLATFORM_WINDOWS
#undef stricmp
#endif
int _V_stricmp( const char *s1, const char *s2 )
int _V_stricmp(const char* file, int line, const char *s1, const char *s2 )
{ {
AssertValidStringPtr( s1 ); _AssertValidStringPtr( s1 );
AssertValidStringPtr( s2 ); _AssertValidStringPtr( s2 );
return stricmp( s1, s2 ); return stricmp( s1, s2 );
} }
char *_V_strstr(const char* file, int line, const char *s1, const char *search ) char *_V_strstr( const char *s1, const char *search )
{ {
AssertValidStringPtr( s1 ); _AssertValidStringPtr( s1 );
AssertValidStringPtr( search ); _AssertValidStringPtr( search );
#if defined( _X360 ) #if defined( _X360 )
return (char *)strstr( (char *)s1, search ); return (char *)strstr( (char *)s1, search );
@ -185,24 +187,24 @@ char *_V_strstr(const char* file, int line, const char *s1, const char *search
#endif #endif
} }
char *_V_strupr (const char* file, int line, char *start) char *_V_strupr (char *start)
{ {
AssertValidStringPtr( start ); _AssertValidStringPtr( start );
return strupr( start ); return strupr( start );
} }
char *_V_strlower (const char* file, int line, char *start) char *_V_strlower (char *start)
{ {
AssertValidStringPtr( start ); _AssertValidStringPtr( start );
return strlwr(start); return strlwr(start);
} }
int V_strncmp (const char *s1, const char *s2, int count) int V_strncmp (const char *s1, const char *s2, int count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidStringPtr( s1, count ); _AssertValidStringPtr( s1, count );
AssertValidStringPtr( s2, count ); _AssertValidStringPtr( s2, count );
while ( count-- > 0 ) while ( count-- > 0 )
{ {
@ -220,7 +222,7 @@ int V_strncmp (const char *s1, const char *s2, int count)
char *V_strnlwr(char *s, size_t count) char *V_strnlwr(char *s, size_t count)
{ {
Assert( count >= 0 ); Assert( count >= 0 );
AssertValidStringPtr( s, count ); _AssertValidStringPtr( s, count );
char* pRet = s; char* pRet = s;
if ( !s ) if ( !s )
@ -247,8 +249,8 @@ char *V_strnlwr(char *s, size_t count)
int V_strncasecmp (const char *s1, const char *s2, int n) int V_strncasecmp (const char *s1, const char *s2, int n)
{ {
Assert( n >= 0 ); Assert( n >= 0 );
AssertValidStringPtr( s1 ); _AssertValidStringPtr( s1 );
AssertValidStringPtr( s2 ); _AssertValidStringPtr( s2 );
while ( n-- > 0 ) while ( n-- > 0 )
{ {
@ -273,8 +275,8 @@ int V_strncasecmp (const char *s1, const char *s2, int n)
int V_strcasecmp( const char *s1, const char *s2 ) int V_strcasecmp( const char *s1, const char *s2 )
{ {
AssertValidStringPtr( s1 ); _AssertValidStringPtr( s1 );
AssertValidStringPtr( s2 ); _AssertValidStringPtr( s2 );
return stricmp( s1, s2 ); return stricmp( s1, s2 );
} }
@ -282,8 +284,8 @@ int V_strcasecmp( const char *s1, const char *s2 )
int V_strnicmp (const char *s1, const char *s2, int n) int V_strnicmp (const char *s1, const char *s2, int n)
{ {
Assert( n >= 0 ); Assert( n >= 0 );
AssertValidStringPtr(s1); _AssertValidStringPtr(s1);
AssertValidStringPtr(s2); _AssertValidStringPtr(s2);
return V_strncasecmp( s1, s2, n ); return V_strncasecmp( s1, s2, n );
} }
@ -291,8 +293,8 @@ int V_strnicmp (const char *s1, const char *s2, int n)
const char *StringAfterPrefix( const char *str, const char *prefix ) const char *StringAfterPrefix( const char *str, const char *prefix )
{ {
AssertValidStringPtr( str ); _AssertValidStringPtr( str );
AssertValidStringPtr( prefix ); _AssertValidStringPtr( prefix );
do do
{ {
if ( !*prefix ) if ( !*prefix )
@ -304,8 +306,8 @@ const char *StringAfterPrefix( const char *str, const char *prefix )
const char *StringAfterPrefixCaseSensitive( const char *str, const char *prefix ) const char *StringAfterPrefixCaseSensitive( const char *str, const char *prefix )
{ {
AssertValidStringPtr( str ); _AssertValidStringPtr( str );
AssertValidStringPtr( prefix ); _AssertValidStringPtr( prefix );
do do
{ {
if ( !*prefix ) if ( !*prefix )
@ -318,7 +320,7 @@ const char *StringAfterPrefixCaseSensitive( const char *str, const char *prefix
int V_atoi (const char *str) int V_atoi (const char *str)
{ {
AssertValidStringPtr( str ); _AssertValidStringPtr( str );
int val; int val;
int sign; int sign;
@ -380,7 +382,7 @@ int V_atoi (const char *str)
float V_atof (const char *str) float V_atof (const char *str)
{ {
AssertValidStringPtr( str ); _AssertValidStringPtr( str );
double val; double val;
int sign; int sign;
int c; int c;
@ -489,8 +491,8 @@ void V_normalizeFloatString( char* pFloat )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
char const* V_stristr( char const* pStr, char const* pSearch ) char const* V_stristr( char const* pStr, char const* pSearch )
{ {
AssertValidStringPtr(pStr); _AssertValidStringPtr(pStr);
AssertValidStringPtr(pSearch); _AssertValidStringPtr(pSearch);
if (!pStr || !pSearch) if (!pStr || !pSearch)
return 0; return 0;
@ -532,8 +534,8 @@ char const* V_stristr( char const* pStr, char const* pSearch )
char* V_stristr( char* pStr, char const* pSearch ) char* V_stristr( char* pStr, char const* pSearch )
{ {
AssertValidStringPtr( pStr ); _AssertValidStringPtr( pStr );
AssertValidStringPtr( pSearch ); _AssertValidStringPtr( pSearch );
return (char*)V_stristr( (char const*)pStr, pSearch ); return (char*)V_stristr( (char const*)pStr, pSearch );
} }
@ -543,8 +545,8 @@ char* V_stristr( char* pStr, char const* pSearch )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
char const* V_strnistr( char const* pStr, char const* pSearch, int n ) char const* V_strnistr( char const* pStr, char const* pSearch, int n )
{ {
AssertValidStringPtr(pStr); _AssertValidStringPtr(pStr);
AssertValidStringPtr(pSearch); _AssertValidStringPtr(pSearch);
if (!pStr || !pSearch) if (!pStr || !pSearch)
return 0; return 0;
@ -613,7 +615,7 @@ void V_strncpy( char *pDest, char const *pSrc, int maxLen )
{ {
Assert( maxLen >= 0 ); Assert( maxLen >= 0 );
AssertValidWritePtr( pDest, maxLen ); AssertValidWritePtr( pDest, maxLen );
AssertValidStringPtr( pSrc ); _AssertValidStringPtr( pSrc );
strncpy( pDest, pSrc, maxLen ); strncpy( pDest, pSrc, maxLen );
if ( maxLen > 0 ) if ( maxLen > 0 )
@ -672,7 +674,7 @@ int V_snprintf( char *pDest, int maxLen, char const *pFormat, ... )
{ {
Assert( maxLen >= 0 ); Assert( maxLen >= 0 );
AssertValidWritePtr( pDest, maxLen ); AssertValidWritePtr( pDest, maxLen );
AssertValidStringPtr( pFormat ); _AssertValidStringPtr( pFormat );
va_list marker; va_list marker;
@ -701,7 +703,7 @@ int V_vsnprintf( char *pDest, int maxLen, char const *pFormat, va_list params )
{ {
Assert( maxLen > 0 ); Assert( maxLen > 0 );
AssertValidWritePtr( pDest, maxLen ); AssertValidWritePtr( pDest, maxLen );
AssertValidStringPtr( pFormat ); _AssertValidStringPtr( pFormat );
int len = _vsnprintf( pDest, maxLen, pFormat, params ); int len = _vsnprintf( pDest, maxLen, pFormat, params );
@ -730,8 +732,8 @@ char *V_strncat(char *pDest, const char *pSrc, size_t destBufferSize, int max_ch
size_t charstocopy = (size_t)0; size_t charstocopy = (size_t)0;
Assert( destBufferSize >= 0 ); Assert( destBufferSize >= 0 );
AssertValidStringPtr( pDest); _AssertValidStringPtr( pDest);
AssertValidStringPtr( pSrc ); _AssertValidStringPtr( pSrc );
size_t len = strlen(pDest); size_t len = strlen(pDest);
size_t srclen = strlen( pSrc ); size_t srclen = strlen( pSrc );
@ -888,21 +890,21 @@ char *V_pretifynum( int64 value )
if ( value >= 1000000000000LL ) if ( value >= 1000000000000LL )
{ {
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
V_snprintf( pchRender, 32, "%d,", value / 1000000000000LL ); V_snprintf( pchRender, 32, "%lld,", value / 1000000000000LL );
} }
// Render trillions // Render trillions
if ( value >= 1000000000000LL ) if ( value >= 1000000000000LL )
{ {
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
V_snprintf( pchRender, 32, "%d,", value / 1000000000000LL ); V_snprintf( pchRender, 32, "%lld,", value / 1000000000000LL );
} }
// Render billions // Render billions
if ( value >= 1000000000 ) if ( value >= 1000000000 )
{ {
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
V_snprintf( pchRender, 32, "%d,", value / 1000000000 ); V_snprintf( pchRender, 32, "%lld,", value / 1000000000 );
} }
// Render millions // Render millions
@ -910,9 +912,9 @@ char *V_pretifynum( int64 value )
{ {
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
if ( value >= 1000000000 ) if ( value >= 1000000000 )
V_snprintf( pchRender, 32, "%03d,", ( value / 1000000 ) % 1000 ); V_snprintf( pchRender, 32, "%03d,", (unsigned int)(( value / 1000000 ) % 1000 ));
else else
V_snprintf( pchRender, 32, "%d,", ( value / 1000000 ) % 1000 ); V_snprintf( pchRender, 32, "%d,", (unsigned int)(( value / 1000000 ) % 1000 ));
} }
// Render thousands // Render thousands
@ -920,17 +922,17 @@ char *V_pretifynum( int64 value )
{ {
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
if ( value >= 1000000 ) if ( value >= 1000000 )
V_snprintf( pchRender, 32, "%03d,", ( value / 1000 ) % 1000 ); V_snprintf( pchRender, 32, "%03d,", (unsigned int)(( value / 1000 ) % 1000 ));
else else
V_snprintf( pchRender, 32, "%d,", ( value / 1000 ) % 1000 ); V_snprintf( pchRender, 32, "%d,", (unsigned int)(( value / 1000 ) % 1000 ));
} }
// Render units // Render units
char *pchRender = out + V_strlen( out ); char *pchRender = out + V_strlen( out );
if ( value > 1000 ) if ( value > 1000 )
V_snprintf( pchRender, 32, "%03d", value % 1000 ); V_snprintf( pchRender, 32, "%03d", (unsigned int)(value % 1000) );
else else
V_snprintf( pchRender, 32, "%d", value % 1000 ); V_snprintf( pchRender, 32, "%d", (unsigned int)(value % 1000) );
return out; return out;
} }
@ -941,7 +943,7 @@ char *V_pretifynum( int64 value )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInBytes ) int V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInBytes )
{ {
AssertValidStringPtr(pUTF8); _AssertValidStringPtr(pUTF8);
AssertValidWritePtr(pwchDest); AssertValidWritePtr(pwchDest);
pwchDest[0] = 0; pwchDest[0] = 0;
@ -959,7 +961,7 @@ int V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInByte
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int V_UnicodeToUTF8( const wchar_t *pUnicode, char *pUTF8, int cubDestSizeInBytes ) int V_UnicodeToUTF8( const wchar_t *pUnicode, char *pUTF8, int cubDestSizeInBytes )
{ {
AssertValidStringPtr(pUTF8, cubDestSizeInBytes); _AssertValidStringPtr(pUTF8, cubDestSizeInBytes);
AssertValidReadPtr(pUnicode); AssertValidReadPtr(pUnicode);
pUTF8[0] = 0; pUTF8[0] = 0;

View File

@ -6,20 +6,7 @@
#include <tier1/tier1.h> #include <tier1/tier1.h>
#include "tier0/dbg.h" #include "tier0/dbg.h"
#include "vstdlib/iprocessutils.h" #include "interfaces/interfaces.h"
#include "icvar.h"
//-----------------------------------------------------------------------------
// These tier1 libraries must be set by any users of this library.
// They can be set by calling ConnectTier1Libraries or InitDefaultFileSystem.
// It is hoped that setting this, and using this library will be the common mechanism for
// allowing link libraries to access tier1 library interfaces
//-----------------------------------------------------------------------------
ICvar *cvar = 0;
ICvar *g_pCVar = 0;
IProcessUtils *g_pProcessUtils = 0;
static bool s_bConnected = false;
// for utlsortvector.h // for utlsortvector.h
#ifndef _WIN32 #ifndef _WIN32
@ -33,31 +20,10 @@ static bool s_bConnected = false;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount ) void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount )
{ {
// Don't connect twice.. ConnectInterfaces( pFactoryList, nFactoryCount);
if ( s_bConnected )
return;
s_bConnected = true;
for ( int i = 0; i < nFactoryCount; ++i )
{
if ( !g_pCVar )
{
cvar = g_pCVar = ( ICvar * )pFactoryList[i]( CVAR_INTERFACE_VERSION, NULL );
}
if ( !g_pProcessUtils )
{
g_pProcessUtils = ( IProcessUtils * )pFactoryList[i]( PROCESS_UTILS_INTERFACE_VERSION, NULL );
}
}
} }
void DisconnectTier1Libraries() void DisconnectTier1Libraries()
{ {
if ( !s_bConnected ) DisconnectInterfaces();
return;
g_pCVar = cvar = 0;
g_pProcessUtils = NULL;
s_bConnected = false;
} }

20
tier1/tier1.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1.vcxproj", "{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.ActiveCfg = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Debug|Win32.Build.0 = Debug|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.ActiveCfg = Release|Win32
{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

254
tier1/tier1.vcxproj Normal file
View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>tier1</ProjectName>
<ProjectGuid>{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}</ProjectGuid>
<RootNamespace>tier1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PostBuildEventUseInBuild>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\lib\public\</OutDir>
<PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;VEL': value '0' doesn't match value '2' in core_metamod.obj;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>
</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>
</PrecompiledHeader>
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput>
</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
<WarningLevel>Level3</WarningLevel>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
</ClCompile>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Xdcmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Xdcmake>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(OutDir)tier1.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="bitbuf.cpp" />
<ClCompile Include="byteswap.cpp" />
<ClCompile Include="characterset.cpp" />
<ClCompile Include="checksum_crc.cpp" />
<ClCompile Include="checksum_md5.cpp" />
<ClCompile Include="commandbuffer.cpp" />
<ClCompile Include="convar.cpp" />
<ClCompile Include="datamanager.cpp" />
<ClCompile Include="diff.cpp" />
<ClCompile Include="generichash.cpp" />
<ClCompile Include="interface.cpp" />
<ClCompile Include="KeyValues.cpp" />
<ClCompile Include="mempool.cpp" />
<ClCompile Include="memstack.cpp" />
<ClCompile Include="NetAdr.cpp" />
<ClCompile Include="newbitbuf.cpp" />
<ClCompile Include="processor_detect.cpp">
<ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Sync</ExceptionHandling>
<ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Sync</ExceptionHandling>
</ClCompile>
<ClCompile Include="rangecheckedvar.cpp" />
<ClCompile Include="stringpool.cpp" />
<ClCompile Include="strtools.cpp" />
<ClCompile Include="tier1.cpp" />
<ClCompile Include="uniqueid.cpp" />
<ClCompile Include="utlbuffer.cpp" />
<ClCompile Include="utlbufferutil.cpp" />
<ClCompile Include="utlstring.cpp" />
<ClCompile Include="utlsymbol.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\tier1\bitbuf.h" />
<ClInclude Include="..\public\tier1\byteswap.h" />
<ClInclude Include="..\public\tier1\callqueue.h" />
<ClInclude Include="..\public\tier1\characterset.h" />
<ClInclude Include="..\public\tier1\checksum_crc.h" />
<ClInclude Include="..\public\tier1\checksum_md5.h" />
<ClInclude Include="..\public\tier1\CommandBuffer.h" />
<ClInclude Include="..\public\tier1\convar.h" />
<ClInclude Include="..\public\tier1\datamanager.h" />
<ClInclude Include="..\public\datamap.h" />
<ClInclude Include="..\public\tier1\delegates.h" />
<ClInclude Include="..\public\tier1\diff.h" />
<ClInclude Include="..\public\tier1\fmtstr.h" />
<ClInclude Include="..\public\tier1\functors.h" />
<ClInclude Include="..\public\tier1\generichash.h" />
<ClInclude Include="..\public\tier1\iconvar.h" />
<ClInclude Include="..\public\tier1\interface.h" />
<ClInclude Include="..\public\tier1\KeyValues.h" />
<ClInclude Include="..\public\tier1\lzmaDecoder.h" />
<ClInclude Include="..\public\tier1\lzss.h" />
<ClInclude Include="..\public\tier1\mempool.h" />
<ClInclude Include="..\public\tier1\memstack.h" />
<ClInclude Include="..\public\tier1\netadr.h" />
<ClInclude Include="..\public\tier1\processor_detect.h" />
<ClInclude Include="..\public\tier1\rangecheckedvar.h" />
<ClInclude Include="..\public\tier1\refcount.h" />
<ClInclude Include="..\public\tier1\smartptr.h" />
<ClInclude Include="..\public\tier1\stringpool.h" />
<ClInclude Include="..\public\tier1\strtools.h" />
<ClInclude Include="..\public\tier1\tier1.h" />
<ClInclude Include="..\public\tier1\uniqueid.h" />
<ClInclude Include="..\public\tier1\utlbidirectionalset.h" />
<ClInclude Include="..\public\tier1\utlblockmemory.h" />
<ClInclude Include="..\public\tier1\utlbuffer.h" />
<ClInclude Include="..\public\tier1\utlbufferutil.h" />
<ClInclude Include="..\public\tier1\utldict.h" />
<ClInclude Include="..\public\tier1\utlenvelope.h" />
<ClInclude Include="..\public\tier1\utlfixedmemory.h" />
<ClInclude Include="..\public\tier1\utlhandletable.h" />
<ClInclude Include="..\public\tier1\utlhash.h" />
<ClInclude Include="..\public\tier1\utllinkedlist.h" />
<ClInclude Include="..\public\tier1\utlmap.h" />
<ClInclude Include="..\public\tier1\utlmemory.h" />
<ClInclude Include="..\public\tier1\utlmultilist.h" />
<ClInclude Include="..\public\tier1\utlpriorityqueue.h" />
<ClInclude Include="..\public\tier1\utlqueue.h" />
<ClInclude Include="..\public\tier1\utlrbtree.h" />
<ClInclude Include="..\public\tier1\UtlSortVector.h" />
<ClInclude Include="..\public\tier1\utlstack.h" />
<ClInclude Include="..\public\tier1\utlstring.h" />
<ClInclude Include="..\public\tier1\UtlStringMap.h" />
<ClInclude Include="..\public\tier1\utlsymbol.h" />
<ClInclude Include="..\public\tier1\utlvector.h" />
<ClInclude Include="..\common\xbox\xboxstubs.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

257
tier1/tier1.vcxproj.filters Normal file
View File

@ -0,0 +1,257 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{aba1d919-d95c-4c3f-a495-be0375bab184}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{0295d938-2af6-4393-9785-4b7b122313c9}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="bitbuf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="byteswap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="characterset.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="checksum_crc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="checksum_md5.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="commandbuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="convar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="datamanager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="diff.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="generichash.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="interface.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="KeyValues.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mempool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="memstack.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NetAdr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="newbitbuf.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="processor_detect.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="rangecheckedvar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stringpool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="strtools.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tier1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="uniqueid.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utlbuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utlbufferutil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utlstring.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utlsymbol.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\public\tier1\bitbuf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\byteswap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\callqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\characterset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\checksum_crc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\checksum_md5.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\CommandBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\convar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\datamanager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\datamap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\delegates.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\diff.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\fmtstr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\functors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\generichash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\iconvar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\interface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\KeyValues.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\lzmaDecoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\lzss.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\mempool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\memstack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\netadr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\processor_detect.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\rangecheckedvar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\refcount.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\smartptr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\stringpool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\strtools.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\tier1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\uniqueid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbidirectionalset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlblockmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlbufferutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utldict.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlenvelope.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlfixedmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlhandletable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlhash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utllinkedlist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlmultilist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlpriorityqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlrbtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\UtlSortVector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlstack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlstring.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\UtlStringMap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlsymbol.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\public\tier1\utlvector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common\xbox\xboxstubs.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>