mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-23 01:59:43 +08:00
TF2 win64 + Ambuild tier1/mathlib + long=devil (#198)
* Fix compilation for windows, setup ambuild * Add built tier1 and mathlib for win64 * Ensure compilation is working on windows and linux * Add -fPIC * Add compiled libs, with optimisation enabled * Added windows lib * Fix hl2sdk for windows * Longs are the devil * Fix up threadtools functions * Add updated libs * Rework lib naming, and package script * Update lib directory according to new packaging --------- Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
This commit is contained in:
parent
dcf515fea8
commit
8a6d1c6cd2
151
AMBuildScript
Normal file
151
AMBuildScript
Normal file
@ -0,0 +1,151 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os, sys, shutil
|
||||
from ambuild2 import util
|
||||
|
||||
def ResolveEnvPath(env, folder=None):
|
||||
if env in os.environ:
|
||||
path = os.environ[env]
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
return None
|
||||
|
||||
if folder:
|
||||
head = os.getcwd()
|
||||
oldhead = None
|
||||
while head != None and head != oldhead:
|
||||
path = os.path.join(head, folder)
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
|
||||
return None
|
||||
|
||||
def Normalize(path):
|
||||
return os.path.abspath(os.path.normpath(path))
|
||||
|
||||
class SDKConfig(object):
|
||||
def __init__(self):
|
||||
self.libs = []
|
||||
self.targets = []
|
||||
self.target_archs = set()
|
||||
|
||||
for arch in ['x86', 'x86_64']:
|
||||
try:
|
||||
cxx = builder.DetectCxx(target_arch = arch)
|
||||
self.target_archs.add(cxx.target.arch)
|
||||
except Exception as e:
|
||||
if builder.options.targets:
|
||||
raise
|
||||
print('Skipping target {}: {}'.format(arch, e))
|
||||
continue
|
||||
self.targets.append(cxx)
|
||||
|
||||
if not self.targets:
|
||||
raise Exception('No suitable C/C++ compiler was found.')
|
||||
|
||||
@property
|
||||
def tag(self):
|
||||
if builder.options.debug == '1':
|
||||
return 'Debug'
|
||||
return 'Release'
|
||||
|
||||
def configure_cxx(self, cxx):
|
||||
if cxx.like('gcc'):
|
||||
self.configure_gcc(cxx)
|
||||
elif cxx.family == 'msvc':
|
||||
self.configure_msvc(cxx)
|
||||
|
||||
# Optimization
|
||||
if builder.options.opt == '1':
|
||||
cxx.defines += ['NDEBUG']
|
||||
|
||||
# Debugging
|
||||
if builder.options.debug == '1':
|
||||
cxx.defines += ['DEBUG', '_DEBUG']
|
||||
|
||||
if cxx.target.arch == 'x86_64':
|
||||
cxx.defines += ['X64BITS', 'PLATFORM_64BITS']
|
||||
|
||||
# Platform-specifics
|
||||
if cxx.target.platform == 'linux':
|
||||
self.configure_linux(cxx)
|
||||
elif cxx.target.platform == 'windows':
|
||||
self.configure_windows(cxx)
|
||||
|
||||
def configure_gcc(self, cxx):
|
||||
cxx.cflags += [
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-Wno-overloaded-virtual',
|
||||
'-msse',
|
||||
'-fPIC'
|
||||
]
|
||||
|
||||
cxx.defines += [
|
||||
'COMPILER_GCC'
|
||||
]
|
||||
|
||||
cxx.cxxflags += [
|
||||
'-std=c++17'
|
||||
]
|
||||
|
||||
if builder.options.opt == '1':
|
||||
cxx.cflags += ['-O3']
|
||||
return
|
||||
|
||||
def configure_msvc(self, cxx):
|
||||
cxx.cxxflags += [
|
||||
'/std:c++17',
|
||||
'/WX'
|
||||
]
|
||||
|
||||
|
||||
if builder.options.opt == '1':
|
||||
cxx.cflags += ['/Ox', '/Zo']
|
||||
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
|
||||
|
||||
return
|
||||
|
||||
def configure_linux(self, cxx):
|
||||
cxx.defines += ['_LINUX', 'POSIX', 'GNUC']
|
||||
|
||||
# Set of defines required by the HL2SDK
|
||||
cxx.defines += [
|
||||
'_finite=finite', 'stricmp=strcasecmp',
|
||||
'_stricmp=strcasecmp', '_strnicmp=strncasecmp',
|
||||
'strnicmp=strncasecmp', '_vsnprintf=vsnprintf',
|
||||
'_alloca=alloca', 'strcmpi=strcasecmp',
|
||||
'NO_MALLOC_OVERRIDE'
|
||||
]
|
||||
return
|
||||
|
||||
def configure_windows(self, cxx):
|
||||
cxx.defines += ['_WINDOWS']
|
||||
if cxx.target.arch == 'x86':
|
||||
cxx.defines += ['WIN32']
|
||||
elif cxx.target.arch == 'x86_64':
|
||||
cxx.defines += ['WIN64']
|
||||
return
|
||||
|
||||
def configure(self):
|
||||
for cxx in self.targets:
|
||||
self.configure_cxx(cxx)
|
||||
|
||||
def ConfigureLibrary(self, project, compiler, context, prefix = ''):
|
||||
name = prefix + project.name
|
||||
if compiler.target.platform == 'linux' and compiler.target.arch == 'x86':
|
||||
name += '_i486'
|
||||
binary = project.Configure(compiler, name, '{0} - {1}'.format(self.tag, compiler.target.arch))
|
||||
binary.compiler.cxxincludes += [
|
||||
os.path.join(context.currentSourcePath)
|
||||
]
|
||||
return binary
|
||||
|
||||
HL2SDK = SDKConfig()
|
||||
HL2SDK.configure()
|
||||
|
||||
BuildScripts = ['mathlib/AMBuilder', 'tier1/AMBuilder', 'PackageScript']
|
||||
# Turn off the 'lib' prefix for all platform, we will add it if we need to
|
||||
util.StaticLibPrefix = ''
|
||||
builder.Build(BuildScripts, { 'HL2SDK': HL2SDK })
|
56
PackageScript
Normal file
56
PackageScript
Normal file
@ -0,0 +1,56 @@
|
||||
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
|
||||
import os
|
||||
|
||||
# This is where the files will be output to
|
||||
# package is the default
|
||||
builder.SetBuildFolder('lib')
|
||||
|
||||
|
||||
folder_list = []
|
||||
|
||||
for task in HL2SDK.libs:
|
||||
if task.target.platform == 'windows':
|
||||
folder_list += ['public', 'public/win64']
|
||||
break
|
||||
|
||||
for task in HL2SDK.libs:
|
||||
if task.target.platform == 'linux':
|
||||
folder_list += ['linux', 'linux64']
|
||||
break
|
||||
|
||||
# Create the distribution folder hierarchy.
|
||||
folder_map = {}
|
||||
for folder in folder_list:
|
||||
norm_folder = os.path.normpath(folder)
|
||||
folder_map[folder] = builder.AddFolder(norm_folder)
|
||||
|
||||
# Do all straight-up file copies from the source tree.
|
||||
def CopyFiles(src, dest, files):
|
||||
if not dest:
|
||||
dest = src
|
||||
dest_entry = folder_map[dest]
|
||||
for source_file in files:
|
||||
source_path = os.path.join(builder.sourcePath, src, source_file)
|
||||
builder.AddCopy(source_path, dest_entry)
|
||||
def CopyFile(src, dest):
|
||||
dest_entry = folder_map[dest]
|
||||
source_path = os.path.join(builder.sourcePath, src)
|
||||
builder.AddCopy(source_path, dest_entry)
|
||||
def CopyDirContent(src, dest):
|
||||
dest_entry = folder_map[dest]
|
||||
for item in os.scandir(os.path.join(builder.sourcePath, src)):
|
||||
if item.is_file():
|
||||
builder.AddCopy(item.path, dest_entry)
|
||||
|
||||
# Copy binaries.
|
||||
for task in HL2SDK.libs:
|
||||
if task.target.platform == 'linux':
|
||||
if task.target.arch == 'x86_64':
|
||||
builder.AddCopy(task.binary, folder_map['linux64'])
|
||||
else:
|
||||
builder.AddCopy(task.binary, folder_map['linux'])
|
||||
elif task.target.platform == 'windows':
|
||||
if task.target.arch == 'x86_64':
|
||||
builder.AddCopy(task.binary, folder_map['public/win64'])
|
||||
else:
|
||||
builder.AddCopy(task.binary, folder_map['public'])
|
11
configure.py
Normal file
11
configure.py
Normal file
@ -0,0 +1,11 @@
|
||||
import sys
|
||||
from ambuild2 import run
|
||||
|
||||
parser = run.BuildParser(sourcePath = sys.path[0], api='2.2')
|
||||
parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
|
||||
help='Enable debugging symbols')
|
||||
parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
|
||||
help='Enable optimization')
|
||||
parser.options.add_argument('--targets', type=str, dest='targets', default=None,
|
||||
help="Override the target architecture (use commas to separate multiple targets).")
|
||||
parser.Configure()
|
@ -15,7 +15,7 @@
|
||||
|
||||
void ScratchPad_DrawWorldToScratchPad(
|
||||
IScratchPad3D *pPad,
|
||||
unsigned long flags )
|
||||
uint32_t flags )
|
||||
{
|
||||
pPad->SetRenderState( IScratchPad3D::RS_FillMode, IScratchPad3D::FillMode_Wireframe );
|
||||
|
||||
@ -52,7 +52,7 @@ void ScratchPad_DrawWorldToScratchPad(
|
||||
|
||||
void ScratchPad_DrawEntityToScratchPad(
|
||||
IScratchPad3D *pPad,
|
||||
unsigned long flags,
|
||||
uint32_t flags,
|
||||
CBaseEntity *pEnt,
|
||||
const Vector &vColor )
|
||||
{
|
||||
|
@ -27,12 +27,12 @@ class IScratchPad3D;
|
||||
// flags is a combination of the SPDRAWWORLD_ flags.
|
||||
void ScratchPad_DrawWorldToScratchPad(
|
||||
IScratchPad3D *pPad,
|
||||
unsigned long flags );
|
||||
uint32_t flags );
|
||||
|
||||
// Draw a specific entity into the scratch pad.
|
||||
void ScratchPad_DrawEntityToScratchPad(
|
||||
IScratchPad3D *pPad,
|
||||
unsigned long flags,
|
||||
uint32_t flags,
|
||||
CBaseEntity *pEnt,
|
||||
const Vector &vColor );
|
||||
|
||||
|
@ -86,7 +86,7 @@ class Color;
|
||||
|
||||
namespace vgui2
|
||||
{
|
||||
typedef unsigned long HFont;
|
||||
typedef uint32_t HFont;
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
|
@ -162,7 +162,7 @@ bool CVoiceGameMgr::ClientCommand( CBasePlayer *pPlayer, const CCommand &args )
|
||||
{
|
||||
for(int i=1; i < args.ArgC(); i++)
|
||||
{
|
||||
unsigned long mask = 0;
|
||||
uint32_t mask = 0;
|
||||
sscanf( args[i], "%p", (void**)&mask);
|
||||
|
||||
if( i <= VOICE_MAX_PLAYERS_DW )
|
||||
|
@ -349,11 +349,11 @@ void CVoiceStatus::UpdateServerState(bool bForce)
|
||||
Q_strncpy(str,"vban",sizeof(str));
|
||||
bool bChange = false;
|
||||
|
||||
for(unsigned long dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)
|
||||
for(uint32_t dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)
|
||||
{
|
||||
unsigned long serverBanMask = 0;
|
||||
unsigned long banMask = 0;
|
||||
for(unsigned long i=0; i < 32; i++)
|
||||
uint32_t serverBanMask = 0;
|
||||
uint32_t banMask = 0;
|
||||
for(uint32_t i=0; i < 32; i++)
|
||||
{
|
||||
int playerIndex = ( dw * 32 + i );
|
||||
if ( playerIndex >= MAX_PLAYERS )
|
||||
@ -408,11 +408,11 @@ void CVoiceStatus::UpdateServerState(bool bForce)
|
||||
|
||||
void CVoiceStatus::HandleVoiceMaskMsg(bf_read &msg)
|
||||
{
|
||||
unsigned long dw;
|
||||
uint32_t dw;
|
||||
for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++)
|
||||
{
|
||||
m_AudiblePlayers.SetDWord(dw, (unsigned long)msg.ReadLong());
|
||||
m_ServerBannedPlayers.SetDWord(dw, (unsigned long)msg.ReadLong());
|
||||
m_AudiblePlayers.SetDWord(dw, (uint32_t)msg.ReadLong());
|
||||
m_ServerBannedPlayers.SetDWord(dw, (uint32_t)msg.ReadLong());
|
||||
|
||||
if( voice_clientdebug.GetInt())
|
||||
{
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/public/win64/mathlib.lib
Normal file
BIN
lib/public/win64/mathlib.lib
Normal file
Binary file not shown.
BIN
lib/public/win64/tier0.lib
Normal file
BIN
lib/public/win64/tier0.lib
Normal file
Binary file not shown.
BIN
lib/public/win64/tier1.lib
Normal file
BIN
lib/public/win64/tier1.lib
Normal file
Binary file not shown.
BIN
lib/public/win64/vstdlib.lib
Normal file
BIN
lib/public/win64/vstdlib.lib
Normal file
Binary file not shown.
@ -1,195 +0,0 @@
|
||||
#
|
||||
# SDK Makefile for x86 Linux
|
||||
#
|
||||
#
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
#############################################################################
|
||||
# Developer configurable items
|
||||
#############################################################################
|
||||
|
||||
# the name of the mod binary (_i486.so is appended to the end)
|
||||
NAME = server
|
||||
|
||||
# the location of the vcproj that builds the mod
|
||||
MOD_PROJ = ../game/server/server_scratch-2005.vcproj
|
||||
# the name of the mod configuration (typically <proj name>_<build type><build target>)
|
||||
MOD_CONFIG = Server\(SDK\)_ReleaseWin32
|
||||
|
||||
# the directory the base binaries (tier0_i486.so, etc) are located
|
||||
# this should point to your orange box subfolder of where you have srcds installed.
|
||||
SRCDS_DIR = ~/srcds/orangebox
|
||||
|
||||
# the path to your mods directory
|
||||
# set this so that 'make install' or 'make installrelease' will copy your binary over automatically.
|
||||
GAME_DIR = $(SRCDS_DIR)/scratchmod
|
||||
|
||||
# compiler options (gcc 3.4.1 or above is required - 4.1.2+ recommended)
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CC = /usr/bin/clang
|
||||
CPLUS = /usr/bin/clang++
|
||||
CLINK = /usr/bin/clang
|
||||
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 =
|
||||
|
||||
# link flags for your mod, make sure to include any special libraries here
|
||||
LDFLAGS = "-lm -ldl $(LIB_DIR)/particles_i486.a $(LIB_DIR)/dmxloader_i486.a $(LIB_DIR)/mathlib_i486.a tier0_i486.so vstdlib_i486.so $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/tier2_i486.a $(LIB_DIR)/tier3_i486.a $(LIB_DIR)/choreoobjects_i486.a steam_api_i486.so"
|
||||
|
||||
# XERCES 2.6.0 or above ( http://xml.apache.org/xerces-c/ ) is used by the vcproj to makefile converter
|
||||
# it must be installed before being able to run this makefile
|
||||
# if you have xerces installed already you should be able to use the two lines below
|
||||
XERCES_INC_DIR = /usr/include
|
||||
XERCES_LIB_DIR = /usr/lib
|
||||
|
||||
# Change this to true if you want to build debug binaries for everything
|
||||
# The only exception is the mod/game as MOD_CONFIG determines if it's a debug build or not
|
||||
DEBUG = false
|
||||
|
||||
#############################################################################
|
||||
# Things below here shouldn't need to be altered
|
||||
#############################################################################
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
MAKE = make
|
||||
AR = "ar rvs"
|
||||
|
||||
# the dir we want to put binaries we build into
|
||||
BUILD_DIR = .
|
||||
# the place to put object files
|
||||
BUILD_OBJ_DIR = $(BUILD_DIR)/obj
|
||||
|
||||
# the location of the source code
|
||||
SRC_DIR = ..
|
||||
|
||||
# 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 -msse -msse2 -m32
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
DEFINES = -D_OSX -DOSX -D_DLL_EXT=.dylib
|
||||
ARCH_CFLAGS += -mmacosx-version-min=10.5
|
||||
SHLIBEXT = dylib
|
||||
SHLIBLDFLAGS = -dynamiclib -mmacosx-version-min=10.5
|
||||
SHLIBSUFFIX =
|
||||
else
|
||||
DEFINES = -D_LINUX -DLINUX -D_DLL_EXT=.so
|
||||
SHLIBEXT = so
|
||||
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt
|
||||
SHLIBSUFFIX = _srv
|
||||
endif
|
||||
|
||||
DEFINES +=-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 -DPOSIX -DGNUC -DCOMPILER_GCC -DNO_MALLOC_OVERRIDE
|
||||
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||
|
||||
BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \
|
||||
-Wno-unknown-pragmas -Wno-unused
|
||||
SHLIBCFLAGS = -fPIC
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
BASE_CFLAGS += -Wno-delete-non-virtual-dtor -Wno-narrowing
|
||||
endif
|
||||
|
||||
ifeq "$(shell expr $(IS_CLANG) \= 0 \& $(CPP_MAJOR) \>= 6)" "1"
|
||||
BASE_CFLAGS += -Wno-nonnull-compare
|
||||
endif
|
||||
|
||||
# Flags passed to the c compiler
|
||||
CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS)
|
||||
ifdef USER_CFLAGS
|
||||
CFLAGS += $(USER_CFLAGS)
|
||||
endif
|
||||
CFLAGS += $(UNDEF)
|
||||
|
||||
# Debug flags
|
||||
DBG_DEFINES = "-D_DEBUG -DDEBUG"
|
||||
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) 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) \
|
||||
XERCES_INC_DIR=$(XERCES_INC_DIR) XERCES_LIB_DIR=$(XERCES_LIB_DIR)
|
||||
|
||||
# Project Makefile
|
||||
MAKE_SERVER = Makefile.server
|
||||
MAKE_VCPM = Makefile.vcpm
|
||||
MAKE_PLUGIN = Makefile.plugin
|
||||
MAKE_TIER1 = Makefile.tier1
|
||||
MAKE_MATH = Makefile.mathlib
|
||||
MAKE_CHOREO = Makefile.choreo
|
||||
|
||||
all: check vcpm mod
|
||||
|
||||
check:
|
||||
if [ -z "$(CC)" ]; then echo "Compiler not defined."; exit; fi
|
||||
if [ ! -d $(BUILD_DIR) ];then mkdir -p $(BUILD_DIR);fi
|
||||
cd $(BUILD_DIR)
|
||||
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 "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
|
||||
|
||||
mod: check vcpm
|
||||
./vcpm $(MOD_PROJ)
|
||||
$(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES)
|
||||
|
||||
plugin: check
|
||||
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES)
|
||||
|
||||
tier1:
|
||||
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES)
|
||||
|
||||
mathlib:
|
||||
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES)
|
||||
|
||||
choreo:
|
||||
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES)
|
||||
|
||||
install:
|
||||
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
installrelease:
|
||||
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
strip $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean
|
||||
$(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean
|
||||
$(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) clean
|
||||
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean
|
||||
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean
|
||||
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean
|
@ -1,57 +0,0 @@
|
||||
#
|
||||
# Choreoobjects Static Library Makefile
|
||||
#
|
||||
|
||||
override NAME = choreoobjects
|
||||
|
||||
LIB_SRC_DIR = $(SRC_DIR)/game/shared
|
||||
PUBLIC_SRC_DIR = $(SRC_DIR)/public
|
||||
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
|
||||
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
|
||||
UTIL_COMMON_SRC_DIR = $(SRC_DIR)/utils/common
|
||||
|
||||
LIB_OBJ_DIR = $(BUILD_OBJ_DIR)/$(NAME)_$(ARCH)
|
||||
|
||||
# Extension of linux static library
|
||||
override SHLIBEXT = a
|
||||
|
||||
INCLUDEDIRS = -I$(LIB_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -I$(UTIL_COMMON_SRC_DIR) -D_LIB -DCHOREOOBJECTS_STATIC_LIB
|
||||
|
||||
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += -DNDEBUG $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
#####################################################################
|
||||
|
||||
LIB_OBJS= \
|
||||
$(LIB_OBJ_DIR)/choreoactor.o \
|
||||
$(LIB_OBJ_DIR)/choreochannel.o \
|
||||
$(LIB_OBJ_DIR)/choreoevent.o \
|
||||
$(LIB_OBJ_DIR)/choreoscene.o \
|
||||
$(LIB_OBJ_DIR)/sceneimage.o \
|
||||
|
||||
all: dirs $(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
dirs:
|
||||
-mkdir -p $(BUILD_OBJ_DIR)
|
||||
-mkdir -p $(LIB_OBJ_DIR)
|
||||
|
||||
$(NAME)_$(ARCH).$(SHLIBEXT): $(LIB_OBJS)
|
||||
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
|
||||
|
||||
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
install:
|
||||
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(LIB_DIR)/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
clean:
|
||||
-rm -rf $(LIB_OBJ_DIR)
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
#
|
||||
# Mathlin Static Library Makefile
|
||||
#
|
||||
|
||||
override NAME = mathlib
|
||||
|
||||
LIB_SRC_DIR = $(SRC_DIR)/$(NAME)
|
||||
PUBLIC_SRC_DIR = $(SRC_DIR)/public
|
||||
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
|
||||
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
|
||||
MATHLIB_PUBLIC_SRC_DIR = $(SRC_DIR)/public/mathlib
|
||||
|
||||
LIB_OBJ_DIR = $(BUILD_OBJ_DIR)/$(NAME) #_$(ARCH)
|
||||
|
||||
# Extension of linux static library
|
||||
override SHLIBEXT = a
|
||||
|
||||
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -I$(MATHLIB_PUBLIC_SRC_DIR) -D_LIB
|
||||
|
||||
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += -DNDEBUG $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
#####################################################################
|
||||
|
||||
LIB_OBJS= \
|
||||
$(LIB_OBJ_DIR)/anorms.o \
|
||||
$(LIB_OBJ_DIR)/bumpvects.o \
|
||||
$(LIB_OBJ_DIR)/color_conversion.o \
|
||||
$(LIB_OBJ_DIR)/halton.o \
|
||||
$(LIB_OBJ_DIR)/IceKey.o \
|
||||
$(LIB_OBJ_DIR)/imagequant.o \
|
||||
$(LIB_OBJ_DIR)/lightdesc.o \
|
||||
$(LIB_OBJ_DIR)/mathlib_base.o \
|
||||
$(LIB_OBJ_DIR)/polyhedron.o \
|
||||
$(LIB_OBJ_DIR)/powsse.o \
|
||||
$(LIB_OBJ_DIR)/quantize.o \
|
||||
$(LIB_OBJ_DIR)/randsse.o \
|
||||
$(LIB_OBJ_DIR)/simdvectormatrix.o \
|
||||
$(LIB_OBJ_DIR)/sparse_convolution_noise.o \
|
||||
$(LIB_OBJ_DIR)/sse.o \
|
||||
$(LIB_OBJ_DIR)/sseconst.o \
|
||||
$(LIB_OBJ_DIR)/ssenoise.o \
|
||||
$(LIB_OBJ_DIR)/vector.o \
|
||||
$(LIB_OBJ_DIR)/vmatrix.o \
|
||||
|
||||
all: dirs $(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
dirs:
|
||||
-mkdir -p $(BUILD_OBJ_DIR)
|
||||
-mkdir -p $(LIB_OBJ_DIR)
|
||||
|
||||
$(NAME)_$(ARCH).$(SHLIBEXT): $(LIB_OBJS)
|
||||
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
|
||||
|
||||
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
install:
|
||||
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(LIB_DIR)/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
clean:
|
||||
-rm -rf $(LIB_OBJ_DIR)
|
||||
|
@ -1,57 +0,0 @@
|
||||
#
|
||||
# Sample server plugin for SRC engine
|
||||
#
|
||||
# October 2004, alfred@valvesoftware.com
|
||||
#
|
||||
|
||||
override NAME = serverplugin_empty
|
||||
|
||||
PLUGIN_SRC_DIR = $(SRC_DIR)/utils/serverplugin_sample
|
||||
PUBLIC_SRC_DIR = $(SRC_DIR)/public
|
||||
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
|
||||
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
|
||||
|
||||
PLUGIN_OBJ_DIR = $(BUILD_OBJ_DIR)/serverplugin_empty_$(ARCH)
|
||||
TIER0_OBJ_DIR = $(PLUGIN_OBJ_DIR)/tier0
|
||||
|
||||
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR)
|
||||
LDFLAGS_PLG = -lm -ldl tier0_i486.so vstdlib_i486.so $(LIB_DIR)/mathlib_i486.a $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/tier2_i486.a
|
||||
|
||||
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += -DNDEBUG $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
#####################################################################
|
||||
|
||||
PLUGIN_OBJS = \
|
||||
$(PLUGIN_OBJ_DIR)/serverplugin_bot.o \
|
||||
$(PLUGIN_OBJ_DIR)/serverplugin_empty.o \
|
||||
|
||||
TIER0_OBJS = \
|
||||
$(TIER0_OBJ_DIR)/memoverride.o \
|
||||
|
||||
all: dirs $(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
dirs:
|
||||
-mkdir -p $(BUILD_OBJ_DIR)
|
||||
-mkdir -p $(PLUGIN_OBJ_DIR)
|
||||
-mkdir -p $(TIER0_OBJ_DIR)
|
||||
|
||||
$(NAME)_$(ARCH).$(SHLIBEXT): $(PLUGIN_OBJS) $(TIER0_OBJS)
|
||||
$(CLINK) -o $(BUILD_DIR)/$@ -m32 $(SHLIBLDFLAGS) $(PLUGIN_OBJS) $(TIER0_OBJS) $(PUBLIC_OBJS) $(CPP_LIB) $(LDFLAGS_PLG) $(CPP_LIB)
|
||||
|
||||
$(PLUGIN_OBJ_DIR)/%.o: $(PLUGIN_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
$(TIER0_OBJ_DIR)/%.o: $(TIER0_PUBLIC_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
clean:
|
||||
-rm -rf $(PLUGIN_OBJ_DIR)
|
||||
-rm -f $(NAME)_$(ARCH).$(SHLIBEXT)
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# wrapper Makefile for auto-generated make files
|
||||
#
|
||||
#
|
||||
|
||||
#############################################################################
|
||||
# PROJECT MAKEFILES
|
||||
#############################################################################
|
||||
MAKE_FILE = Makefile.$(MOD_CONFIG)
|
||||
-include $(MAKE_FILE)
|
||||
|
||||
#############################################################################
|
||||
# The compiler command line for each src code file to compile
|
||||
#############################################################################
|
||||
DO_CC = $(CPLUS) $(INCLUDES) -DARCH=$(ARCH)
|
||||
|
||||
ifeq (_DEBUG,$(findstring _DEBUG,$(CFLAGS)))
|
||||
DO_CC += $(DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
clean:
|
||||
rm -rf obj/$(NAME)_$(ARCH)
|
||||
rm -f $(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
@ -1,77 +0,0 @@
|
||||
#
|
||||
# Tier1 Static Library Makefile
|
||||
#
|
||||
|
||||
override NAME = tier1
|
||||
|
||||
LIB_SRC_DIR = $(SRC_DIR)/$(NAME)
|
||||
PUBLIC_SRC_DIR = $(SRC_DIR)/public
|
||||
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
|
||||
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
|
||||
|
||||
LIB_OBJ_DIR=$(BUILD_OBJ_DIR)/$(NAME) #_$(ARCH)
|
||||
|
||||
# Extension of linux static library
|
||||
override SHLIBEXT = a
|
||||
|
||||
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -D_LIB -DTIER1_STATIC_LIB
|
||||
|
||||
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += -DNDEBUG $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
#####################################################################
|
||||
|
||||
LIB_OBJS= \
|
||||
$(LIB_OBJ_DIR)/bitbuf.o \
|
||||
$(LIB_OBJ_DIR)/byteswap.o \
|
||||
$(LIB_OBJ_DIR)/characterset.o \
|
||||
$(LIB_OBJ_DIR)/checksum_crc.o \
|
||||
$(LIB_OBJ_DIR)/checksum_md5.o \
|
||||
$(LIB_OBJ_DIR)/commandbuffer.o \
|
||||
$(LIB_OBJ_DIR)/convar.o \
|
||||
$(LIB_OBJ_DIR)/datamanager.o \
|
||||
$(LIB_OBJ_DIR)/diff.o \
|
||||
$(LIB_OBJ_DIR)/generichash.o \
|
||||
$(LIB_OBJ_DIR)/interface.o \
|
||||
$(LIB_OBJ_DIR)/KeyValues.o \
|
||||
$(LIB_OBJ_DIR)/mempool.o \
|
||||
$(LIB_OBJ_DIR)/NetAdr.o \
|
||||
$(LIB_OBJ_DIR)/newbitbuf.o \
|
||||
$(LIB_OBJ_DIR)/processor_detect.o \
|
||||
$(LIB_OBJ_DIR)/rangecheckedvar.o \
|
||||
$(LIB_OBJ_DIR)/stringpool.o \
|
||||
$(LIB_OBJ_DIR)/strtools.o \
|
||||
$(LIB_OBJ_DIR)/tier1.o \
|
||||
$(LIB_OBJ_DIR)/tokenreader.o \
|
||||
$(LIB_OBJ_DIR)/undiff.o \
|
||||
$(LIB_OBJ_DIR)/uniqueid.o \
|
||||
$(LIB_OBJ_DIR)/utlbuffer.o \
|
||||
$(LIB_OBJ_DIR)/utlbufferutil.o \
|
||||
$(LIB_OBJ_DIR)/utlstring.o \
|
||||
$(LIB_OBJ_DIR)/utlsymbol.o \
|
||||
|
||||
all: dirs $(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
dirs:
|
||||
-mkdir -p $(BUILD_OBJ_DIR)
|
||||
-mkdir -p $(LIB_OBJ_DIR)
|
||||
|
||||
$(NAME)_$(ARCH).$(SHLIBEXT): $(LIB_OBJS)
|
||||
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
|
||||
|
||||
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
install:
|
||||
cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(LIB_DIR)/$(NAME)_$(ARCH).$(SHLIBEXT)
|
||||
|
||||
clean:
|
||||
-rm -rf $(LIB_OBJ_DIR)
|
||||
|
@ -1,50 +0,0 @@
|
||||
#
|
||||
# VCProject file to Makefile converter
|
||||
#
|
||||
# November 2004, alfred@valvesoftware.com
|
||||
#
|
||||
|
||||
VCPM_SRC_DIR = $(SRC_DIR)/utils/vprojtomake
|
||||
PUBLIC_SRC_DIR = $(SRC_DIR)/public
|
||||
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
|
||||
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
|
||||
UTIL_COMMON_SRC_DIR = $(SRC_DIR)/utils/common
|
||||
|
||||
VCPM_OBJ_DIR = $(BUILD_OBJ_DIR)/vcpm
|
||||
|
||||
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(XERCES_INC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -I$(UTIL_COMMON_SRC_DIR)
|
||||
LDFLAGS_VC = -lm -ldl -L$(XERCES_LIB_DIR) -lxerces-c tier0_i486.so vstdlib_i486.so $(LIB_DIR)/tier1_i486.a
|
||||
|
||||
DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS)
|
||||
else
|
||||
DO_CC += -DNDEBUG $(CFLAGS)
|
||||
endif
|
||||
|
||||
DO_CC += -o $@ -c $<
|
||||
|
||||
#####################################################################
|
||||
|
||||
VCPM_OBJS = \
|
||||
$(VCPM_OBJ_DIR)/makefilecreator.o \
|
||||
$(VCPM_OBJ_DIR)/vprojtomake.o \
|
||||
$(VCPM_OBJ_DIR)/vcprojconvert.o \
|
||||
|
||||
all: dirs vcpm
|
||||
|
||||
dirs:
|
||||
-mkdir -p $(BUILD_OBJ_DIR)
|
||||
-mkdir -p $(VCPM_OBJ_DIR)
|
||||
|
||||
vcpm: $(VCPM_OBJS)
|
||||
$(CLINK) -m32 -o $(BUILD_DIR)/$@ $(VCPM_OBJS) $(CPP_LIB) $(LDFLAGS_VC)
|
||||
|
||||
$(VCPM_OBJ_DIR)/%.o: $(VCPM_SRC_DIR)/%.cpp
|
||||
$(DO_CC)
|
||||
|
||||
clean:
|
||||
-rm -rf $(VCPM_OBJ_DIR)
|
||||
-rm -f vcpm
|
||||
|
45
mathlib/AMBuilder
Normal file
45
mathlib/AMBuilder
Normal file
@ -0,0 +1,45 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os, sys
|
||||
|
||||
def AddSourceFilesFromDir(path, files):
|
||||
list = []
|
||||
for file in files:
|
||||
list.append(os.path.join(path, file))
|
||||
return list
|
||||
|
||||
builder.SetBuildFolder('/')
|
||||
|
||||
project = builder.StaticLibraryProject('mathlib')
|
||||
project.sources = [
|
||||
'anorms.cpp',
|
||||
'bumpvects.cpp',
|
||||
'color_conversion.cpp',
|
||||
'halton.cpp',
|
||||
'IceKey.cpp',
|
||||
'imagequant.cpp',
|
||||
'lightdesc.cpp',
|
||||
'mathlib_base.cpp',
|
||||
'polyhedron.cpp',
|
||||
'powsse.cpp',
|
||||
'quantize.cpp',
|
||||
'randsse.cpp',
|
||||
'simdvectormatrix.cpp',
|
||||
'sparse_convolution_noise.cpp',
|
||||
'sse.cpp',
|
||||
'sseconst.cpp',
|
||||
'ssenoise.cpp',
|
||||
'vector.cpp',
|
||||
'vmatrix.cpp',
|
||||
]
|
||||
|
||||
for cxx in HL2SDK.targets:
|
||||
binary = HL2SDK.ConfigureLibrary(project, cxx, builder)
|
||||
compiler = binary.compiler
|
||||
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(builder.currentSourcePath, '..', 'public'),
|
||||
os.path.join(builder.currentSourcePath, '..', 'public', 'tier0'),
|
||||
os.path.join(builder.currentSourcePath, '..', 'public', 'mathlib')
|
||||
]
|
||||
|
||||
HL2SDK.libs += builder.Add(project)
|
@ -5,6 +5,7 @@
|
||||
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
|
||||
|
||||
#include "mathlib/IceKey.H"
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4244)
|
||||
@ -13,12 +14,12 @@
|
||||
/* Structure of a single round subkey */
|
||||
class IceSubkey {
|
||||
public:
|
||||
unsigned long val[3];
|
||||
uint32_t val[3];
|
||||
};
|
||||
|
||||
|
||||
/* The S-boxes */
|
||||
static unsigned long ice_sbox[4][1024];
|
||||
static uint32_t ice_sbox[4][1024];
|
||||
static int ice_sboxes_initialised = 0;
|
||||
|
||||
|
||||
@ -37,7 +38,7 @@ static const int ice_sxor[4][4] = {
|
||||
{0xea, 0xcb, 0x2e, 0x04}};
|
||||
|
||||
/* Permutation values for the P-box */
|
||||
static const unsigned long ice_pbox[32] = {
|
||||
static const uint32_t ice_pbox[32] = {
|
||||
0x00000001, 0x00000080, 0x00000400, 0x00002000,
|
||||
0x00080000, 0x00200000, 0x01000000, 0x40000000,
|
||||
0x00000008, 0x00000020, 0x00000100, 0x00004000,
|
||||
@ -61,11 +62,11 @@ static const int ice_keyrot[16] = {
|
||||
|
||||
static unsigned int
|
||||
gf_mult (
|
||||
register unsigned int a,
|
||||
register unsigned int b,
|
||||
register unsigned int m
|
||||
unsigned int a,
|
||||
unsigned int b,
|
||||
unsigned int m
|
||||
) {
|
||||
register unsigned int res = 0;
|
||||
unsigned int res = 0;
|
||||
|
||||
while (b) {
|
||||
if (b & 1)
|
||||
@ -87,12 +88,12 @@ gf_mult (
|
||||
* Raise the base to the power of 7, modulo m.
|
||||
*/
|
||||
|
||||
static unsigned long
|
||||
static uint32_t
|
||||
gf_exp7 (
|
||||
register unsigned int b,
|
||||
unsigned int b,
|
||||
unsigned int m
|
||||
) {
|
||||
register unsigned int x;
|
||||
unsigned int x;
|
||||
|
||||
if (b == 0)
|
||||
return (0);
|
||||
@ -108,12 +109,12 @@ gf_exp7 (
|
||||
* Carry out the ICE 32-bit P-box permutation.
|
||||
*/
|
||||
|
||||
static unsigned long
|
||||
static uint32_t
|
||||
ice_perm32 (
|
||||
register unsigned long x
|
||||
uint32_t x
|
||||
) {
|
||||
register unsigned long res = 0;
|
||||
register const unsigned long *pbox = ice_pbox;
|
||||
uint32_t res = 0;
|
||||
const uint32_t *pbox = ice_pbox;
|
||||
|
||||
while (x) {
|
||||
if (x & 1)
|
||||
@ -134,12 +135,12 @@ ice_perm32 (
|
||||
static void
|
||||
ice_sboxes_init (void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i=0; i<1024; i++) {
|
||||
int col = (i >> 1) & 0xff;
|
||||
int row = (i & 0x1) | ((i & 0x200) >> 8);
|
||||
unsigned long x;
|
||||
uint32_t x;
|
||||
|
||||
x = gf_exp7 (col ^ ice_sxor[0][row], ice_smod[0][row]) << 24;
|
||||
ice_sbox[0][i] = ice_perm32 (x);
|
||||
@ -201,13 +202,13 @@ IceKey::~IceKey ()
|
||||
* The single round ICE f function.
|
||||
*/
|
||||
|
||||
static unsigned long
|
||||
static uint32_t
|
||||
ice_f (
|
||||
register unsigned long p,
|
||||
uint32_t p,
|
||||
const IceSubkey *sk
|
||||
) {
|
||||
unsigned long tl, tr; /* Expanded 40-bit values */
|
||||
unsigned long al, ar; /* Salted expanded 40-bit values */
|
||||
uint32_t tl, tr; /* Expanded 40-bit values */
|
||||
uint32_t al, ar; /* Salted expanded 40-bit values */
|
||||
|
||||
/* Left half expansion */
|
||||
tl = ((p >> 16) & 0x3ff) | (((p >> 14) | (p << 18)) & 0xffc00);
|
||||
@ -241,15 +242,15 @@ IceKey::encrypt (
|
||||
unsigned char *ctext
|
||||
) const
|
||||
{
|
||||
register int i;
|
||||
register unsigned long l, r;
|
||||
int i;
|
||||
uint32_t l, r;
|
||||
|
||||
l = (((unsigned long) ptext[0]) << 24)
|
||||
| (((unsigned long) ptext[1]) << 16)
|
||||
| (((unsigned long) ptext[2]) << 8) | ptext[3];
|
||||
r = (((unsigned long) ptext[4]) << 24)
|
||||
| (((unsigned long) ptext[5]) << 16)
|
||||
| (((unsigned long) ptext[6]) << 8) | ptext[7];
|
||||
l = (((uint32_t) ptext[0]) << 24)
|
||||
| (((uint32_t) ptext[1]) << 16)
|
||||
| (((uint32_t) ptext[2]) << 8) | ptext[3];
|
||||
r = (((uint32_t) ptext[4]) << 24)
|
||||
| (((uint32_t) ptext[5]) << 16)
|
||||
| (((uint32_t) ptext[6]) << 8) | ptext[7];
|
||||
|
||||
for (i = 0; i < _rounds; i += 2) {
|
||||
l ^= ice_f (r, &_keysched[i]);
|
||||
@ -276,15 +277,15 @@ IceKey::decrypt (
|
||||
unsigned char *ptext
|
||||
) const
|
||||
{
|
||||
register int i;
|
||||
register unsigned long l, r;
|
||||
int i;
|
||||
uint32_t l, r;
|
||||
|
||||
l = (((unsigned long) ctext[0]) << 24)
|
||||
| (((unsigned long) ctext[1]) << 16)
|
||||
| (((unsigned long) ctext[2]) << 8) | ctext[3];
|
||||
r = (((unsigned long) ctext[4]) << 24)
|
||||
| (((unsigned long) ctext[5]) << 16)
|
||||
| (((unsigned long) ctext[6]) << 8) | ctext[7];
|
||||
l = (((uint32_t) ctext[0]) << 24)
|
||||
| (((uint32_t) ctext[1]) << 16)
|
||||
| (((uint32_t) ctext[2]) << 8) | ctext[3];
|
||||
r = (((uint32_t) ctext[4]) << 24)
|
||||
| (((uint32_t) ctext[5]) << 16)
|
||||
| (((uint32_t) ctext[6]) << 8) | ctext[7];
|
||||
|
||||
for (i = _rounds - 1; i > 0; i -= 2) {
|
||||
l ^= ice_f (r, &_keysched[i]);
|
||||
@ -314,20 +315,20 @@ IceKey::scheduleBuild (
|
||||
int i;
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
register int j;
|
||||
register int kr = keyrot[i];
|
||||
int j;
|
||||
int kr = keyrot[i];
|
||||
IceSubkey *isk = &_keysched[n + i];
|
||||
|
||||
for (j=0; j<3; j++)
|
||||
isk->val[j] = 0;
|
||||
|
||||
for (j=0; j<15; j++) {
|
||||
register int k;
|
||||
unsigned long *curr_sk = &isk->val[j % 3];
|
||||
int k;
|
||||
uint32_t *curr_sk = &isk->val[j % 3];
|
||||
|
||||
for (k=0; k<4; k++) {
|
||||
unsigned short *curr_kb = &kb[(kr + k) & 3];
|
||||
register int bit = *curr_kb & 1;
|
||||
int bit = *curr_kb & 1;
|
||||
|
||||
*curr_sk = (*curr_sk << 1) | bit;
|
||||
*curr_kb = (*curr_kb >> 1) | ((bit ^ 1) << 15);
|
||||
|
@ -1,399 +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=".\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=".\noisedata.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sse.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -6,6 +6,7 @@
|
||||
|
||||
/// FIXME: As soon as all references to mathlib.c are gone, include it in here
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <float.h> // Needed for FLT_EPSILON
|
||||
|
||||
@ -2949,9 +2950,9 @@ float CalcSqrDistanceToAABB( const Vector &mins, const Vector &maxs, const Vecto
|
||||
|
||||
void CalcClosestPointOnAABB( const Vector &mins, const Vector &maxs, const Vector &point, Vector &closestOut )
|
||||
{
|
||||
closestOut.x = clamp( point.x, mins.x, maxs.x );
|
||||
closestOut.y = clamp( point.y, mins.y, maxs.y );
|
||||
closestOut.z = clamp( point.z, mins.z, maxs.z );
|
||||
closestOut.x = std::clamp( point.x, mins.x, maxs.x );
|
||||
closestOut.y = std::clamp( point.y, mins.y, maxs.y );
|
||||
closestOut.z = std::clamp( point.z, mins.z, maxs.z );
|
||||
}
|
||||
|
||||
void CalcSqrDistAndClosestPointOnAABB( const Vector &mins, const Vector &maxs, const Vector &point, Vector &closestOut, float &distSqrOut )
|
||||
@ -3027,7 +3028,7 @@ void CalcClosestPointOnLineSegment( const Vector &P, const Vector &vLineA, const
|
||||
{
|
||||
Vector vDir;
|
||||
float t = CalcClosestPointToLineT( P, vLineA, vLineB, vDir );
|
||||
t = clamp( t, 0, 1 );
|
||||
t = std::clamp( t, 0.0f, 1.0f );
|
||||
if ( outT )
|
||||
{
|
||||
*outT = t;
|
||||
@ -3099,7 +3100,7 @@ void CalcClosestPointOnLineSegment2D( const Vector2D &P, const Vector2D &vLineA,
|
||||
{
|
||||
Vector2D vDir;
|
||||
float t = CalcClosestPointToLineT2D( P, vLineA, vLineB, vDir );
|
||||
t = clamp( t, 0, 1 );
|
||||
t = std::clamp( t, 0.0f, 1.0f );
|
||||
if ( outT )
|
||||
{
|
||||
*outT = t;
|
||||
|
@ -16,8 +16,10 @@
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#if defined ( _WIN32 ) && !defined ( _WIN64 )
|
||||
static const uint32 _sincos_masks[] = { (uint32)0x0, (uint32)~0x0 };
|
||||
static const uint32 _sincos_inv_masks[] = { (uint32)~0x0, (uint32)0x0 };
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Macros and constants required by some of the SSE assembly:
|
||||
@ -49,6 +51,7 @@ static const uint32 _sincos_inv_masks[] = { (uint32)~0x0, (uint32)0x0 };
|
||||
static const __attribute__((aligned(16))) float _ps_##Name[4] = { Val, Val, Val, Val }
|
||||
#endif
|
||||
|
||||
#if defined ( _WIN32 ) && !defined ( _WIN64 )
|
||||
_PS_EXTERN_CONST(am_0, 0.0f);
|
||||
_PS_EXTERN_CONST(am_1, 1.0f);
|
||||
_PS_EXTERN_CONST(am_m1, -1.0f);
|
||||
@ -59,7 +62,7 @@ _PS_EXTERN_CONST(am_pi_o_2, (float)(M_PI / 2.0));
|
||||
_PS_EXTERN_CONST(am_2_o_pi, (float)(2.0 / M_PI));
|
||||
_PS_EXTERN_CONST(am_pi_o_4, (float)(M_PI / 4.0));
|
||||
_PS_EXTERN_CONST(am_4_o_pi, (float)(4.0 / M_PI));
|
||||
_PS_EXTERN_CONST_TYPE(am_sign_mask, int32, 0x80000000);
|
||||
_PS_EXTERN_CONST_TYPE(am_sign_mask, int32, (int32)0x80000000);
|
||||
_PS_EXTERN_CONST_TYPE(am_inv_sign_mask, int32, ~0x80000000);
|
||||
_PS_EXTERN_CONST_TYPE(am_min_norm_pos,int32, 0x00800000);
|
||||
_PS_EXTERN_CONST_TYPE(am_mant_mask, int32, 0x7f800000);
|
||||
@ -72,6 +75,7 @@ _PS_CONST(sincos_p0, 0.15707963267948963959e1f);
|
||||
_PS_CONST(sincos_p1, -0.64596409750621907082e0f);
|
||||
_PS_CONST(sincos_p2, 0.7969262624561800806e-1f);
|
||||
_PS_CONST(sincos_p3, -0.468175413106023168e-2f);
|
||||
#endif
|
||||
|
||||
#ifdef PFN_VECTORMA
|
||||
void __cdecl _SSE_VectorMA( const float *start, float scale, const float *direction, float *dest );
|
||||
@ -82,6 +86,9 @@ void __cdecl _SSE_VectorMA( const float *start, float scale, const float *direc
|
||||
//-----------------------------------------------------------------------------
|
||||
float _SSE_Sqrt(float x)
|
||||
{
|
||||
#if defined( _WIN64 )
|
||||
return std::sqrt(x);
|
||||
#else
|
||||
Assert( s_bMathlibInitialized );
|
||||
float root = 0.f;
|
||||
#ifdef _WIN32
|
||||
@ -100,6 +107,7 @@ float _SSE_Sqrt(float x)
|
||||
);
|
||||
#endif
|
||||
return root;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
// Single iteration NewtonRaphson reciprocal square root:
|
||||
@ -123,6 +131,9 @@ float _SSE_RSqrtAccurate(float x)
|
||||
// Intel / Kipps SSE RSqrt. Significantly faster than above.
|
||||
float _SSE_RSqrtAccurate(float a)
|
||||
{
|
||||
#if defined( _WIN64 )
|
||||
return std::sqrt(a);
|
||||
#else
|
||||
float x;
|
||||
float half = 0.5f;
|
||||
float three = 3.f;
|
||||
@ -163,6 +174,7 @@ float _SSE_RSqrtAccurate(float a)
|
||||
#endif
|
||||
|
||||
return x;
|
||||
#endif // _WIN64
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -170,6 +182,9 @@ float _SSE_RSqrtAccurate(float a)
|
||||
// or so, so ok for closed transforms. (ie, computing lighting normals)
|
||||
float _SSE_RSqrtFast(float x)
|
||||
{
|
||||
#if defined( _WIN64 )
|
||||
return std::sqrt(x);
|
||||
#else
|
||||
Assert( s_bMathlibInitialized );
|
||||
|
||||
float rroot = 0.0f;
|
||||
@ -192,10 +207,18 @@ float _SSE_RSqrtFast(float x)
|
||||
#endif
|
||||
|
||||
return rroot;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
float FASTCALL _SSE_VectorNormalize (Vector& vec)
|
||||
{
|
||||
#if defined( _WIN64 )
|
||||
float l = std::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z);
|
||||
vec.x /= l;
|
||||
vec.y /= l;
|
||||
vec.z /= l;
|
||||
return l;
|
||||
#else
|
||||
Assert( s_bMathlibInitialized );
|
||||
|
||||
// NOTE: This is necessary to prevent an memory overwrite...
|
||||
@ -273,6 +296,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
|
||||
}
|
||||
|
||||
return radius;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
void FASTCALL _SSE_VectorNormalizeFast (Vector& vec)
|
||||
@ -286,6 +310,10 @@ void FASTCALL _SSE_VectorNormalizeFast (Vector& vec)
|
||||
|
||||
float _SSE_InvRSquared(const float* v)
|
||||
{
|
||||
#if defined( _WIN64 )
|
||||
float r2 = DotProduct(v, v);
|
||||
return r2 < 1.f ? 1.f : 1/r2;
|
||||
#else
|
||||
float inv_r2 = 1.f;
|
||||
#ifdef _WIN32
|
||||
_asm { // Intel SSE only routine
|
||||
@ -332,11 +360,15 @@ float _SSE_InvRSquared(const float* v)
|
||||
#endif
|
||||
|
||||
return inv_r2;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
void _SSE_SinCos(float x, float* s, float* c)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN64 )
|
||||
*s = std::sin(x);
|
||||
*c = std::cos(x);
|
||||
#elif defined( _WIN32 )
|
||||
float t4, t8, t12;
|
||||
|
||||
__asm
|
||||
@ -430,7 +462,9 @@ void _SSE_SinCos(float x, float* s, float* c)
|
||||
|
||||
float _SSE_cos( float x )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined ( _WIN64 )
|
||||
return std::cos(x);
|
||||
#elif defined( _WIN32 )
|
||||
float temp;
|
||||
__asm
|
||||
{
|
||||
@ -493,7 +527,10 @@ float _SSE_cos( float x )
|
||||
//-----------------------------------------------------------------------------
|
||||
void _SSE2_SinCos(float x, float* s, float* c) // any x
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN64 )
|
||||
*s = std::sin(x);
|
||||
*c = std::cos(x);
|
||||
#elif defined( _WIN32 )
|
||||
__asm
|
||||
{
|
||||
movss xmm0, x
|
||||
@ -578,7 +615,9 @@ void _SSE2_SinCos(float x, float* s, float* c) // any x
|
||||
|
||||
float _SSE2_cos(float x)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined ( _WIN64 )
|
||||
return std::cos(x);
|
||||
#elif defined( _WIN32 )
|
||||
__asm
|
||||
{
|
||||
movss xmm0, x
|
||||
@ -638,8 +677,11 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
|
||||
{
|
||||
Assert( s_bMathlibInitialized );
|
||||
Assert( in1 != out1 );
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined ( _WIN64 )
|
||||
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];
|
||||
#elif defined( _WIN32 )
|
||||
__asm
|
||||
{
|
||||
mov eax, in1;
|
||||
@ -695,8 +737,11 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
|
||||
{
|
||||
Assert( s_bMathlibInitialized );
|
||||
Assert( in1 != out1 );
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined ( _WIN64 )
|
||||
out1[0] = DotProduct( in1, in2[0] );
|
||||
out1[1] = DotProduct( in1, in2[1] );
|
||||
out1[2] = DotProduct( in1, in2[2] );
|
||||
#elif defined( _WIN32 )
|
||||
__asm
|
||||
{
|
||||
mov eax, in1;
|
||||
@ -745,7 +790,7 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN32 ) && !defined( _WIN64 )
|
||||
void _declspec(naked) _SSE_VectorMA( const float *start, float scale, const float *direction, float *dest )
|
||||
{
|
||||
// FIXME: This don't work!! It will overwrite memory in the write to dest
|
||||
@ -776,7 +821,7 @@ void _declspec(naked) _SSE_VectorMA( const float *start, float scale, const floa
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN32 ) && !defined( _WIN64 )
|
||||
#ifdef PFN_VECTORMA
|
||||
void _declspec(naked) __cdecl _SSE_VectorMA( const Vector &start, float scale, const Vector &direction, Vector &dest )
|
||||
{
|
||||
@ -842,4 +887,3 @@ vec_t DotProduct (const vec_t *a, const vec_t *c)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -30,32 +30,24 @@ const fltx4 Four_FLT_MAX={FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX};
|
||||
const fltx4 Four_Negative_FLT_MAX={-FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX};
|
||||
const fltx4 g_SIMD_0123 = { 0., 1., 2., 3. };
|
||||
|
||||
const fltx4 g_QuatMultRowSign[4] =
|
||||
{
|
||||
{ 1.0f, 1.0f, -1.0f, 1.0f },
|
||||
{ -1.0f, 1.0f, 1.0f, 1.0f },
|
||||
{ 1.0f, -1.0f, 1.0f, 1.0f },
|
||||
{ -1.0f, -1.0f, -1.0f, 1.0f }
|
||||
};
|
||||
|
||||
const int32 ALIGN16 g_SIMD_clear_signmask[4]= {0x7fffffff,0x7fffffff,0x7fffffff,0x7fffffff};
|
||||
const int32 ALIGN16 g_SIMD_signmask[4]= { 0x80000000, 0x80000000, 0x80000000, 0x80000000 };
|
||||
const int32 ALIGN16 g_SIMD_lsbmask[4]= { 0xfffffffe, 0xfffffffe, 0xfffffffe, 0xfffffffe };
|
||||
const int32 ALIGN16 g_SIMD_clear_wmask[4]= { 0xffffffff, 0xffffffff, 0xffffffff, 0 };
|
||||
const int32 ALIGN16 g_SIMD_AllOnesMask[4]= { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; // ~0,~0,~0,~0
|
||||
const int32 ALIGN16 g_SIMD_Low16BitsMask[4]= { 0xffff, 0xffff, 0xffff, 0xffff }; // 0xffff x 4
|
||||
const int32 ALIGN16 g_SIMD_clear_signmask[4]= {(int32)0x7fffffff,(int32)0x7fffffff,(int32)0x7fffffff,(int32)0x7fffffff};
|
||||
const int32 ALIGN16 g_SIMD_signmask[4]= { (int32)0x80000000, (int32)0x80000000, (int32)0x80000000, (int32)0x80000000 };
|
||||
const int32 ALIGN16 g_SIMD_lsbmask[4]= { (int32)0xfffffffe, (int32)0xfffffffe, (int32)0xfffffffe, (int32)0xfffffffe };
|
||||
const int32 ALIGN16 g_SIMD_clear_wmask[4]= { (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff, 0 };
|
||||
const int32 ALIGN16 g_SIMD_AllOnesMask[4]= { (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff }; // ~0,~0,~0,~0
|
||||
const int32 ALIGN16 g_SIMD_Low16BitsMask[4]= { (int32)0xffff, (int32)0xffff,(int32) 0xffff, (int32)0xffff }; // 0xffff x 4
|
||||
|
||||
const int32 ALIGN16 g_SIMD_ComponentMask[4][4] =
|
||||
{
|
||||
{ 0xFFFFFFFF, 0, 0, 0 }, { 0, 0xFFFFFFFF, 0, 0 }, { 0, 0, 0xFFFFFFFF, 0 }, { 0, 0, 0, 0xFFFFFFFF }
|
||||
{ (int32)0xFFFFFFFF, 0, 0, 0 }, { 0, (int32)0xFFFFFFFF, 0, 0 }, { 0, 0, (int32)0xFFFFFFFF, 0 }, { 0, 0, 0, (int32)0xFFFFFFFF }
|
||||
};
|
||||
|
||||
const int32 ALIGN16 g_SIMD_SkipTailMask[4][4] =
|
||||
{
|
||||
{ 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff },
|
||||
{ 0xffffffff, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 },
|
||||
{ 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000 },
|
||||
{ (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff },
|
||||
{ (int32)0xffffffff, (int32)0x00000000, (int32)0x00000000, (int32)0x00000000 },
|
||||
{ (int32)0xffffffff, (int32)0xffffffff, (int32)0x00000000, (int32)0x00000000 },
|
||||
{ (int32)0xffffffff, (int32)0xffffffff, (int32)0xffffffff, (int32)0x00000000 },
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
CBaseHandle();
|
||||
CBaseHandle( const CBaseHandle &other );
|
||||
CBaseHandle( unsigned long value );
|
||||
CBaseHandle( uint32_t value );
|
||||
CBaseHandle( int iEntry, int iSerialNumber );
|
||||
|
||||
void Init( int iEntry, int iSerialNumber );
|
||||
@ -63,7 +63,7 @@ public:
|
||||
protected:
|
||||
// The low NUM_SERIAL_BITS hold the index. If this value is less than MAX_EDICTS, then the entity is networkable.
|
||||
// The high NUM_SERIAL_NUM_BITS bits are the serial number.
|
||||
unsigned long m_Index;
|
||||
uint32_t m_Index;
|
||||
};
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ inline CBaseHandle::CBaseHandle( const CBaseHandle &other )
|
||||
m_Index = other.m_Index;
|
||||
}
|
||||
|
||||
inline CBaseHandle::CBaseHandle( unsigned long value )
|
||||
inline CBaseHandle::CBaseHandle( uint32_t value )
|
||||
{
|
||||
m_Index = value;
|
||||
}
|
||||
@ -164,7 +164,7 @@ inline bool CBaseHandle::operator <( const CBaseHandle &other ) const
|
||||
|
||||
inline bool CBaseHandle::operator <( const IHandleEntity *pEntity ) const
|
||||
{
|
||||
unsigned long otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX;
|
||||
uint32_t otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX;
|
||||
return m_Index < otherIndex;
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ inline void CBitVecAccessor::operator=(int val)
|
||||
if(val)
|
||||
m_pDWords[m_iBit >> 5] |= (1 << (m_iBit & 31));
|
||||
else
|
||||
m_pDWords[m_iBit >> 5] &= ~(unsigned long)(1 << (m_iBit & 31));
|
||||
m_pDWords[m_iBit >> 5] &= ~(uint32_t)(1 << (m_iBit & 31));
|
||||
}
|
||||
|
||||
inline CBitVecAccessor::operator uint32()
|
||||
|
@ -660,7 +660,7 @@ public:
|
||||
CDispCornerNeighbors m_CornerNeighbors[4]; // Indexed by CORNER_ defines.
|
||||
|
||||
enum unnamed { ALLOWEDVERTS_SIZE = PAD_NUMBER( MAX_DISPVERTS, 32 ) / 32 };
|
||||
unsigned long m_AllowedVerts[ALLOWEDVERTS_SIZE]; // This is built based on the layout and sizes of our neighbors
|
||||
uint32_t m_AllowedVerts[ALLOWEDVERTS_SIZE]; // This is built based on the layout and sizes of our neighbors
|
||||
// and tells us which vertices are allowed to be active.
|
||||
};
|
||||
|
||||
|
@ -420,7 +420,7 @@ public:
|
||||
virtual bool IsFileWritable( char const *pFileName, const char *pPathID = 0 ) = 0;
|
||||
virtual bool SetFileWritable( char const *pFileName, bool writable, const char *pPathID = 0 ) = 0;
|
||||
|
||||
virtual long GetFileTime( const char *pFileName, const char *pPathID = 0 ) = 0;
|
||||
virtual int32_t GetFileTime( const char *pFileName, const char *pPathID = 0 ) = 0;
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Reads/writes files to utlbuffers. Use this for optimal read performance when doing open/read/close
|
||||
@ -505,7 +505,7 @@ public:
|
||||
// File I/O and info
|
||||
virtual bool IsDirectory( const char *pFileName, const char *pathID = 0 ) = 0;
|
||||
|
||||
virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, long fileTime ) = 0;
|
||||
virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, int32_t fileTime ) = 0;
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Open file operations
|
||||
@ -716,7 +716,7 @@ public:
|
||||
virtual bool FullPathToRelativePathEx( const char *pFullpath, const char *pPathId, char *pRelative, int maxlen ) = 0;
|
||||
|
||||
virtual int GetPathIndex( const FileNameHandle_t &handle ) = 0;
|
||||
virtual long GetPathTime( const char *pPath, const char *pPathID ) = 0;
|
||||
virtual int32_t GetPathTime( const char *pPath, const char *pPathID ) = 0;
|
||||
|
||||
virtual DVDMode_t GetDVDMode() = 0;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
virtual bool FileExists( const char *pFileName, const char *pPathID ) { return m_pBaseFileSystemPassThru->FileExists( pFileName, pPathID ); }
|
||||
virtual bool IsFileWritable( char const *pFileName, const char *pPathID ) { return m_pBaseFileSystemPassThru->IsFileWritable( pFileName, pPathID ); }
|
||||
virtual bool SetFileWritable( char const *pFileName, bool writable, const char *pPathID ) { return m_pBaseFileSystemPassThru->SetFileWritable( pFileName, writable, pPathID ); }
|
||||
virtual long GetFileTime( const char *pFileName, const char *pPathID ) { return m_pBaseFileSystemPassThru->GetFileTime( pFileName, pPathID ); }
|
||||
virtual int32_t GetFileTime( const char *pFileName, const char *pPathID ) { return m_pBaseFileSystemPassThru->GetFileTime( pFileName, pPathID ); }
|
||||
virtual bool ReadFile( const char *pFileName, const char *pPath, CUtlBuffer &buf, int nMaxBytes = 0, int nStartingByte = 0, FSAllocFunc_t pfnAlloc = NULL ) { return m_pBaseFileSystemPassThru->ReadFile( pFileName, pPath, buf, nMaxBytes, nStartingByte, pfnAlloc ); }
|
||||
virtual bool WriteFile( const char *pFileName, const char *pPath, CUtlBuffer &buf ) { return m_pBaseFileSystemPassThru->WriteFile( pFileName, pPath, buf ); }
|
||||
virtual bool UnzipFile( const char *pFileName, const char *pPath, const char *pDestination ) { return m_pBaseFileSystemPassThru->UnzipFile( pFileName, pPath, pDestination ); }
|
||||
@ -100,7 +100,7 @@ public:
|
||||
virtual bool RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID ) { return m_pFileSystemPassThru->RenameFile( pOldPath, pNewPath, pathID ); }
|
||||
virtual void CreateDirHierarchy( const char *path, const char *pathID ) { m_pFileSystemPassThru->CreateDirHierarchy( path, pathID ); }
|
||||
virtual bool IsDirectory( const char *pFileName, const char *pathID ) { return m_pFileSystemPassThru->IsDirectory( pFileName, pathID ); }
|
||||
virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, long fileTime ) { m_pFileSystemPassThru->FileTimeToString( pStrip, maxCharsIncludingTerminator, fileTime ); }
|
||||
virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, int32_t fileTime ) { m_pFileSystemPassThru->FileTimeToString( pStrip, maxCharsIncludingTerminator, fileTime ); }
|
||||
virtual void SetBufferSize( FileHandle_t file, unsigned nBytes ) { m_pFileSystemPassThru->SetBufferSize( file, nBytes ); }
|
||||
virtual bool IsOk( FileHandle_t file ) { return m_pFileSystemPassThru->IsOk( file ); }
|
||||
virtual bool EndOfFile( FileHandle_t file ) { return m_pFileSystemPassThru->EndOfFile( file ); }
|
||||
@ -211,7 +211,7 @@ public:
|
||||
virtual bool ReadToBuffer( FileHandle_t hFile, CUtlBuffer &buf, int nMaxBytes = 0, FSAllocFunc_t pfnAlloc = NULL ) { return m_pFileSystemPassThru->ReadToBuffer( hFile, buf, nMaxBytes, pfnAlloc ); }
|
||||
virtual bool FullPathToRelativePathEx( const char *pFullPath, const char *pPathId, char *pRelative, int nMaxLen ) { return m_pFileSystemPassThru->FullPathToRelativePathEx( pFullPath, pPathId, pRelative, nMaxLen ); }
|
||||
virtual int GetPathIndex( const FileNameHandle_t &handle ) { return m_pFileSystemPassThru->GetPathIndex( handle ); }
|
||||
virtual long GetPathTime( const char *pPath, const char *pPathID ) { return m_pFileSystemPassThru->GetPathTime( pPath, pPathID ); }
|
||||
virtual int32_t GetPathTime( const char *pPath, const char *pPathID ) { return m_pFileSystemPassThru->GetPathTime( pPath, pPathID ); }
|
||||
|
||||
virtual DVDMode_t GetDVDMode() { return m_pFileSystemPassThru->GetDVDMode(); }
|
||||
|
||||
|
@ -209,7 +209,7 @@ public:
|
||||
virtual IWorldRenderList * CreateWorldList() = 0;
|
||||
|
||||
virtual void BuildWorldLists( IWorldRenderList *pList, WorldListInfo_t* pInfo, int iForceFViewLeaf, const VisOverrideData_t* pVisData = NULL, bool bShadowDepth = false, float *pReflectionWaterHeight = NULL ) = 0;
|
||||
virtual void DrawWorldLists( IWorldRenderList *pList, unsigned long flags, float waterZAdjust ) = 0;
|
||||
virtual void DrawWorldLists( IWorldRenderList *pList, uint32_t flags, float waterZAdjust ) = 0;
|
||||
|
||||
// Optimization for top view
|
||||
virtual void DrawTopView( bool enable ) = 0;
|
||||
@ -221,7 +221,7 @@ public:
|
||||
virtual void DrawMaskEntities( void ) = 0;
|
||||
|
||||
// Draw surfaces with alpha
|
||||
virtual void DrawTranslucentSurfaces( IWorldRenderList *pList, int sortIndex, unsigned long flags, bool bShadowDepth ) = 0;
|
||||
virtual void DrawTranslucentSurfaces( IWorldRenderList *pList, int sortIndex, uint32_t flags, bool bShadowDepth ) = 0;
|
||||
|
||||
// Draw Particles ( just draws the linefine for debugging map leaks )
|
||||
virtual void DrawLineFile( void ) = 0;
|
||||
@ -257,7 +257,7 @@ public:
|
||||
virtual void DrawBrushModelShadow( IClientRenderable *pRenderable ) = 0;
|
||||
|
||||
// Does the leaf contain translucent surfaces?
|
||||
virtual bool LeafContainsTranslucentSurfaces( IWorldRenderList *pList, int sortIndex, unsigned long flags ) = 0;
|
||||
virtual bool LeafContainsTranslucentSurfaces( IWorldRenderList *pList, int sortIndex, uint32_t flags ) = 0;
|
||||
|
||||
virtual bool DoesBoxIntersectWaterVolume( const Vector &mins, const Vector &maxs, int leafWaterDataID ) = 0;
|
||||
|
||||
|
@ -1428,9 +1428,9 @@ public:
|
||||
virtual void GetFogDistances( float *fStart, float *fEnd, float *fFogZ ) = 0;
|
||||
|
||||
// Hooks for firing PIX events from outside the Material System...
|
||||
virtual void BeginPIXEvent( unsigned long color, const char *szName ) = 0;
|
||||
virtual void BeginPIXEvent( uint32_t color, const char *szName ) = 0;
|
||||
virtual void EndPIXEvent() = 0;
|
||||
virtual void SetPIXMarker( unsigned long color, const char *szName ) = 0;
|
||||
virtual void SetPIXMarker( uint32_t color, const char *szName ) = 0;
|
||||
|
||||
// Batch API
|
||||
// from changelist 166623:
|
||||
@ -1768,7 +1768,7 @@ private:
|
||||
class PIXEvent
|
||||
{
|
||||
public:
|
||||
PIXEvent( IMatRenderContext *pRenderContext, const char *szName, unsigned long color = PIX_VALVE_ORANGE )
|
||||
PIXEvent( IMatRenderContext *pRenderContext, const char *szName, uint32_t color = PIX_VALVE_ORANGE )
|
||||
{
|
||||
m_pRenderContext = pRenderContext;
|
||||
Assert( m_pRenderContext );
|
||||
|
@ -21,8 +21,8 @@ class VMatrix;
|
||||
class ITexture;
|
||||
|
||||
#define MAKE_MATERIALVAR_FOURCC(ch0, ch1, ch2, ch3) \
|
||||
((unsigned long)(ch0) | ((unsigned long)(ch1) << 8) | \
|
||||
((unsigned long)(ch2) << 16) | ((unsigned long)(ch3) << 24 ))
|
||||
((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) | \
|
||||
((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24 ))
|
||||
|
||||
// This fourcc is reserved.
|
||||
#define FOURCC_UNKNOWN MAKE_MATERIALVAR_FOURCC('U','N','K','N')
|
||||
@ -49,7 +49,7 @@ typedef unsigned short MaterialVarSym_t;
|
||||
class IMaterialVar
|
||||
{
|
||||
public:
|
||||
typedef unsigned long FourCC;
|
||||
typedef uint32_t FourCC;
|
||||
|
||||
protected:
|
||||
// base data and accessors
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef _3D_UNITVEC_H
|
||||
#define _3D_UNITVEC_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define UNITVEC_DECLARE_STATICS \
|
||||
float cUnitVector::mUVAdjustment[0x2000]; \
|
||||
@ -75,8 +76,8 @@ public:
|
||||
// a little slower... old pack was 4 multiplies and 2 adds.
|
||||
// This is 2 multiplies, 2 adds, and a divide....
|
||||
float w = 126.0f / ( tmp.x + tmp.y + tmp.z );
|
||||
long xbits = (long)( tmp.x * w );
|
||||
long ybits = (long)( tmp.y * w );
|
||||
int32_t xbits = (int32_t)( tmp.x * w );
|
||||
int32_t ybits = (int32_t)( tmp.y * w );
|
||||
|
||||
Assert( xbits < 127 );
|
||||
Assert( xbits >= 0 );
|
||||
@ -110,8 +111,8 @@ public:
|
||||
// multiplication
|
||||
|
||||
// get the x and y bits
|
||||
long xbits = (( mVec & TOP_MASK ) >> 7 );
|
||||
long ybits = ( mVec & BOTTOM_MASK );
|
||||
int32_t xbits = (( mVec & TOP_MASK ) >> 7 );
|
||||
int32_t ybits = ( mVec & BOTTOM_MASK );
|
||||
|
||||
// map the numbers back to the triangle (0,0)-(0,126)-(126,0)
|
||||
if (( xbits + ybits ) >= 127 )
|
||||
@ -139,8 +140,8 @@ public:
|
||||
{
|
||||
for ( int idx = 0; idx < 0x2000; idx++ )
|
||||
{
|
||||
long xbits = idx >> 7;
|
||||
long ybits = idx & BOTTOM_MASK;
|
||||
int32_t xbits = idx >> 7;
|
||||
int32_t ybits = idx & BOTTOM_MASK;
|
||||
|
||||
// map the numbers back to the triangle (0,0)-(0,127)-(127,0)
|
||||
if (( xbits + ybits ) >= 127 )
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef MATH_LIB_H
|
||||
#define MATH_LIB_H
|
||||
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
#include "tier0/basetypes.h"
|
||||
#include "mathlib/vector.h"
|
||||
@ -313,7 +314,10 @@ int Q_log2(int val);
|
||||
// Math routines done in optimized assembly math package routines
|
||||
void inline SinCos( float radians, float *sine, float *cosine )
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined( _WIN64 )
|
||||
*sine = sinf(radians);
|
||||
*cosine = cosf(radians);
|
||||
#elif defined( _X360 )
|
||||
XMScalarSinCos( sine, cosine, radians );
|
||||
#elif defined( _WIN32 )
|
||||
_asm
|
||||
@ -1072,7 +1076,9 @@ inline float SimpleSplineRemapValClamped( float val, float A, float B, float C,
|
||||
|
||||
FORCEINLINE int RoundFloatToInt(float f)
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined( _WIN64 )
|
||||
return std::round(f);
|
||||
#elif defined( _X360 )
|
||||
#ifdef Assert
|
||||
Assert( IsFPUControlWordSet() );
|
||||
#endif
|
||||
@ -1102,7 +1108,9 @@ FORCEINLINE int RoundFloatToInt(float f)
|
||||
|
||||
FORCEINLINE unsigned char RoundFloatToByte(float f)
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined( _WIN64 )
|
||||
return std::round(f);
|
||||
#elif defined( _X360 )
|
||||
#ifdef Assert
|
||||
Assert( IsFPUControlWordSet() );
|
||||
#endif
|
||||
@ -1142,9 +1150,11 @@ FORCEINLINE unsigned char RoundFloatToByte(float f)
|
||||
#endif
|
||||
}
|
||||
|
||||
FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
||||
FORCEINLINE uint32_t RoundFloatToUnsignedLong(float f)
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined( _WIN64 )
|
||||
return std::round(f);
|
||||
#elif defined( _X360 )
|
||||
#ifdef Assert
|
||||
Assert( IsFPUControlWordSet() );
|
||||
#endif
|
||||
@ -1152,7 +1162,7 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
||||
{
|
||||
double flResult;
|
||||
int pIntResult[2];
|
||||
unsigned long pResult[2];
|
||||
uint32_t pResult[2];
|
||||
};
|
||||
flResult = __fctiw( f );
|
||||
Assert( pIntResult[1] >= 0 );
|
||||
@ -1173,7 +1183,7 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
||||
);
|
||||
#endif
|
||||
|
||||
return *((unsigned long*)nResult);
|
||||
return *((uint32_t*)nResult);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1185,7 +1195,9 @@ FORCEINLINE bool IsIntegralValue( float flValue, float flTolerance = 0.001f )
|
||||
// Fast, accurate ftol:
|
||||
FORCEINLINE int Float2Int( float a )
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined ( _WIN64 )
|
||||
return a;
|
||||
#elif defined( _X360 )
|
||||
union
|
||||
{
|
||||
double flResult;
|
||||
@ -1223,8 +1235,10 @@ FORCEINLINE int Float2Int( float a )
|
||||
// Over 15x faster than: (int)floor(value)
|
||||
inline int Floor2Int( float a )
|
||||
{
|
||||
#if defined ( _WIN64 )
|
||||
return std::floor(a);
|
||||
#else
|
||||
int RetVal;
|
||||
|
||||
#if defined( _X360 )
|
||||
RetVal = (int)floor( a );
|
||||
#elif defined( _WIN32 )
|
||||
@ -1245,8 +1259,8 @@ inline int Floor2Int( float a )
|
||||
#elif defined( _LINUX ) || defined( __APPLE__ )
|
||||
RetVal = static_cast<int>( floor(a) );
|
||||
#endif
|
||||
|
||||
return RetVal;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1281,6 +1295,9 @@ inline float ClampToMsec( float in )
|
||||
// Over 15x faster than: (int)ceil(value)
|
||||
inline int Ceil2Int( float a )
|
||||
{
|
||||
#if defined ( _WIN64 )
|
||||
return std::ceil(a);
|
||||
#else
|
||||
int RetVal;
|
||||
|
||||
#if defined( _X360 )
|
||||
@ -1303,8 +1320,8 @@ inline int Ceil2Int( float a )
|
||||
#elif defined( _LINUX ) || defined( __APPLE__ )
|
||||
RetVal = static_cast<int>( ceil(a) );
|
||||
#endif
|
||||
|
||||
return RetVal;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
|
||||
|
@ -2407,13 +2407,10 @@ FORCEINLINE i32x4 IntShiftLeftWordSIMD(const i32x4 &vSrcA, const i32x4 &vSrcB)
|
||||
// like this.
|
||||
FORCEINLINE void ConvertStoreAsIntsSIMD(intx4 * RESTRICT pDest, const fltx4 &vSrc)
|
||||
{
|
||||
__m64 bottom = _mm_cvttps_pi32( vSrc );
|
||||
__m64 top = _mm_cvttps_pi32( _mm_movehl_ps(vSrc,vSrc) );
|
||||
|
||||
*reinterpret_cast<__m64 *>(&(*pDest)[0]) = bottom;
|
||||
*reinterpret_cast<__m64 *>(&(*pDest)[2]) = top;
|
||||
|
||||
_mm_empty();
|
||||
(*pDest)[0] = SubFloat(vSrc, 0);
|
||||
(*pDest)[1] = SubFloat(vSrc, 1);
|
||||
(*pDest)[2] = SubFloat(vSrc, 2);
|
||||
(*pDest)[3] = SubFloat(vSrc, 3);
|
||||
}
|
||||
|
||||
|
||||
|
@ -249,10 +249,10 @@ inline void Vector4D::Init( vec_t ix, vec_t iy, vec_t iz, vec_t iw )
|
||||
|
||||
inline void Vector4D::Random( vec_t minVal, vec_t maxVal )
|
||||
{
|
||||
x = minVal + ((vec_t)rand() / RAND_MAX) * (maxVal - minVal);
|
||||
y = minVal + ((vec_t)rand() / RAND_MAX) * (maxVal - minVal);
|
||||
z = minVal + ((vec_t)rand() / RAND_MAX) * (maxVal - minVal);
|
||||
w = minVal + ((vec_t)rand() / RAND_MAX) * (maxVal - minVal);
|
||||
x = minVal + ((vec_t)rand() / (float)RAND_MAX) * (maxVal - minVal);
|
||||
y = minVal + ((vec_t)rand() / (float)RAND_MAX) * (maxVal - minVal);
|
||||
z = minVal + ((vec_t)rand() / (float)RAND_MAX) * (maxVal - minVal);
|
||||
w = minVal + ((vec_t)rand() / (float)RAND_MAX) * (maxVal - minVal);
|
||||
}
|
||||
|
||||
inline void Vector4DClear( Vector4D& a )
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
// Returns the checksums that the stripping info was generated for:
|
||||
// plChecksumOriginal if non-NULL will hold the checksum of the original model submitted for stripping
|
||||
// plChecksumStripped if non-NULL will hold the resulting checksum of the stripped model
|
||||
virtual bool GetCheckSum( long *plChecksumOriginal, long *plChecksumStripped ) const = 0;
|
||||
virtual bool GetCheckSum( int32_t *plChecksumOriginal, int32_t *plChecksumStripped ) const = 0;
|
||||
|
||||
//
|
||||
// Stripping
|
||||
|
@ -226,7 +226,7 @@ struct FileHeader_t
|
||||
int maxBonesPerVert;
|
||||
|
||||
// must match checkSum in the .mdl
|
||||
long checkSum;
|
||||
int32_t checkSum;
|
||||
|
||||
int numLODs; // garymcthack - this is also specified in ModelHeader_t and should match
|
||||
|
||||
|
@ -17,7 +17,7 @@ typedef struct phyheader_s
|
||||
int size;
|
||||
int id;
|
||||
int solidCount;
|
||||
long checkSum; // checksum of source .mdl file
|
||||
int32_t checkSum; // checksum of source .mdl file
|
||||
} phyheader_t;
|
||||
|
||||
#endif // PHYFILE_H
|
||||
|
@ -105,7 +105,7 @@ struct levellist_t
|
||||
|
||||
struct EHandlePlaceholder_t // Engine does some of the game writing (alas, probably shouldn't), but can't see ehandle.h
|
||||
{
|
||||
unsigned long i;
|
||||
uint32_t i;
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -219,7 +219,7 @@ bool CScratchPad3D::LoadCommandsFromFile( )
|
||||
if( !fp )
|
||||
return false;
|
||||
|
||||
long fileEndPos = m_pFileSystem->Size( fp );
|
||||
int32_t fileEndPos = m_pFileSystem->Size( fp );
|
||||
|
||||
CFileRead fileRead( m_pFileSystem, fp );
|
||||
while( fileRead.m_Pos != fileEndPos )
|
||||
@ -352,12 +352,12 @@ void CScratchPad3D::DrawRectXY( float zPos, const Vector2D &vMin, const Vector2D
|
||||
DrawRectGeneric( 2, 0, 1, zPos, vMin, vMax, vColor );
|
||||
}
|
||||
|
||||
void CScratchPad3D::SetRenderState( RenderState state, unsigned long val )
|
||||
void CScratchPad3D::SetRenderState( RenderState state, uint32_t val )
|
||||
{
|
||||
CCommand_RenderState *cmd = new CCommand_RenderState;
|
||||
m_Commands.AddToTail( cmd );
|
||||
|
||||
cmd->m_State = (unsigned long)state;
|
||||
cmd->m_State = (uint32_t)state;
|
||||
cmd->m_Val = val;
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
virtual void Read( CFileRead *pFile );
|
||||
virtual void Write( IFileSystem* pFileSystem, FileHandle_t fp );
|
||||
|
||||
unsigned long m_State; // One of the RS_ enums.
|
||||
unsigned long m_Val;
|
||||
uint32_t m_State; // One of the RS_ enums.
|
||||
uint32_t m_Val;
|
||||
};
|
||||
|
||||
class CCommand_Text : public CBaseCommand
|
||||
@ -180,7 +180,7 @@ public:
|
||||
virtual void DrawRectXY( float zPos, Vector2D const &vMin, Vector2D const &vMax, CSPColor const &vColor );
|
||||
virtual void DrawWireframeBox( Vector const &vMin, Vector const &vMax, Vector const &vColor );
|
||||
virtual void DrawText( const char *pStr, const CTextParams ¶ms );
|
||||
virtual void SetRenderState( RenderState state, unsigned long val );
|
||||
virtual void SetRenderState( RenderState state, uint32_t val );
|
||||
virtual void Clear();
|
||||
virtual void Flush();
|
||||
virtual void DrawImageBW(
|
||||
|
@ -189,7 +189,7 @@ unsigned int CSoundCombiner::ComputeChecksum()
|
||||
// Msg( " %i -> sentence %u, startoffset %f fn %s\n",
|
||||
// i, chk, curitem->entry->startoffset, curitem->entry->wavefile );
|
||||
|
||||
CRC32_ProcessBuffer( &crc, &chk, sizeof( unsigned long ) );
|
||||
CRC32_ProcessBuffer( &crc, &chk, sizeof( uint32_t ) );
|
||||
CRC32_ProcessBuffer( &crc, &curitem->entry->startoffset, sizeof( float ) );
|
||||
CRC32_ProcessBuffer( &crc, curitem->entry->wavefile, Q_strlen( curitem->entry->wavefile ) );
|
||||
}
|
||||
|
@ -49,14 +49,14 @@ typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
#ifdef X64BITS
|
||||
typedef long long intp;
|
||||
typedef unsigned long long uintp;
|
||||
typedef int64_t intp;
|
||||
typedef uint64_t uintp;
|
||||
#else
|
||||
typedef int intp;
|
||||
typedef unsigned int uintp;
|
||||
typedef int32_t intp;
|
||||
typedef uint32_t uintp;
|
||||
#endif
|
||||
|
||||
#endif // else _WIN32
|
||||
|
@ -1796,7 +1796,7 @@ struct vertexFileHeader_t
|
||||
DECLARE_BYTESWAP_DATADESC();
|
||||
int id; // MODEL_VERTEX_FILE_ID
|
||||
int version; // MODEL_VERTEX_FILE_VERSION
|
||||
long checksum; // same as studiohdr_t, ensures sync
|
||||
int32_t checksum; // same as studiohdr_t, ensures sync
|
||||
int numLODs; // num of valid lods
|
||||
int numLODVertexes[MAX_NUM_LODS]; // num verts for desired root lod
|
||||
int numFixups; // num of vertexFileFixup_t
|
||||
@ -1964,7 +1964,7 @@ struct studiohdr_t
|
||||
int id;
|
||||
int version;
|
||||
|
||||
long checksum; // this has to be the same in the phy and vtx files to load!
|
||||
int32_t checksum; // this has to be the same in the phy and vtx files to load!
|
||||
|
||||
inline const char * pszName( void ) const { return name; }
|
||||
char name[64];
|
||||
|
@ -19,7 +19,7 @@ class SurfInfo
|
||||
public:
|
||||
// Shape of the surface.
|
||||
Vector m_Verts[ MAX_SURFINFO_VERTS ];
|
||||
unsigned long m_nVerts;
|
||||
uint32_t m_nVerts;
|
||||
|
||||
// Plane of the surface.
|
||||
VPlane m_Plane;
|
||||
|
@ -137,10 +137,10 @@ AFX_STATIC_DATA AFX_ALLOC_HOOK pfnAllocHook = _AfxDefaultAllocHook;
|
||||
AFX_STATIC_DATA _CRT_ALLOC_HOOK pfnCrtAllocHook = NULL;
|
||||
#if _MSC_VER >= 1200
|
||||
int __cdecl _AfxAllocHookProxy(int nAllocType, void * pvData, size_t nSize,
|
||||
int nBlockUse, long lRequest, const unsigned char * szFilename, int nLine)
|
||||
int nBlockUse, int32_t lRequest, const unsigned char * szFilename, int nLine)
|
||||
#else
|
||||
int __cdecl _AfxAllocHookProxy(int nAllocType, void * pvData, size_t nSize,
|
||||
int nBlockUse, long lRequest, const char * szFilename, int nLine)
|
||||
int nBlockUse, int32_t lRequest, const char * szFilename, int nLine)
|
||||
#endif
|
||||
{
|
||||
#if _MSC_VER >= 1200
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef BASETYPES_H
|
||||
#define BASETYPES_H
|
||||
|
||||
#include <cstdint>
|
||||
#include "tier0/platform.h"
|
||||
#include "commonmacros.h"
|
||||
#include "wchartypes.h"
|
||||
@ -60,7 +61,16 @@
|
||||
template <typename T>
|
||||
inline T AlignValue( T val, unsigned alignment )
|
||||
{
|
||||
return (T)( ( (uintp)val + alignment - 1 ) & ~( alignment - 1 ) );
|
||||
uintp align = alignment;
|
||||
return (T)( ( (uintp)val + align - 1 ) & ~( align - 1 ) );
|
||||
}
|
||||
|
||||
// Tell MSVC to shut the hell up
|
||||
template<>
|
||||
inline char* AlignValue( char* val, unsigned alignment )
|
||||
{
|
||||
uintptr_t align = alignment;
|
||||
return (char *)( ( reinterpret_cast<uintptr_t>(val) + align - 1 ) & ~( align - 1 ) );
|
||||
}
|
||||
|
||||
|
||||
@ -141,17 +151,17 @@ typedef float vec_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline unsigned long& FloatBits( vec_t& f )
|
||||
inline uint32_t& FloatBits( vec_t& f )
|
||||
{
|
||||
return *reinterpret_cast<unsigned long*>(&f);
|
||||
return *reinterpret_cast<uint32_t*>(&f);
|
||||
}
|
||||
|
||||
inline unsigned long const& FloatBits( vec_t const& f )
|
||||
inline uint32_t const& FloatBits( vec_t const& f )
|
||||
{
|
||||
return *reinterpret_cast<unsigned long const*>(&f);
|
||||
return *reinterpret_cast<uint32_t const*>(&f);
|
||||
}
|
||||
|
||||
inline vec_t BitsToFloat( unsigned long i )
|
||||
inline vec_t BitsToFloat( uint32_t i )
|
||||
{
|
||||
return *reinterpret_cast<vec_t*>(&i);
|
||||
}
|
||||
@ -161,7 +171,7 @@ inline bool IsFinite( vec_t f )
|
||||
return ((FloatBits(f) & 0x7F800000) != 0x7F800000);
|
||||
}
|
||||
|
||||
inline unsigned long FloatAbsBits( vec_t f )
|
||||
inline uint32_t FloatAbsBits( vec_t f )
|
||||
{
|
||||
return FloatBits(f) & 0x7FFFFFFF;
|
||||
}
|
||||
@ -205,7 +215,7 @@ inline float FloatNegate( vec_t f )
|
||||
}
|
||||
|
||||
|
||||
#define FLOAT32_NAN_BITS (unsigned long)0x7FC00000 // not a number!
|
||||
#define FLOAT32_NAN_BITS (uint32_t)0x7FC00000 // not a number!
|
||||
#define FLOAT32_NAN BitsToFloat( FLOAT32_NAN_BITS )
|
||||
|
||||
#define VEC_T_NAN FLOAT32_NAN
|
||||
@ -317,7 +327,7 @@ protected:
|
||||
|
||||
|
||||
template< class DummyType >
|
||||
class CIntHandle32 : public CBaseIntHandle< unsigned long >
|
||||
class CIntHandle32 : public CBaseIntHandle< uint32_t >
|
||||
{
|
||||
public:
|
||||
inline CIntHandle32() {}
|
||||
|
@ -576,7 +576,7 @@ public:
|
||||
va_list arg_ptr;
|
||||
|
||||
va_start(arg_ptr, pszFormat);
|
||||
_vsntprintf(m_szBuf, sizeof(m_szBuf)-1, pszFormat, arg_ptr);
|
||||
_vsnprintf(m_szBuf, sizeof(m_szBuf)-1, pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
|
||||
m_szBuf[sizeof(m_szBuf)-1] = 0;
|
||||
|
@ -15,9 +15,9 @@
|
||||
#include "tier0/platform.h"
|
||||
|
||||
PLATFORM_INTERFACE int64 g_ClockSpeed;
|
||||
PLATFORM_INTERFACE unsigned long g_dwClockSpeed;
|
||||
PLATFORM_INTERFACE uint32_t g_dwClockSpeed;
|
||||
#if defined( _X360 ) && defined( _CERT )
|
||||
PLATFORM_INTERFACE unsigned long g_dwFakeFastCounter;
|
||||
PLATFORM_INTERFACE uint32_t g_dwFakeFastCounter;
|
||||
#endif
|
||||
|
||||
PLATFORM_INTERFACE double g_ClockSpeedMicrosecondsMultiplier;
|
||||
@ -42,15 +42,15 @@ public:
|
||||
|
||||
// Convert to other time representations. These functions are slow, so it's preferable to call them
|
||||
// during display rather than inside a timing block.
|
||||
unsigned long GetCycles() const;
|
||||
uint32_t GetCycles() const;
|
||||
int64 GetLongCycles() const;
|
||||
|
||||
unsigned long GetMicroseconds() const;
|
||||
uint32_t GetMicroseconds() const;
|
||||
uint64 GetUlMicroseconds() const;
|
||||
double GetMicrosecondsF() const;
|
||||
void SetMicroseconds( unsigned long nMicroseconds );
|
||||
void SetMicroseconds( uint32_t nMicroseconds );
|
||||
|
||||
unsigned long GetMilliseconds() const;
|
||||
uint32_t GetMilliseconds() const;
|
||||
double GetMillisecondsF() const;
|
||||
|
||||
double GetSeconds() const;
|
||||
@ -85,7 +85,7 @@ public:
|
||||
const CPUInformation& pi = GetCPUInformation();
|
||||
|
||||
g_ClockSpeed = pi.m_Speed;
|
||||
g_dwClockSpeed = (unsigned long)g_ClockSpeed;
|
||||
g_dwClockSpeed = (uint32_t)g_ClockSpeed;
|
||||
|
||||
g_ClockSpeedMicrosecondsMultiplier = 1000000.0 / (double)g_ClockSpeed;
|
||||
g_ClockSpeedMillisecondsMultiplier = 1000.0 / (double)g_ClockSpeed;
|
||||
@ -104,7 +104,7 @@ public:
|
||||
CCycleCount GetDurationInProgress() const; // Call without ending. Not that cheap.
|
||||
|
||||
// Return number of cycles per second on this processor.
|
||||
static inline unsigned long GetClockSpeed();
|
||||
static inline uint32_t GetClockSpeed();
|
||||
|
||||
private:
|
||||
CCycleCount m_Duration;
|
||||
@ -308,8 +308,8 @@ inline void CCycleCount::Sample()
|
||||
#else
|
||||
m_Int64 = ++g_dwFakeFastCounter;
|
||||
#endif
|
||||
#elif defined( _WIN32 )
|
||||
unsigned long* pSample = (unsigned long *)&m_Int64;
|
||||
#elif defined( _WIN32 ) && !defined( _WIN64 )
|
||||
uint32_t* pSample = (uint32_t *)&m_Int64;
|
||||
__asm
|
||||
{
|
||||
// force the cpu to synchronize the instruction queue
|
||||
@ -323,7 +323,7 @@ inline void CCycleCount::Sample()
|
||||
mov [ecx+4], edx
|
||||
}
|
||||
#elif defined( _LINUX )
|
||||
unsigned long* pSample = (unsigned long *)&m_Int64;
|
||||
uint32_t* pSample = (uint32_t *)&m_Int64;
|
||||
__asm__ __volatile__ (
|
||||
"rdtsc\n\t"
|
||||
"movl %%eax, (%0)\n\t"
|
||||
@ -368,9 +368,9 @@ inline bool CCycleCount::IsLessThan(CCycleCount const &other) const
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long CCycleCount::GetCycles() const
|
||||
inline uint32_t CCycleCount::GetCycles() const
|
||||
{
|
||||
return (unsigned long)m_Int64;
|
||||
return (uint32_t)m_Int64;
|
||||
}
|
||||
|
||||
inline int64 CCycleCount::GetLongCycles() const
|
||||
@ -378,9 +378,9 @@ inline int64 CCycleCount::GetLongCycles() const
|
||||
return m_Int64;
|
||||
}
|
||||
|
||||
inline unsigned long CCycleCount::GetMicroseconds() const
|
||||
inline uint32_t CCycleCount::GetMicroseconds() const
|
||||
{
|
||||
return (unsigned long)((m_Int64 * 1000000) / g_ClockSpeed);
|
||||
return (uint32_t)((m_Int64 * 1000000) / g_ClockSpeed);
|
||||
}
|
||||
|
||||
inline uint64 CCycleCount::GetUlMicroseconds() const
|
||||
@ -395,15 +395,15 @@ inline double CCycleCount::GetMicrosecondsF() const
|
||||
}
|
||||
|
||||
|
||||
inline void CCycleCount::SetMicroseconds( unsigned long nMicroseconds )
|
||||
inline void CCycleCount::SetMicroseconds( uint32_t nMicroseconds )
|
||||
{
|
||||
m_Int64 = ((int64)nMicroseconds * g_ClockSpeed) / 1000000;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long CCycleCount::GetMilliseconds() const
|
||||
inline uint32_t CCycleCount::GetMilliseconds() const
|
||||
{
|
||||
return (unsigned long)((m_Int64 * 1000) / g_ClockSpeed);
|
||||
return (uint32_t)((m_Int64 * 1000) / g_ClockSpeed);
|
||||
}
|
||||
|
||||
|
||||
@ -475,7 +475,7 @@ inline CCycleCount CFastTimer::GetDurationInProgress() const
|
||||
}
|
||||
|
||||
|
||||
inline unsigned long CFastTimer::GetClockSpeed()
|
||||
inline uint32_t CFastTimer::GetClockSpeed()
|
||||
{
|
||||
return g_dwClockSpeed;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
|
||||
// FIXME: Remove when we have our own allocator
|
||||
// these methods of the Crt debug code is used in our codebase currently
|
||||
virtual long CrtSetBreakAlloc( long lNewBreakAlloc ) = 0;
|
||||
virtual int32_t CrtSetBreakAlloc( int32_t lNewBreakAlloc ) = 0;
|
||||
virtual int CrtSetReportMode( int nReportType, int nReportMode ) = 0;
|
||||
virtual int CrtIsValidHeapPointer( const void *pMem ) = 0;
|
||||
virtual int CrtIsValidPointer( const void *pMem, unsigned int size, int access ) = 0;
|
||||
|
@ -614,8 +614,8 @@ int* AFNAME(_crtDbgFlag)(void)
|
||||
return AFRET(_crtDbgFlag);
|
||||
}
|
||||
|
||||
long _crtBreakAlloc; /* Break on this allocation */
|
||||
long* AFNAME(_crtBreakAlloc) (void)
|
||||
int32_t _crtBreakAlloc; /* Break on this allocation */
|
||||
int32_t* AFNAME(_crtBreakAlloc) (void)
|
||||
{
|
||||
return AFRET(_crtBreakAlloc);
|
||||
}
|
||||
@ -631,7 +631,7 @@ _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook( _CRT_ALLOC_HOOK pfnNewHook )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
long __cdecl _CrtSetBreakAlloc( long lNewBreakAlloc )
|
||||
int32_t __cdecl _CrtSetBreakAlloc( int32_t lNewBreakAlloc )
|
||||
{
|
||||
return g_pMemAlloc->CrtSetBreakAlloc( lNewBreakAlloc );
|
||||
}
|
||||
@ -653,7 +653,7 @@ int __cdecl _CrtCheckMemory( void )
|
||||
}
|
||||
|
||||
int __cdecl _CrtIsMemoryBlock( const void *pMem, unsigned int nSize,
|
||||
long *plRequestNumber, char **ppFileName, int *pnLine )
|
||||
int32_t *plRequestNumber, char **ppFileName, int *pnLine )
|
||||
{
|
||||
DebuggerBreak();
|
||||
return 1;
|
||||
@ -690,7 +690,7 @@ void __cdecl _CrtDoForAllClientObjects( void (*pfn)(void *, void *), void * pCon
|
||||
//-----------------------------------------------------------------------------
|
||||
// Methods in dbgrpt.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
long _crtAssertBusy = -1;
|
||||
int32_t _crtAssertBusy = -1;
|
||||
|
||||
int __cdecl _CrtSetReportMode( int nReportType, int nReportMode )
|
||||
{
|
||||
@ -1165,7 +1165,7 @@ SIZE_T WINAPI XMemSize( PVOID pAddress, DWORD dwAllocAttributes )
|
||||
#define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
|
||||
|
||||
struct _is_ctype_compatible {
|
||||
unsigned long id;
|
||||
uint32_t id;
|
||||
int is_clike;
|
||||
};
|
||||
typedef struct setloc_struct {
|
||||
@ -1188,15 +1188,15 @@ typedef struct setloc_struct {
|
||||
} _setloc_struct, *_psetloc_struct;
|
||||
|
||||
struct _tiddata {
|
||||
unsigned long _tid; /* thread ID */
|
||||
uint32_t _tid; /* thread ID */
|
||||
|
||||
|
||||
uintptr_t _thandle; /* thread handle */
|
||||
|
||||
int _terrno; /* errno value */
|
||||
unsigned long _tdoserrno; /* _doserrno value */
|
||||
uint32_t _tdoserrno; /* _doserrno value */
|
||||
unsigned int _fpds; /* Floating Point data segment */
|
||||
unsigned long _holdrand; /* rand() seed value */
|
||||
uint32_t _holdrand; /* rand() seed value */
|
||||
char * _token; /* ptr to strtok() token */
|
||||
wchar_t * _wtoken; /* ptr to wcstok() token */
|
||||
unsigned char * _mtoken; /* ptr to _mbstok() token */
|
||||
@ -1235,7 +1235,7 @@ struct _tiddata {
|
||||
int _ownlocale; /* if 1, this thread owns its own locale */
|
||||
|
||||
/* following field is needed by NLG routines */
|
||||
unsigned long _NLG_dwCode;
|
||||
uint32_t _NLG_dwCode;
|
||||
|
||||
/*
|
||||
* Per-Thread data needed by C++ Exception Handling
|
||||
@ -1272,7 +1272,7 @@ struct _tiddata {
|
||||
|
||||
int _cxxReThrow; /* Set to True if it's a rethrown C++ Exception */
|
||||
|
||||
unsigned long __initDomain; /* initial domain used by _beginthread[ex] for managed function */
|
||||
uint32_t __initDomain; /* initial domain used by _beginthread[ex] for managed function */
|
||||
};
|
||||
|
||||
typedef struct _tiddata * _ptiddata;
|
||||
|
@ -9,6 +9,14 @@
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
typedef uint64_t ThreadId_t;
|
||||
#else
|
||||
typedef uint32_t ThreadId_t;
|
||||
#endif
|
||||
|
||||
#if defined( _X360 )
|
||||
#define NO_STEAM
|
||||
#define NO_VOICE
|
||||
@ -134,7 +142,7 @@
|
||||
typedef unsigned char uint8;
|
||||
typedef signed char int8;
|
||||
|
||||
#ifdef __x86_64__
|
||||
#if defined( __x86_64__ ) || defined( _WIN64 )
|
||||
#ifndef X64BITS
|
||||
#define X64BITS
|
||||
#endif
|
||||
@ -170,14 +178,14 @@ typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
#ifdef X64BITS
|
||||
typedef long long intp;
|
||||
typedef unsigned long long uintp;
|
||||
typedef int64_t intp;
|
||||
typedef uint64_t uintp;
|
||||
#else
|
||||
typedef int intp;
|
||||
typedef unsigned int uintp;
|
||||
typedef int32_t intp;
|
||||
typedef uint32_t uintp;
|
||||
#endif
|
||||
|
||||
#endif // else _WIN32
|
||||
@ -285,21 +293,12 @@ 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
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
#if defined( _WIN64 ) && !defined( _X360 )
|
||||
#define DebuggerBreak() {}
|
||||
#elif defined( _WIN32 ) && !defined( _X360 )
|
||||
#define DebuggerBreak() __asm { int 3 }
|
||||
#elif defined( _X360 )
|
||||
#define DebuggerBreak() DebugBreak()
|
||||
@ -541,6 +540,7 @@ static FORCEINLINE double fsel(double fComparand, double fValGE, double fLT)
|
||||
//-----------------------------------------------------------------------------
|
||||
//#define CHECK_FLOAT_EXCEPTIONS 1
|
||||
|
||||
#if !defined( _WIN64 )
|
||||
#if !defined( _X360 )
|
||||
#if defined( _MSC_VER )
|
||||
|
||||
@ -628,6 +628,7 @@ inline void SetupFPUControlWord()
|
||||
}
|
||||
|
||||
#endif // _X360
|
||||
#endif // _WIN64
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Standard functions for handling endian-ness
|
||||
@ -686,7 +687,7 @@ inline T DWordSwap360Intr( T dw )
|
||||
return output;
|
||||
}
|
||||
|
||||
#elif defined( _MSC_VER )
|
||||
#elif defined( _MSC_VER ) && !defined( _WIN64 )
|
||||
|
||||
#define WordSwap WordSwapAsm
|
||||
#define DWordSwap DWordSwapAsm
|
||||
@ -786,47 +787,45 @@ inline T DWordSwapAsm( T dw )
|
||||
// platform/compiler this should be tested.
|
||||
inline short BigShort( short val ) { int test = 1; return ( *(char *)&test == 1 ) ? WordSwap( val ) : val; }
|
||||
inline uint16 BigWord( uint16 val ) { int test = 1; return ( *(char *)&test == 1 ) ? WordSwap( val ) : val; }
|
||||
inline long BigLong( long val ) { int test = 1; return ( *(char *)&test == 1 ) ? DWordSwap( val ) : val; }
|
||||
inline int32_t BigLong( int32_t val ) { int test = 1; return ( *(char *)&test == 1 ) ? DWordSwap( val ) : val; }
|
||||
inline uint32 BigDWord( uint32 val ) { int test = 1; return ( *(char *)&test == 1 ) ? DWordSwap( val ) : val; }
|
||||
inline short LittleShort( short val ) { int test = 1; return ( *(char *)&test == 1 ) ? val : WordSwap( val ); }
|
||||
inline uint16 LittleWord( uint16 val ) { int test = 1; return ( *(char *)&test == 1 ) ? val : WordSwap( val ); }
|
||||
inline long LittleLong( long val ) { int test = 1; return ( *(char *)&test == 1 ) ? val : DWordSwap( val ); }
|
||||
inline int32_t LittleLong( int32_t val ) { int test = 1; return ( *(char *)&test == 1 ) ? val : DWordSwap( val ); }
|
||||
inline uint32 LittleDWord( uint32 val ) { int test = 1; return ( *(char *)&test == 1 ) ? val : DWordSwap( val ); }
|
||||
inline short SwapShort( short val ) { return WordSwap( val ); }
|
||||
inline uint16 SwapWord( uint16 val ) { return WordSwap( val ); }
|
||||
inline long SwapLong( long val ) { return DWordSwap( val ); }
|
||||
inline int32_t SwapLong( int32_t val ) { return DWordSwap( val ); }
|
||||
inline uint32 SwapDWord( uint32 val ) { return DWordSwap( val ); }
|
||||
|
||||
// Pass floats by pointer for swapping to avoid truncation in the fpu
|
||||
inline void BigFloat( float *pOut, const float *pIn ) { int test = 1; ( *(char *)&test == 1 ) ? SafeSwapFloat( pOut, pIn ) : ( *pOut = *pIn ); }
|
||||
inline void LittleFloat( float *pOut, const float *pIn ) { int test = 1; ( *(char *)&test == 1 ) ? ( *pOut = *pIn ) : SafeSwapFloat( pOut, pIn ); }
|
||||
inline void SwapFloat( float *pOut, const float *pIn ) { SafeSwapFloat( pOut, pIn ); }
|
||||
|
||||
#endif
|
||||
|
||||
#if _X360
|
||||
inline unsigned long LoadLittleDWord( unsigned long *base, unsigned int dwordIndex )
|
||||
inline uint32_t LoadLittleDWord( uint32_t *base, unsigned int dwordIndex )
|
||||
{
|
||||
return __loadwordbytereverse( dwordIndex<<2, base );
|
||||
}
|
||||
|
||||
inline void StoreLittleDWord( unsigned long *base, unsigned int dwordIndex, unsigned long dword )
|
||||
inline void StoreLittleDWord( uint32_t *base, unsigned int dwordIndex, uint32_t dword )
|
||||
{
|
||||
__storewordbytereverse( dword, dwordIndex<<2, base );
|
||||
}
|
||||
#else
|
||||
inline unsigned long LoadLittleDWord( unsigned long *base, unsigned int dwordIndex )
|
||||
inline uint32_t LoadLittleDWord( uint32_t *base, unsigned int dwordIndex )
|
||||
{
|
||||
return LittleDWord( base[dwordIndex] );
|
||||
}
|
||||
|
||||
inline void StoreLittleDWord( unsigned long *base, unsigned int dwordIndex, unsigned long dword )
|
||||
inline void StoreLittleDWord( uint32_t *base, unsigned int dwordIndex, uint32_t dword )
|
||||
{
|
||||
base[dwordIndex] = LittleDWord(dword);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef STATIC_TIER0
|
||||
|
||||
#ifdef TIER0_DLL_EXPORT
|
||||
@ -854,7 +853,7 @@ PLATFORM_INTERFACE bool Plat_IsInBenchmarkMode();
|
||||
|
||||
|
||||
PLATFORM_INTERFACE double Plat_FloatTime(); // Returns time in seconds since the module was loaded.
|
||||
PLATFORM_INTERFACE unsigned long Plat_MSTime(); // Time in milliseconds.
|
||||
PLATFORM_INTERFACE uint32_t Plat_MSTime(); // Time in milliseconds.
|
||||
|
||||
// b/w compatibility
|
||||
#define Sys_FloatTime Plat_FloatTime
|
||||
@ -907,25 +906,25 @@ PLATFORM_INTERFACE void ShutdownPME();
|
||||
//-----------------------------------------------------------------------------
|
||||
// Registers the current thread with Tier0's thread management system.
|
||||
// This should be called on every thread created in the game.
|
||||
PLATFORM_INTERFACE unsigned long Plat_RegisterThread( const tchar *pName = _T("Source Thread"));
|
||||
PLATFORM_INTERFACE ThreadId_t Plat_RegisterThread( const tchar *pName = _T("Source Thread"));
|
||||
|
||||
// Registers the current thread as the primary thread.
|
||||
PLATFORM_INTERFACE unsigned long Plat_RegisterPrimaryThread();
|
||||
PLATFORM_INTERFACE ThreadId_t Plat_RegisterPrimaryThread();
|
||||
|
||||
// VC-specific. Sets the thread's name so it has a friendly name in the debugger.
|
||||
// This should generally only be handled by Plat_RegisterThread and Plat_RegisterPrimaryThread
|
||||
PLATFORM_INTERFACE void Plat_SetThreadName( unsigned long dwThreadID, const tchar *pName );
|
||||
PLATFORM_INTERFACE void Plat_SetThreadName( ThreadId_t dwThreadID, const tchar *pName );
|
||||
|
||||
// These would be private if it were possible to export private variables from a .DLL.
|
||||
// They need to be variables because they are checked by inline functions at performance
|
||||
// critical places.
|
||||
PLATFORM_INTERFACE unsigned long Plat_PrimaryThreadID;
|
||||
PLATFORM_INTERFACE ThreadId_t Plat_PrimaryThreadID;
|
||||
|
||||
// Returns the ID of the currently executing thread.
|
||||
PLATFORM_INTERFACE unsigned long Plat_GetCurrentThreadID();
|
||||
PLATFORM_INTERFACE ThreadId_t Plat_GetCurrentThreadID();
|
||||
|
||||
// Returns the ID of the primary thread.
|
||||
inline unsigned long Plat_GetPrimaryThreadID()
|
||||
inline ThreadId_t Plat_GetPrimaryThreadID()
|
||||
{
|
||||
return Plat_PrimaryThreadID;
|
||||
}
|
||||
|
@ -35,15 +35,15 @@ enum SYSTEM_CALL_RESULT_t
|
||||
//
|
||||
struct PAGED_POOL_INFO_t
|
||||
{
|
||||
unsigned long numPagesUsed; // Number of Paged Pool pages used
|
||||
unsigned long numPagesFree; // Number of Paged Pool pages free
|
||||
uint32_t numPagesUsed; // Number of Paged Pool pages used
|
||||
uint32_t numPagesFree; // Number of Paged Pool pages free
|
||||
};
|
||||
|
||||
//
|
||||
// Plat_GetMemPageSize
|
||||
// Returns the size of a memory page in kilobytes.
|
||||
//
|
||||
PLATFORM_INTERFACE unsigned long Plat_GetMemPageSize();
|
||||
PLATFORM_INTERFACE uint32_t Plat_GetMemPageSize();
|
||||
|
||||
//
|
||||
// Plat_GetPagedPoolInfo
|
||||
|
@ -76,8 +76,6 @@ const unsigned TT_INFINITE = 0xffffffff;
|
||||
|
||||
#endif // NO_THREAD_LOCAL
|
||||
|
||||
typedef unsigned long ThreadId_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Simple thread creation. Differs from VCR mode/CreateThread/_beginthreadex
|
||||
@ -95,7 +93,7 @@ TT_INTERFACE bool ReleaseThreadHandle( ThreadHandle_t );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TT_INTERFACE void ThreadSleep(unsigned duration = 0);
|
||||
TT_INTERFACE uint ThreadGetCurrentId();
|
||||
TT_INTERFACE ThreadId_t ThreadGetCurrentId();
|
||||
TT_INTERFACE ThreadHandle_t ThreadGetCurrentHandle();
|
||||
TT_INTERFACE int ThreadGetPriority( ThreadHandle_t hThread = NULL );
|
||||
TT_INTERFACE bool ThreadSetPriority( ThreadHandle_t hThread, int priority );
|
||||
@ -108,14 +106,16 @@ typedef int (*ThreadedLoadLibraryFunc_t)();
|
||||
TT_INTERFACE void SetThreadedLoadLibraryFunc( ThreadedLoadLibraryFunc_t func );
|
||||
TT_INTERFACE ThreadedLoadLibraryFunc_t GetThreadedLoadLibraryFunc();
|
||||
|
||||
#if defined( _WIN32 ) && !defined( _WIN64 ) && !defined( _X360 )
|
||||
extern "C" unsigned long __declspec(dllimport) __stdcall GetCurrentThreadId();
|
||||
#define ThreadGetCurrentId GetCurrentThreadId
|
||||
#if defined( _WIN64 )
|
||||
#include <immintrin.h>
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
inline void ThreadPause()
|
||||
{
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
#if defined( _WIN64 )
|
||||
_mm_pause();
|
||||
#elif defined( _WIN32 ) && !defined( _X360 )
|
||||
__asm pause;
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
__asm __volatile("pause");
|
||||
@ -180,28 +180,50 @@ extern "C"
|
||||
#pragma intrinsic( _InterlockedExchangeAdd )
|
||||
#pragma intrinsic( _InterlockedIncrement )
|
||||
|
||||
inline long ThreadInterlockedIncrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( p ); }
|
||||
inline long ThreadInterlockedDecrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( p ); }
|
||||
inline long ThreadInterlockedExchange( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( p, value ); }
|
||||
inline long ThreadInterlockedExchangeAdd( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( p, value ); }
|
||||
inline long ThreadInterlockedCompareExchange( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( p, value, comperand ) == comperand ); }
|
||||
#else
|
||||
TT_INTERFACE long ThreadInterlockedIncrement( long volatile * );
|
||||
TT_INTERFACE long ThreadInterlockedDecrement( long volatile * );
|
||||
TT_INTERFACE long ThreadInterlockedExchange( long volatile *, long value );
|
||||
TT_INTERFACE long ThreadInterlockedExchangeAdd( long volatile *, long value );
|
||||
TT_INTERFACE long ThreadInterlockedCompareExchange( long volatile *, long value, long comperand );
|
||||
TT_INTERFACE bool ThreadInterlockedAssignIf( long volatile *, long value, long comperand );
|
||||
inline int32_t ThreadInterlockedIncrement( int32_t volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( (volatile long*)p ); }
|
||||
inline int32_t ThreadInterlockedDecrement( int32_t volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( (volatile long*)p ); }
|
||||
inline int32_t ThreadInterlockedExchange( int32_t volatile *p, int32_t value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( (volatile long*)p, value ); }
|
||||
inline int32_t ThreadInterlockedExchangeAdd( int32_t volatile *p, int32_t value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( (volatile long*)p, value ); }
|
||||
inline int32_t ThreadInterlockedCompareExchange( int32_t volatile *p, int32_t value, int32_t comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( (volatile long*)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( int32_t volatile *p, int32_t value, int32_t comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( (volatile long*)p, value, comperand ) == comperand ); }
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
#pragma intrinsic( _InterlockedCompareExchange64 )
|
||||
#pragma intrinsic( _InterlockedDecrement64 )
|
||||
#pragma intrinsic( _InterlockedExchange64 )
|
||||
#pragma intrinsic( _InterlockedExchangeAdd64 )
|
||||
#pragma intrinsic( _InterlockedIncrement64 )
|
||||
|
||||
inline int64 ThreadInterlockedIncrement64( int64 volatile *p ) { Assert( (size_t)p % 8 == 0 ); return _InterlockedIncrement64( p ); }
|
||||
inline int64 ThreadInterlockedDecrement64( int64 volatile *p ) { Assert( (size_t)p % 8 == 0 ); return _InterlockedDecrement64( p ); }
|
||||
inline int64 ThreadInterlockedExchange64( int64 volatile *p, int64 value ) { Assert( (size_t)p % 8 == 0 ); return _InterlockedExchange64( p, value ); }
|
||||
inline int64 ThreadInterlockedExchangeAdd64( int64 volatile *p, int64 value ) { Assert( (size_t)p % 8 == 0 ); return _InterlockedExchangeAdd64( p, value ); }
|
||||
inline int64 ThreadInterlockedCompareExchange64( int64 volatile *p, int64 value, int64 comperand ) { Assert( (size_t)p % 8 == 0 ); return _InterlockedCompareExchange64( p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf64( int64 volatile *p, int64 value, int64 comperand ) { Assert( (size_t)p % 8 == 0 ); return ( _InterlockedCompareExchange64( p, value, comperand ) == comperand ); }
|
||||
#endif
|
||||
|
||||
inline unsigned ThreadInterlockedExchangeSubtract( long volatile *p, long value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, -value ); }
|
||||
#else
|
||||
TT_INTERFACE int32_t ThreadInterlockedIncrement( int32_t volatile * );
|
||||
TT_INTERFACE int32_t ThreadInterlockedDecrement( int32_t volatile * );
|
||||
TT_INTERFACE int32_t ThreadInterlockedExchange( int32_t volatile *, int32_t value );
|
||||
TT_INTERFACE int32_t ThreadInterlockedExchangeAdd( int32_t volatile *, int32_t value );
|
||||
TT_INTERFACE int32_t ThreadInterlockedCompareExchange( int32_t volatile *, int32_t value, int32_t comperand );
|
||||
TT_INTERFACE bool ThreadInterlockedAssignIf( int32_t volatile *, int32_t value, int32_t comperand );
|
||||
#endif
|
||||
|
||||
#if defined( USE_INTRINSIC_INTERLOCKED ) && !defined( _WIN64 )
|
||||
inline int32_t ThreadInterlockedExchangeSubtract( int32_t volatile *p, int32_t value ) { return ThreadInterlockedExchangeAdd( (int32_t volatile *)p, -value ); }
|
||||
|
||||
#if defined( USE_INTRINSIC_INTERLOCKED )
|
||||
#define TIPTR()
|
||||
inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)_InterlockedExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value) ); }
|
||||
inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)_InterlockedCompareExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value), reinterpret_cast<long>(comperand) ); }
|
||||
inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( _InterlockedCompareExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value), reinterpret_cast<long>(comperand) ) == reinterpret_cast<long>(comperand) ); }
|
||||
#ifdef PLATFORM_64BITS
|
||||
inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)( ThreadInterlockedExchange64( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value) ) ); }
|
||||
inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)( ThreadInterlockedCompareExchange64( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ) ); }
|
||||
inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ThreadInterlockedAssignIf64( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ); }
|
||||
#else
|
||||
inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)( ThreadInterlockedExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value) ) ); }
|
||||
inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)( ThreadInterlockedCompareExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ) ); }
|
||||
inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( ThreadInterlockedCompareExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ) == reinterpret_cast<intp>(comperand) ); }
|
||||
#endif
|
||||
#else
|
||||
TT_INTERFACE void *ThreadInterlockedExchangePointer( void * volatile *, void *value );
|
||||
TT_INTERFACE void *ThreadInterlockedCompareExchangePointer( void * volatile *, void *value, void *comperand );
|
||||
@ -212,28 +234,33 @@ inline void const *ThreadInterlockedExchangePointerToConst( void const * volatil
|
||||
inline void const *ThreadInterlockedCompareExchangePointerToConst( void const * volatile *p, void const *value, void const *comperand ) { return ThreadInterlockedCompareExchangePointer( const_cast < void * volatile * > ( p ), const_cast < void * > ( value ), const_cast < void * > ( comperand ) ); }
|
||||
inline bool ThreadInterlockedAssignPointerToConstIf( void const * volatile *p, void const *value, void const *comperand ) { return ThreadInterlockedAssignPointerIf( const_cast < void * volatile * > ( p ), const_cast < void * > ( value ), const_cast < void * > ( comperand ) ); }
|
||||
|
||||
#if !defined( USE_INTRINSIC_INTERLOCKED ) || ( defined( _WIN32 ) && !defined( PLATFORM_64BITS ) )
|
||||
#if defined( _LINUX ) && defined( PLATFORM_64BITS )
|
||||
// http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Atomic-Builtins.html#Atomic-Builtins
|
||||
// https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
|
||||
inline int64 ThreadInterlockedIncrement64( int64 volatile * pDest ) { Assert( (size_t)pDest % 8 == 0 ); return __atomic_add_fetch( pDest, 1, __ATOMIC_ACQ_REL ); }
|
||||
inline int64 ThreadInterlockedDecrement64( int64 volatile * pDest ) { Assert( (size_t)pDest % 8 == 0 ); return __atomic_sub_fetch( pDest, 1, __ATOMIC_ACQ_REL ); }
|
||||
inline int64 ThreadInterlockedExchange64( int64 volatile * pDest, int64 value ) { Assert( (size_t)pDest % 8 == 0 ); return __atomic_exchange_n( pDest, value, __ATOMIC_ACQ_REL ); }
|
||||
inline int64 ThreadInterlockedExchangeAdd64( int64 volatile * pDest, int64 value ) { Assert( (size_t)pDest % 8 == 0 ); return __atomic_fetch_add( pDest, value, __ATOMIC_ACQ_REL ); }
|
||||
inline int64 ThreadInterlockedCompareExchange64( int64 volatile * pDest, int64 value, int64 comperand ) { Assert( (size_t)pDest % 8 == 0 ); int64* alignedComperand = (int64*)aligned_alloc(8, sizeof(int64)); *alignedComperand = comperand; auto initial = __atomic_load_n( pDest, __ATOMIC_ACQUIRE ); __atomic_compare_exchange_n( pDest, alignedComperand, value, false, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED ); free(alignedComperand); return initial; }
|
||||
inline bool ThreadInterlockedAssignIf64( int64 volatile *pDest, int64 value, int64 comperand ) { Assert( (size_t)pDest % 8 == 0 ); return __atomic_compare_exchange_n( pDest, &comperand, value, false, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED ); }
|
||||
#else
|
||||
TT_INTERFACE int64 ThreadInterlockedIncrement64( int64 volatile * );
|
||||
TT_INTERFACE int64 ThreadInterlockedDecrement64( int64 volatile * );
|
||||
TT_INTERFACE int64 ThreadInterlockedCompareExchange64( int64 volatile *, int64 value, int64 comperand );
|
||||
TT_INTERFACE int64 ThreadInterlockedExchange64( int64 volatile *, int64 value );
|
||||
TT_INTERFACE int64 ThreadInterlockedExchangeAdd64( int64 volatile *, int64 value );
|
||||
TT_INTERFACE bool ThreadInterlockedAssignIf64(volatile int64 *pDest, int64 value, int64 comperand );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline unsigned ThreadInterlockedExchangeSubtract( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedIncrement( unsigned volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); }
|
||||
inline unsigned ThreadInterlockedDecrement( unsigned volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); }
|
||||
inline unsigned ThreadInterlockedExchange( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedExchangeAdd( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedCompareExchange( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); }
|
||||
|
||||
inline int ThreadInterlockedExchangeSubtract( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedIncrement( int volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); }
|
||||
inline int ThreadInterlockedDecrement( int volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); }
|
||||
inline int ThreadInterlockedExchange( int volatile *p, int value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedExchangeAdd( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedCompareExchange( int volatile *p, int value, int comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( int volatile *p, int value, int comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); }
|
||||
inline uint32_t ThreadInterlockedExchangeSubtract( uint32_t volatile *p, uint32_t value ) { return ThreadInterlockedExchangeAdd( (int32_t volatile *)p, value ); }
|
||||
inline uint32_t ThreadInterlockedIncrement( uint32_t volatile *p ) { return ThreadInterlockedIncrement( (int32_t volatile *)p ); }
|
||||
inline uint32_t ThreadInterlockedDecrement( uint32_t volatile *p ) { return ThreadInterlockedDecrement( (int32_t volatile *)p ); }
|
||||
inline uint32_t ThreadInterlockedExchange( uint32_t volatile *p, uint32_t value ) { return ThreadInterlockedExchange( (int32_t volatile *)p, value ); }
|
||||
inline uint32_t ThreadInterlockedExchangeAdd( uint32_t volatile *p, uint32_t value ) { return ThreadInterlockedExchangeAdd( (int32_t volatile *)p, value ); }
|
||||
inline uint32_t ThreadInterlockedCompareExchange( uint32_t volatile *p, uint32_t value, uint32_t comperand ) { return ThreadInterlockedCompareExchange( (int32_t volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( uint32_t volatile *p, uint32_t value, uint32_t comperand ) { return ThreadInterlockedAssignIf( (int32_t volatile *)p, value, comperand ); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Access to VTune thread profiling
|
||||
@ -379,7 +406,7 @@ template <typename T>
|
||||
class CInterlockedIntT
|
||||
{
|
||||
public:
|
||||
CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(long) ); }
|
||||
CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(int32_t) ); }
|
||||
CInterlockedIntT( T value ) : m_value( value ) {}
|
||||
|
||||
operator T() const { return m_value; }
|
||||
@ -388,17 +415,17 @@ public:
|
||||
bool operator==( T rhs ) const { return ( m_value == rhs ); }
|
||||
bool operator!=( T rhs ) const { return ( m_value != rhs ); }
|
||||
|
||||
T operator++() { return (T)ThreadInterlockedIncrement( (long *)&m_value ); }
|
||||
T operator++() { return (T)ThreadInterlockedIncrement( (int32_t *)&m_value ); }
|
||||
T operator++(int) { return operator++() - 1; }
|
||||
|
||||
T operator--() { return (T)ThreadInterlockedDecrement( (long *)&m_value ); }
|
||||
T operator--() { return (T)ThreadInterlockedDecrement( (int32_t *)&m_value ); }
|
||||
T operator--(int) { return operator--() + 1; }
|
||||
|
||||
bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (long *)&m_value, (long)newValue, (long)conditionValue ); }
|
||||
bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (int32_t *)&m_value, (int32_t)newValue, (int32_t)conditionValue ); }
|
||||
|
||||
T operator=( T newValue ) { ThreadInterlockedExchange((long *)&m_value, newValue); return m_value; }
|
||||
T operator=( T newValue ) { ThreadInterlockedExchange((int32_t *)&m_value, newValue); return m_value; }
|
||||
|
||||
void operator+=( T add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, (long)add ); }
|
||||
void operator+=( T add ) { ThreadInterlockedExchangeAdd( (int32_t *)&m_value, (int32_t)add ); }
|
||||
void operator-=( T subtract ) { operator+=( -subtract ); }
|
||||
void operator*=( T multiplier ) {
|
||||
T original, result;
|
||||
@ -433,7 +460,7 @@ template <typename T>
|
||||
class CInterlockedPtr
|
||||
{
|
||||
public:
|
||||
CInterlockedPtr() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T *) == sizeof(long) ); /* Will need to rework operator+= for 64 bit */ }
|
||||
CInterlockedPtr() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T *) == sizeof(int32_t) ); /* Will need to rework operator+= for 64 bit */ }
|
||||
CInterlockedPtr( T *value ) : m_value( value ) {}
|
||||
|
||||
operator T *() const { return m_value; }
|
||||
@ -442,17 +469,17 @@ public:
|
||||
bool operator==( T *rhs ) const { return ( m_value == rhs ); }
|
||||
bool operator!=( T *rhs ) const { return ( m_value != rhs ); }
|
||||
|
||||
T *operator++() { return ((T *)ThreadInterlockedExchangeAdd( (long *)&m_value, sizeof(T) )) + 1; }
|
||||
T *operator++(int) { return (T *)ThreadInterlockedExchangeAdd( (long *)&m_value, sizeof(T) ); }
|
||||
T *operator++() { return ((T *)ThreadInterlockedExchangeAdd( (int32_t *)&m_value, sizeof(T) )) + 1; }
|
||||
T *operator++(int) { return (T *)ThreadInterlockedExchangeAdd( (int32_t *)&m_value, sizeof(T) ); }
|
||||
|
||||
T *operator--() { return ((T *)ThreadInterlockedExchangeAdd( (long *)&m_value, -sizeof(T) )) - 1; }
|
||||
T *operator--(int) { return (T *)ThreadInterlockedExchangeAdd( (long *)&m_value, -sizeof(T) ); }
|
||||
T *operator--() { return ((T *)ThreadInterlockedExchangeAdd( (int32_t *)&m_value, -sizeof(T) )) - 1; }
|
||||
T *operator--(int) { return (T *)ThreadInterlockedExchangeAdd( (int32_t *)&m_value, -sizeof(T) ); }
|
||||
|
||||
bool AssignIf( T *conditionValue, T *newValue ) { return ThreadInterlockedAssignPointerToConstIf( (void const **) &m_value, (void const *) newValue, (void const *) conditionValue ); }
|
||||
|
||||
T *operator=( T *newValue ) { ThreadInterlockedExchangePointerToConst( (void const **) &m_value, (void const *) newValue ); return newValue; }
|
||||
|
||||
void operator+=( int add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, add * sizeof(T) ); }
|
||||
void operator+=( int add ) { ThreadInterlockedExchangeAdd( (int32_t *)&m_value, add * sizeof(T) ); }
|
||||
void operator-=( int subtract ) { operator+=( -subtract ); }
|
||||
|
||||
T *operator+( int rhs ) const { return m_value + rhs; }
|
||||
@ -555,22 +582,21 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
FORCEINLINE bool TryLockInline( const uint32 threadId ) volatile
|
||||
FORCEINLINE bool TryLockInline( const ThreadId_t threadId ) volatile
|
||||
{
|
||||
if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( (volatile long *)&m_ownerID, (long)threadId, 0 ) )
|
||||
if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( (volatile int32_t *)&m_ownerID, (int32_t)threadId, 0 ) )
|
||||
return false;
|
||||
|
||||
++m_depth;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TryLock( const uint32 threadId ) volatile
|
||||
bool TryLock( const ThreadId_t threadId ) volatile
|
||||
{
|
||||
return TryLockInline( threadId );
|
||||
}
|
||||
|
||||
TT_CLASS void Lock( const uint32 threadId, unsigned nSpinSleepTime ) volatile;
|
||||
|
||||
TT_CLASS void Lock( const ThreadId_t threadId, unsigned nSpinSleepTime ) volatile;
|
||||
public:
|
||||
bool TryLock() volatile
|
||||
{
|
||||
@ -589,7 +615,7 @@ public:
|
||||
#endif
|
||||
void Lock( unsigned nSpinSleepTime = 0 ) volatile
|
||||
{
|
||||
const uint32 threadId = ThreadGetCurrentId();
|
||||
const auto threadId = ThreadGetCurrentId();
|
||||
|
||||
if ( !TryLockInline( threadId ) )
|
||||
{
|
||||
@ -622,8 +648,13 @@ public:
|
||||
#endif
|
||||
|
||||
--m_depth;
|
||||
if ( !m_depth )
|
||||
if ( !m_depth ) {
|
||||
#ifdef _WIN64
|
||||
_InterlockedExchange64( (int64 volatile*)&m_ownerID, 0 );
|
||||
#else
|
||||
ThreadInterlockedExchange( &m_ownerID, 0 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool TryLock() const volatile { return (const_cast<CThreadFastMutex *>(this))->TryLock(); }
|
||||
@ -633,11 +664,11 @@ public:
|
||||
// To match regular CThreadMutex:
|
||||
bool AssertOwnedByCurrentThread() { return true; }
|
||||
void SetTrace( bool ) {}
|
||||
ThreadId_t GetOwnerId() const { return m_ownerID; }
|
||||
|
||||
uint32 GetOwnerId() const { return m_ownerID; }
|
||||
int GetDepth() const { return m_depth; }
|
||||
private:
|
||||
volatile uint32 m_ownerID;
|
||||
volatile ThreadId_t m_ownerID;
|
||||
int m_depth;
|
||||
};
|
||||
|
||||
@ -845,13 +876,13 @@ private:
|
||||
class TT_CLASS CThreadSemaphore : public CThreadSyncObject
|
||||
{
|
||||
public:
|
||||
CThreadSemaphore(long initialValue, long maxValue);
|
||||
CThreadSemaphore(int32_t initialValue, int32_t maxValue);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Increases the count of the semaphore object by a specified
|
||||
// amount. Wait() decreases the count by one on return.
|
||||
//-----------------------------------------------------
|
||||
bool Release(long releaseCount = 1, long * pPreviousCount = NULL );
|
||||
bool Release(int32_t releaseCount = 1, int32_t * pPreviousCount = NULL );
|
||||
|
||||
private:
|
||||
CThreadSemaphore(const CThreadSemaphore &);
|
||||
@ -989,7 +1020,6 @@ public:
|
||||
Assert( (int)this % 8 == 0 );
|
||||
m_lockInfo.m_writerId = 0;
|
||||
m_lockInfo.m_nReaders = 0;
|
||||
m_lockInfo.m_i64 = 0;
|
||||
}
|
||||
|
||||
bool TryLockForWrite();
|
||||
@ -1008,19 +1038,15 @@ public:
|
||||
void UnlockWrite() const { const_cast<CThreadSpinRWLock *>(this)->UnlockWrite(); }
|
||||
|
||||
private:
|
||||
union LockInfo_t
|
||||
struct LockInfo_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32 m_writerId;
|
||||
ThreadId_t m_writerId;
|
||||
int m_nReaders;
|
||||
};
|
||||
int64 m_i64;
|
||||
};
|
||||
|
||||
bool AssignIf( const LockInfo_t &newValue, const LockInfo_t &comperand );
|
||||
bool TryLockForWrite( const uint32 threadId );
|
||||
void SpinLockForWrite( const uint32 threadId );
|
||||
bool TryLockForWrite( const ThreadId_t threadId );
|
||||
void SpinLockForWrite( const ThreadId_t threadId );
|
||||
|
||||
volatile LockInfo_t m_lockInfo;
|
||||
CInterlockedInt m_nWriters;
|
||||
@ -1062,7 +1088,7 @@ public:
|
||||
#ifdef _WIN32
|
||||
// Access the thread handle directly
|
||||
HANDLE GetThreadHandle();
|
||||
uint GetThreadId();
|
||||
ThreadId_t GetThreadId();
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------
|
||||
@ -1362,7 +1388,7 @@ extern "C"
|
||||
inline void CThreadMutex::Lock()
|
||||
{
|
||||
#ifdef THREAD_MUTEX_TRACING_ENABLED
|
||||
uint thisThreadID = ThreadGetCurrentId();
|
||||
ThreadId_t thisThreadID = ThreadGetCurrentId();
|
||||
if ( m_bTrace && m_currentOwnerID && ( m_currentOwnerID != thisThreadID ) )
|
||||
Msg( "Thread %u about to wait for lock %x owned by %u\n", ThreadGetCurrentId(), (CRITICAL_SECTION *)&m_CriticalSection, m_currentOwnerID );
|
||||
#endif
|
||||
@ -1520,7 +1546,7 @@ inline bool CThreadSpinRWLock::AssignIf( const LockInfo_t &newValue, const LockI
|
||||
return ThreadInterlockedAssignIf64( (int64 *)&m_lockInfo, *((int64 *)&newValue), *((int64 *)&comperand) );
|
||||
}
|
||||
|
||||
inline bool CThreadSpinRWLock::TryLockForWrite( const uint32 threadId )
|
||||
inline bool CThreadSpinRWLock::TryLockForWrite( const ThreadId_t threadId )
|
||||
{
|
||||
// In order to grab a write lock, there can be no readers and no owners of the write lock
|
||||
if ( m_lockInfo.m_nReaders > 0 || ( m_lockInfo.m_writerId && m_lockInfo.m_writerId != threadId ) )
|
||||
@ -1528,8 +1554,8 @@ inline bool CThreadSpinRWLock::TryLockForWrite( const uint32 threadId )
|
||||
return false;
|
||||
}
|
||||
|
||||
static const LockInfo_t oldValue = { {0, 0} };
|
||||
LockInfo_t newValue = { {threadId, 0} };
|
||||
static const LockInfo_t oldValue = {0, 0};
|
||||
LockInfo_t newValue = {threadId, 0};
|
||||
const bool bSuccess = AssignIf( newValue, oldValue );
|
||||
#if defined(_X360)
|
||||
if ( bSuccess )
|
||||
@ -1578,7 +1604,7 @@ inline bool CThreadSpinRWLock::TryLockForRead()
|
||||
|
||||
inline void CThreadSpinRWLock::LockForWrite()
|
||||
{
|
||||
const uint32 threadId = ThreadGetCurrentId();
|
||||
const ThreadId_t threadId = ThreadGetCurrentId();
|
||||
|
||||
m_nWriters++;
|
||||
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
TSLNodeBase_t *Detach()
|
||||
{
|
||||
#ifdef USE_NATIVE_SLIST
|
||||
TSLNodeBase_t *pBase = (TSLNodeBase_t *)InterlockedFlushSList( &m_Head );
|
||||
TSLNodeBase_t *pBase = (TSLNodeBase_t *)InterlockedFlushSList( (PSLIST_HEADER)&m_Head );
|
||||
#ifdef _X360
|
||||
__lwsync(); // read-acquire barrier
|
||||
#endif
|
||||
@ -201,7 +201,7 @@ public:
|
||||
int Count() const
|
||||
{
|
||||
#ifdef USE_NATIVE_SLIST
|
||||
return QueryDepthSList( &m_Head );
|
||||
return QueryDepthSList( (PSLIST_HEADER)&m_Head );
|
||||
#else
|
||||
return m_Head.value.Depth;
|
||||
#endif
|
||||
|
@ -139,18 +139,18 @@ typedef struct VCR_s
|
||||
tchar* (*Hook_GetCommandLine)();
|
||||
|
||||
// Registry hooks.
|
||||
long (*Hook_RegOpenKeyEx)( void *hKey, const tchar *lpSubKey, unsigned long ulOptions, unsigned long samDesired, void *pHKey );
|
||||
long (*Hook_RegSetValueEx)(void *hKey, tchar const *lpValueName, unsigned long Reserved, unsigned long dwType, uint8 const *lpData, unsigned long cbData);
|
||||
long (*Hook_RegQueryValueEx)(void *hKey, tchar const *lpValueName, unsigned long *lpReserved, unsigned long *lpType, uint8 *lpData, unsigned long *lpcbData);
|
||||
long (*Hook_RegCreateKeyEx)(void *hKey, tchar const *lpSubKey, unsigned long Reserved, tchar *lpClass, unsigned long dwOptions, unsigned long samDesired, void *lpSecurityAttributes, void *phkResult, unsigned long *lpdwDisposition);
|
||||
int32_t (*Hook_RegOpenKeyEx)( void *hKey, const tchar *lpSubKey, uint32_t ulOptions, uint32_t samDesired, void *pHKey );
|
||||
int32_t (*Hook_RegSetValueEx)(void *hKey, tchar const *lpValueName, uint32_t Reserved, uint32_t dwType, uint8 const *lpData, uint32_t cbData);
|
||||
int32_t (*Hook_RegQueryValueEx)(void *hKey, tchar const *lpValueName, uint32_t *lpReserved, uint32_t *lpType, uint8 *lpData, uint32_t *lpcbData);
|
||||
int32_t (*Hook_RegCreateKeyEx)(void *hKey, tchar const *lpSubKey, uint32_t Reserved, tchar *lpClass, uint32_t dwOptions, uint32_t samDesired, void *lpSecurityAttributes, void *phkResult, uint32_t *lpdwDisposition);
|
||||
void (*Hook_RegCloseKey)(void *hKey);
|
||||
|
||||
// hInput is a HANDLE.
|
||||
int (*Hook_GetNumberOfConsoleInputEvents)( void *hInput, unsigned long *pNumEvents );
|
||||
int (*Hook_GetNumberOfConsoleInputEvents)( void *hInput, uint32_t *pNumEvents );
|
||||
|
||||
// hInput is a HANDLE.
|
||||
// pRecs is an INPUT_RECORD pointer.
|
||||
int (*Hook_ReadConsoleInput)( void *hInput, void *pRecs, int nMaxRecs, unsigned long *pNumRead );
|
||||
int (*Hook_ReadConsoleInput)( void *hInput, void *pRecs, int nMaxRecs, uint32_t *pNumRead );
|
||||
|
||||
|
||||
// This calls time() then gives you localtime()'s result.
|
||||
@ -186,19 +186,19 @@ typedef struct VCR_s
|
||||
// This mirrors the Windows API CreateThread function and returns a HANDLE the same way.
|
||||
void* (*Hook_CreateThread)(
|
||||
void *lpThreadAttributes,
|
||||
unsigned long dwStackSize,
|
||||
uint32_t dwStackSize,
|
||||
void *lpStartAddress,
|
||||
void *lpParameter,
|
||||
unsigned long dwCreationFlags,
|
||||
unsigned long *lpThreadID );
|
||||
uint32_t dwCreationFlags,
|
||||
uint32_t *lpThreadID );
|
||||
|
||||
unsigned long (*Hook_WaitForSingleObject)(
|
||||
uint32_t (*Hook_WaitForSingleObject)(
|
||||
void *handle,
|
||||
unsigned long dwMilliseconds );
|
||||
uint32_t dwMilliseconds );
|
||||
|
||||
void (*Hook_EnterCriticalSection)( void *pCS );
|
||||
|
||||
void (*Hook_Time)( long *pTime );
|
||||
void (*Hook_Time)( int32_t *pTime );
|
||||
|
||||
// String value. Playback just verifies that the incoming string is the same as it was when recording.
|
||||
void (*GenericString)( const char *pEventName, const char *pString );
|
||||
@ -206,7 +206,7 @@ typedef struct VCR_s
|
||||
// Works like GenericValue, except upon playback it will verify that pData's contents are the same as it was during recording.
|
||||
void (*GenericValueVerify)( const tchar *pEventName, const void *pData, int maxLen );
|
||||
|
||||
unsigned long (*Hook_WaitForMultipleObjects)( uint32 nHandles, const void **pHandles, int bWaitAll, uint32 timeout );
|
||||
uint32_t (*Hook_WaitForMultipleObjects)( uint32 nHandles, const void **pHandles, int bWaitAll, uint32 timeout );
|
||||
|
||||
} VCR_t;
|
||||
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
int GetL2CacheMisses();
|
||||
|
||||
// Not used in the common case...
|
||||
void SetCurFrameTime( unsigned long milliseconds );
|
||||
void SetCurFrameTime( uint32_t milliseconds );
|
||||
|
||||
void SetClientData( int iClientData ) { m_iClientData = iClientData; }
|
||||
int GetClientData() const { return m_iClientData; }
|
||||
|
@ -156,7 +156,7 @@ public:
|
||||
void WriteByte(int val);
|
||||
void WriteShort(int val);
|
||||
void WriteWord(int val);
|
||||
void WriteLong(long val);
|
||||
void WriteLong(int32_t val);
|
||||
void WriteLongLong(int64 val);
|
||||
void WriteFloat(float val);
|
||||
bool WriteBytes( const void *pBuf, int nBytes );
|
||||
@ -297,7 +297,7 @@ inline void old_bf_write::WriteUBitLong( unsigned int curData, int numbits, bool
|
||||
// Make sure it doesn't overflow.
|
||||
if ( bCheckRange && numbits < 32 )
|
||||
{
|
||||
if ( curData >= (unsigned long)(1 << numbits) )
|
||||
if ( curData >= (uint32_t)(1 << numbits) )
|
||||
{
|
||||
CallErrorHandler( BITBUFERROR_VALUE_OUT_OF_RANGE, GetDebugName() );
|
||||
}
|
||||
@ -305,7 +305,7 @@ inline void old_bf_write::WriteUBitLong( unsigned int curData, int numbits, bool
|
||||
Assert( numbits >= 0 && numbits <= 32 );
|
||||
#endif
|
||||
|
||||
extern unsigned long g_BitWriteMasks[32][33];
|
||||
extern uint32_t g_BitWriteMasks[32][33];
|
||||
|
||||
// Bounds checking..
|
||||
if ((m_iCurBit+numbits) > m_nDataBits)
|
||||
@ -321,17 +321,17 @@ inline void old_bf_write::WriteUBitLong( unsigned int curData, int numbits, bool
|
||||
|
||||
// Mask in a dword.
|
||||
unsigned int iDWord = iCurBit >> 5;
|
||||
Assert( (iDWord*4 + sizeof(long)) <= (unsigned int)m_nDataBytes );
|
||||
Assert( (iDWord*4 + sizeof(int32_t)) <= (unsigned int)m_nDataBytes );
|
||||
|
||||
unsigned long iCurBitMasked = iCurBit & 31;
|
||||
uint32_t iCurBitMasked = iCurBit & 31;
|
||||
|
||||
unsigned long dword = LoadLittleDWord( (unsigned long*)m_pData, iDWord );
|
||||
uint32_t dword = LoadLittleDWord( (uint32_t*)m_pData, iDWord );
|
||||
|
||||
dword &= g_BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
dword |= curData << iCurBitMasked;
|
||||
|
||||
// write to stream (lsb to msb ) properly
|
||||
StoreLittleDWord( (unsigned long*)m_pData, iDWord, dword );
|
||||
StoreLittleDWord( (uint32_t*)m_pData, iDWord, dword );
|
||||
|
||||
// Did it span a dword?
|
||||
int nBitsWritten = 32 - iCurBitMasked;
|
||||
@ -341,13 +341,13 @@ inline void old_bf_write::WriteUBitLong( unsigned int curData, int numbits, bool
|
||||
curData >>= nBitsWritten;
|
||||
|
||||
// read from stream (lsb to msb) properly
|
||||
dword = LoadLittleDWord( (unsigned long*)m_pData, iDWord+1 );
|
||||
dword = LoadLittleDWord( (uint32_t*)m_pData, iDWord+1 );
|
||||
|
||||
dword &= g_BitWriteMasks[0][nBitsLeft];
|
||||
dword |= curData;
|
||||
|
||||
// write to stream (lsb to msb) properly
|
||||
StoreLittleDWord( (unsigned long*)m_pData, iDWord+1, dword );
|
||||
StoreLittleDWord( (uint32_t*)m_pData, iDWord+1, dword );
|
||||
}
|
||||
|
||||
m_iCurBit += numbits;
|
||||
@ -459,7 +459,7 @@ public:
|
||||
int ReadByte();
|
||||
int ReadShort();
|
||||
int ReadWord();
|
||||
long ReadLong();
|
||||
int32_t ReadLong();
|
||||
int64 ReadLongLong();
|
||||
float ReadFloat();
|
||||
bool ReadBytes(void *pOut, int nBytes);
|
||||
@ -604,9 +604,9 @@ inline int old_bf_read::ReadOneBit()
|
||||
|
||||
inline float old_bf_read::ReadBitFloat()
|
||||
{
|
||||
long val;
|
||||
int32_t val;
|
||||
|
||||
Assert(sizeof(float) == sizeof(long));
|
||||
Assert(sizeof(float) == sizeof(int32_t));
|
||||
Assert(sizeof(float) == 4);
|
||||
|
||||
if(CheckForOverflow(32))
|
||||
@ -627,7 +627,7 @@ inline float old_bf_read::ReadBitFloat()
|
||||
|
||||
inline unsigned int old_bf_read::ReadUBitLong( int numbits )
|
||||
{
|
||||
extern unsigned long g_ExtraMasks[32];
|
||||
extern uint32_t g_ExtraMasks[32];
|
||||
|
||||
if ( (m_iCurBit+numbits) > m_nDataBits )
|
||||
{
|
||||
@ -640,7 +640,7 @@ inline unsigned int old_bf_read::ReadUBitLong( int numbits )
|
||||
|
||||
// Read the current dword.
|
||||
int idword1 = m_iCurBit >> 5;
|
||||
unsigned int dword1 = LoadLittleDWord( (unsigned long*)m_pData, idword1 );
|
||||
unsigned int dword1 = LoadLittleDWord( (uint32_t*)m_pData, idword1 );
|
||||
|
||||
dword1 >>= (m_iCurBit & 31); // Get the bits we're interested in.
|
||||
|
||||
@ -656,7 +656,7 @@ inline unsigned int old_bf_read::ReadUBitLong( int numbits )
|
||||
else
|
||||
{
|
||||
int nExtraBits = m_iCurBit & 31;
|
||||
unsigned int dword2 = LoadLittleDWord( (unsigned long*)m_pData, idword1+1 );
|
||||
unsigned int dword2 = LoadLittleDWord( (uint32_t*)m_pData, idword1+1 );
|
||||
|
||||
dword2 &= g_ExtraMasks[nExtraBits];
|
||||
|
||||
@ -809,7 +809,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
FORCEINLINE void WriteLong(long val)
|
||||
FORCEINLINE void WriteLong(int32_t val)
|
||||
{
|
||||
WriteSBitLong( val, 32 );
|
||||
}
|
||||
@ -910,7 +910,7 @@ FORCEINLINE void CBitWrite::WriteUBitLong( unsigned int nData, int nNumBits, boo
|
||||
// Make sure it doesn't overflow.
|
||||
if ( bCheckRange && nNumBits < 32 )
|
||||
{
|
||||
Assert( nData <= (unsigned long)(1 << nNumBits ) );
|
||||
Assert( nData <= (uint32_t)(1 << nNumBits ) );
|
||||
}
|
||||
Assert( nNumBits >= 0 && nNumBits <= 32 );
|
||||
#endif
|
||||
@ -1195,12 +1195,12 @@ FORCEINLINE int CBitRead::ReadSBitLong( int numbits )
|
||||
|
||||
FORCEINLINE int CBitRead::ReadLong( void )
|
||||
{
|
||||
return ( int ) ReadUBitLong( sizeof(long) << 3 );
|
||||
return ( int ) ReadUBitLong( sizeof(int32_t) << 3 );
|
||||
}
|
||||
|
||||
FORCEINLINE float CBitRead::ReadFloat( void )
|
||||
{
|
||||
uint32 nUval = ReadUBitLong( sizeof(long) << 3 );
|
||||
uint32 nUval = ReadUBitLong( sizeof(int32_t) << 3 );
|
||||
return * ( ( float * ) &nUval );
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
typedef unsigned long CRC32_t;
|
||||
#include <cstdint>
|
||||
|
||||
typedef uint32_t CRC32_t;
|
||||
|
||||
void CRC32_Init( CRC32_t *pulCRC );
|
||||
void CRC32_ProcessBuffer( CRC32_t *pulCRC, const void *p, int len );
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
bool IsValid() const; // ip & port != 0
|
||||
void SetFromSocket( int hSocket );
|
||||
// These function names are decorated because the Xbox360 defines macros for ntohl and htonl
|
||||
unsigned long addr_ntohl() const;
|
||||
unsigned long addr_htonl() const;
|
||||
uint32_t addr_ntohl() const;
|
||||
uint32_t addr_htonl() const;
|
||||
bool operator==(const netadr_s &netadr) const {return ( CompareAdr( netadr ) );}
|
||||
bool operator<(const netadr_s &netadr) const;
|
||||
|
||||
|
@ -159,8 +159,8 @@ public:
|
||||
class CRefMT
|
||||
{
|
||||
public:
|
||||
static int Increment( int *p) { return ThreadInterlockedIncrement( (long *)p ); }
|
||||
static int Decrement( int *p) { return ThreadInterlockedDecrement( (long *)p ); }
|
||||
static int Increment( int *p) { return ThreadInterlockedIncrement( (int32_t *)p ); }
|
||||
static int Decrement( int *p) { return ThreadInterlockedDecrement( (int32_t *)p ); }
|
||||
};
|
||||
|
||||
class CRefST
|
||||
|
@ -629,7 +629,7 @@ inline void CUtlBuffer::GetTypeBin< float >( float &dest )
|
||||
{
|
||||
if ( CheckGet( sizeof( float ) ) )
|
||||
{
|
||||
uintp pData = (uintp)PeekGet();
|
||||
uintptr_t pData = (uintptr_t)PeekGet();
|
||||
if ( IsX360() && ( pData & 0x03 ) )
|
||||
{
|
||||
// handle unaligned read
|
||||
|
@ -661,7 +661,7 @@ inline bool CUtlMemory<T,I>::IsIdxValid( I i ) const
|
||||
{
|
||||
// GCC warns if I is an unsigned type and we do a ">= 0" against it (since the comparison is always 0).
|
||||
// We get the warning even if we cast inside the expression. It only goes away if we assign to another variable.
|
||||
long x = i;
|
||||
int32_t x = i;
|
||||
return ( x >= 0 ) && ( x < m_nAllocationCount );
|
||||
}
|
||||
|
||||
|
@ -385,21 +385,6 @@ struct validindex_t<T, unsigned int>
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct validindex_t<T, unsigned long>
|
||||
{
|
||||
static inline bool IsValidIndex(const CUtlMultiList<T, unsigned long> *list, unsigned long i)
|
||||
{
|
||||
return (i < list->m_MaxElementIndex) && ((list->m_Memory[i].m_Previous != i) ||
|
||||
(list->m_Memory[i].m_Next == i));
|
||||
}
|
||||
|
||||
static inline bool IsInList(const CUtlMultiList<T, unsigned long> *list, unsigned long i)
|
||||
{
|
||||
return (i < list->m_MaxElementIndex) && (list->Previous(i) != i);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Are nodes in the list or valid?
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -979,7 +979,7 @@ public:
|
||||
m_szDescription = pszDescription;
|
||||
}
|
||||
|
||||
void Run( long lBegin, long nItems, int nMaxParallel = INT_MAX )
|
||||
void Run( int32_t lBegin, int32_t nItems, int nMaxParallel = INT_MAX )
|
||||
{
|
||||
if ( nItems )
|
||||
{
|
||||
@ -1015,11 +1015,11 @@ private:
|
||||
{
|
||||
m_ItemProcessor.Begin();
|
||||
|
||||
long lLimit = m_lLimit;
|
||||
int32_t lLimit = m_lLimit;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
long lIndex = m_lIndex ++;
|
||||
int32_t lIndex = m_lIndex ++;
|
||||
if ( lIndex < lLimit )
|
||||
{
|
||||
m_ItemProcessor.Process( lIndex );
|
||||
@ -1035,23 +1035,23 @@ private:
|
||||
--m_nActive;
|
||||
}
|
||||
CInterlockedInt m_lIndex;
|
||||
long m_lLimit;
|
||||
int32_t m_lLimit;
|
||||
CInterlockedInt m_nActive;
|
||||
const char * m_szDescription;
|
||||
};
|
||||
|
||||
inline void ParallelLoopProcess( const char *szDescription, long lBegin, unsigned nItems, void (*pfnProcess)( long const & ), void (*pfnBegin)() = NULL, void (*pfnEnd)() = NULL, int nMaxParallel = INT_MAX )
|
||||
inline void ParallelLoopProcess( const char *szDescription, int32_t lBegin, unsigned nItems, void (*pfnProcess)( int32_t const & ), void (*pfnBegin)() = NULL, void (*pfnEnd)() = NULL, int nMaxParallel = INT_MAX )
|
||||
{
|
||||
CParallelLoopProcessor< CFuncJobItemProcessor< long const > > processor( szDescription );
|
||||
CParallelLoopProcessor< CFuncJobItemProcessor< int32_t const > > processor( szDescription );
|
||||
processor.m_ItemProcessor.Init( pfnProcess, pfnBegin, pfnEnd );
|
||||
processor.Run( lBegin, nItems, nMaxParallel );
|
||||
|
||||
}
|
||||
|
||||
template < typename OBJECT_TYPE, typename FUNCTION_CLASS >
|
||||
inline void ParallelLoopProcess( const char *szDescription, long lBegin, unsigned nItems, OBJECT_TYPE *pObject, void (FUNCTION_CLASS::*pfnProcess)( long const & ), void (FUNCTION_CLASS::*pfnBegin)() = NULL, void (FUNCTION_CLASS::*pfnEnd)() = NULL, int nMaxParallel = INT_MAX )
|
||||
inline void ParallelLoopProcess( const char *szDescription, int32_t lBegin, unsigned nItems, OBJECT_TYPE *pObject, void (FUNCTION_CLASS::*pfnProcess)( long const & ), void (FUNCTION_CLASS::*pfnBegin)() = NULL, void (FUNCTION_CLASS::*pfnEnd)() = NULL, int nMaxParallel = INT_MAX )
|
||||
{
|
||||
CParallelLoopProcessor< CMemberFuncJobItemProcessor<long const, OBJECT_TYPE, FUNCTION_CLASS> > processor( szDescription );
|
||||
CParallelLoopProcessor< CMemberFuncJobItemProcessor<int32_t const, OBJECT_TYPE, FUNCTION_CLASS> > processor( szDescription );
|
||||
processor.m_ItemProcessor.Init( pObject, pfnProcess, pfnBegin, pfnEnd );
|
||||
processor.Run( lBegin, nItems, nMaxParallel );
|
||||
}
|
||||
|
48
tier1/AMBuilder
Normal file
48
tier1/AMBuilder
Normal file
@ -0,0 +1,48 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os, sys
|
||||
|
||||
builder.SetBuildFolder('/')
|
||||
|
||||
project = builder.StaticLibraryProject('tier1')
|
||||
|
||||
project.sources = [
|
||||
'bitbuf.cpp',
|
||||
'byteswap.cpp',
|
||||
'characterset.cpp',
|
||||
'checksum_crc.cpp',
|
||||
'checksum_md5.cpp',
|
||||
'commandbuffer.cpp',
|
||||
'convar.cpp',
|
||||
'datamanager.cpp',
|
||||
'diff.cpp',
|
||||
'generichash.cpp',
|
||||
'interface.cpp',
|
||||
'KeyValues.cpp',
|
||||
'mempool.cpp',
|
||||
'memstack.cpp',
|
||||
'NetAdr.cpp',
|
||||
'newbitbuf.cpp',
|
||||
'processor_detect.cpp',
|
||||
'rangecheckedvar.cpp',
|
||||
'stringpool.cpp',
|
||||
'strtools.cpp',
|
||||
'tier1.cpp',
|
||||
'undiff.cpp',
|
||||
'uniqueid.cpp',
|
||||
'utlbuffer.cpp',
|
||||
'utlbufferutil.cpp',
|
||||
'utlstring.cpp',
|
||||
'utlsymbol.cpp'
|
||||
]
|
||||
|
||||
for cxx in HL2SDK.targets:
|
||||
binary = HL2SDK.ConfigureLibrary(project, cxx, builder)
|
||||
compiler = binary.compiler
|
||||
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(builder.currentSourcePath, '..', 'public'),
|
||||
os.path.join(builder.currentSourcePath, '..', 'public', 'tier0'),
|
||||
os.path.join(builder.currentSourcePath, '..', 'public', 'tier1')
|
||||
]
|
||||
|
||||
HL2SDK.libs += builder.Add(project)
|
@ -2882,14 +2882,16 @@ bool KeyValues::Dump( IKeyValuesDumpContext *pDump, int nIndentLevel /* = 0 */ )
|
||||
return false;
|
||||
|
||||
// Dump values
|
||||
for ( KeyValues *val = this ? GetFirstValue() : NULL; val; val = val->GetNextValue() )
|
||||
KeyValues *val = this;
|
||||
for ( val = val ? GetFirstValue() : val; val; val = val->GetNextValue() )
|
||||
{
|
||||
if ( !pDump->KvWriteValue( val, nIndentLevel + 1 ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
// Dump subkeys
|
||||
for ( KeyValues *sub = this ? GetFirstTrueSubKey() : NULL; sub; sub = sub->GetNextTrueSubKey() )
|
||||
KeyValues *sub = this;
|
||||
for ( sub = sub ? GetFirstTrueSubKey() : sub; sub; sub = sub->GetNextTrueSubKey() )
|
||||
{
|
||||
if ( !sub->Dump( pDump, nIndentLevel + 1 ) )
|
||||
return false;
|
||||
|
@ -184,12 +184,12 @@ unsigned int netadr_t::GetIP() const
|
||||
return *(unsigned int *)&ip;;
|
||||
}
|
||||
|
||||
unsigned long netadr_t::addr_ntohl() const
|
||||
uint32_t netadr_t::addr_ntohl() const
|
||||
{
|
||||
return ntohl( GetIP() );
|
||||
}
|
||||
|
||||
unsigned long netadr_t::addr_htonl() const
|
||||
uint32_t netadr_t::addr_htonl() const
|
||||
{
|
||||
return htonl( GetIP() );
|
||||
}
|
||||
|
@ -86,10 +86,10 @@ void SetBitBufErrorHandler( BitBufErrorHandler fn )
|
||||
|
||||
// Precalculated bit masks for WriteUBitLong. Using these tables instead of
|
||||
// doing the calculations gives a 33% speedup in WriteUBitLong.
|
||||
unsigned long g_BitWriteMasks[32][33];
|
||||
uint32_t g_BitWriteMasks[32][33];
|
||||
|
||||
// (1 << i) - 1
|
||||
unsigned long g_ExtraMasks[32];
|
||||
uint32_t g_ExtraMasks[32];
|
||||
|
||||
class CBitWriteMasksInit
|
||||
{
|
||||
@ -147,7 +147,7 @@ void old_bf_write::StartWriting( void *pData, int nBytes, int iStartBit, int nBi
|
||||
{
|
||||
// Make sure it's dword aligned and padded.
|
||||
Assert( (nBytes % 4) == 0 );
|
||||
Assert(((unsigned long)pData & 3) == 0);
|
||||
Assert(((uint32_t)pData & 3) == 0);
|
||||
|
||||
// The writing code will overrun the end of the buffer if it isn't dword aligned, so truncate to force alignment
|
||||
nBytes &= ~3;
|
||||
@ -331,7 +331,7 @@ bool old_bf_write::WriteBits(const void *pInData, int nBits)
|
||||
}
|
||||
|
||||
// Align output to dword boundary
|
||||
while (((unsigned long)pOut & 3) != 0 && nBitsLeft >= 8)
|
||||
while (((uintptr_t)pOut & 3) != 0 && nBitsLeft >= 8)
|
||||
{
|
||||
|
||||
WriteUBitLong( *pOut, 8, false );
|
||||
@ -354,18 +354,18 @@ bool old_bf_write::WriteBits(const void *pInData, int nBits)
|
||||
// X360TBD: Can't write dwords in WriteBits because they'll get swapped
|
||||
if ( IsPC() && nBitsLeft >= 32 )
|
||||
{
|
||||
unsigned long iBitsRight = (m_iCurBit & 31);
|
||||
unsigned long iBitsLeft = 32 - iBitsRight;
|
||||
unsigned long bitMaskLeft = g_BitWriteMasks[iBitsRight][32];
|
||||
unsigned long bitMaskRight = g_BitWriteMasks[0][iBitsRight];
|
||||
uint32_t iBitsRight = (m_iCurBit & 31);
|
||||
uint32_t iBitsLeft = 32 - iBitsRight;
|
||||
uint32_t bitMaskLeft = g_BitWriteMasks[iBitsRight][32];
|
||||
uint32_t bitMaskRight = g_BitWriteMasks[0][iBitsRight];
|
||||
|
||||
unsigned long *pData = &((unsigned long*)m_pData)[m_iCurBit>>5];
|
||||
uint32_t *pData = &((uint32_t*)m_pData)[m_iCurBit>>5];
|
||||
|
||||
// Read dwords.
|
||||
while(nBitsLeft >= 32)
|
||||
{
|
||||
unsigned long curData = *(unsigned long*)pOut;
|
||||
pOut += sizeof(unsigned long);
|
||||
uint32_t curData = *(uint32_t*)pOut;
|
||||
pOut += sizeof(uint32_t);
|
||||
|
||||
*pData &= bitMaskLeft;
|
||||
*pData |= curData << iBitsRight;
|
||||
@ -529,12 +529,12 @@ void old_bf_write::WriteBitCoord (const float f)
|
||||
|
||||
void old_bf_write::WriteBitFloat(float val)
|
||||
{
|
||||
long intVal;
|
||||
int32_t intVal;
|
||||
|
||||
Assert(sizeof(long) == sizeof(float));
|
||||
Assert(sizeof(int32_t) == sizeof(float));
|
||||
Assert(sizeof(float) == 4);
|
||||
|
||||
intVal = *((long*)&val);
|
||||
intVal = *((int32_t*)&val);
|
||||
WriteUBitLong( intVal, 32 );
|
||||
}
|
||||
|
||||
@ -623,9 +623,9 @@ void old_bf_write::WriteWord(int val)
|
||||
WriteUBitLong(val, sizeof(unsigned short) << 3);
|
||||
}
|
||||
|
||||
void old_bf_write::WriteLong(long val)
|
||||
void old_bf_write::WriteLong(int32_t val)
|
||||
{
|
||||
WriteSBitLong(val, sizeof(long) << 3);
|
||||
WriteSBitLong(val, sizeof(int32_t) << 3);
|
||||
}
|
||||
|
||||
void old_bf_write::WriteLongLong(int64 val)
|
||||
@ -635,8 +635,8 @@ void old_bf_write::WriteLongLong(int64 val)
|
||||
// Insert the two DWORDS according to network endian
|
||||
const short endianIndex = 0x0100;
|
||||
byte *idx = (byte*)&endianIndex;
|
||||
WriteUBitLong(pLongs[*idx++], sizeof(long) << 3);
|
||||
WriteUBitLong(pLongs[*idx], sizeof(long) << 3);
|
||||
WriteUBitLong(pLongs[*idx++], sizeof(int32_t) << 3);
|
||||
WriteUBitLong(pLongs[*idx], sizeof(int32_t) << 3);
|
||||
}
|
||||
|
||||
void old_bf_write::WriteFloat(float val)
|
||||
@ -701,7 +701,7 @@ old_bf_read::old_bf_read( const char *pDebugName, const void *pData, int nBytes,
|
||||
void old_bf_read::StartReading( const void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// Make sure we're dword aligned.
|
||||
Assert(((unsigned long)pData & 3) == 0);
|
||||
Assert(((uint32_t)pData & 3) == 0);
|
||||
|
||||
m_pData = (unsigned char*)pData;
|
||||
m_nDataBytes = nBytes;
|
||||
@ -768,7 +768,7 @@ void old_bf_read::ReadBits(void *pOutData, int nBits)
|
||||
|
||||
|
||||
// align output to dword boundary
|
||||
while( ((unsigned long)pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
while( ((uintptr_t)pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = (unsigned char)ReadUBitLong(8);
|
||||
++pOut;
|
||||
@ -781,8 +781,8 @@ void old_bf_read::ReadBits(void *pOutData, int nBits)
|
||||
// read dwords
|
||||
while ( nBitsLeft >= 32 )
|
||||
{
|
||||
*((unsigned long*)pOut) = ReadUBitLong(32);
|
||||
pOut += sizeof(unsigned long);
|
||||
*((uint32_t*)pOut) = ReadUBitLong(32);
|
||||
pOut += sizeof(uint32_t);
|
||||
nBitsLeft -= 32;
|
||||
}
|
||||
}
|
||||
@ -867,7 +867,9 @@ int old_bf_read::ReadSBitLong( int numbits )
|
||||
}
|
||||
|
||||
const byte g_BitMask[8] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
|
||||
#if FAST_BIT_SCAN
|
||||
const byte g_TrailingMask[8] = {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80};
|
||||
#endif
|
||||
|
||||
inline int old_bf_read::CountRunOfZeros()
|
||||
{
|
||||
@ -1156,9 +1158,9 @@ int old_bf_read::ReadWord()
|
||||
return ReadUBitLong(sizeof(unsigned short) << 3);
|
||||
}
|
||||
|
||||
long old_bf_read::ReadLong()
|
||||
int32_t old_bf_read::ReadLong()
|
||||
{
|
||||
return ReadSBitLong(sizeof(long) << 3);
|
||||
return ReadSBitLong(sizeof(int32_t) << 3);
|
||||
}
|
||||
|
||||
int64 old_bf_read::ReadLongLong()
|
||||
@ -1169,8 +1171,8 @@ int64 old_bf_read::ReadLongLong()
|
||||
// Read the two DWORDs according to network endian
|
||||
const short endianIndex = 0x0100;
|
||||
byte *idx = (byte*)&endianIndex;
|
||||
pLongs[*idx++] = ReadUBitLong(sizeof(long) << 3);
|
||||
pLongs[*idx] = ReadUBitLong(sizeof(long) << 3);
|
||||
pLongs[*idx++] = ReadUBitLong(sizeof(uint32_t) << 3);
|
||||
pLongs[*idx] = ReadUBitLong(sizeof(uint32_t) << 3);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
static void MD5Transform(unsigned int buf[4], unsigned int const in[16])
|
||||
{
|
||||
register unsigned int a, b, c, d;
|
||||
unsigned int a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
|
@ -29,7 +29,7 @@ void CBitWrite::StartWriting( void *pData, int nBytes, int iStartBit, int nBits
|
||||
{
|
||||
// Make sure it's dword aligned and padded.
|
||||
Assert( (nBytes % 4) == 0 );
|
||||
Assert(((unsigned long)pData & 3) == 0);
|
||||
Assert(((uint32_t)pData & 3) == 0);
|
||||
Assert( iStartBit == 0 );
|
||||
m_pData = (uint32 *) pData;
|
||||
m_pDataOut = m_pData;
|
||||
@ -107,8 +107,8 @@ void CBitWrite::WriteLongLong(int64 val)
|
||||
// Insert the two DWORDS according to network endian
|
||||
const short endianIndex = 0x0100;
|
||||
byte *idx = (byte*)&endianIndex;
|
||||
WriteUBitLong(pLongs[*idx++], sizeof(long) << 3);
|
||||
WriteUBitLong(pLongs[*idx], sizeof(long) << 3);
|
||||
WriteUBitLong(pLongs[*idx++], sizeof(uint32_t) << 3);
|
||||
WriteUBitLong(pLongs[*idx], sizeof(uint32_t) << 3);
|
||||
}
|
||||
|
||||
bool CBitWrite::WriteBits(const void *pInData, int nBits)
|
||||
@ -390,7 +390,7 @@ bool CBitRead::Seek( int nPosition )
|
||||
void CBitRead::StartReading( const void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// Make sure it's dword aligned and padded.
|
||||
Assert(((unsigned long)pData & 3) == 0);
|
||||
Assert(((uint32_t)pData & 3) == 0);
|
||||
m_pData = (uint32 *) pData;
|
||||
m_pDataIn = m_pData;
|
||||
m_nDataBytes = nBytes;
|
||||
@ -471,8 +471,8 @@ int64 CBitRead::ReadLongLong( void )
|
||||
// Read the two DWORDs according to network endian
|
||||
const short endianIndex = 0x0100;
|
||||
byte *idx = (byte*)&endianIndex;
|
||||
pLongs[*idx++] = ReadUBitLong(sizeof(long) << 3);
|
||||
pLongs[*idx] = ReadUBitLong(sizeof(long) << 3);
|
||||
pLongs[*idx++] = ReadUBitLong(sizeof(uint32_t) << 3);
|
||||
pLongs[*idx] = ReadUBitLong(sizeof(uint32_t) << 3);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ void CBitRead::ReadBits(void *pOutData, int nBits)
|
||||
|
||||
|
||||
// align output to dword boundary
|
||||
while( ((unsigned long)pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
while( ((uintptr_t)pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||
{
|
||||
*pOut = (unsigned char)ReadUBitLong(8);
|
||||
++pOut;
|
||||
@ -496,8 +496,8 @@ void CBitRead::ReadBits(void *pOutData, int nBits)
|
||||
// read dwords
|
||||
while ( nBitsLeft >= 32 )
|
||||
{
|
||||
*((unsigned long*)pOut) = ReadUBitLong(32);
|
||||
pOut += sizeof(unsigned long);
|
||||
*((uint32_t*)pOut) = ReadUBitLong(32);
|
||||
pOut += sizeof(uint32_t);
|
||||
nBitsLeft -= 32;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,14 @@
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#if defined _LINUX || defined __APPLE__
|
||||
#if defined ( _WIN64 )
|
||||
|
||||
bool CheckMMXTechnology(void) { return true; }
|
||||
bool CheckSSETechnology(void) { return true; }
|
||||
bool CheckSSE2Technology(void) { return true; }
|
||||
bool Check3DNowTechnology(void) { return true; }
|
||||
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
|
||||
#include "processor_detect_linux.cpp"
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// $Workfile: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include <cstdint>
|
||||
|
||||
#define cpuid(in,a,b,c,d) \
|
||||
asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in));
|
||||
@ -12,7 +13,7 @@
|
||||
bool CheckMMXTechnology(void)
|
||||
{
|
||||
#ifndef PLATFORM_64BITS
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32_t eax,ebx,edx,unused;
|
||||
cpuid(1,eax,ebx,unused,edx);
|
||||
|
||||
return edx & 0x800000;
|
||||
@ -24,7 +25,7 @@ bool CheckMMXTechnology(void)
|
||||
bool CheckSSETechnology(void)
|
||||
{
|
||||
#ifndef PLATFORM_64BITS
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32_t eax,ebx,edx,unused;
|
||||
cpuid(1,eax,ebx,unused,edx);
|
||||
|
||||
return edx & 0x2000000L;
|
||||
@ -36,7 +37,7 @@ bool CheckSSETechnology(void)
|
||||
bool CheckSSE2Technology(void)
|
||||
{
|
||||
#ifndef PLATFORM_64BITS
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
uint32_t eax,ebx,edx,unused;
|
||||
cpuid(1,eax,ebx,unused,edx);
|
||||
|
||||
return edx & 0x04000000;
|
||||
@ -48,7 +49,7 @@ bool CheckSSE2Technology(void)
|
||||
bool Check3DNowTechnology(void)
|
||||
{
|
||||
#ifndef PLATFORM_64BITS
|
||||
unsigned long eax, unused;
|
||||
uint32_t eax, unused;
|
||||
cpuid(0x80000000,eax,unused,unused,unused);
|
||||
|
||||
if ( eax > 0x80000000L )
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user