Update to current-ish.

This commit is contained in:
Nicholas Hastings 2016-08-23 21:38:05 -04:00
parent badee7a0de
commit 737599c056
49 changed files with 1912 additions and 2586 deletions

View File

@ -153,11 +153,7 @@ public:
// The Source engine is really designed for 32 or less players. If you raise this number above 32, you better know what you are doing
// and have a good answer for a bunch of perf question related to player simulation, thinking logic, tracelines, networking overhead, etc.
// But if you are brave or are doing something interesting, go for it... ywb 9/22/03
#if defined( CSTRIKE_DLL )
#define MAX_PLAYERS 64 // Absolute max players supported
#else
#define MAX_PLAYERS 32 // Absolute max players supported
#endif
#define MAX_PLAYERS 128 // Absolute max players supported
#define MAX_PLACE_NAME_LENGTH 18
@ -695,6 +691,7 @@ struct EmitSound_t
m_SoundLevel( SNDLVL_NONE ),
m_nFlags( 0 ),
m_nPitch( PITCH_NORM ),
m_nSpecialDSP( 0 ),
m_pOrigin( 0 ),
m_flSoundTime( 0.0f ),
m_pflSoundDuration( 0 ),
@ -715,6 +712,7 @@ struct EmitSound_t
soundlevel_t m_SoundLevel;
int m_nFlags;
int m_nPitch;
int m_nSpecialDSP;
const Vector *m_pOrigin;
float m_flSoundTime; ///< NOT DURATION, but rather, some absolute time in the future until which this sound should be delayed
float *m_pflSoundDuration;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,8 @@
#
#
OS := $(shell uname -s)
#############################################################################
# Developer configurable items
#############################################################################
@ -24,10 +26,17 @@ SRCDS_DIR = ~/srcds/orangebox
GAME_DIR = $(SRCDS_DIR)/scratchmod
# compiler options (gcc 3.4.1 or above is required - 4.1.2+ recommended)
CC = /usr/bin/gcc-4.2
CPLUS = /usr/bin/g++-4.2
CLINK = /usr/bin/gcc-4.2
CPP_LIB = "libstdc++.a libgcc_eh.a"
#ifeq "$(OS)" "Darwin"
CC = /usr/bin/clang-3.8
CPLUS = /usr/bin/clang++-3.8
CLINK = /usr/bin/clang-3.8
CPP_LIB =
#else
#CC = /usr/bin/gcc
#CPLUS = /usr/bin/g++
#CLINK = /usr/bin/gcc
#CPP_LIB = $(SRCDS_DIR)/bin/libstdc++.so.6 $(SRCDS_DIR)/bin/libgcc_s.so.1
#endif
# put any compiler flags you want passed here
USER_CFLAGS =
@ -58,21 +67,37 @@ BUILD_OBJ_DIR = $(BUILD_DIR)/obj
# the location of the source code
SRC_DIR = ..
# the location of the Linux static libraries
# the location of the static libraries
ifeq "$(OS)" "Darwin"
LIB_DIR = $(SRC_DIR)/lib/mac
else
LIB_DIR = $(SRC_DIR)/lib/linux
endif
# the CPU target for the build, must be i486 for now
ARCH = i486
ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -m32
DEFINES = -D_LINUX -DLINUX -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
ifeq "$(OS)" "Darwin"
DEFINES = -D_OSX -DOSX
SHLIBEXT = dylib
SHLIBLDFLAGS = -dynamiclib -mmacosx-version-min=10.5
SHLIBSUFFIX =
else
DEFINES = -D_LINUX -DLINUX
SHLIBEXT = so
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl
SHLIBSUFFIX = _srv
endif
DEFINES +=-DGNUC -D_POSIX -DPOSIX -DVPROF_LEVEL=1 -DSWDS -DNO_MALLOC_OVERRIDE -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
-Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wconversion -Wno-non-virtual-dtor -Wno-invalid-offsetof
SHLIBEXT = so
BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \
-Wno-delete-non-virtual-dtor -Wno-unused-const-variable
SHLIBCFLAGS = -fPIC
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl
# Flags passed to the c compiler
CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS)
@ -88,7 +113,7 @@ DBG_CFLAGS = "$(DEFINES) $(ARCH_CFLAGS) -g -ggdb $(BASE_CFLAGS) $(UNDEF)"
# define list passed to make for the sub makefile
BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \
BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \
LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \
LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS="$(SHLIBLDFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBSUFFIX=$(SHLIBSUFFIX) \
CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \
DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \
ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \
@ -111,9 +136,9 @@ check:
if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi
if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi
if [ ! -e "$(LIB_DIR)/choreoobjects_i486.a" ]; then $(MAKE) choreo;fi
if [ ! -f "tier0_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/tier0_i486.so .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/vstdlib_i486.so .; fi
if [ ! -f "steam_api_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/steam_api_i486.so .; fi
if [ ! -f "libtier0$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libtier0$(SHLIBSUFFIX).$(SHLIBEXT) .; fi
if [ ! -f "libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT) .; fi
if [ ! -f "libsteam_api.$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libsteam_api.$(SHLIBEXT) .; fi
vcpm: check
if [ ! -e "vcpm" ]; then $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES);fi

View File

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

View File

@ -42,7 +42,6 @@ LIB_OBJS= \
$(LIB_OBJ_DIR)/interface.o \
$(LIB_OBJ_DIR)/KeyValues.o \
$(LIB_OBJ_DIR)/mempool.o \
$(LIB_OBJ_DIR)/memstack.o \
$(LIB_OBJ_DIR)/NetAdr.o \
$(LIB_OBJ_DIR)/newbitbuf.o \
$(LIB_OBJ_DIR)/processor_detect.o \

View File

@ -1,193 +0,0 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 3DNow Math primitives.
//
//=====================================================================================//
#include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/amd3dx.h"
#include "mathlib/vector.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#ifdef _MSC_VER
#pragma warning(disable:4244) // "conversion from 'const int' to 'float', possible loss of data"
#pragma warning(disable:4730) // "mixing _m64 and floating point expressions may result in incorrect code"
#endif
//-----------------------------------------------------------------------------
// 3D Now Implementations of optimized routines:
//-----------------------------------------------------------------------------
float _3DNow_Sqrt(float x)
{
Assert( s_bMathlibInitialized );
float root = 0.f;
#ifdef _WIN32
_asm
{
femms
movd mm0, x
PFRSQRT (mm1,mm0)
punpckldq mm0, mm0
PFMUL (mm0, mm1)
movd root, mm0
femms
}
#elif defined _LINUX || defined __APPLE__
__asm __volatile__( "femms" );
__asm __volatile__
(
"pfrsqrt %y0, %y1 \n\t"
"punpckldq %y1, %y1 \n\t"
"pfmul %y1, %y0 \n\t"
: "=y" (root), "=y" (x)
:"0" (x)
);
__asm __volatile__( "femms" );
#else
#error
#endif
return root;
}
// NJS FIXME: Need to test Recripricol squareroot performance and accuraccy
// on AMD's before using the specialized instruction.
float _3DNow_RSqrt(float x)
{
Assert( s_bMathlibInitialized );
return 1.f / _3DNow_Sqrt(x);
}
float FASTCALL _3DNow_VectorNormalize (Vector& vec)
{
Assert( s_bMathlibInitialized );
float *v = &vec[0];
float radius = 0.f;
if ( v[0] || v[1] || v[2] )
{
#ifdef _WIN32
_asm
{
mov eax, v
femms
movq mm0, QWORD PTR [eax]
movd mm1, DWORD PTR [eax+8]
movq mm2, mm0
movq mm3, mm1
PFMUL (mm0, mm0)
PFMUL (mm1, mm1)
PFACC (mm0, mm0)
PFADD (mm1, mm0)
PFRSQRT (mm0, mm1)
punpckldq mm1, mm1
PFMUL (mm1, mm0)
PFMUL (mm2, mm0)
PFMUL (mm3, mm0)
movq QWORD PTR [eax], mm2
movd DWORD PTR [eax+8], mm3
movd radius, mm1
femms
}
#elif defined _LINUX || defined __APPLE__
long long a,c;
int b,d;
memcpy(&a,&vec[0],sizeof(a));
memcpy(&b,&vec[2],sizeof(b));
memcpy(&c,&vec[0],sizeof(c));
memcpy(&d,&vec[2],sizeof(d));
__asm __volatile__( "femms" );
__asm __volatile__
(
"pfmul %y3, %y3\n\t"
"pfmul %y0, %y0 \n\t"
"pfacc %y3, %y3 \n\t"
"pfadd %y3, %y0 \n\t"
"pfrsqrt %y0, %y3 \n\t"
"punpckldq %y0, %y0 \n\t"
"pfmul %y3, %y0 \n\t"
"pfmul %y3, %y2 \n\t"
"pfmul %y3, %y1 \n\t"
: "=y" (radius), "=y" (c), "=y" (d)
: "y" (a), "0" (b), "1" (c), "2" (d)
);
memcpy(&vec[0],&c,sizeof(c));
memcpy(&vec[2],&d,sizeof(d));
__asm __volatile__( "femms" );
#else
#error
#endif
}
return radius;
}
void FASTCALL _3DNow_VectorNormalizeFast (Vector& vec)
{
_3DNow_VectorNormalize( vec );
}
// JAY: This complains with the latest processor pack
#ifdef _MSC_VER
#pragma warning(disable: 4730)
#endif
float _3DNow_InvRSquared(const float* v)
{
Assert( s_bMathlibInitialized );
float r2 = 1.f;
#ifdef _WIN32
_asm { // AMD 3DNow only routine
mov eax, v
femms
movq mm0, QWORD PTR [eax]
movd mm1, DWORD PTR [eax+8]
movd mm2, [r2]
PFMUL (mm0, mm0)
PFMUL (mm1, mm1)
PFACC (mm0, mm0)
PFADD (mm1, mm0)
PFMAX (mm1, mm2)
PFRCP (mm0, mm1)
movd [r2], mm0
femms
}
#elif defined _LINUX || defined __APPLE__
long long a,c;
int b;
memcpy(&a,&v[0],sizeof(a));
memcpy(&b,&v[2],sizeof(b));
memcpy(&c,&v[0],sizeof(c));
__asm __volatile__( "femms" );
__asm __volatile__
(
"PFMUL %y2, %y2 \n\t"
"PFMUL %y3, %y3 \n\t"
"PFACC %y2, %y2 \n\t"
"PFADD %y2, %y3 \n\t"
"PFMAX %y3, %y4 \n\t"
"PFRCP %y3, %y2 \n\t"
"movq %y2, %y0 \n\t"
: "=y" (r2)
: "0" (r2), "y" (a), "y" (b), "y" (c)
);
__asm __volatile__( "femms" );
#else
#error
#endif
return r2;
}

View File

@ -1,16 +0,0 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=====================================================================================//
#ifndef _3DNOW_H
#define _3DNOW_H
float _3DNow_Sqrt(float x);
float _3DNow_RSqrt(float x);
float FASTCALL _3DNow_VectorNormalize (Vector& vec);
void FASTCALL _3DNow_VectorNormalizeFast (Vector& vec);
float _3DNow_InvRSquared(const float* v);
#endif // _3DNOW_H

View File

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

22
mathlib/mathlib-2005.sln Normal file
View File

@ -0,0 +1,22 @@

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

View File

@ -1,407 +0,0 @@
<?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>

View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>mathlib</ProjectName>
<ProjectGuid>{884C66F2-7F84-4570-AE6C-B634C1113D69}</ProjectGuid>
<RootNamespace>mathlib</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</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>14.0.25420.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>.\Debug\</OutDir>
<IntDir>.\Debug\</IntDir>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command />
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;..\public\mathlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<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 />
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation />
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command />
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\mathlib.lib</OutputFile>
<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 />
</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;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<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 />
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation />
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command />
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>..\lib\public\mathlib.lib</OutputFile>
<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\mathlib.h" />
<ClInclude Include="..\public\mathlib\math_pfns.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="noisedata.h" />
<ClInclude Include="sse.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,150 @@
<?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>{b3a9ae3e-2130-49ce-828c-923c9d4de5b1}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Public Header Files">
<UniqueIdentifier>{1d151cce-a8fe-4bc0-97f5-605b9531b637}</UniqueIdentifier>
<Extensions>h</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{95debf5a-5683-4ab3-ad3a-638316176fd8}</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="noisedata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sse.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -24,8 +24,6 @@
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#if !defined( _X360 )
#include "mathlib/amd3dx.h"
#include "3dnow.h"
#include "sse.h"
#endif
@ -3235,24 +3233,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
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;
}
s_b3DNowEnabled = false;
if ( bAllowSSE && pi.m_bSSE )
{

View File

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

View File

@ -35,18 +35,18 @@ static const uint32 _sincos_inv_masks[] = { (uint32)~0x0, (uint32)0x0 };
#define _PS_CONST(Name, Val) \
static const __declspec(align(16)) float _ps_##Name[4] = { Val, Val, Val, Val }
#elif defined _LINUX || defined __APPLE__
#elif POSIX
#define _PS_EXTERN_CONST(Name, Val) \
const __attribute__((aligned(16))) float _ps_##Name[4] = { Val, Val, Val, Val }
const float _ps_##Name[4] __attribute__((aligned(16))) = { Val, Val, Val, Val }
#define _PS_EXTERN_CONST_TYPE(Name, Type, Val) \
const __attribute__((aligned(16))) Type _ps_##Name[4] = { Val, Val, Val, Val }; \
const Type _ps_##Name[4] __attribute__((aligned(16))) = { Val, Val, Val, Val }; \
#define _EPI32_CONST(Name, Val) \
static const __attribute__((aligned(16))) int32 _epi32_##Name[4] = { Val, Val, Val, Val }
static const int32 _epi32_##Name[4] __attribute__((aligned(16))) = { Val, Val, Val, Val }
#define _PS_CONST(Name, Val) \
static const __attribute__((aligned(16))) float _ps_##Name[4] = { Val, Val, Val, Val }
static const float _ps_##Name[4] __attribute__((aligned(16))) = { Val, Val, Val, Val }
#endif
_PS_EXTERN_CONST(am_0, 0.0f);
@ -90,14 +90,8 @@ float _SSE_Sqrt(float x)
sqrtss xmm0, x
movss root, xmm0
}
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"movss %1,%%xmm2\n"
"sqrtss %%xmm2,%%xmm1\n"
"movss %%xmm1,%0"
: "=m" (root)
: "m" (x)
);
#elif POSIX
_mm_store_ss( &root, _mm_sqrt_ss( _mm_load_ss( &x ) ) );
#endif
return root;
}
@ -120,14 +114,21 @@ float _SSE_RSqrtAccurate(float x)
return (0.5f * rroot) * (3.f - (x * rroot) * rroot);
}
#else
#ifdef POSIX
const __m128 f3 = _mm_set_ss(3.0f); // 3 as SSE value
const __m128 f05 = _mm_set_ss(0.5f); // 0.5 as SSE value
#endif
// Intel / Kipps SSE RSqrt. Significantly faster than above.
float _SSE_RSqrtAccurate(float a)
{
#ifdef _WIN32
float x;
float half = 0.5f;
float three = 3.f;
#ifdef _WIN32
__asm
{
movss xmm3, a;
@ -143,26 +144,25 @@ float _SSE_RSqrtAccurate(float a)
movss x, xmm1;
}
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"movss %1, %%xmm3 \n\t"
"movss %2, %%xmm1 \n\t"
"movss %3, %%xmm2 \n\t"
"rsqrtss %%xmm3, %%xmm0 \n\t"
"mulss %%xmm0, %%xmm3 \n\t"
"mulss %%xmm0, %%xmm1 \n\t"
"mulss %%xmm0, %%xmm3 \n\t"
"subss %%xmm3, %%xmm2 \n\t"
"mulss %%xmm2, %%xmm1 \n\t"
"movss %%xmm1, %0 \n\t"
: "=m" (x)
: "m" (a), "m" (half), "m" (three)
);
return x;
#elif POSIX
__m128 xx = _mm_load_ss( &a );
__m128 xr = _mm_rsqrt_ss( xx );
__m128 xt;
xt = _mm_mul_ss( xr, xr );
xt = _mm_mul_ss( xt, xx );
xt = _mm_sub_ss( f3, xt );
xt = _mm_mul_ss( xt, f05 );
xr = _mm_mul_ss( xr, xt );
_mm_store_ss( &a, xr );
return a;
#else
#error "Not Implemented"
#endif
return x;
}
#endif
@ -179,14 +179,8 @@ float _SSE_RSqrtFast(float x)
rsqrtss xmm0, x
movss rroot, xmm0
}
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"rsqrtss %1, %%xmm0 \n\t"
"movss %%xmm0, %0 \n\t"
: "=m" (x)
: "m" (rroot)
: "%xmm0"
);
#elif POSIX
__asm__ __volatile__( "rsqrtss %0, %1" : "=x" (rroot) : "x" (x) );
#else
#error
#endif
@ -202,11 +196,14 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
// sice vec only has 3 floats, we can't "movaps" directly into it.
#ifdef _WIN32
__declspec(align(16)) float result[4];
#elif defined _LINUX || defined __APPLE__
__attribute__((aligned(16))) float result[4];
#elif POSIX
float result[4] __attribute__((aligned(16)));
#endif
float *v = &vec[0];
#ifdef _WIN32
float *r = &result[0];
#endif
float radius = 0.f;
// Blah, get rid of these comparisons ... in reality, if you have all 3 as zero, it shouldn't
@ -214,7 +211,6 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
if ( v[0] || v[1] || v[2] )
{
#ifdef _WIN32
float *r = &result[0];
_asm
{
mov eax, v
@ -239,7 +235,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
mulps xmm4, xmm1 // r4 = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
movaps [edx], xmm4 // v = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
}
#elif defined _LINUX || defined __APPLE__
#elif POSIX
__asm__ __volatile__(
#ifdef ALIGNED_VECTOR
"movaps %2, %%xmm4 \n\t"
@ -262,6 +258,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
"movaps %%xmm4, %1 \n\t"
: "=m" (radius), "=m" (result)
: "m" (*v)
: "xmm1", "xmm2", "xmm3", "xmm4"
);
#else
#error "Not Implemented"
@ -303,12 +300,13 @@ float _SSE_InvRSquared(const float* v)
shufps xmm2, xmm2, 1 // x2 = vy * vy, X, X, X
addss xmm1, xmm2 // x1 = (vx * vx) + (vy * vy), X, X, X
addss xmm1, xmm3 // x1 = (vx * vx) + (vy * vy) + (vz * vz), X, X, X
maxss xmm1, xmm5 // x1 = MAX( 1.0, x1 )
rcpss xmm0, xmm1 // x0 = 1 / MAX( 1.0, x1 )
maxss xmm1, xmm5 // x1 = max( 1.0, x1 )
rcpss xmm0, xmm1 // x0 = 1 / max( 1.0, x1 )
movss inv_r2, xmm0 // inv_r2 = x0
}
#elif defined _LINUX || defined __APPLE__
#elif POSIX
__asm__ __volatile__(
"movss %0, %%xmm5 \n\t"
#ifdef ALIGNED_VECTOR
"movaps %1, %%xmm4 \n\t"
#else
@ -324,8 +322,9 @@ float _SSE_InvRSquared(const float* v)
"maxss %%xmm5, %%xmm1 \n\t"
"rcpss %%xmm1, %%xmm0 \n\t"
"movss %%xmm0, %0 \n\t"
: "=m" (inv_r2)
: "m" (*v), "m" (inv_r2)
: "+m" (inv_r2)
: "m" (*v)
: "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
);
#else
#error "Not Implemented"
@ -334,6 +333,48 @@ float _SSE_InvRSquared(const float* v)
return inv_r2;
}
#ifdef POSIX
// #define _PS_CONST(Name, Val) static const ALIGN16 float _ps_##Name[4] ALIGN16_POST = { Val, Val, Val, Val }
#define _PS_CONST_TYPE(Name, Type, Val) static const ALIGN16 Type _ps_##Name[4] ALIGN16_POST = { Val, Val, Val, Val }
_PS_CONST_TYPE(sign_mask, int, 0x80000000);
_PS_CONST_TYPE(inv_sign_mask, int, ~0x80000000);
#define _PI32_CONST(Name, Val) static const ALIGN16 int _pi32_##Name[4] ALIGN16_POST = { Val, Val, Val, Val }
_PI32_CONST(1, 1);
_PI32_CONST(inv1, ~1);
_PI32_CONST(2, 2);
_PI32_CONST(4, 4);
_PI32_CONST(0x7f, 0x7f);
_PS_CONST(1 , 1.0f);
_PS_CONST(0p5, 0.5f);
_PS_CONST(minus_cephes_DP1, -0.78515625);
_PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);
_PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8);
_PS_CONST(sincof_p0, -1.9515295891E-4);
_PS_CONST(sincof_p1, 8.3321608736E-3);
_PS_CONST(sincof_p2, -1.6666654611E-1);
_PS_CONST(coscof_p0, 2.443315711809948E-005);
_PS_CONST(coscof_p1, -1.388731625493765E-003);
_PS_CONST(coscof_p2, 4.166664568298827E-002);
_PS_CONST(cephes_FOPI, 1.27323954473516); // 4 / M_PI
typedef union xmm_mm_union {
__m128 xmm;
__m64 mm[2];
} xmm_mm_union;
#define COPY_MM_TO_XMM(mm0_, mm1_, xmm_) { xmm_mm_union u; u.mm[0]=mm0_; u.mm[1]=mm1_; xmm_ = u.xmm; }
typedef __m128 v4sf; // vector of 4 float (sse1)
typedef __m64 v2si; // vector of 2 int (mmx)
#endif
void _SSE_SinCos(float x, float* s, float* c)
{
#ifdef _WIN32
@ -421,8 +462,121 @@ void _SSE_SinCos(float x, float* s, float* c)
movss [eax], xmm0
movss [edx], xmm4
}
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE_sincos NOT implemented!"
#elif POSIX
Assert( "Needs testing, verify impl!\n" );
v4sf xx = _mm_load_ss( &x );
v4sf xmm1, xmm2, xmm3 = _mm_setzero_ps(), sign_bit_sin, y;
v2si mm0, mm1, mm2, mm3, mm4, mm5;
sign_bit_sin = xx;
/* take the absolute value */
xx = _mm_and_ps(xx, *(v4sf*)_ps_inv_sign_mask);
/* extract the sign bit (upper one) */
sign_bit_sin = _mm_and_ps(sign_bit_sin, *(v4sf*)_ps_sign_mask);
/* scale by 4/Pi */
y = _mm_mul_ps(xx, *(v4sf*)_ps_cephes_FOPI);
/* store the integer part of y in mm2:mm3 */
xmm3 = _mm_movehl_ps(xmm3, y);
mm2 = _mm_cvttps_pi32(y);
mm3 = _mm_cvttps_pi32(xmm3);
/* j=(j+1) & (~1) (see the cephes sources) */
mm2 = _mm_add_pi32(mm2, *(v2si*)_pi32_1);
mm3 = _mm_add_pi32(mm3, *(v2si*)_pi32_1);
mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_inv1);
mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_inv1);
y = _mm_cvtpi32x2_ps(mm2, mm3);
mm4 = mm2;
mm5 = mm3;
/* get the swap sign flag for the sine */
mm0 = _mm_and_si64(mm2, *(v2si*)_pi32_4);
mm1 = _mm_and_si64(mm3, *(v2si*)_pi32_4);
mm0 = _mm_slli_pi32(mm0, 29);
mm1 = _mm_slli_pi32(mm1, 29);
v4sf swap_sign_bit_sin;
COPY_MM_TO_XMM(mm0, mm1, swap_sign_bit_sin);
/* get the polynom selection mask for the sine */
mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_2);
mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_2);
mm2 = _mm_cmpeq_pi32(mm2, _mm_setzero_si64());
mm3 = _mm_cmpeq_pi32(mm3, _mm_setzero_si64());
v4sf poly_mask;
COPY_MM_TO_XMM(mm2, mm3, poly_mask);
/* The magic pass: "Extended precision modular arithmetic"
x = ((x - y * DP1) - y * DP2) - y * DP3; */
xmm1 = *(v4sf*)_ps_minus_cephes_DP1;
xmm2 = *(v4sf*)_ps_minus_cephes_DP2;
xmm3 = *(v4sf*)_ps_minus_cephes_DP3;
xmm1 = _mm_mul_ps(y, xmm1);
xmm2 = _mm_mul_ps(y, xmm2);
xmm3 = _mm_mul_ps(y, xmm3);
xx = _mm_add_ps(xx, xmm1);
xx = _mm_add_ps(xx, xmm2);
xx = _mm_add_ps(xx, xmm3);
/* get the sign flag for the cosine */
mm4 = _mm_sub_pi32(mm4, *(v2si*)_pi32_2);
mm5 = _mm_sub_pi32(mm5, *(v2si*)_pi32_2);
mm4 = _mm_andnot_si64(mm4, *(v2si*)_pi32_4);
mm5 = _mm_andnot_si64(mm5, *(v2si*)_pi32_4);
mm4 = _mm_slli_pi32(mm4, 29);
mm5 = _mm_slli_pi32(mm5, 29);
v4sf sign_bit_cos;
COPY_MM_TO_XMM(mm4, mm5, sign_bit_cos);
_mm_empty(); /* good-bye mmx */
sign_bit_sin = _mm_xor_ps(sign_bit_sin, swap_sign_bit_sin);
/* Evaluate the first polynom (0 <= x <= Pi/4) */
v4sf z = _mm_mul_ps(xx,xx);
y = *(v4sf*)_ps_coscof_p0;
y = _mm_mul_ps(y, z);
y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p1);
y = _mm_mul_ps(y, z);
y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p2);
y = _mm_mul_ps(y, z);
y = _mm_mul_ps(y, z);
v4sf tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);
y = _mm_sub_ps(y, tmp);
y = _mm_add_ps(y, *(v4sf*)_ps_1);
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
v4sf y2 = *(v4sf*)_ps_sincof_p0;
y2 = _mm_mul_ps(y2, z);
y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p1);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p2);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_mul_ps(y2, xx);
y2 = _mm_add_ps(y2, xx);
/* select the correct result from the two polynoms */
xmm3 = poly_mask;
v4sf ysin2 = _mm_and_ps(xmm3, y2);
v4sf ysin1 = _mm_andnot_ps(xmm3, y);
y2 = _mm_sub_ps(y2,ysin2);
y = _mm_sub_ps(y, ysin1);
xmm1 = _mm_add_ps(ysin1,ysin2);
xmm2 = _mm_add_ps(y,y2);
/* update the sign */
_mm_store_ss( s, _mm_xor_ps(xmm1, sign_bit_sin) );
_mm_store_ss( c, _mm_xor_ps(xmm2, sign_bit_cos) );
#else
#error "Not Implemented"
#endif
@ -479,8 +633,102 @@ float _SSE_cos( float x )
movss x, xmm0
}
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE_cos NOT implemented!"
#elif POSIX
Assert( "Needs testing, verify impl!\n" );
v4sf xmm1, xmm2 = _mm_setzero_ps(), xmm3, y;
v2si mm0, mm1, mm2, mm3;
/* take the absolute value */
v4sf xx = _mm_load_ss( &x );
xx = _mm_and_ps(xx, *(v4sf*)_ps_inv_sign_mask);
/* scale by 4/Pi */
y = _mm_mul_ps(xx, *(v4sf*)_ps_cephes_FOPI);
/* store the integer part of y in mm0:mm1 */
xmm2 = _mm_movehl_ps(xmm2, y);
mm2 = _mm_cvttps_pi32(y);
mm3 = _mm_cvttps_pi32(xmm2);
/* j=(j+1) & (~1) (see the cephes sources) */
mm2 = _mm_add_pi32(mm2, *(v2si*)_pi32_1);
mm3 = _mm_add_pi32(mm3, *(v2si*)_pi32_1);
mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_inv1);
mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_inv1);
y = _mm_cvtpi32x2_ps(mm2, mm3);
mm2 = _mm_sub_pi32(mm2, *(v2si*)_pi32_2);
mm3 = _mm_sub_pi32(mm3, *(v2si*)_pi32_2);
/* get the swap sign flag in mm0:mm1 and the
polynom selection mask in mm2:mm3 */
mm0 = _mm_andnot_si64(mm2, *(v2si*)_pi32_4);
mm1 = _mm_andnot_si64(mm3, *(v2si*)_pi32_4);
mm0 = _mm_slli_pi32(mm0, 29);
mm1 = _mm_slli_pi32(mm1, 29);
mm2 = _mm_and_si64(mm2, *(v2si*)_pi32_2);
mm3 = _mm_and_si64(mm3, *(v2si*)_pi32_2);
mm2 = _mm_cmpeq_pi32(mm2, _mm_setzero_si64());
mm3 = _mm_cmpeq_pi32(mm3, _mm_setzero_si64());
v4sf sign_bit, poly_mask;
COPY_MM_TO_XMM(mm0, mm1, sign_bit);
COPY_MM_TO_XMM(mm2, mm3, poly_mask);
_mm_empty(); /* good-bye mmx */
/* The magic pass: "Extended precision modular arithmetic"
x = ((x - y * DP1) - y * DP2) - y * DP3; */
xmm1 = *(v4sf*)_ps_minus_cephes_DP1;
xmm2 = *(v4sf*)_ps_minus_cephes_DP2;
xmm3 = *(v4sf*)_ps_minus_cephes_DP3;
xmm1 = _mm_mul_ps(y, xmm1);
xmm2 = _mm_mul_ps(y, xmm2);
xmm3 = _mm_mul_ps(y, xmm3);
xx = _mm_add_ps(xx, xmm1);
xx = _mm_add_ps(xx, xmm2);
xx = _mm_add_ps(xx, xmm3);
/* Evaluate the first polynom (0 <= x <= Pi/4) */
y = *(v4sf*)_ps_coscof_p0;
v4sf z = _mm_mul_ps(xx,xx);
y = _mm_mul_ps(y, z);
y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p1);
y = _mm_mul_ps(y, z);
y = _mm_add_ps(y, *(v4sf*)_ps_coscof_p2);
y = _mm_mul_ps(y, z);
y = _mm_mul_ps(y, z);
v4sf tmp = _mm_mul_ps(z, *(v4sf*)_ps_0p5);
y = _mm_sub_ps(y, tmp);
y = _mm_add_ps(y, *(v4sf*)_ps_1);
/* Evaluate the second polynom (Pi/4 <= x <= 0) */
v4sf y2 = *(v4sf*)_ps_sincof_p0;
y2 = _mm_mul_ps(y2, z);
y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p1);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_add_ps(y2, *(v4sf*)_ps_sincof_p2);
y2 = _mm_mul_ps(y2, z);
y2 = _mm_mul_ps(y2, xx);
y2 = _mm_add_ps(y2, xx);
/* select the correct result from the two polynoms */
xmm3 = poly_mask;
y2 = _mm_and_ps(xmm3, y2); //, xmm3);
y = _mm_andnot_ps(xmm3, y);
y = _mm_add_ps(y,y2);
/* update the sign */
_mm_store_ss( &x, _mm_xor_ps(y, sign_bit) );
#else
#error "Not Implemented"
#endif
@ -491,6 +739,7 @@ float _SSE_cos( float x )
//-----------------------------------------------------------------------------
// SSE2 implementations of optimized routines:
//-----------------------------------------------------------------------------
#ifdef PLATFORM_WINDOWS_PC32
void _SSE2_SinCos(float x, float* s, float* c) // any x
{
#ifdef _WIN32
@ -569,13 +818,16 @@ void _SSE2_SinCos(float x, float* s, float* c) // any x
movss [eax], xmm0
movss [edx], xmm6
}
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE2_SinCos NOT implemented!"
#elif POSIX
#warning "_SSE2_SinCos NOT implemented!"
Assert( 0 );
#else
#error "Not Implemented"
#endif
}
#endif // PLATFORM_WINDOWS_PC32
#ifdef PLATFORM_WINDOWS_PC32
float _SSE2_cos(float x)
{
#ifdef _WIN32
@ -624,15 +876,18 @@ float _SSE2_cos(float x)
mulss xmm0, xmm1
movss x, xmm0
}
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE2_cos NOT implemented!"
#elif POSIX
#warning "_SSE2_cos NOT implemented!"
Assert( 0 );
#else
#error "Not Implemented"
#endif
return x;
}
#endif // PLATFORM_WINDOWS_PC32
#if 0
// SSE Version of VectorTransform
void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
{
@ -681,8 +936,8 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
addss xmm0, [ecx+12]
movss [edx+8], xmm0;
}
#elif defined _LINUX || defined __APPLE__
// #warning "VectorTransformSSE C implementation only"
#elif POSIX
#warning "VectorTransformSSE C implementation only"
out1[0] = DotProduct(in1, in2[0]) + in2[0][3];
out1[1] = DotProduct(in1, in2[1]) + in2[1][3];
out1[2] = DotProduct(in1, in2[2]) + in2[2][3];
@ -690,7 +945,9 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
#error "Not Implemented"
#endif
}
#endif
#if 0
void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
{
Assert( s_bMathlibInitialized );
@ -735,8 +992,8 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
addss xmm0, xmm2;
movss [edx+8], xmm0;
}
#elif defined _LINUX || defined __APPLE__
// #warning "VectorRotateSSE C implementation only"
#elif POSIX
#warning "VectorRotateSSE C implementation only"
out1[0] = DotProduct( in1, in2[0] );
out1[1] = DotProduct( in1, in2[1] );
out1[2] = DotProduct( in1, in2[2] );
@ -744,6 +1001,7 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
#error "Not Implemented"
#endif
}
#endif
#ifdef _WIN32
void _declspec(naked) _SSE_VectorMA( const float *start, float scale, const float *direction, float *dest )

View File

@ -25,6 +25,7 @@
typedef short HSOUNDSCRIPTHANDLE;
#define SOUNDEMITTER_INVALID_HANDLE (HSOUNDSCRIPTHANDLE)-1
class IFileList;
//-----------------------------------------------------------------------------
// Purpose:
@ -253,13 +254,15 @@ public:
// Called from both client and server (single player) or just one (server only in dedicated server and client only if connected to a remote server)
// Called by LevelInitPreEntity to override sound scripts for the mod with level specific overrides based on custom mapnames, etc.
virtual void AddSoundOverrides( char const *scriptfile ) = 0;
virtual void AddSoundOverrides( char const *scriptfile, bool bUnknown ) = 0;
// Called by either client or server in LevelShutdown to clear out custom overrides
virtual void ClearSoundOverrides() = 0;
virtual bool GetParametersForSoundEx( const char *soundname, HSOUNDSCRIPTHANDLE& handle, CSoundParameters& params, gender_t gender, bool isbeingemitted = false ) = 0;
virtual soundlevel_t LookupSoundLevelByHandle( char const *soundname, HSOUNDSCRIPTHANDLE& handle ) = 0;
virtual void ReloadSoundEntriesInList( IFileList *pFileList ) = 0;
};
#endif // ISOUNDEMITTERSYSTEMBASE_H

View File

@ -120,10 +120,6 @@ DECLARE_FIELD_SIZE( FIELD_MODELINDEX, sizeof(int) )
DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0]))
#define SIZE_OF_ARRAY(p) _ARRAYSIZE(p)

View File

@ -57,6 +57,8 @@ class CStandardSendProxies;
class IAchievementMgr;
class CGamestatsData;
class CSteamID;
class IGet;
class IGMODDataTable;
typedef struct player_info_s player_info_t;
@ -72,6 +74,12 @@ typedef struct player_info_s player_info_t;
#define INTERFACEVERSION_VENGINESERVER "VEngineServer021"
struct bbox_t
{
Vector mins;
Vector maxs;
};
//-----------------------------------------------------------------------------
// Purpose: Interface the engine exposes to the game DLL
//-----------------------------------------------------------------------------
@ -387,12 +395,35 @@ public:
// Send a client command keyvalues
// keyvalues are deleted inside the function
virtual void ClientCommandKeyValues( edict_t *pEdict, KeyValues *pCommand ) = 0;
// Returns the SteamID of the specified player. It'll be NULL if the player hasn't authenticated yet.
virtual const CSteamID *GetClientSteamIDByPlayerIndex( int entnum ) = 0;
// Gets a list of all clusters' bounds. Returns total number of clusters.
virtual int GetClusterCount() = 0;
virtual int GetAllClusterBounds( bbox_t *pBBoxList, int maxBBox ) = 0;
// Create a bot with the given name. Returns NULL if fake client can't be created
virtual edict_t *CreateFakeClientEx( const char *netname, bool bReportFakeClient = true ) = 0;
// Server version from the steam.inf, this will be compared to the GC version
virtual int GetServerVersion() const = 0;
virtual void GMOD_SetTimeManipulator( float flFramerateScale ) = 0;
virtual void GMOD_SendToClient( IRecipientFilter *filter, void *pData, int size ) = 0;
virtual void GMOD_SendToClient( int player_idx, void *pData, int size ) = 0;
virtual void GMOD_RawServerCommand( const char *str ) = 0;
virtual IGMODDataTable *GMOD_CreateDataTable( void ) = 0;
virtual void GMOD_DestroyDataTable( IGMODDataTable *pTable ) = 0;
virtual const char *GMOD_GetServerAddress( void ) = 0;
virtual void GMOD_LoadModel( const char *pszModel ) = 0;
};
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_4 "ServerGameDLL004"
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_5 "ServerGameDLL005"
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_6 "ServerGameDLL006"
#define INTERFACEVERSION_SERVERGAMEDLL "ServerGameDLL007"
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_8 "ServerGameDLL008"
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_9 "ServerGameDLL009"
#define INTERFACEVERSION_SERVERGAMEDLL "ServerGameDLL009"
#define INTERFACEVERSION_SERVERGAMEDLL_INT 9
class IServerGCLobby;
//-----------------------------------------------------------------------------
// Purpose: These are the interfaces that the game .dll exposes to the engine
@ -400,15 +431,18 @@ public:
abstract_class IServerGameDLL
{
public:
virtual bool PreInit( CreateInterfaceFn engineFactory, IGet *get ) = 0;
// Initialize the game (one-time call when the DLL is first loaded )
// Return false if there is an error during startup.
virtual bool DLLInit( CreateInterfaceFn engineFactory,
CreateInterfaceFn physicsFactory,
CreateInterfaceFn fileSystemFactory,
CGlobalVars *pGlobals) = 0;
virtual bool ReplayInit( CreateInterfaceFn replayFactory ) = 0;
// Setup replay interfaces on the server
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory ) = 0;
// This is called when a new game is started. (restart, map)
virtual bool GameInit( void ) = 0;
@ -498,11 +532,29 @@ public:
// iCookie is the value returned by IServerPluginHelpers::StartQueryCvarValue.
// Added with version 2 of the interface.
virtual void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue ) = 0;
// Called after the steam API has been activated post-level startup
virtual void GameServerSteamAPIActivated( void ) = 0;
// Called after the steam API has been shutdown post-level startup
virtual void GameServerSteamAPIShutdown( void ) = 0;
virtual void SetServerHibernation( bool bHibernating ) = 0;
// interface to the new GC based lobby system
virtual IServerGCLobby *GetServerGCLobby() = 0;
// Return override string to show in the server browser
// "map" column, or NULL to just use the default value
// (the map name)
virtual const char *GetServerBrowserMapOverride() = 0;
// Get gamedata string to send to the master serer updater.
virtual const char *GetServerBrowserGameData() = 0;
virtual bool GMOD_CheckPassword(
unsigned long long, const char *, const char *, const char *, const char *, char *pszRejectMsg, unsigned int len
) = 0;
};
//-----------------------------------------------------------------------------
@ -606,6 +658,8 @@ public:
virtual void ClientCommandKeyValues( edict_t *pEntity, KeyValues *pKeyValues ) = 0;
virtual void ClientSpawned( edict_t *pEntity ) = 0;
virtual void GMOD_ReceiveClientMessage( int, edict_t *pEntity, bf_read *bf, int len ) = 0;
};
#define INTERFACEVERSION_UPLOADGAMESTATS "ServerUploadGameStats001"

View File

@ -32,8 +32,10 @@ public:
// These methods return the bounds of an OBB measured in "collision" space
// which can be retreived through the CollisionToWorldTransform or
// GetCollisionOrigin/GetCollisionAngles methods
virtual const Vector& OBBMins( ) const = 0;
virtual const Vector& OBBMaxs( ) const = 0;
virtual const Vector& OBBMinsPreScaled() const = 0;
virtual const Vector& OBBMaxsPreScaled() const = 0;
virtual const Vector& OBBMins() const = 0;
virtual const Vector& OBBMaxs() const = 0;
// Returns the bounds of a world-space box used when the collideable is being traced
// against as a trigger. It's only valid to call these methods if the solid flags

View File

@ -72,15 +72,15 @@ public:
// NOTE: setting iEntIndex to -1 will cause the sound to be emitted from the local
// player (client-side only)
virtual void EmitSound( IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM,
float flVolume, float flAttenuation, int iFlags = 0, int iPitch = PITCH_NORM, int iSpecialDSP = 0,
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
virtual void EmitSound( IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, soundlevel_t iSoundlevel, int iFlags = 0, int iPitch = PITCH_NORM,
float flVolume, soundlevel_t iSoundlevel, int iFlags = 0, int iPitch = PITCH_NORM, int iSpecialDSP = 0,
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
virtual void EmitSentenceByIndex( IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex,
float flVolume, soundlevel_t iSoundlevel, int iFlags = 0, int iPitch = PITCH_NORM,
float flVolume, soundlevel_t iSoundlevel, int iFlags = 0, int iPitch = PITCH_NORM, int iSpecialDSP = 0,
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
virtual void StopSound( int iEntIndex, int iChannel, const char *pSample ) = 0;

View File

@ -11,6 +11,7 @@
#include "tier0/memalloc.h"
#include "tier1/interface.h"
#include "tier1/utlsymbol.h"
#include "tier1/utlstring.h"
#include "appframework/IAppSystem.h"
#include "tier1/checksum_crc.h"
@ -300,7 +301,8 @@ enum FSAsyncFlags_t
enum EFileCRCStatus
{
k_eFileCRCStatus_CantOpenFile, // We don't have this file.
k_eFileCRCStatus_GotCRC
k_eFileCRCStatus_GotCRC,
k_eFileCRCStatus_FileInVPK
};
// Used in CacheFileCRCs.
@ -338,6 +340,29 @@ struct FileAsyncRequest_t
FSAllocFunc_t pfnAlloc; // custom allocator. can be null. not compatible with FSASYNC_FLAGS_FREEDATAPTR
};
struct MD5Value_t
{
unsigned char bits[16];
};
struct FileHash_t
{
int m_eFileHashType;
CRC32_t m_crcIOSequence;
MD5Value_t m_md5contents;
int m_cbFileLen;
int m_PackFileID;
int m_nPackFileNumber;
};
class CUnverifiedFileHash
{
public:
char m_PathID[MAX_PATH];
char m_Filename[MAX_PATH];
int m_nFileFraction;
FileHash_t m_FileHash;
};
class CUnverifiedCRCFile
{
@ -347,13 +372,22 @@ public:
CRC32_t m_CRC;
};
// Spew flags for SetWhitelistSpewFlags (set with the fs_whitelist_spew_flags cvar).
// Update the comment for the fs_whitelist_spew_flags cvar if you change these.
#define WHITELIST_SPEW_WHILE_LOADING 0x0001 // list files as they are added to the CRC tracker
#define WHITELIST_SPEW_RELOAD_FILES 0x0002 // show files the filesystem is telling the engine to reload
#define WHITELIST_SPEW_DONT_RELOAD_FILES 0x0004 // show files the filesystem is NOT telling the engine to reload
abstract_class IPureServerWhitelist
{
public:
virtual void AddRef() = 0;
virtual void Release() = 0;
virtual const char *GetFileClass( const char * ) = 0;
virtual int GetTrustedKeyCount() const = 0;
virtual void GetTrustedKey( int keyIndex, int *pBuffer ) = 0;
};
//-----------------------------------------------------------------------------
// Base file system interface
@ -401,7 +435,7 @@ public:
// Main file system interface
//-----------------------------------------------------------------------------
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem019"
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem022"
abstract_class IFileSystem : public IAppSystem, public IBaseFileSystem
{
@ -692,7 +726,7 @@ public:
// This should be called ONCE at startup. Multiplayer games (gameinfo.txt does not contain singleplayer_only)
// want to enable this so sv_pure works.
virtual void EnableWhitelistFileTracking( bool bEnable ) = 0;
virtual void EnableWhitelistFileTracking( bool bEnable, bool bCacheAllVPKHashes, bool bRecalculateAndCheckHashes ) = 0;
// This is called when the client connects to a server using a pure_server_whitelist.txt file.
//
@ -714,7 +748,7 @@ public:
// and the engine should reload it so it can come from Steam.
//
// Be sure to call Release() on pFilesToReload.
virtual void RegisterFileWhitelist( IFileList *pWantCRCList, IFileList *pAllowFromDiskList, IFileList **pFilesToReload ) = 0;
virtual void RegisterFileWhitelist( IPureServerWhitelist *pPureList, IFileList **pFilesToReload ) = 0;
// Called when the client logs onto a server. Any files that came off disk should be marked as
// unverified because this server may have a different set of files it wants to guarantee.
@ -723,24 +757,16 @@ public:
// As the server loads whitelists when it transitions maps, it calls this to calculate CRCs for any files marked
// with check_crc. Then it calls CheckCachedFileCRC later when it gets client requests to verify CRCs.
virtual void CacheFileCRCs( const char *pPathname, ECacheCRCType eType, IFileList *pFilter ) = 0;
virtual EFileCRCStatus CheckCachedFileCRC( const char *pPathID, const char *pRelativeFilename, CRC32_t *pCRC ) = 0;
virtual EFileCRCStatus CheckCachedFileHash( const char *pPathID, const char *pRelativeFilename, int nFileFraction, FileHash_t *pFileHash ) = 0;
virtual void CacheFileMD5s( const char *pPathname, ECacheCRCType eType, IFileList *pFilter ) = 0;
// Last param is an MD5Value_t pointer.
virtual EFileCRCStatus CheckCachedFileMD5( const char *pPathID, const char *pRelativeFilename, void *pMD5 ) = 0;
// Fills in the list of files that have been loaded off disk and have not been verified.
// Returns the number of files filled in (between 0 and nMaxFiles).
//
// This also removes any files it's returning from the unverified CRC list, so they won't be
// returned from here again.
// The client sends batches of these to the server to verify.
virtual int GetUnverifiedCRCFiles( CUnverifiedCRCFile *pFiles, int nMaxFiles ) = 0;
virtual int GetUnverifiedFileHashes( CUnverifiedFileHash *pFiles, int nMaxFiles ) = 0;
// First param is a CUnverifiedMD5File pointer.
virtual int GetUnverifiedMD5Files( void *pFiles, int nMaxFiles ) = 0;
// Control debug message output.
// Pass a combination of WHITELIST_SPEW_ flags.
virtual int GetWhitelistSpewFlags() = 0;
@ -757,6 +783,14 @@ public:
virtual bool IsFileCacheFileLoaded( void *pFileCache, const char *szFile ) = 0;
virtual bool IsFileCacheLoaded( void *pFileCache ) = 0;
virtual void DestroyFileCache( void *pFileCache ) = 0;
virtual bool RegisterMemoryFile( void *pFile, void **ppExistingFileWithRef ) = 0;
virtual void UnregisterMemoryFile( void *pFile ) = 0;
virtual void CacheAllVPKFileHashes( bool bCacheAllVPKHashes, bool bRecalculateAndCheckHashes ) = 0;
virtual bool CheckVPKFileHash( int PackFileID, int nPackFileNumber, int nFileFraction, MD5Value_t &md5Value ) = 0;
virtual void NotifyFileUnloaded( const char *pFileName, const char *pPathId ) = 0;
};
//-----------------------------------------------------------------------------

View File

@ -215,24 +215,18 @@ public:
virtual DVDMode_t GetDVDMode() { return m_pFileSystemPassThru->GetDVDMode(); }
virtual void EnableWhitelistFileTracking( bool bEnable )
{ m_pFileSystemPassThru->EnableWhitelistFileTracking( bEnable ); }
virtual void RegisterFileWhitelist( IFileList *pForceMatchList, IFileList *pAllowFromDiskList, IFileList **pFilesToReload )
{ m_pFileSystemPassThru->RegisterFileWhitelist( pForceMatchList, pAllowFromDiskList, pFilesToReload ); }
virtual void EnableWhitelistFileTracking( bool bEnable, bool bCacheAllVPKHashes, bool bRecalculateAndCheckHashes )
{ m_pFileSystemPassThru->EnableWhitelistFileTracking( bEnable, bCacheAllVPKHashes, bRecalculateAndCheckHashes ); }
virtual void RegisterFileWhitelist( IPureServerWhitelist *pPureList, IFileList **pFilesToReload )
{ m_pFileSystemPassThru->RegisterFileWhitelist( pPureList, pFilesToReload ); }
virtual void MarkAllCRCsUnverified()
{ m_pFileSystemPassThru->MarkAllCRCsUnverified(); }
virtual void CacheFileCRCs( const char *pPathname, ECacheCRCType eType, IFileList *pFilter )
{ return m_pFileSystemPassThru->CacheFileCRCs( pPathname, eType, pFilter ); }
virtual void CacheFileMD5s( const char *pPathname, ECacheCRCType eType, IFileList *pFilter )
{ return m_pFileSystemPassThru->CacheFileMD5s( pPathname, eType, pFilter ); }
virtual EFileCRCStatus CheckCachedFileCRC( const char *pPathID, const char *pRelativeFilename, CRC32_t *pCRC )
{ return m_pFileSystemPassThru->CheckCachedFileCRC( pPathID, pRelativeFilename, pCRC ); }
virtual EFileCRCStatus CheckCachedFileMD5( const char *pPathID, const char *pRelativeFilename, void *pMD5 )
{ return m_pFileSystemPassThru->CheckCachedFileMD5( pPathID, pRelativeFilename, pMD5 ); }
virtual int GetUnverifiedCRCFiles( CUnverifiedCRCFile *pFiles, int nMaxFiles )
{ return m_pFileSystemPassThru->GetUnverifiedCRCFiles( pFiles, nMaxFiles ); }
virtual int GetUnverifiedMD5Files( void *pFiles, int nMaxFiles )
{ return m_pFileSystemPassThru->GetUnverifiedMD5Files( pFiles, nMaxFiles ); }
virtual EFileCRCStatus CheckCachedFileHash( const char *pPathID, const char *pRelativeFilename, int nFileFraction, FileHash_t *pFileHash )
{ return m_pFileSystemPassThru->CheckCachedFileHash( pPathID, pRelativeFilename, nFileFraction, pFileHash ); }
virtual int GetUnverifiedFileHashes( CUnverifiedFileHash *pFiles, int nMaxFiles )
{ return m_pFileSystemPassThru->GetUnverifiedFileHashes( pFiles, nMaxFiles ); }
virtual int GetWhitelistSpewFlags()
{ return m_pFileSystemPassThru->GetWhitelistSpewFlags(); }
virtual void SetWhitelistSpewFlags( int spewFlags )
@ -253,6 +247,19 @@ public:
virtual void DestroyFileCache( void *pFileCache )
{ m_pFileSystemPassThru->DestroyFileCache( pFileCache ); }
virtual bool RegisterMemoryFile( void *pFile, void **ppExistingFileWithRef )
{ return m_pFileSystemPassThru->RegisterMemoryFile( pFile, ppExistingFileWithRef ); }
virtual void UnregisterMemoryFile( void *pFile )
{ m_pFileSystemPassThru->UnregisterMemoryFile( pFile ); }
virtual void CacheAllVPKFileHashes( bool bCacheAllVPKHashes, bool bRecalculateAndCheckHashes )
{ m_pFileSystemPassThru->CacheAllVPKFileHashes( bCacheAllVPKHashes, bRecalculateAndCheckHashes ); }
virtual bool CheckVPKFileHash( int PackFileID, int nPackFileNumber, int nFileFraction, MD5Value_t &md5Value )
{ return m_pFileSystemPassThru->CheckVPKFileHash( PackFileID, nPackFileNumber, nFileFraction, md5Value ); }
virtual void NotifyFileUnloaded( const char *pFileName, const char *pPathId )
{ m_pFileSystemPassThru->NotifyFileUnloaded( pFileName, pPathId ); }
protected:
IFileSystem *m_pFileSystemPassThru;
};

View File

@ -74,7 +74,6 @@ public:
virtual bool IsFakeClient( void ) const = 0;
// returns true, if client is a HLTV proxy
virtual bool IsHLTV( void ) const = 0;
virtual bool IsReplay( void ) const = 0;
// returns true, if client hears this player
virtual bool IsHearingClient(int index) const = 0;

View File

@ -72,8 +72,6 @@ public:
virtual void SetCompressionMode( bool bUseCompression ) = 0;
virtual unsigned int RequestFile(const char *filename) = 0;
virtual float GetTimeSinceLastReceived( void ) const = 0;
virtual void SetMaxBufferSize(bool bReliable, int nBytes, bool bVoice = false ) = 0;
virtual bool IsNull() const = 0;

File diff suppressed because it is too large Load Diff

View File

@ -412,8 +412,8 @@ public:
// this set of functions is hidden, will be moved out of class
explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid );
char * Render() const; // renders this steam ID to string
static char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string
const char * Render() const; // renders this steam ID to string
static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string
void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse );
bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse );

View File

@ -178,6 +178,12 @@ enum SpewRetval_t
/* type of externally defined function used to display debug spew */
typedef SpewRetval_t (*SpewOutputFunc_t)( SpewType_t spewType, const tchar *pMsg );
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#endif
/* Used to redirect spew output */
DBG_INTERFACE void SpewOutputFunc( SpewOutputFunc_t func );
@ -206,6 +212,10 @@ DBG_INTERFACE bool SetupWin32ConsoleIO();
// Returns true if they want to break in the debugger.
DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFile, int line, const tchar *pExpression );
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/* Used to define macros, never use these directly. */
#define _AssertMsg( _exp, _msg, _executeExp, _bFatal ) \

View File

@ -233,8 +233,8 @@ private:
unsigned m_nIters;
CCycleCount m_Total;
CCycleCount m_Peak;
bool m_fReport;
const tchar *m_pszName;
// bool m_fReport;
// const tchar *m_pszName;
};
// -------------------------------------------------------------------------- //

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: This header should never be used directly from leaf code!!!
// Instead, just add the file memoverride.cpp into your project and all this
@ -14,21 +14,31 @@
#pragma once
#endif
// These memory debugging switches aren't relevant under Linux builds since memoverride.cpp
// isn't built into Linux projects
#ifndef POSIX
// Define this in release to get memory tracking even in release builds
//#define USE_MEM_DEBUG 1
#endif
#if defined( _MEMTEST )
#ifdef _WIN32
#define USE_MEM_DEBUG 1
#endif
#endif
// Undefine this if using a compiler lacking threadsafe RTTI (like vc6)
#define MEM_DEBUG_CLASSNAME 1
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
#include <stddef.h>
#if defined( OSX )
#include <malloc/malloc.h>
#endif
#include "tier0/mem.h"
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
struct _CrtMemState;
#define MEMALLOC_VERSION 1
@ -103,7 +113,17 @@ public:
#endif
// Returns 0 if no failure, otherwise the size_t of the last requested chunk
// "I'm sure this is completely thread safe!" Brian Deen 7/19/2012.
virtual size_t MemoryAllocFailed() = 0;
// handles storing allocation info for coroutines
virtual uint32 GetDebugInfoSize() = 0;
virtual void SaveDebugInfo( void *pvDebugInfo ) = 0;
virtual void RestoreDebugInfo( const void *pvDebugInfo ) = 0;
virtual void InitDebugInfo( void *pvDebugInfo, const char *pchRootFileName, int nLine ) = 0;
// Replacement for ::GlobalMemoryStatus which accounts for unused memory in our system
virtual void GlobalMemoryStatus( size_t *pUsedMemory, size_t *pFreeMemory ) = 0;
};
//-----------------------------------------------------------------------------
@ -113,11 +133,52 @@ MEM_INTERFACE IMemAlloc *g_pMemAlloc;
//-----------------------------------------------------------------------------
#ifdef MEMALLOC_REGIONS
#ifndef MEMALLOC_REGION
#define MEMALLOC_REGION 0
#endif
inline void *MemAlloc_Alloc( size_t nSize )
{
return g_pMemAlloc->RegionAlloc( MEMALLOC_REGION, nSize );
}
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName, int nLine )
{
return g_pMemAlloc->RegionAlloc( MEMALLOC_REGION, nSize, pFileName, nLine );
}
#else
#undef MEMALLOC_REGION
inline void *MemAlloc_Alloc( size_t nSize )
{
return g_pMemAlloc->Alloc( nSize );
}
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName, int nLine )
{
return g_pMemAlloc->Alloc( nSize, pFileName, nLine );
}
#endif
inline void MemAlloc_Free( void *ptr )
{
g_pMemAlloc->Free( ptr );
}
inline void MemAlloc_Free( void *ptr, const char *pFileName, int nLine )
{
g_pMemAlloc->Free( ptr, pFileName, nLine );
}
//-----------------------------------------------------------------------------
inline bool ValueIsPowerOfTwo( size_t value ) // don't clash with mathlib definition
{
return (value & ( value - 1 )) == 0;
}
inline void *MemAlloc_AllocAligned( size_t size, size_t align )
{
unsigned char *pAlloc, *pResult;
if (!IsPowerOfTwo(uint(align)))
if (!IsPowerOfTwo(align))
return NULL;
align = (align > sizeof(void *) ? align : sizeof(void *)) - 1;
@ -135,7 +196,7 @@ inline void *MemAlloc_AllocAligned( size_t size, size_t align, const char *pszFi
{
unsigned char *pAlloc, *pResult;
if (!IsPowerOfTwo(uint(align)))
if (!IsPowerOfTwo(align))
return NULL;
align = (align > sizeof(void *) ? align : sizeof(void *)) - 1;
@ -149,9 +210,45 @@ inline void *MemAlloc_AllocAligned( size_t size, size_t align, const char *pszFi
return (void *)pResult;
}
inline void *MemAlloc_AllocAlignedUnattributed( size_t size, size_t align )
{
unsigned char *pAlloc, *pResult;
if (!ValueIsPowerOfTwo(align))
return NULL;
align = (align > sizeof(void *) ? align : sizeof(void *)) - 1;
if ( (pAlloc = (unsigned char*)MemAlloc_Alloc( sizeof(void *) + align + size ) ) == (unsigned char*)NULL)
return NULL;
pResult = (unsigned char*)( (size_t)(pAlloc + sizeof(void *) + align ) & ~align );
((unsigned char**)(pResult))[-1] = pAlloc;
return (void *)pResult;
}
inline void *MemAlloc_AllocAlignedFileLine( size_t size, size_t align, const char *pszFile, int nLine )
{
unsigned char *pAlloc, *pResult;
if (!ValueIsPowerOfTwo(align))
return NULL;
align = (align > sizeof(void *) ? align : sizeof(void *)) - 1;
if ( (pAlloc = (unsigned char*)MemAlloc_Alloc( sizeof(void *) + align + size, pszFile, nLine ) ) == (unsigned char*)NULL)
return NULL;
pResult = (unsigned char*)( (size_t)(pAlloc + sizeof(void *) + align ) & ~align );
((unsigned char**)(pResult))[-1] = pAlloc;
return (void *)pResult;
}
inline void *MemAlloc_ReallocAligned( void *ptr, size_t size, size_t align )
{
if ( !IsPowerOfTwo( uint(align) ) )
if ( !IsPowerOfTwo( align ) )
return NULL;
// Don't change alignment between allocation + reallocation.
@ -197,6 +294,23 @@ inline void MemAlloc_FreeAligned( void *pMemBlock )
g_pMemAlloc->Free( pAlloc );
}
inline void MemAlloc_FreeAligned( void *pMemBlock, const char *pFileName, int nLine )
{
void *pAlloc;
if ( pMemBlock == NULL )
return;
pAlloc = pMemBlock;
// pAlloc points to the pointer to starting of the memory block
pAlloc = (void *)(((size_t)pAlloc & ~( sizeof(void *) - 1 ) ) - sizeof(void *));
// pAlloc is the pointer to the start of memory block
pAlloc = *( (void **)pAlloc );
g_pMemAlloc->Free( pAlloc, pFileName, nLine );
}
inline size_t MemAlloc_GetSizeAligned( void *pMemBlock )
{
void *pAlloc;
@ -230,6 +344,20 @@ inline size_t MemAlloc_GetSizeAligned( void *pMemBlock )
#define MemAlloc_RegisterDeallocation( pFileName, nLine, nLogicalSize, nActualSize, nTime ) ((void)0)
#endif
#define MemAlloc_DumpStats() g_pMemAlloc->DumpStats()
#define MemAlloc_CompactHeap() g_pMemAlloc->CompactHeap()
#define MemAlloc_OutOfMemory() g_pMemAlloc->OutOfMemory()
#define MemAlloc_CompactIncremental() g_pMemAlloc->CompactIncremental()
#define MemAlloc_DumpStatsFileBase( _filename ) g_pMemAlloc->DumpStatsFileBase( _filename )
#define MemAlloc_CrtCheckMemory() g_pMemAlloc->CrtCheckMemory()
#define MemAlloc_GlobalMemoryStatus( _usedMemory, _freeMemory ) g_pMemAlloc->GlobalMemoryStatus( _usedMemory, _freeMemory )
#define MemAlloc_MemoryAllocFailed() g_pMemAlloc->MemoryAllocFailed()
#define MemAlloc_GetDebugInfoSize() g_pMemAlloc->GetDebugInfoSize()
#define MemAlloc_SaveDebugInfo( pvDebugInfo ) g_pMemAlloc->SaveDebugInfo( pvDebugInfo )
#define MemAlloc_RestoreDebugInfo( pvDebugInfo ) g_pMemAlloc->RestoreDebugInfo( pvDebugInfo )
#define MemAlloc_InitDebugInfo( pvDebugInfo, pchRootFileName, nLine ) g_pMemAlloc->InitDebugInfo( pvDebugInfo, pchRootFileName, nLine )
#define MemAlloc_GetSize( x ) g_pMemAlloc->GetSize( x );
//-----------------------------------------------------------------------------
class CMemAllocAttributeAlloction
@ -335,6 +463,51 @@ struct MemAllocFileLine_t
//-----------------------------------------------------------------------------
#elif defined( POSIX )
#if defined( OSX )
// Mac always aligns allocs, don't need to call posix_memalign which doesn't exist in 10.5.8 which TF2 still needs to run on
//inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; posix_memalign(&pTmp, alignment, size); return pTmp;}
inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; pTmp = malloc(size); return pTmp;}
#endif
inline void *_aligned_malloc( size_t nSize, size_t align ) { return memalign( align, nSize ); }
inline void _aligned_free( void *ptr ) { free( ptr ); }
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName = NULL, int nLine = 0 ) { return malloc( nSize ); }
inline void MemAlloc_Free( void *ptr, const char *pFileName = NULL, int nLine = 0 ) { free( ptr ); }
inline void *MemAlloc_AllocAligned( size_t size, size_t align, const char *pszFile = NULL, int nLine = 0 ) { return memalign( align, size ); }
inline void *MemAlloc_AllocAlignedFileLine( size_t size, size_t align, const char *pszFile = NULL, int nLine = 0 ) { return memalign( align, size ); }
inline void MemAlloc_FreeAligned( void *pMemBlock, const char *pszFile = NULL, int nLine = 0 ) { free( pMemBlock ); }
#if defined( OSX )
inline size_t _msize( void *ptr ) { return malloc_size( ptr ); }
#else
inline size_t _msize( void *ptr ) { return malloc_usable_size( ptr ); }
#endif
inline void *MemAlloc_ReallocAligned( void *ptr, size_t size, size_t align )
{
void *ptr_new_aligned = memalign( align, size );
if( ptr_new_aligned )
{
size_t old_size = _msize( ptr );
size_t copy_size = ( size < old_size ) ? size : old_size;
memcpy( ptr_new_aligned, ptr, copy_size );
free( ptr );
}
return ptr_new_aligned;
}
#else
#define MemAlloc_GetDebugInfoSize() g_pMemAlloc->GetDebugInfoSize()
#define MemAlloc_SaveDebugInfo( pvDebugInfo ) g_pMemAlloc->SaveDebugInfo( pvDebugInfo )
#define MemAlloc_RestoreDebugInfo( pvDebugInfo ) g_pMemAlloc->RestoreDebugInfo( pvDebugInfo )
#define MemAlloc_InitDebugInfo( pvDebugInfo, pchRootFileName, nLine ) g_pMemAlloc->InitDebugInfo( pvDebugInfo, pchRootFileName, nLine )
#endif // !STEAM && !NO_MALLOC_OVERRIDE
//-----------------------------------------------------------------------------
@ -343,11 +516,139 @@ struct MemAllocFileLine_t
#define MEM_ALLOC_CREDIT_(tag) ((void)0)
#define MEM_ALLOC_CREDIT() MEM_ALLOC_CREDIT_(__FILE__)
#define MEM_ALLOC_CREDIT_FUNCTION()
#define MEM_ALLOC_CREDIT_CLASS()
#define MEM_ALLOC_CLASSNAME(type) NULL
#define MemAlloc_PushAllocDbgInfo( pszFile, line )
#define MemAlloc_PopAllocDbgInfo()
#define MemAlloc_RegisterAllocation( pFileName, nLine, nLogicalSize, nActualSize, nTime ) ((void)0)
#define MemAlloc_RegisterDeallocation( pFileName, nLine, nLogicalSize, nActualSize, nTime ) ((void)0)
#define MemAlloc_DumpStats() ((void)0)
#define MemAlloc_CompactHeap() ((void)0)
#define MemAlloc_OutOfMemory() ((void)0)
#define MemAlloc_CompactIncremental() ((void)0)
#define MemAlloc_DumpStatsFileBase( _filename ) ((void)0)
inline bool MemAlloc_CrtCheckMemory() { return true; }
inline void MemAlloc_GlobalMemoryStatus( size_t *pusedMemory, size_t *pfreeMemory )
{
*pusedMemory = 0;
*pfreeMemory = 0;
}
#define MemAlloc_MemoryAllocFailed() 0
#define MemAlloc_GetDebugInfoSize() 0
#define MemAlloc_SaveDebugInfo( pvDebugInfo ) ((void)0)
#define MemAlloc_RestoreDebugInfo( pvDebugInfo ) ((void)0)
#define MemAlloc_InitDebugInfo( pvDebugInfo, pchRootFileName, nLine ) ((void)0)
#define MEMALLOC_DEFINE_EXTERNAL_TRACKING( tag )
#define MemAlloc_RegisterExternalAllocation( tag, p, size ) ((void)0)
#define MemAlloc_RegisterExternalDeallocation( tag, p, size ) ((void)0)
#endif // !STEAM && NO_MALLOC_OVERRIDE
//-----------------------------------------------------------------------------
// linux memory tracking via hooks.
#if defined( POSIX ) && !defined( NO_HOOK_MALLOC )
PLATFORM_INTERFACE void MemoryLogMessage( char const *s ); // throw a message into the memory log
PLATFORM_INTERFACE void EnableMemoryLogging( bool bOnOff );
PLATFORM_INTERFACE void DumpMemoryLog( int nThresh );
PLATFORM_INTERFACE void DumpMemorySummary( void );
PLATFORM_INTERFACE void SetMemoryMark( void );
PLATFORM_INTERFACE void DumpChangedMemory( int nThresh );
#else
FORCEINLINE void MemoryLogMessage( char const *s )
{
}
FORCEINLINE void EnableMemoryLogging( bool bOnOff )
{
}
FORCEINLINE void DumpMemoryLog( int nThresh )
{
}
FORCEINLINE void DumpMemorySummary( void )
{
}
FORCEINLINE void SetMemoryMark( void )
{
}
FORCEINLINE void DumpChangedMemory( int nThresh )
{
}
#endif
#ifdef POSIX
// ApproximateProcessMemoryUsage returns the approximate memory footprint of this process.
PLATFORM_INTERFACE size_t ApproximateProcessMemoryUsage( void );
#else
FORCEINLINE size_t ApproximateProcessMemoryUsage( void )
{
return 0;
}
#endif
struct aligned_tmp_t
{
// empty base class
};
/*
This class used to be required if you wanted an object to be allocated with a specific
alignment. ALIGN16 and ALIGN16_POST are not actually sufficient for this because they
guarantee that the globals, statics, locals, and function parameters are appropriately
aligned they do not affect memory allocation alignment.
However this class is usually not needed because as of 2012 our policy is that our
allocator should take care of this automatically. Any object whose size is a multiple
of 16 will be 16-byte aligned. Existing uses of this class were not changed because
the cost/benefit did not justify it.
*/
// template here to allow adding alignment at levels of hierarchy that aren't the base
template< int bytesAlignment = 16, class T = aligned_tmp_t >
class CAlignedNewDelete : public T
{
public:
/*
Note that this class does not overload operator new[] and delete[] which means that
classes that depend on this for alignment may end up misaligned if an array is
allocated. This problem is now mostly theoretical because this class is mostly
obsolete.
*/
void *operator new( size_t nSize )
{
return MemAlloc_AllocAligned( nSize, bytesAlignment );
}
void* operator new( size_t nSize, int nBlockUse, const char *pFileName, int nLine )
{
return MemAlloc_AllocAlignedFileLine( nSize, bytesAlignment, pFileName, nLine );
}
void operator delete(void *pData)
{
if ( pData )
{
MemAlloc_FreeAligned( pData );
}
}
void operator delete( void* pData, int nBlockUse, const char *pFileName, int nLine )
{
if ( pData )
{
MemAlloc_FreeAligned( pData, pFileName, nLine );
}
}
};
#endif /* TIER0_MEMALLOC_H */

View File

@ -11,6 +11,10 @@
// to include this potentially multiple times (since we can deactivate debugging
// by including memdbgoff.h)
#if !defined(NO_MALLOC_OVERRIDE) && defined(POSIX)
#define NO_MALLOC_OVERRIDE
#endif
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
// SPECIAL NOTE #2: This must be the final include in a .cpp or .h file!!!

View File

@ -75,27 +75,58 @@
#ifdef _WIN32
#define IsLinux() false
#define IsOSX() false
#define IsPosix() false
#ifndef PLATFORM_WINDOWS
#define PLATFORM_WINDOWS 1 // Windows PC or Xbox 360
#endif
#ifndef _X360
#define IsWindows() true
#define IsPC() true
#define IsConsole() false
#define IsX360() false
#define IsPS3() false
#define IS_WINDOWS_PC
#else
#ifndef _CONSOLE
#define _CONSOLE
#define PLATFORM_WINDOWS_PC 1 // Windows PC
#ifdef _WIN64
#define IsPlatformWindowsPC64() true
#define IsPlatformWindowsPC32() false
#define PLATFORM_WINDOWS_PC64 1
#else
#define IsPlatformWindowsPC64() false
#define IsPlatformWindowsPC32() true
#define PLATFORM_WINDOWS_PC32 1
#endif
#else
#define PLATFORM_X360 1
#ifndef _CONSOLE
#define _CONSOLE
#endif
#define IsWindows() false
#define IsPC() false
#define IsConsole() true
#define IsX360() true
#define IsPS3() false
#endif
#elif defined(_LINUX) || defined(__APPLE__)
#elif defined(POSIX)
#define IsPC() true
#define IsWindows() false
#define IsConsole() false
#define IsX360() false
#define IsPS3() false
#define IsLinux() true
#if defined( LINUX )
#define IsLinux() true
#else
#define IsLinux() false
#endif
#if defined( OSX )
#define IsOSX() true
#else
#define IsOSX() false
#endif
#define IsPosix() true
#else
#error
#endif
@ -252,6 +283,17 @@ typedef void * HINSTANCE;
#define MAX_PATH 260
#endif
#ifdef GNUC
#undef offsetof
//#define offsetof( type, var ) __builtin_offsetof( type, var )
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#else
#undef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ) // need macro for constant expression
// Used to step into the debugger
@ -283,17 +325,41 @@ typedef void * HINSTANCE;
#ifdef _WIN32
#define DECL_ALIGN(x) __declspec(align(x))
#elif defined(_LINUX) || defined(__APPLE__)
#elif GNUC
#define DECL_ALIGN(x) __attribute__((aligned(x)))
#else
#define DECL_ALIGN(x) /* */
#endif
#ifdef _MSC_VER
// MSVC has the align at the start of the struct
#define ALIGN4 DECL_ALIGN(4)
#define ALIGN8 DECL_ALIGN(8)
#define ALIGN16 DECL_ALIGN(16)
#define ALIGN32 DECL_ALIGN(32)
#define ALIGN128 DECL_ALIGN(128)
#define ALIGN4_POST
#define ALIGN8_POST
#define ALIGN16_POST
#define ALIGN32_POST
#define ALIGN128_POST
#elif defined( GNUC )
// gnuc has the align decoration at the end
#define ALIGN4
#define ALIGN8
#define ALIGN16
#define ALIGN32
#define ALIGN128
#define ALIGN4_POST DECL_ALIGN(4)
#define ALIGN8_POST DECL_ALIGN(8)
#define ALIGN16_POST DECL_ALIGN(16)
#define ALIGN32_POST DECL_ALIGN(32)
#define ALIGN128_POST DECL_ALIGN(128)
#else
#error
#endif
// Linux had a few areas where it didn't construct objects in the same order that Windows does.
// So when CVProfile::CVProfile() would access g_pMemAlloc, it would crash because the allocator wasn't initalized yet.
@ -824,8 +890,18 @@ struct CPUInformation
tchar* m_szProcessorID; // Processor vendor Identification.
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
#endif
PLATFORM_INTERFACE const CPUInformation& GetCPUInformation();
#ifdef __clang__
#pragma clang diagnostic pop
#endif
PLATFORM_INTERFACE void GetCurrentDate( int *pDay, int *pMonth, int *pYear );
// ---------------------------------------------------------------------------------- //

View File

@ -113,7 +113,7 @@ private:
bool ParseArgV0( CUtlBuffer &buf, char *pArgv0, int nMaxLen, const char **pArgs );
char m_pArgSBuffer[ ARGS_BUFFER_LENGTH ];
int m_nLastUsedArgSSize;
//int m_nLastUsedArgSSize;
int m_nArgSBufferSize;
CUtlFixedLinkedList< Command_t > m_Commands;
int m_nCurrentTick;

View File

@ -336,7 +336,6 @@ void CUtlBlockMemory<T,I>::Purge( int numElements )
}
int nBlockSize = NumElementsInBlock();
int nBlocksOld = m_nBlocks;
int nBlocks = ( numElements + nBlockSize - 1 ) / nBlockSize;
// If the number of blocks is the same as the allocated number of blocks, we are done.

View File

@ -27,6 +27,11 @@ class IToolSystem;
class IClientRenderable;
class Vector;
class QAngle;
class CBaseEntity;
class CBaseAnimating;
class CTakeDamageInfo;
class ITempEntsSystem;
class IEntityFactoryDictionary;
//-----------------------------------------------------------------------------
@ -173,19 +178,19 @@ public:
virtual bool IsInNoClipMode( IClientEntity *pClientPlayer = NULL ) = 0;
// entity searching
virtual void *FirstEntity( void ) = 0;
virtual void *NextEntity( void *pEntity ) = 0;
virtual void *FindEntityByHammerID( int iHammerID ) = 0;
virtual CBaseEntity *FirstEntity( void ) = 0;
virtual CBaseEntity *NextEntity( CBaseEntity *pEntity ) = 0;
virtual CBaseEntity *FindEntityByHammerID( int iHammerID ) = 0;
// entity query
virtual bool GetKeyValue( void *pEntity, const char *szField, char *szValue, int iMaxLen ) = 0;
virtual bool SetKeyValue( void *pEntity, const char *szField, const char *szValue ) = 0;
virtual bool SetKeyValue( void *pEntity, const char *szField, float flValue ) = 0;
virtual bool SetKeyValue( void *pEntity, const char *szField, const Vector &vecValue ) = 0;
virtual bool GetKeyValue( CBaseEntity *pEntity, const char *szField, char *szValue, int iMaxLen ) = 0;
virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const char *szValue ) = 0;
virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, float flValue ) = 0;
virtual bool SetKeyValue( CBaseEntity *pEntity, const char *szField, const Vector &vecValue ) = 0;
// entity spawning
virtual void *CreateEntityByName( const char *szClassName ) = 0;
virtual void DispatchSpawn( void *pEntity ) = 0;
virtual CBaseEntity *CreateEntityByName( const char *szClassName ) = 0;
virtual void DispatchSpawn( CBaseEntity *pEntity ) = 0;
// This reloads a portion or all of a particle definition file.
// It's up to the server to decide if it cares about this file
@ -193,9 +198,32 @@ public:
virtual void ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen ) = 0;
virtual void AddOriginToPVS( const Vector &org ) = 0;
virtual void MoveEngineViewTo( const Vector &vPos, const QAngle &vAngles ) = 0;
virtual bool DestroyEntityByHammerId( int iHammerID ) = 0;
virtual CBaseEntity *GetBaseEntityByEntIndex( int iEntIndex ) = 0;
virtual void RemoveEntity( CBaseEntity *pEntity ) = 0;
virtual void RemoveEntityImmediate( CBaseEntity *pEntity ) = 0;
virtual IEntityFactoryDictionary *GetEntityFactoryDictionary( void ) = 0;
virtual void SetMoveType( CBaseEntity *pEntity, int val ) = 0;
virtual void SetMoveType( CBaseEntity *pEntity, int val, int moveCollide ) = 0;
virtual void ResetSequence( CBaseAnimating *pEntity, int nSequence ) = 0;
virtual void ResetSequenceInfo( CBaseAnimating *pEntity ) = 0;
virtual void ClearMultiDamage( void ) = 0;
virtual void ApplyMultiDamage( void ) = 0;
virtual void AddMultiDamage( const CTakeDamageInfo &pTakeDamageInfo, CBaseEntity *pEntity ) = 0;
virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRadius, int iClassIgnore, CBaseEntity *pEntityIgnore ) = 0;
virtual ITempEntsSystem *GetTempEntsSystem( void ) = 0;
};
#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS001"
typedef IServerTools IServerTools001;
#define VSERVERTOOLS_INTERFACE_VERSION_1 "VSERVERTOOLS001"
#define VSERVERTOOLS_INTERFACE_VERSION "VSERVERTOOLS002"
#define VSERVERTOOLS_INTERFACE_VERSION_INT 2
//-----------------------------------------------------------------------------
// Purpose: Client side tool interace (right now just handles IClientRenderables).

View File

@ -27,6 +27,17 @@
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
template<typename T>
T *KVStringAlloc(size_t nLength)
{
return reinterpret_cast<T*>(MemAlloc_Alloc(sizeof(T) * nLength));
}
void KVStringDelete(void* pMem)
{
MemAlloc_Free(pMem);
}
static const char * s_LastFileLoadingFrom = "unknown"; // just needed for error messages
#define KEYVALUES_TOKEN_SIZE 1024
@ -323,9 +334,9 @@ void KeyValues::RemoveEverything()
delete dat;
}
delete [] m_sValue;
KVStringDelete(m_sValue);
m_sValue = NULL;
delete [] m_wsValue;
KVStringDelete(m_wsValue);
m_wsValue = NULL;
}
@ -1280,9 +1291,9 @@ void KeyValues::SetColor( const char *keyName, Color value)
void KeyValues::SetStringValue( char const *strValue )
{
// delete the old value
delete [] m_sValue;
KVStringDelete(m_sValue);
// make sure we're not storing the WSTRING - as we're converting over to STRING
delete [] m_wsValue;
KVStringDelete(m_wsValue);
m_wsValue = NULL;
if (!strValue)
@ -1293,7 +1304,7 @@ void KeyValues::SetStringValue( char const *strValue )
// allocate memory for the new value and copy it in
int len = Q_strlen( strValue );
m_sValue = new char[len + 1];
m_sValue = KVStringAlloc<char>(len + 1);
Q_memcpy( m_sValue, strValue, len+1 );
m_iDataType = TYPE_STRING;
@ -1309,9 +1320,9 @@ void KeyValues::SetString( const char *keyName, const char *value )
if ( dat )
{
// delete the old value
delete [] dat->m_sValue;
KVStringDelete(dat->m_sValue);
// make sure we're not storing the WSTRING - as we're converting over to STRING
delete [] dat->m_wsValue;
KVStringDelete(dat->m_wsValue);
dat->m_wsValue = NULL;
if (!value)
@ -1322,7 +1333,7 @@ void KeyValues::SetString( const char *keyName, const char *value )
// allocate memory for the new value and copy it in
int len = Q_strlen( value );
dat->m_sValue = new char[len + 1];
dat->m_sValue = KVStringAlloc<char>(len + 1);
Q_memcpy( dat->m_sValue, value, len+1 );
dat->m_iDataType = TYPE_STRING;
@ -1338,9 +1349,9 @@ void KeyValues::SetWString( const char *keyName, const wchar_t *value )
if ( dat )
{
// delete the old value
delete [] dat->m_wsValue;
KVStringDelete(dat->m_wsValue);
// make sure we're not storing the STRING - as we're converting over to WSTRING
delete [] dat->m_sValue;
KVStringDelete(dat->m_sValue);
dat->m_sValue = NULL;
if (!value)
@ -1351,7 +1362,7 @@ void KeyValues::SetWString( const char *keyName, const wchar_t *value )
// allocate memory for the new value and copy it in
int len = wcslen( value );
dat->m_wsValue = new wchar_t[len + 1];
dat->m_wsValue = KVStringAlloc<wchar_t>(len + 1);
Q_memcpy( dat->m_wsValue, value, (len+1) * sizeof(wchar_t) );
dat->m_iDataType = TYPE_WSTRING;
@ -1382,12 +1393,12 @@ void KeyValues::SetUint64( const char *keyName, uint64 value )
if ( dat )
{
// delete the old value
delete [] dat->m_sValue;
KVStringDelete(dat->m_sValue);
// make sure we're not storing the WSTRING - as we're converting over to STRING
delete [] dat->m_wsValue;
KVStringDelete(dat->m_wsValue);
dat->m_wsValue = NULL;
dat->m_sValue = new char[sizeof(uint64)];
dat->m_sValue = KVStringAlloc<char>(sizeof(uint64));
*((uint64 *)dat->m_sValue) = value;
dat->m_iDataType = TYPE_UINT64;
}
@ -1444,7 +1455,7 @@ void KeyValues::RecursiveCopyKeyValues( KeyValues& src )
if( src.m_sValue )
{
int len = Q_strlen(src.m_sValue) + 1;
m_sValue = new char[len];
m_sValue = KVStringAlloc<char>(len);
Q_strncpy( m_sValue, src.m_sValue, len );
}
break;
@ -1453,7 +1464,7 @@ void KeyValues::RecursiveCopyKeyValues( KeyValues& src )
m_iValue = src.m_iValue;
Q_snprintf( buf,sizeof(buf), "%d", m_iValue );
int len = Q_strlen(buf) + 1;
m_sValue = new char[len];
m_sValue = KVStringAlloc<char>(len);
Q_strncpy( m_sValue, buf, len );
}
break;
@ -1462,7 +1473,7 @@ void KeyValues::RecursiveCopyKeyValues( KeyValues& src )
m_flValue = src.m_flValue;
Q_snprintf( buf,sizeof(buf), "%f", m_flValue );
int len = Q_strlen(buf) + 1;
m_sValue = new char[len];
m_sValue = KVStringAlloc<char>(len);
Q_strncpy( m_sValue, buf, len );
}
break;
@ -1473,7 +1484,7 @@ void KeyValues::RecursiveCopyKeyValues( KeyValues& src )
break;
case TYPE_UINT64:
{
m_sValue = new char[sizeof(uint64)];
m_sValue = KVStringAlloc<char>(sizeof(uint64));
Q_memcpy( m_sValue, src.m_sValue, sizeof(uint64) );
}
break;
@ -1584,7 +1595,7 @@ KeyValues *KeyValues::MakeCopy( void ) const
{
int len = Q_strlen( m_sValue );
Assert( !newKeyValue->m_sValue );
newKeyValue->m_sValue = new char[len + 1];
newKeyValue->m_sValue = KVStringAlloc<char>(len + 1);
Q_memcpy( newKeyValue->m_sValue, m_sValue, len+1 );
}
}
@ -1594,7 +1605,7 @@ KeyValues *KeyValues::MakeCopy( void ) const
if ( m_wsValue )
{
int len = wcslen( m_wsValue );
newKeyValue->m_wsValue = new wchar_t[len+1];
newKeyValue->m_wsValue = KVStringAlloc<wchar_t>(len + 1);
Q_memcpy( newKeyValue->m_wsValue, m_wsValue, (len+1)*sizeof(wchar_t));
}
}
@ -1620,7 +1631,7 @@ KeyValues *KeyValues::MakeCopy( void ) const
break;
case TYPE_UINT64:
newKeyValue->m_sValue = new char[sizeof(uint64)];
newKeyValue->m_sValue = KVStringAlloc<char>(sizeof(uint64));
Q_memcpy( newKeyValue->m_sValue, m_sValue, sizeof(uint64) );
break;
};
@ -2062,7 +2073,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
if (dat->m_sValue)
{
delete[] dat->m_sValue;
KVStringDelete(dat->m_sValue);
dat->m_sValue = NULL;
}
@ -2094,7 +2105,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
digit -= 'A' - ( '9' + 1 );
retVal = ( retVal * 16 ) + ( digit - '0' );
}
dat->m_sValue = new char[sizeof(uint64)];
dat->m_sValue = KVStringAlloc<char>(sizeof(uint64));
*((uint64 *)dat->m_sValue) = retVal;
dat->m_iDataType = TYPE_UINT64;
}
@ -2116,7 +2127,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b
if (dat->m_iDataType == TYPE_STRING)
{
// copy in the string information
dat->m_sValue = new char[len+1];
dat->m_sValue = KVStringAlloc<char>(len + 1);
Q_memcpy( dat->m_sValue, value, len+1 );
}
@ -2274,7 +2285,7 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer )
token[KEYVALUES_TOKEN_SIZE-1] = 0;
int len = Q_strlen( token );
dat->m_sValue = new char[len + 1];
dat->m_sValue = KVStringAlloc<char>(len + 1);
Q_memcpy( dat->m_sValue, token, len+1 );
break;
@ -2293,7 +2304,7 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer )
case TYPE_UINT64:
{
dat->m_sValue = new char[sizeof(uint64)];
dat->m_sValue = KVStringAlloc<char>(sizeof(uint64));
*((double *)dat->m_sValue) = buffer.GetDouble();
}

View File

@ -867,7 +867,6 @@ int old_bf_read::ReadSBitLong( int numbits )
}
const byte g_BitMask[8] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const byte g_TrailingMask[8] = {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80};
inline int old_bf_read::CountRunOfZeros()
{

View File

@ -232,7 +232,7 @@ void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5Context_t *ctx)
MD5Transform(ctx->buf, (unsigned int *) ctx->in);
//byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, MD5_DIGEST_LENGTH);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
memset(ctx, 0, sizeof(MD5Context_t)); /* In case it's sensitive */
}
//-----------------------------------------------------------------------------

View File

@ -122,8 +122,6 @@ unsigned int CDataManagerBase::FlushAll()
unsigned int CDataManagerBase::Purge( unsigned int nBytesToPurge )
{
unsigned int nTargetSize = MemUsed_Inline() - nBytesToPurge;
if ( nTargetSize < 0 )
nTargetSize = 0;
unsigned int nImpliedCapacity = MemTotal_Inline() - nTargetSize;
return EnsureCapacity( nImpliedCapacity );
}

View File

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

View File

@ -226,7 +226,7 @@ char *V_strnlwr(char *s, size_t count)
if ( !s )
return s;
while ( --count >= 0 )
while ( count-- )
{
if ( !*s )
break;

22
tier1/tier1-2005.sln Normal file
View File

@ -0,0 +1,22 @@

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

View File

@ -1,568 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="tier1"
ProjectGUID="{E1DA8DB8-FB4C-4B14-91A6-98BCED6B9720}"
RootNamespace="tier1"
>
<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"
PreprocessorDefinitions="WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB"
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"
AdditionalDependencies="Rpcrt4.lib"
OutputFile="..\lib\public\tier1.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/tier1.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"
PreprocessorDefinitions="WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB"
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"
AdditionalDependencies="Rpcrt4.lib"
OutputFile="..\lib\public\tier1.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
SuppressStartupBanner="true"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(OutDir)/tier1.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=".\bitbuf.cpp"
>
</File>
<File
RelativePath=".\byteswap.cpp"
>
</File>
<File
RelativePath=".\characterset.cpp"
>
</File>
<File
RelativePath=".\checksum_crc.cpp"
>
</File>
<File
RelativePath=".\checksum_md5.cpp"
>
</File>
<File
RelativePath=".\commandbuffer.cpp"
>
</File>
<File
RelativePath=".\convar.cpp"
>
</File>
<File
RelativePath=".\datamanager.cpp"
>
</File>
<File
RelativePath=".\diff.cpp"
>
</File>
<File
RelativePath=".\generichash.cpp"
>
</File>
<File
RelativePath=".\interface.cpp"
>
</File>
<File
RelativePath=".\KeyValues.cpp"
>
</File>
<File
RelativePath=".\mempool.cpp"
>
</File>
<File
RelativePath=".\memstack.cpp"
>
</File>
<File
RelativePath=".\NetAdr.cpp"
>
</File>
<File
RelativePath=".\newbitbuf.cpp"
>
</File>
<File
RelativePath=".\processor_detect.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ExceptionHandling="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ExceptionHandling="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\rangecheckedvar.cpp"
>
</File>
<File
RelativePath=".\stringpool.cpp"
>
</File>
<File
RelativePath=".\strtools.cpp"
>
</File>
<File
RelativePath=".\tier1.cpp"
>
</File>
<File
RelativePath=".\tokenreader.cpp"
>
</File>
<File
RelativePath=".\uniqueid.cpp"
>
</File>
<File
RelativePath=".\utlbuffer.cpp"
>
</File>
<File
RelativePath=".\utlbufferutil.cpp"
>
</File>
<File
RelativePath=".\utlstring.cpp"
>
</File>
<File
RelativePath=".\utlsymbol.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\public\tier1\bitbuf.h"
>
</File>
<File
RelativePath="..\public\tier1\byteswap.h"
>
</File>
<File
RelativePath="..\public\tier1\callqueue.h"
>
</File>
<File
RelativePath="..\public\tier1\characterset.h"
>
</File>
<File
RelativePath="..\public\tier1\checksum_crc.h"
>
</File>
<File
RelativePath="..\public\tier1\checksum_md5.h"
>
</File>
<File
RelativePath="..\public\tier1\CommandBuffer.h"
>
</File>
<File
RelativePath="..\public\tier1\convar.h"
>
</File>
<File
RelativePath="..\public\tier1\datamanager.h"
>
</File>
<File
RelativePath="..\public\datamap.h"
>
</File>
<File
RelativePath="..\public\tier1\delegates.h"
>
</File>
<File
RelativePath="..\public\tier1\diff.h"
>
</File>
<File
RelativePath="..\public\tier1\fmtstr.h"
>
</File>
<File
RelativePath="..\public\tier1\functors.h"
>
</File>
<File
RelativePath="..\public\tier1\generichash.h"
>
</File>
<File
RelativePath="..\public\tier1\iconvar.h"
>
</File>
<File
RelativePath="..\public\tier1\interface.h"
>
</File>
<File
RelativePath="..\public\tier1\KeyValues.h"
>
</File>
<File
RelativePath="..\public\tier1\lzmaDecoder.h"
>
</File>
<File
RelativePath="..\public\tier1\lzss.h"
>
</File>
<File
RelativePath="..\public\tier1\mempool.h"
>
</File>
<File
RelativePath="..\public\tier1\memstack.h"
>
</File>
<File
RelativePath="..\public\tier1\netadr.h"
>
</File>
<File
RelativePath="..\public\tier1\processor_detect.h"
>
</File>
<File
RelativePath="..\public\tier1\rangecheckedvar.h"
>
</File>
<File
RelativePath="..\public\tier1\refcount.h"
>
</File>
<File
RelativePath="..\public\tier1\smartptr.h"
>
</File>
<File
RelativePath="..\public\tier1\stringpool.h"
>
</File>
<File
RelativePath="..\public\tier1\strtools.h"
>
</File>
<File
RelativePath="..\public\tier1\tier1.h"
>
</File>
<File
RelativePath="..\public\tier1\tokenreader.h"
>
</File>
<File
RelativePath="..\public\tier1\uniqueid.h"
>
</File>
<File
RelativePath="..\public\tier1\utlbidirectionalset.h"
>
</File>
<File
RelativePath="..\public\tier1\utlblockmemory.h"
>
</File>
<File
RelativePath="..\public\tier1\utlbuffer.h"
>
</File>
<File
RelativePath="..\public\tier1\utlbufferutil.h"
>
</File>
<File
RelativePath="..\public\tier1\utldict.h"
>
</File>
<File
RelativePath="..\public\tier1\utlenvelope.h"
>
</File>
<File
RelativePath="..\public\tier1\utlfixedmemory.h"
>
</File>
<File
RelativePath="..\public\tier1\utlhandletable.h"
>
</File>
<File
RelativePath="..\public\tier1\utlhash.h"
>
</File>
<File
RelativePath="..\public\tier1\utllinkedlist.h"
>
</File>
<File
RelativePath="..\public\tier1\utlmap.h"
>
</File>
<File
RelativePath="..\public\tier1\utlmemory.h"
>
</File>
<File
RelativePath="..\public\tier1\utlmultilist.h"
>
</File>
<File
RelativePath="..\public\tier1\utlpriorityqueue.h"
>
</File>
<File
RelativePath="..\public\tier1\utlqueue.h"
>
</File>
<File
RelativePath="..\public\tier1\utlrbtree.h"
>
</File>
<File
RelativePath="..\public\tier1\UtlSortVector.h"
>
</File>
<File
RelativePath="..\public\tier1\utlstack.h"
>
</File>
<File
RelativePath="..\public\tier1\utlstring.h"
>
</File>
<File
RelativePath="..\public\tier1\UtlStringMap.h"
>
</File>
<File
RelativePath="..\public\tier1\utlsymbol.h"
>
</File>
<File
RelativePath="..\public\tier1\utlvector.h"
>
</File>
<File
RelativePath="..\common\xbox\xboxstubs.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

251
tier1/tier1-2005.vcxproj Normal file
View File

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</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>14.0.25420.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>.\Debug\</OutDir>
<IntDir>.\Debug\</IntDir>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command />
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\public;..\public\tier0;..\public\tier1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<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 />
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation />
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command />
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\lib\public\tier1.lib</OutputFile>
<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 />
</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;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TIER1_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<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 />
<ExpandAttributedSource>false</ExpandAttributedSource>
<AssemblerOutput />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<GenerateXMLDocumentationFiles>false</GenerateXMLDocumentationFiles>
<BrowseInformation />
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<ErrorReporting>Prompt</ErrorReporting>
</ClCompile>
<PreLinkEvent>
<Command />
</PreLinkEvent>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\lib\public\tier1.lib</OutputFile>
<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="tokenreader.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="..\common\xbox\xboxstubs.h" />
<ClInclude Include="..\public\datamap.h" />
<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\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\tokenreader.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" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,263 @@
<?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>{b2c0d006-1973-4c49-943e-d62b5b01e5c5}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{5fb26705-abb8-4153-bf1f-88ef637c9b51}</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="tokenreader.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\tokenreader.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>