1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Various fixes for 64-builds and added 64-bit libs for macOS.

This commit is contained in:
Scott Ehlert 2017-06-02 08:31:37 -05:00
parent 06c1c90b4e
commit 6fd68f3835
33 changed files with 929 additions and 103 deletions

BIN
lib/osx64/interfaces.a Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/osx64/libtier0.dylib Normal file

Binary file not shown.

BIN
lib/osx64/libvstdlib.dylib Normal file

Binary file not shown.

BIN
lib/osx64/mathlib.a Normal file

Binary file not shown.

BIN
lib/osx64/tier1.a Normal file

Binary file not shown.

211
linux_sdk/x86-64/Makefile Normal file
View File

@ -0,0 +1,211 @@
#
# 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/csgo
# 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 =
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/osx64
else
LIB_DIR = $(SRC_DIR)/lib/linux64
endif
# the CPU target for the build, must be i486 for now
ARCH = x86_64
ARCH_CFLAGS = -mtune=x86-64 -march=core2 -mmmx -msse -msse2
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 =
endif
DEFINES += -DCOMPILER_GCC -DPOSIX -DX64BITS -DPLATFORM_64BITS -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
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \
-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
# 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_SHADERAPIEMPTY = Makefile.shaderapiempty
MAKE_TIER1 = Makefile.tier1
MAKE_MATH = Makefile.mathlib
MAKE_IFACE = Makefile.interfaces
MAKE_CHOREO = Makefile.choreo
MAKE_APPFRMWRK = Makefile.appframework
MAKE_DEDICATED = Makefile.dedicated
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.a" ]; then $(MAKE) tier1;fi
if [ ! -e "$(LIB_DIR)/mathlib.a" ]; then $(MAKE) mathlib;fi
if [ ! -e "$(LIB_DIR)/appframework.a" ]; then $(MAKE) appframework;fi
if [ ! -f "libtier0.$(SHLIBEXT)" ]; then ln -s $(LIB_DIR)/libtier0.$(SHLIBEXT) .; fi
if [ ! -f "libvstdlib.$(SHLIBEXT)" ]; then ln -s $(LIB_DIR)/libvstdlib.$(SHLIBEXT) .; fi
if [ ! -f "libsteam_api.$(SHLIBEXT)" ]; then ln -s $(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)
shaderapiempty: check
$(MAKE) -f $(MAKE_SHADERAPIEMPTY) $(BASE_DEFINES)
tier1:
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES)
mathlib:
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES)
interfaces:
$(MAKE) -f $(MAKE_IFACE) $(BASE_DEFINES)
choreo:
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES)
appframework:
$(MAKE) -f $(MAKE_APPFRMWRK) $(BASE_DEFINES)
dedicated: check
$(MAKE) -f $(MAKE_DEDICATED) $(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_SHADERAPIEMPTY) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_IFACE) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_APPFRMWRK) $(BASE_DEFINES) clean
$(MAKE) -f $(MAKE_DEDICATED) $(BASE_DEFINES) clean

View File

@ -0,0 +1,57 @@
#
# 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)

View File

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

View File

@ -0,0 +1,70 @@
#
# 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).$(SHLIBEXT)
dirs:
-mkdir -p $(BUILD_OBJ_DIR)
-mkdir -p $(LIB_OBJ_DIR)
$(NAME).$(SHLIBEXT): $(LIB_OBJS)
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
$(DO_CC)
install:
cp -f $(NAME).$(SHLIBEXT) $(LIB_DIR)/$(NAME).$(SHLIBEXT)
clean:
-rm -rf $(LIB_OBJ_DIR)

View File

@ -0,0 +1,57 @@
#
# 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)

View File

@ -0,0 +1,28 @@
#
# 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)

View File

@ -0,0 +1,55 @@
#
# Empty Shader API Library Makefile
#
override NAME = shaderapiempty
SHADER_SRC_DIR = $(SRC_DIR)/materialsystem/$(NAME)
MAT_SRC_DIR = $(SRC_DIR)/materialsystem
PUBLIC_SRC_DIR = $(SRC_DIR)/public
MAT_PUBLIC_SRC_DIR = $(SRC_DIR)/public/materialsystem
SHADERAPI_PUBLIC_SRC_DIR = $(SRC_DIR)/public/shaderapi
TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0
TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1
SHADER_OBJ_DIR = $(BUILD_OBJ_DIR)/materialsystem/$(NAME)
INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(MAT_SRC_DIR) -I$(MAT_PUBLIC_SRC_DIR) \
-I $(SHADERAPI_PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR)
LDFLAGS_SHADER = -lm -ldl libtier0.$(SHLIBEXT) libvstdlib.$(SHLIBEXT) \
$(LIB_DIR)/tier1.a $(LIB_DIR)/interfaces.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 $<
#####################################################################
SHADER_OBJS= \
$(SHADER_OBJ_DIR)/shaderapiempty.o \
all: dirs $(NAME).$(SHLIBEXT)
dirs:
-mkdir -p $(BUILD_OBJ_DIR)
-mkdir -p $(SHADER_OBJ_DIR)
$(NAME).$(SHLIBEXT): $(SHADER_OBJS)
$(CPLUS) $(SHLIBLDFLAGS) -o $(BUILD_DIR)/$@ $(SHADER_OBJS) $(LDFLAGS_SHADER) $(CPP_LIB)
$(SHADER_OBJ_DIR)/%.o: $(SHADER_SRC_DIR)/%.cpp
$(DO_CC)
install:
cp -f $(NAME).$(SHLIBEXT) $(LIB_DIR)/$(NAME).$(SHLIBEXT)
clean:
-rm -rf $(SHADER_OBJ_DIR)
-rm -rf $(NAME).$(SHLIBEXT)

View File

@ -0,0 +1,77 @@
#
# 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)/memstack.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)/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).$(SHLIBEXT)
dirs:
-mkdir -p $(BUILD_OBJ_DIR)
-mkdir -p $(LIB_OBJ_DIR)
$(NAME).$(SHLIBEXT): $(LIB_OBJS)
$(AR) $(LIB_DIR)/$@ $(LIB_OBJS)
$(LIB_OBJ_DIR)/%.o: $(LIB_SRC_DIR)/%.cpp
$(DO_CC)
install:
cp -f $(NAME).$(SHLIBEXT) $(LIB_DIR)/$(NAME).$(SHLIBEXT)
clean:
-rm -rf $(LIB_OBJ_DIR)

View File

@ -0,0 +1,50 @@
#
# 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

View File

@ -23,7 +23,7 @@
#include "tier1/interface.h"
#include "tier1/utlvector.h"
#include "tier1/utldict.h"
#include "tier1/utlstringmap.h"
#include "tier1/UtlStringMap.h"
#include "IAppSystem.h"
//-----------------------------------------------------------------------------

View File

@ -0,0 +1,166 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// ilaunchermgr.h
//
//==================================================================================================
#ifndef ILAUNCHERMGR_H
#define ILAUNCHERMGR_H
#ifdef _WIN32
#pragma once
#endif
#if defined( USE_SDL )
#include "tier0/threadtools.h"
#include "appframework/IAppSystem.h"
#include "inputsystem/iinputsystem.h"
#if defined( DX_TO_GL_ABSTRACTION )
#if !defined(DEDICATED)
#if defined( LINUX ) || defined( _WIN32 )
#include "togl/linuxwin/glmgrbasics.h"
#include "togl/linuxwin/glmdisplay.h"
#elif defined( OSX )
#include "togl/osx/glmgrbasics.h"
#include "togl/osx/glmdisplay.h"
#endif
#endif
class GLMDisplayDB;
class CShowPixelsParams;
#if defined(DEDICATED)
typedef void *PseudoGLContextPtr;
class GLMRendererInfoFields;
#endif
#endif // DX_TO_GL_ABSTRACTION
// if you rev this version also update materialsystem/cmaterialsystem.cpp CMaterialSystem::Connect as it defines the string directly
#define SDLMGR_INTERFACE_VERSION "SDLMgrInterface001"
class CCocoaEvent;
class CStackCrawlParams;
class ILauncherMgr : public IAppSystem
{
public:
// Create the window.
virtual bool CreateGameWindow( const char *pTitle, bool bWindowed, int width, int height ) = 0;
#if defined( DX_TO_GL_ABSTRACTION )
virtual void GetDesiredPixelFormatAttribsAndRendererInfo( uint **ptrOut, uint *countOut, GLMRendererInfoFields *rendInfoOut ) = 0;
// Get the NSGLContext for a window's main view - note this is the carbon windowref as an argument
virtual PseudoGLContextPtr GetGLContextForWindow( void *windowref ) = 0;
#endif
// Get the next N events. The function returns the number of events that were filled into your array.
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false ) = 0;
// Set the mouse cursor position.
virtual void SetCursorPosition( int x, int y ) = 0;
virtual void GetCursorPosition( int *x, int *y ) = 0;
#if defined( DX_TO_GL_ABSTRACTION )
virtual void ShowPixels( CShowPixelsParams *params ) = 0;
#endif
virtual void SetWindowFullScreen( bool bFullScreen, int nWidth, int nHeight ) = 0;
virtual bool IsWindowFullScreen() = 0;
virtual void MoveWindow( int x, int y ) = 0;
virtual void SizeWindow( int width, int tall ) = 0;
virtual void PumpWindowsMessageLoop() = 0;
virtual void DestroyGameWindow() = 0;
virtual void SetApplicationIcon( const char *pchAppIconFile ) = 0;
virtual void GetMouseDelta( int &x, int &y, bool bIgnoreNextMouseDelta = false ) = 0;
virtual void GetNativeDisplayInfo( int nDisplay, uint &nWidth, uint &nHeight, uint &nRefreshHz ) = 0; // Retrieve the size of the monitor (desktop)
virtual void RenderedSize( uint &width, uint &height, bool set ) = 0; // either set or retrieve rendered size value (from dxabstract)
virtual void DisplayedSize( uint &width, uint &height ) = 0; // query backbuffer size (window size whether FS or windowed)
#if defined( DX_TO_GL_ABSTRACTION )
virtual GLMDisplayDB *GetDisplayDB( void ) = 0;
#endif
virtual void WaitUntilUserInput( int msSleepTime ) = 0;
// Loads a cursor defined in a file
virtual InputCursorHandle_t LoadCursorFromFile( const char *pFileName ) = 0;
virtual void FreeCursor( InputCursorHandle_t hCursor ) = 0;
// Sets the cursor icon
virtual void SetCursorIcon( InputCursorHandle_t hCursor ) = 0;
#if defined( DX_TO_GL_ABSTRACTION )
virtual PseudoGLContextPtr GetMainContext() = 0;
virtual PseudoGLContextPtr CreateExtraContext() = 0;
virtual void DeleteContext( PseudoGLContextPtr hContext ) = 0;
virtual bool MakeContextCurrent( PseudoGLContextPtr hContext ) = 0;
#endif
virtual void GetStackCrawl( CStackCrawlParams *params ) = 0;
virtual void *GetWindowRef() = 0;
virtual void SetMouseVisible( bool bState ) = 0;
virtual void SetForbidMouseGrab( bool bForbidMouseGrab ) = 0;
virtual void SetGammaRamp( const uint16 *pRed, const uint16 *pGreen, const uint16 *pBlue ) = 0;
virtual double GetPrevGLSwapWindowTime() = 0;
};
extern ILauncherMgr *g_pLauncherMgr;
enum CocoaEventType_t
{
CocoaEvent_KeyDown,
CocoaEvent_KeyUp,
CocoaEvent_MouseButtonDown,
CocoaEvent_MouseMove,
CocoaEvent_MouseButtonUp,
CocoaEvent_AppActivate,
CocoaEvent_MouseScroll,
CocoaEvent_AppQuit,
CocoaEvent_Deleted, // Event was one of the above, but has been handled and should be ignored now.
};
// enum values need to match bit-shifting logic in CInputSystem::UpdateMouseButtonState and
// the codes from NSEvent pressedMouseButtons, turns out the two are in agreement right now
enum CocoaMouseButton_t
{
COCOABUTTON_LEFT = 1 << 0,
COCOABUTTON_RIGHT = 1 << 1,
COCOABUTTON_MIDDLE = 1 << 2,
COCOABUTTON_4 = 1 << 3,
COCOABUTTON_5 = 1 << 4,
};
enum ECocoaKeyModifier
{
eCapsLockKey,
eShiftKey,
eControlKey,
eAltKey, // aka option
eCommandKey
};
class CCocoaEvent
{
public:
CocoaEventType_t m_EventType;
int m_VirtualKeyCode;
wchar_t m_UnicodeKey;
wchar_t m_UnicodeKeyUnmodified;
uint m_ModifierKeyMask; //
int m_MousePos[2];
int m_MouseButtonFlags; // Current state of the mouse buttons. See COCOABUTTON_xxxx.
uint m_nMouseClickCount;
int m_MouseButton; // which of the CocoaMouseButton_t buttons this is for from above
};
#endif // defined( USE_SDL )
#endif // ILAUNCHERMGR_H

View File

@ -352,6 +352,7 @@ public:
case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD:
case DC_REMOVED:
default:
Assert ( 0 );
return false;
}
@ -537,6 +538,7 @@ public:
case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD:
case DC_REMOVED:
default:
STORAGE_TYPE *p = (STORAGE_TYPE *)notification.clientId;
p->DestroyResource();
return true;

View File

@ -45,7 +45,7 @@ typedef unsigned short MDLHandle_t;
inline MDLHandle_t VoidPtrToMDLHandle( void *ptr )
{
return (MDLHandle_t)(int)ptr;
return (MDLHandle_t)(intp)ptr;
}
enum

View File

@ -12,7 +12,7 @@
#endif
#include "tier0/platform.h"
#include "appframework/iappsystem.h"
#include "appframework/IAppSystem.h"
enum LoaderError_t
{

View File

@ -23,9 +23,8 @@
#include "tier1/strtools.h"
#include "filesystem_init.h"
#include "tier0/icommandline.h"
#include "tier0/stacktools.h"
#include "keyvalues.h"
#include "appframework/iappsystemgroup.h"
#include "KeyValues.h"
#include "appframework/IAppSystemGroup.h"
#include "tier1/smartptr.h"
#if defined( _X360 )
#include "xbox\xbox_win32stubs.h"
@ -37,7 +36,7 @@
#include <tier0/memdbgon.h>
#if !defined( _X360 )
#define GAMEINFO_FILENAME "GameInfo.txt"
#define GAMEINFO_FILENAME "gameinfo.txt"
#else
// The .xtx file is a TCR requirement, as .txt files cannot live on the DVD.
// The .xtx file only exists outside the zips (same as .txt and is made during the image build) and is read to setup the search paths.
@ -382,7 +381,17 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
Q_StrRight( exedir, 4, ext, sizeof( ext ) );
if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, "bin" ) != 0 )
{
#if !defined(PLATFORM_64BITS)
Q_strncat( exedir, "\\bin", exeDirLen, COPY_ALL_CHARACTERS );
#else
#if defined(PLATFORM_WINDOWS)
Q_strncat( exedir, "\\bin\\win64", exeDirLen, COPY_ALL_CHARACTERS );
#elif defined(PLATFORM_LINUX)
Q_strncat( exedir, "\\bin\\linux64", exeDirLen, COPY_ALL_CHARACTERS );
#elif defined(PLATFORM_OSX)
Q_strncat( exedir, "\\bin\\osx64", exeDirLen, COPY_ALL_CHARACTERS );
#endif
#endif
Q_FixSlashes( exedir );
}
@ -546,7 +555,7 @@ bool IsLowViolenceBuild( void )
return retVal;
#elif POSIX
return false;
#elif
#else
#error "Fix me"
#endif
}
@ -620,21 +629,6 @@ static void FileSystem_AddLoadedSearchPath(
initInfo.m_pFileSystem->AddSearchPath( fullLocationPath, pPathID, PATH_ADD_TO_TAIL );
}
bool FileSystem_IsHldsUpdateToolDedicatedServer()
{
// To determine this, we see if the directory our executable was launched from is "orangebox".
// We only are under "orangebox" if we're run from hldsupdatetool.
char baseDir[MAX_PATH];
if ( !FileSystem_GetBaseDir( baseDir, sizeof( baseDir ) ) )
return false;
V_FixSlashes( baseDir );
V_StripTrailingSlash( baseDir );
const char *pLastDir = V_UnqualifiedFileName( baseDir );
return ( pLastDir && V_stricmp( pLastDir, "orangebox" ) == 0 );
}
#ifdef ENGINE_DLL
extern void FileSystem_UpdateAddonSearchPaths( IFileSystem *pFileSystem );
#endif
@ -690,14 +684,6 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo )
// Add the Orange-box path (which also will include whatever the depots mapped in as well if we're
// running a Steam-launched app).
FileSystem_AddLoadedSearchPath( initInfo, pPathID, &bFirstGamePath, baseDir, pLocation, bLowViolence );
if ( FileSystem_IsHldsUpdateToolDedicatedServer() )
{
// If we're using the hldsupdatetool dedicated server, then go up a directory to get the ep1-era files too.
char ep1EraPath[MAX_PATH];
V_snprintf( ep1EraPath, sizeof( ep1EraPath ), "..%c%s", CORRECT_PATH_SEPARATOR, pLocation );
FileSystem_AddLoadedSearchPath( initInfo, pPathID, &bFirstGamePath, baseDir, ep1EraPath, bLowViolence );
}
}
else
{

View File

@ -218,7 +218,7 @@ extern const int32 ALIGN16 g_SIMD_EveryOtherMask[]; // 0, ~0, 0, ~0
template<class T>
inline T *AlignPointer(void * ptr)
{
unsigned temp = (unsigned)ptr;
uintp temp = (uintp)ptr;
temp = ALIGN_VALUE(temp, sizeof(T));
return (T *)temp;
}

View File

@ -22,7 +22,7 @@ typedef unsigned char uint8;
#define POSIX 1
#endif
#if defined(__x86_64__) || defined(_WIN64)
#if (defined(__x86_64__) || defined(_WIN64)) && !defined(X64BITS)
#define X64BITS
#endif

View File

@ -14,9 +14,9 @@
#include "utlmultilist.h"
#include "utlvector.h"
FORWARD_DECLARE_HANDLE( memhandle_t );
DECLARE_HANDLE_32BIT( datamanhandle_t );
#define INVALID_MEMHANDLE ((memhandle_t)0xffffffff)
#define INVALID_MEMHANDLE (datamanhandle_t::MakeHandle(~0))
class CDataManagerBase
{
@ -25,27 +25,27 @@ public:
// public API
// -----------------------------------------------------------------------------
// memhandle_t CreateResource( params ) // implemented by derived class
void DestroyResource( memhandle_t handle );
void DestroyResource( datamanhandle_t handle );
// type-safe implementation in derived class
//void *LockResource( memhandle_t handle );
int UnlockResource( memhandle_t handle );
void TouchResource( memhandle_t handle );
void MarkAsStale( memhandle_t handle ); // move to head of LRU
//void *LockResource( datamanhandle_t handle );
int UnlockResource( datamanhandle_t handle );
void TouchResource( datamanhandle_t handle );
void MarkAsStale( datamanhandle_t handle ); // move to head of LRU
int LockCount( memhandle_t handle );
int BreakLock( memhandle_t handle );
int LockCount( datamanhandle_t handle );
int BreakLock( datamanhandle_t handle );
int BreakAllLocks();
// HACKHACK: For convenience - offers no lock protection
// type-safe implementation in derived class
//void *GetResource_NoLock( memhandle_t handle );
//void *GetResource_NoLock( datamanhandle_t handle );
unsigned int TargetSize();
unsigned int AvailableSize();
unsigned int UsedSize();
void NotifySizeChanged( memhandle_t handle, unsigned int oldSize, unsigned int newSize );
void NotifySizeChanged( datamanhandle_t handle, unsigned int oldSize, unsigned int newSize );
void SetTargetSize( unsigned int targetSize );
@ -68,18 +68,18 @@ public:
void SetFreeOnDestruct( bool value ) { m_freeOnDestruct = value; }
// Debugging only!!!!
void GetLRUHandleList( CUtlVector< memhandle_t >& list );
void GetLockHandleList( CUtlVector< memhandle_t >& list );
void GetLRUHandleList( CUtlVector< datamanhandle_t >& list );
void GetLockHandleList( CUtlVector< datamanhandle_t >& list );
protected:
// derived class must call these to implement public API
unsigned short CreateHandle( bool bCreateLocked );
memhandle_t StoreResourceInHandle( unsigned short memoryIndex, void *pStore, unsigned int realSize );
void *GetResource_NoLock( memhandle_t handle );
void *GetResource_NoLockNoLRUTouch( memhandle_t handle );
void *LockResource( memhandle_t handle );
void *LockResourceReturnCount( int *pCount, memhandle_t handle );
datamanhandle_t StoreResourceInHandle( unsigned short memoryIndex, void *pStore, unsigned int realSize );
void *GetResource_NoLock( datamanhandle_t handle );
void *GetResource_NoLockNoLRUTouch( datamanhandle_t handle );
void *LockResource( datamanhandle_t handle );
void *LockResourceReturnCount( int *pCount, datamanhandle_t handle );
// NOTE: you must call this from the destructor of the derived class! (will assert otherwise)
void FreeAllLists() { FlushAll(); m_listsAreFreed = true; }
@ -96,8 +96,8 @@ protected:
virtual void DestroyResourceStorage( void * ) = 0;
virtual unsigned int GetRealSize( void * ) = 0;
memhandle_t ToHandle( unsigned short index );
unsigned short FromHandle( memhandle_t handle );
datamanhandle_t ToHandle( unsigned short index );
unsigned short FromHandle( datamanhandle_t handle );
void TouchByIndex( unsigned short memoryIndex );
void * GetForFreeByIndex( unsigned short memoryIndex );
@ -150,7 +150,7 @@ public:
}
// Use GetData() to translate pointer to LOCK_TYPE
LOCK_TYPE LockResource( memhandle_t hMem )
LOCK_TYPE LockResource( datamanhandle_t hMem )
{
void *pLock = BaseClass::LockResource( hMem );
if ( pLock )
@ -161,7 +161,7 @@ public:
return NULL;
}
LOCK_TYPE LockResourceReturnCount( int *pCount, memhandle_t hMem )
LOCK_TYPE LockResourceReturnCount( int *pCount, datamanhandle_t hMem )
{
void *pLock = BaseClass::LockResourceReturnCount( pCount, hMem );
if ( pLock )
@ -173,7 +173,7 @@ public:
}
// Use GetData() to translate pointer to LOCK_TYPE
LOCK_TYPE GetResource_NoLock( memhandle_t hMem )
LOCK_TYPE GetResource_NoLock( datamanhandle_t hMem )
{
void *pLock = const_cast<void *>(BaseClass::GetResource_NoLock( hMem ));
if ( pLock )
@ -185,7 +185,7 @@ public:
// Use GetData() to translate pointer to LOCK_TYPE
// Doesn't touch the memory LRU
LOCK_TYPE GetResource_NoLockNoLRUTouch( memhandle_t hMem )
LOCK_TYPE GetResource_NoLockNoLRUTouch( datamanhandle_t hMem )
{
void *pLock = const_cast<void *>(BaseClass::GetResource_NoLockNoLRUTouch( hMem ));
if ( pLock )
@ -196,7 +196,7 @@ public:
}
// Wrapper to match implementation of allocation with typed storage & alloc params.
memhandle_t CreateResource( const CREATE_PARAMS &createParams, bool bCreateLocked = false )
datamanhandle_t CreateResource( const CREATE_PARAMS &createParams, bool bCreateLocked = false )
{
BaseClass::EnsureCapacity(STORAGE_TYPE::EstimatedSize(createParams));
STORAGE_TYPE *pStore = STORAGE_TYPE::CreateResource( createParams );
@ -206,7 +206,7 @@ public:
}
// Iteration. Must lock first
memhandle_t GetFirstUnlocked()
datamanhandle_t GetFirstUnlocked()
{
unsigned node = m_memoryLists.Head(m_lruList);
if ( node == m_memoryLists.InvalidIndex() )
@ -216,7 +216,7 @@ public:
return ToHandle( node );
}
memhandle_t GetFirstLocked()
datamanhandle_t GetFirstLocked()
{
unsigned node = m_memoryLists.Head(m_lockList);
if ( node == m_memoryLists.InvalidIndex() )
@ -226,7 +226,7 @@ public:
return ToHandle( node );
}
memhandle_t GetNext( memhandle_t hPrev )
datamanhandle_t GetNext( datamanhandle_t hPrev )
{
if ( hPrev == INVALID_MEMHANDLE )
{
@ -268,9 +268,9 @@ private:
//-----------------------------------------------------------------------------
inline unsigned short CDataManagerBase::FromHandle( memhandle_t handle )
inline unsigned short CDataManagerBase::FromHandle( datamanhandle_t handle )
{
unsigned int fullWord = (unsigned int)handle;
unsigned int fullWord = handle.GetHandleValue();
unsigned short serial = fullWord>>16;
unsigned short index = fullWord & 0xFFFF;
index--;
@ -279,7 +279,7 @@ inline unsigned short CDataManagerBase::FromHandle( memhandle_t handle )
return m_memoryLists.InvalidIndex();
}
inline int CDataManagerBase::LockCount( memhandle_t handle )
inline int CDataManagerBase::LockCount( datamanhandle_t handle )
{
Lock();
int result = 0;

View File

@ -527,7 +527,7 @@ inline void CAlignedMemPool<ITEM_SIZE, ALIGNMENT, CHUNK_SIZE, CAllocator, GROWMO
template <int ITEM_SIZE, int ALIGNMENT, int CHUNK_SIZE, class CAllocator, bool GROWMODE, int COMPACT_THRESHOLD >
inline int __cdecl CAlignedMemPool<ITEM_SIZE, ALIGNMENT, CHUNK_SIZE, CAllocator, GROWMODE, COMPACT_THRESHOLD>::CompareChunk( void * const *ppLeft, void * const *ppRight )
{
return ((unsigned)*ppLeft) - ((unsigned)*ppRight);
return ((uintp)*ppLeft) - ((uintp)*ppRight);
}
template <int ITEM_SIZE, int ALIGNMENT, int CHUNK_SIZE, class CAllocator, bool GROWMODE, int COMPACT_THRESHOLD >

View File

@ -107,7 +107,7 @@ template < typename T >
class CArrayAutoPtr : public CPlainAutoPtr < T > // Warning: no polymorphic destructor (delete on base class will be a mistake)
{
public:
explicit CArrayAutoPtr( T *p = NULL ) { Attach( p ); }
explicit CArrayAutoPtr( T *p = NULL ) { this->Attach( p ); }
~CArrayAutoPtr( void ) { Delete(); }
public:

View File

@ -82,15 +82,15 @@ public:
return pHeader->m_pNext ? Iterator_t( pHeader->m_pNext, 0 ) : InvalidIterator();
}
int GetIndex( const Iterator_t &it ) const
intp GetIndex( const Iterator_t &it ) const
{
Assert( IsValidIterator( it ) );
if ( !IsValidIterator( it ) )
return InvalidIndex();
return ( int )( HeaderToBlock( it.m_pBlockHeader ) + it.m_nIndex );
return ( intp )( HeaderToBlock( it.m_pBlockHeader ) + it.m_nIndex );
}
bool IsIdxAfter( int i, const Iterator_t &it ) const
bool IsIdxAfter( intp i, const Iterator_t &it ) const
{
Assert( IsValidIterator( it ) );
if ( !IsValidIterator( it ) )
@ -110,17 +110,17 @@ public:
Iterator_t InvalidIterator() const { return Iterator_t( NULL, -1 ); }
// element access
T& operator[]( int i );
const T& operator[]( int i ) const;
T& Element( int i );
const T& Element( int i ) const;
T& operator[]( intp i );
const T& operator[]( intp i ) const;
T& Element( intp i );
const T& Element( intp i ) const;
// Can we use this index?
bool IsIdxValid( int i ) const;
bool IsIdxValid( intp i ) const;
// Specify the invalid ('null') index that we'll only return on failure
static const int INVALID_INDEX = 0; // For use with COMPILE_TIME_ASSERT
static int InvalidIndex() { return INVALID_INDEX; }
static const intp INVALID_INDEX = 0; // For use with COMPILE_TIME_ASSERT
static intp InvalidIndex() { return INVALID_INDEX; }
// Size
int NumAllocated() const;
@ -139,7 +139,7 @@ protected:
// Fast swap - WARNING: Swap invalidates all ptr-based indices!!!
void Swap( CUtlFixedMemory< T > &mem );
bool IsInBlock( int i, BlockHeader_t *pBlockHeader ) const
bool IsInBlock( intp i, BlockHeader_t *pBlockHeader ) const
{
T *p = ( T* )i;
const T *p0 = HeaderToBlock( pBlockHeader );
@ -149,7 +149,7 @@ protected:
struct BlockHeader_t
{
BlockHeader_t *m_pNext;
int m_nBlockSize;
intp m_nBlockSize;
};
const T *HeaderToBlock( const BlockHeader_t *pHeader ) const { return ( T* )( pHeader + 1 ); }
@ -207,28 +207,28 @@ void CUtlFixedMemory<T>::Init( int nGrowSize /* = 0 */, int nInitSize /* = 0 */
// element access
//-----------------------------------------------------------------------------
template< class T >
inline T& CUtlFixedMemory<T>::operator[]( int i )
inline T& CUtlFixedMemory<T>::operator[]( intp i )
{
Assert( IsIdxValid(i) );
return *( T* )i;
}
template< class T >
inline const T& CUtlFixedMemory<T>::operator[]( int i ) const
inline const T& CUtlFixedMemory<T>::operator[]( intp i ) const
{
Assert( IsIdxValid(i) );
return *( T* )i;
}
template< class T >
inline T& CUtlFixedMemory<T>::Element( int i )
inline T& CUtlFixedMemory<T>::Element( intp i )
{
Assert( IsIdxValid(i) );
return *( T* )i;
}
template< class T >
inline const T& CUtlFixedMemory<T>::Element( int i ) const
inline const T& CUtlFixedMemory<T>::Element( intp i ) const
{
Assert( IsIdxValid(i) );
return *( T* )i;
@ -249,7 +249,7 @@ inline int CUtlFixedMemory<T>::NumAllocated() const
// Is element index valid?
//-----------------------------------------------------------------------------
template< class T >
inline bool CUtlFixedMemory<T>::IsIdxValid( int i ) const
inline bool CUtlFixedMemory<T>::IsIdxValid( intp i ) const
{
#ifdef _DEBUG
for ( BlockHeader_t *pbh = m_pBlocks; pbh; pbh = pbh->m_pNext )

View File

@ -1008,7 +1008,7 @@ template<class Data, int NUM_BUCKETS, class HashFuncs> inline UtlHashFixedHandle
for ( UtlPtrLinkedListIndex_t iElement = bucket.Head(); iElement != bucket.InvalidIndex(); iElement = bucket.Next( iElement ) )
{
if ( bucket[iElement].m_uiKey == uiKey )
return (UtlHashFixedHandle_t)iElement;
return (UtlHashFixedHandle_t)(intp)iElement;
}
return InvalidHandle();

View File

@ -22,12 +22,14 @@
#endif
#endif
#ifdef _MSC_VER
#pragma warning( disable: 4786 ) // disables 'identifier truncated in browser information' warning
#pragma warning( disable: 4355 ) // disables 'this' : used in base member initializer list
#pragma warning( disable: 4097 ) // warning C4097: typedef-name 'BaseClass' used as synonym for class-name
#pragma warning( disable: 4514 ) // warning C4514: 'Color::Color' : unreferenced inline function has been removed
#pragma warning( disable: 4100 ) // warning C4100: 'code' : unreferenced formal parameter
#pragma warning( disable: 4127 ) // warning C4127: conditional expression is constant
#endif
typedef unsigned char uchar;
typedef unsigned short ushort;

View File

@ -2228,7 +2228,7 @@ bool KeyValues::WriteAsBinary( CUtlBuffer &buffer )
}
case TYPE_PTR:
{
buffer.PutUnsignedInt( (int)dat->m_pValue );
buffer.PutPtr( dat->m_pValue );
}
default:
@ -2323,7 +2323,7 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer )
}
case TYPE_PTR:
{
dat->m_pValue = (void*)buffer.GetUnsignedInt();
dat->m_pValue = buffer.GetPtr();
}
default:

View File

@ -147,7 +147,7 @@ JustAfew:
// The low-order two bits of pb and nBuffer in total control the
// upfront work.
//
nFront = ((unsigned int)pb) & 3;
nFront = ((uintp)pb) & 3;
nBuffer -= nFront;
switch (nFront)
{

View File

@ -9,8 +9,6 @@
#include "basetypes.h"
#include "datamanager.h"
DECLARE_POINTER_HANDLE( memhandle_t );
#define AUTO_LOCK_DM() AUTO_LOCK_( CDataManagerBase, *this )
CDataManagerBase::CDataManagerBase( unsigned int maxSize )
@ -28,7 +26,7 @@ CDataManagerBase::~CDataManagerBase()
Assert( m_listsAreFreed );
}
void CDataManagerBase::NotifySizeChanged( memhandle_t handle, unsigned int oldSize, unsigned int newSize )
void CDataManagerBase::NotifySizeChanged( datamanhandle_t handle, unsigned int oldSize, unsigned int newSize )
{
Lock();
m_memUsed += (int)newSize - (int)oldSize;
@ -127,7 +125,7 @@ unsigned int CDataManagerBase::Purge( unsigned int nBytesToPurge )
}
void CDataManagerBase::DestroyResource( memhandle_t handle )
void CDataManagerBase::DestroyResource( datamanhandle_t handle )
{
Lock();
unsigned short index = FromHandle( handle );
@ -148,7 +146,7 @@ void CDataManagerBase::DestroyResource( memhandle_t handle )
}
void *CDataManagerBase::LockResource( memhandle_t handle )
void *CDataManagerBase::LockResource( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -167,7 +165,7 @@ void *CDataManagerBase::LockResource( memhandle_t handle )
return NULL;
}
int CDataManagerBase::UnlockResource( memhandle_t handle )
int CDataManagerBase::UnlockResource( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -189,7 +187,7 @@ int CDataManagerBase::UnlockResource( memhandle_t handle )
return 0;
}
void *CDataManagerBase::GetResource_NoLockNoLRUTouch( memhandle_t handle )
void *CDataManagerBase::GetResource_NoLockNoLRUTouch( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -201,7 +199,7 @@ void *CDataManagerBase::GetResource_NoLockNoLRUTouch( memhandle_t handle )
}
void *CDataManagerBase::GetResource_NoLock( memhandle_t handle )
void *CDataManagerBase::GetResource_NoLock( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -213,13 +211,13 @@ void *CDataManagerBase::GetResource_NoLock( memhandle_t handle )
return NULL;
}
void CDataManagerBase::TouchResource( memhandle_t handle )
void CDataManagerBase::TouchResource( datamanhandle_t handle )
{
AUTO_LOCK_DM();
TouchByIndex( FromHandle(handle) );
}
void CDataManagerBase::MarkAsStale( memhandle_t handle )
void CDataManagerBase::MarkAsStale( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -233,7 +231,7 @@ void CDataManagerBase::MarkAsStale( memhandle_t handle )
}
}
int CDataManagerBase::BreakLock( memhandle_t handle )
int CDataManagerBase::BreakLock( datamanhandle_t handle )
{
AUTO_LOCK_DM();
unsigned short memoryIndex = FromHandle(handle);
@ -294,7 +292,7 @@ unsigned short CDataManagerBase::CreateHandle( bool bCreateLocked )
return memoryIndex;
}
memhandle_t CDataManagerBase::StoreResourceInHandle( unsigned short memoryIndex, void *pStore, unsigned int realSize )
datamanhandle_t CDataManagerBase::StoreResourceInHandle( unsigned short memoryIndex, void *pStore, unsigned int realSize )
{
AUTO_LOCK_DM();
resource_lru_element_t &mem = m_memoryLists[memoryIndex];
@ -315,12 +313,12 @@ void CDataManagerBase::TouchByIndex( unsigned short memoryIndex )
}
}
memhandle_t CDataManagerBase::ToHandle( unsigned short index )
datamanhandle_t CDataManagerBase::ToHandle( unsigned short index )
{
unsigned int hiword = m_memoryLists.Element(index).serial;
hiword <<= 16;
index++;
return (memhandle_t)( hiword|index );
return datamanhandle_t::MakeHandle( hiword|index );
}
unsigned int CDataManagerBase::TargetSize()
@ -385,7 +383,7 @@ void *CDataManagerBase::GetForFreeByIndex( unsigned short memoryIndex )
}
// get a list of everything in the LRU
void CDataManagerBase::GetLRUHandleList( CUtlVector< memhandle_t >& list )
void CDataManagerBase::GetLRUHandleList( CUtlVector< datamanhandle_t >& list )
{
for ( int node = m_memoryLists.Tail(m_lruList);
node != m_memoryLists.InvalidIndex();
@ -396,7 +394,7 @@ void CDataManagerBase::GetLRUHandleList( CUtlVector< memhandle_t >& list )
}
// get a list of everything locked
void CDataManagerBase::GetLockHandleList( CUtlVector< memhandle_t >& list )
void CDataManagerBase::GetLockHandleList( CUtlVector< datamanhandle_t >& list )
{
for ( int node = m_memoryLists.Head(m_lockList);
node != m_memoryLists.InvalidIndex();

View File

@ -11,30 +11,43 @@
bool CheckMMXTechnology(void)
{
#ifndef PLATFORM_64BITS
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x800000;
#else
return true;
#endif
}
bool CheckSSETechnology(void)
{
#ifndef PLATFORM_64BITS
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x2000000L;
#else
return true;
#endif
}
bool CheckSSE2Technology(void)
{
#ifndef PLATFORM_64BITS
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x04000000;
#else
return true;
#endif
}
bool Check3DNowTechnology(void)
{
#ifndef PLATFORM_64BITS
unsigned long eax, unused;
cpuid(0x80000000,eax,unused,unused,unused);
@ -44,4 +57,7 @@ bool Check3DNowTechnology(void)
return ( eax & 1<<31 );
}
return false;
#else
return true;
#endif
}