2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

Reconstruction & cleanup include files

Remove useless include files and part of code too
Move defines Q_* functions from engine/common.h to public/strtools.h
Rename functions:
	strcopy > Q_strlcpy
	strncopy > Q_strnlcpy
This commit is contained in:
s1lent 2017-07-23 16:22:49 +07:00
parent 06ed0a12fd
commit 2cf2fc6b63
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
58 changed files with 1475 additions and 1929 deletions

View File

@ -93,6 +93,7 @@ On Windows:
<pre>gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation:
<pre>gradlew --max-workers=1 clean buildFixes</pre>
<b>NOTE:</b> You can also use `Visual Studio` to build, just select from the solution configurations list `Release Swds` or `Debug Swds`<br />
On Linux (ICC):
<pre>./gradlew --max-workers=1 clean buildRelease</pre>

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -33,6 +37,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -42,6 +55,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -78,6 +94,25 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderFile>bzlib_private.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
@ -91,6 +126,7 @@
<ClCompile Include="..\src\precompiled.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\randtable.c" />
</ItemGroup>

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -49,6 +53,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -58,6 +71,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -96,6 +112,26 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReHLDS", "..\rehlds\msvc\ReHLDS.vcxproj", "{70A2B904-B7DB-4C48-8DE0-AF567360D572}"
ProjectSection(ProjectDependencies) = postProject
@ -47,6 +47,7 @@ Global
Debug|Win32 = Debug|Win32
Release Play|Win32 = Release Play|Win32
Release Swds Play|Win32 = Release Swds Play|Win32
Release Swds|Win32 = Release Swds|Win32
Release|Win32 = Release|Win32
Test Fixes|Win32 = Test Fixes|Win32
Tests|Win32 = Tests|Win32
@ -66,6 +67,8 @@ Global
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Play|Win32.Build.0 = Release Play|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Swds Play|Win32.ActiveCfg = Release Swds Play|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Swds Play|Win32.Build.0 = Release Swds Play|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Swds|Win32.ActiveCfg = Release Swds|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release Swds|Win32.Build.0 = Release Swds|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release|Win32.ActiveCfg = Release|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Release|Win32.Build.0 = Release|Win32
{70A2B904-B7DB-4C48-8DE0-AF567360D572}.Test Fixes|Win32.ActiveCfg = Test Fixes|Win32
@ -86,6 +89,8 @@ Global
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Play|Win32.Build.0 = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Swds Play|Win32.Build.0 = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Swds|Win32.ActiveCfg = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Swds|Win32.Build.0 = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.ActiveCfg = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.Build.0 = Release|Win32
{CEB94F7C-E459-4673-AABB-36E2074396C0}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -106,6 +111,8 @@ Global
{792DF067-9904-4579-99B9-46C17277ADE3}.Release Play|Win32.Build.0 = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release Swds Play|Win32.Build.0 = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release Swds|Win32.ActiveCfg = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release Swds|Win32.Build.0 = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release|Win32.ActiveCfg = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Release|Win32.Build.0 = Release|Win32
{792DF067-9904-4579-99B9-46C17277ADE3}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -126,6 +133,8 @@ Global
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Play|Win32.Build.0 = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Swds Play|Win32.Build.0 = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Swds|Win32.ActiveCfg = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Swds|Win32.Build.0 = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release|Win32.ActiveCfg = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release|Win32.Build.0 = Release|Win32
{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -146,6 +155,8 @@ Global
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Play|Win32.Build.0 = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Swds Play|Win32.Build.0 = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Swds|Win32.ActiveCfg = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Swds|Win32.Build.0 = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release|Win32.ActiveCfg = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release|Win32.Build.0 = Release|Win32
{D5CAB879-D54F-456F-8592-31D549CFD1D8}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -166,6 +177,8 @@ Global
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Play|Win32.Build.0 = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Swds Play|Win32.Build.0 = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Swds|Win32.ActiveCfg = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Swds|Win32.Build.0 = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release|Win32.ActiveCfg = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Release|Win32.Build.0 = Release|Win32
{52F752EA-73D1-422D-B805-17EF1FB20E09}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -186,6 +199,8 @@ Global
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Play|Win32.Build.0 = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Swds Play|Win32.Build.0 = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Swds|Win32.ActiveCfg = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Swds|Win32.Build.0 = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release|Win32.ActiveCfg = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Release|Win32.Build.0 = Release|Win32
{05292761-0847-4A68-BA10-9D384DC0D3EE}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -206,6 +221,8 @@ Global
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Play|Win32.Build.0 = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Swds Play|Win32.Build.0 = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Swds|Win32.ActiveCfg = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Swds|Win32.Build.0 = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release|Win32.ActiveCfg = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release|Win32.Build.0 = Release|Win32
{04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Test Fixes|Win32.ActiveCfg = Release|Win32
@ -226,6 +243,8 @@ Global
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Play|Win32.Build.0 = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Swds Play|Win32.ActiveCfg = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Swds Play|Win32.Build.0 = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Swds|Win32.ActiveCfg = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Swds|Win32.Build.0 = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release|Win32.ActiveCfg = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release|Win32.Build.0 = Release|Win32
{ADDFF069-D39D-4A1B-87C9-85A62B980547}.Test Fixes|Win32.ActiveCfg = Release|Win32

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -29,46 +33,57 @@
<ClCompile Include="..\..\..\common\BaseSystemModule.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectList.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\textconsole.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TextConsoleUnix.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TextConsoleWin32.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TokenLine.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\common\common.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\random.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\System.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
</ItemGroup>
@ -103,6 +118,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -114,6 +138,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -123,6 +150,10 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>hltv</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>hltv</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -148,8 +179,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>git.always.run</Outputs>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -180,8 +211,40 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>git.always.run</Outputs>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -143,7 +143,7 @@ bool System::RegisterCommand(char *name, ISystemModule *module, int commandID)
cmd = (command_t *)malloc(sizeof(command_t));
strcopy(cmd->name, name);
Q_strlcpy(cmd->name, name);
cmd->module = module;
cmd->commandID = commandID;
@ -355,7 +355,7 @@ bool System::Init(IBaseSystem *system, int serial, char *name)
SetName("system");
}
strcopy(m_BaseDir, GetBaseDir());
Q_strlcpy(m_BaseDir, GetBaseDir());
m_Developer = CheckParam("-dev") ? true : false;
if (!m_Console.Init(this))
@ -480,7 +480,7 @@ void System::StopVGUI()
void System::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
void System::RunFrame(double time)
@ -776,7 +776,7 @@ void System::CMD_Quit(char *cmdLine)
void System::OpenLogFile(char *filename)
{
CloseLogFile();
strcopy(m_LogFileName, filename);
Q_strlcpy(m_LogFileName, filename);
m_LogFile = m_FileSystem->Open(m_LogFileName, "wt");
if (!m_LogFile)
@ -866,7 +866,7 @@ void System::ExecuteCommandLine()
}
memset(string, 0, sizeof(string));
strcopy(string, token + 1);
Q_strlcpy(string, token + 1);
// next iteration
token = m_Parameters.GetToken(++i);
@ -942,7 +942,7 @@ void System::CMD_UnloadModule(char *cmdLine)
System::library_t *System::GetLibrary(char *name)
{
char fixedname[MAX_PATH];
strcopy(fixedname, name);
Q_strlcpy(fixedname, name);
COM_FixSlashes(fixedname);
library_t *lib = (library_t *)m_Libraries.GetFirst();
@ -1033,7 +1033,7 @@ Panel *System::GetPanel()
void System::SetStatusLine(char *text)
{
strcopy(m_StatusLine, text);
Q_strlcpy(m_StatusLine, text);
}
void System::ShowConsole(bool visible)

View File

@ -1,9 +1,8 @@
#pragma once
#include "osconfig.h"
#include "archtypes.h"
#include "mathlib.h"
#include "basetypes.h"
#include "FileSystem.h"
#include "strtools.h"
#include <HLTV/IProxy.h>
#include <game_shared/counter.h>

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -34,6 +38,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -45,6 +58,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -53,6 +69,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -81,15 +100,9 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -122,15 +135,44 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
@ -142,14 +184,17 @@
<ClCompile Include="..\..\..\hookers\HLTV\Core\DeltaEx.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Core\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Core\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp" />
<ClCompile Include="..\..\common\byteorder.cpp" />
@ -167,44 +212,58 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\Delta.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\NetSocket.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\Network.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
<ClCompile Include="..\src\Server.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\World.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -216,10 +275,12 @@
<ClInclude Include="..\..\..\hookers\HLTV\Core\DeltaEx.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\..\hookers\HLTV\Core\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BitBuffer.h" />
<ClInclude Include="..\..\common\byteorder.h" />

View File

@ -705,7 +705,7 @@ bool BSPModel::LoadFromBuffer(unsigned int *buffer, int length, const char *name
int i;
Clear();
strcopy(m_model.name, name);
Q_strlcpy(m_model.name, name);
m_System->DPrintf("Loading model: %s (%i kB)\n", name, length / 1024);
m_model.needload = NL_PRESENT;

View File

@ -1192,7 +1192,7 @@ bool Delta::ParseField(int count, delta_definition_t *pdefinition, delta_link_t
return false;
}
strcopy(pField->delta->fieldName, com_token);
Q_strlcpy(pField->delta->fieldName, com_token);
pField->delta->fieldOffset = FindOffset(count, pdefinition, com_token);
*pstream = COM_Parse(*pstream);
@ -1399,7 +1399,7 @@ bool Delta::ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (_stricmp(com_token, "none"))
{
strcopy(source, com_token);
Q_strlcpy(source, com_token);
// Parse custom encoder function name
pstream = COM_Parse(pstream);
@ -1408,7 +1408,7 @@ bool Delta::ParseDescription(char *name, delta_t **ppdesc, char *pstream)
return false;
}
strcopy(encoder, com_token);
Q_strlcpy(encoder, com_token);
}
// Parse fields
@ -1439,7 +1439,7 @@ bool Delta::ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (encoder[0])
{
strcopy((*ppdesc)->conditionalencodename, encoder);
Q_strlcpy((*ppdesc)->conditionalencodename, encoder);
(*ppdesc)->conditionalencodename[sizeof((*ppdesc)->conditionalencodename) - 1] = '\0';
(*ppdesc)->conditionalencode = nullptr;
}

View File

@ -281,7 +281,7 @@ bool Network::ResolveAddress(char *string, NetAddress *address)
((sockaddr_in *)&sadr)->sin_family = AF_INET;
((sockaddr_in *)&sadr)->sin_port = 0;
strcopy(copy, string);
Q_strlcpy(copy, string);
// Parse port
char *colon = copy;
@ -384,7 +384,7 @@ char *Network::GetErrorText(int code)
void Network::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
void Network::UpdateStats()

View File

@ -148,8 +148,8 @@ bool Server::Init(IBaseSystem *system, int serial, char *name)
m_ClientData.Clear();
m_DemoData.Clear();
strcopy(m_CDKey, "2123437429222");
strcopy(m_HostName, "Unkown Host");
Q_strlcpy(m_CDKey, "2123437429222");
Q_strlcpy(m_HostName, "Unkown Host");
memset(m_SeqNrMap, 0, sizeof(m_SeqNrMap));
m_validSequence = 0;
@ -612,7 +612,7 @@ void Server::SendConnectPacket()
return;
}
strcopy(buffer, MD5_GetCDKeyHash(m_CDKey));
Q_strlcpy(buffer, MD5_GetCDKeyHash(m_CDKey));
}
protinfo.SetValueForKey("prot", COM_VarArgs("%i", m_AuthProtocol));
@ -787,9 +787,9 @@ void Server::ParseServerinfo()
char levelname[MAX_PATH];
int gametype = m_Instream->ReadByte();
strcopy(gamedir, m_Instream->ReadString());
strcopy(m_HostName, m_Instream->ReadString());
strcopy(levelname, m_Instream->ReadString());
Q_strlcpy(gamedir, m_Instream->ReadString());
Q_strlcpy(m_HostName, m_Instream->ReadString());
Q_strlcpy(levelname, m_Instream->ReadString());
m_Instream->SkipString();
@ -853,7 +853,7 @@ void Server::ParseMoveVars()
movevars.skyvec_y = m_Instream->ReadFloat();
movevars.skyvec_z = m_Instream->ReadFloat();
strcopy(movevars.skyName, m_Instream->ReadString());
Q_strlcpy(movevars.skyName, m_Instream->ReadString());
m_World->SetMoveVars(&movevars);
}
@ -1096,7 +1096,7 @@ void Server::ParseResourceList()
resource.type = (resourcetype_t)m_Instream->ReadBits(4);
strcopy(resource.szFileName, m_Instream->ReadBitString());
Q_strlcpy(resource.szFileName, m_Instream->ReadBitString());
resource.nIndex = m_Instream->ReadBits(12);
resource.nDownloadSize = m_Instream->ReadBits(24);
@ -1348,7 +1348,7 @@ void Server::ParseSignonNum()
SendStringCommand(COM_VarArgs("VModEnable %d", m_IsVoiceBlocking ? 0 : 1));
char string[128];
strcopy(string, "vban");
Q_strlcpy(string, "vban");
for (int i = 0; i < MAX_CLIENTS; i++) {
strcat(string, " 0");
@ -1373,7 +1373,7 @@ void Server::ParseCustomization()
resource_t *resource = (resource_t *)Mem_ZeroMalloc(sizeof(resource_t));
resource->type = (resourcetype_t)m_Instream->ReadByte();
strcopy(resource->szFileName, m_Instream->ReadString());
Q_strlcpy(resource->szFileName, m_Instream->ReadString());
resource->nIndex = m_Instream->ReadShort();
resource->nDownloadSize = m_Instream->ReadLong();
@ -1477,7 +1477,7 @@ bool Server::ParseUserMessage(int cmd)
SendStringCommand(cmdString);
char string[128];
strcopy(string, "vban");
Q_strlcpy(string, "vban");
for (int i = 0; i < MAX_CLIENTS; i++) {
strcat(string, " 0");
@ -1869,11 +1869,11 @@ void Server::ParseInfo(BitBuffer *stream, bool detailed)
{
serverinfo_t si;
strcopy(si.address, m_ServerChannel.GetTargetAddress()->ToBaseString());
strcopy(si.name, stream->ReadString());
strcopy(si.map, stream->ReadString());
strcopy(si.gamedir, stream->ReadString());
strcopy(si.description, stream->ReadString());
Q_strlcpy(si.address, m_ServerChannel.GetTargetAddress()->ToBaseString());
Q_strlcpy(si.name, stream->ReadString());
Q_strlcpy(si.map, stream->ReadString());
Q_strlcpy(si.gamedir, stream->ReadString());
Q_strlcpy(si.description, stream->ReadString());
si.activePlayers = stream->ReadByte();
si.maxPlayers = stream->ReadByte();
@ -1888,9 +1888,9 @@ void Server::ParseInfo(BitBuffer *stream, bool detailed)
if (si.mod)
{
strcopy(si.url_info, stream->ReadString());
strcopy(si.url_dl, stream->ReadString());
strcopy(si.hlversion, stream->ReadString());
Q_strlcpy(si.url_info, stream->ReadString());
Q_strlcpy(si.url_dl, stream->ReadString());
Q_strlcpy(si.hlversion, stream->ReadString());
si.ver = stream->ReadLong();
si.size = stream->ReadLong();
@ -2211,7 +2211,7 @@ void Server::ParseResourceLocation()
{
char *url = m_Instream->ReadString();
if (url) {
strcopy(g_DownloadURL, url);
Q_strlcpy(g_DownloadURL, url);
}
}
@ -2313,7 +2313,7 @@ char *Server::GetCmdName(int cmd)
void Server::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
void Server::ProcessEntityUpdate()

View File

@ -48,7 +48,7 @@ bool World::Init(IBaseSystem *system, int serial, char *name)
m_ServerInfo.SetMaxSize(MAX_SERVERINFO_STRING);
memset(m_HostName, 0, sizeof(m_HostName));
strcopy(m_ServerName, "Unnamed HLTV");
Q_strlcpy(m_ServerName, "Unnamed HLTV");
m_Frames.Init();
m_FramesByTime.Init();
@ -179,7 +179,7 @@ bool World::AddUserMessage(int msgNumber, int size, char *name)
umsg.iSize = -1;
}
strcopy(umsg.szName, name);
Q_strlcpy(umsg.szName, name);
bool bFound = false;
for (UserMsg *pList = m_ClientUserMsgs; pList; pList = pList->next)
@ -223,9 +223,9 @@ void World::UpdatePlayer(int playerNum, int userId, char *infostring, char *hash
m_System->DPrintf("Player update(%i:%s)\n", playerNum, player->name);
infostr.RemovePrefixedKeys('_');
strcopy(player->userinfo, infostr.GetString());
strcopy(player->name, infostr.ValueForKey("name"));
strcopy(player->model, infostr.ValueForKey("model"));
Q_strlcpy(player->userinfo, infostr.GetString());
Q_strlcpy(player->name, infostr.ValueForKey("name"));
Q_strlcpy(player->model, infostr.ValueForKey("model"));
player->topcolor = atoi(infostr.ValueForKey("topcolor"));
player->bottomcolor = atoi(infostr.ValueForKey("bottomcolor"));
@ -333,7 +333,7 @@ void World::SetHostName(char *name)
return;
}
strcopy(m_HostName, name);
Q_strlcpy(m_HostName, name);
}
void World::ClearLightStyles()
@ -353,7 +353,7 @@ void World::AddLightStyle(int index, char *style)
m_System->Printf("WARNING! World::SetLightStyle: style too long (%i).\n", length);
}
strcopy(m_Lightstyles[index], style);
Q_strlcpy(m_Lightstyles[index], style);
}
void World::NewGame(int newServerCount)
@ -1698,7 +1698,7 @@ void World::WriteNewData(BitBuffer *stream)
void World::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
float World::GetBufferedGameTime()
@ -1855,8 +1855,8 @@ void World::SetServerInfo(int protocol, CRC32_t nserverCRC, unsigned char *nclie
m_PlayerNum = nplayernum;
m_GameType = ngametype;
strcopy(m_GameDir, ngamedir);
strcopy(m_LevelName, nlevelname);
Q_strlcpy(m_GameDir, ngamedir);
Q_strlcpy(m_LevelName, nlevelname);
_snprintf(m_ServerName, sizeof(m_ServerName), "%s:%i", nservername, m_PlayerNum);
}
@ -1909,7 +1909,7 @@ void World::ParseDeltaDescription(BitBuffer *stream)
}
char szDesc[256];
strcopy(szDesc, s);
Q_strlcpy(szDesc, s);
m_System->DPrintf("Reading delta description for: %s.\n", s);
delta_t **ppdelta = m_Delta.LookupRegistration(szDesc);
@ -1967,7 +1967,7 @@ bool World::GetPlayerInfoString(int playerNum, InfoString *infoString)
void World::SetExtraInfo(char *nclientfallback, int nallowCheats)
{
strcopy(m_ClientFallback, nclientfallback);
Q_strlcpy(m_ClientFallback, nclientfallback);
m_AllowCheats = nallowCheats ? true : false;
}
@ -2253,14 +2253,14 @@ void World::RearrangeFrame(frame_t *frame, int seqNrOffset, float timeOffset)
void World::UpdateServerInfo()
{
strcopy(m_DetailedServerInfo.address, "");
strcopy(m_DetailedServerInfo.name, GetHostName());
Q_strlcpy(m_DetailedServerInfo.address, "");
Q_strlcpy(m_DetailedServerInfo.name, GetHostName());
COM_FileBase(m_LevelName, m_DetailedServerInfo.map);
m_DetailedServerInfo.map[sizeof(m_DetailedServerInfo.map) - 1] = '\0';
strcopy(m_DetailedServerInfo.gamedir, m_GameDir);
strcopy(m_DetailedServerInfo.description, "HLTV");
Q_strlcpy(m_DetailedServerInfo.gamedir, m_GameDir);
Q_strlcpy(m_DetailedServerInfo.description, "HLTV");
m_DetailedServerInfo.activePlayers = m_PlayerNum;
m_DetailedServerInfo.maxPlayers = m_Maxclients;

View File

@ -1,9 +1,8 @@
#pragma once
#include "basetypes.h"
#include "archtypes.h"
#include "mathlib.h"
#include "FileSystem.h"
#include "strtools.h"
#include "interface.h"
#include "IBaseSystem.h"

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -18,10 +22,12 @@
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\..\hookers\HLTV\DemoPlayer\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\DemoPlayer\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp" />
@ -33,6 +39,7 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
</ItemGroup>
@ -44,6 +51,7 @@
<ClInclude Include="..\..\..\engine\mem.h" />
<ClInclude Include="..\..\..\hookers\HLTV\DemoPlayer\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BitBuffer.h" />
@ -79,6 +87,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -90,6 +107,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -97,6 +117,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -120,15 +143,9 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -160,15 +177,43 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HOOK_HLTV;HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMOPLAYER_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitiHOOons)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<FullProgramDatabaseFile>false</FullProgramDatabaseFile>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -752,7 +752,7 @@ void DemoPlayer::ReadNetchanState(int *incoming_sequence, int *incoming_acknowle
void DemoPlayer::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
void DemoPlayer::RunClocks()
@ -887,7 +887,7 @@ bool DemoPlayer::LoadGame(char *filename)
return false;
}
strcopy(m_DemoFileName, filename);
Q_strlcpy(m_DemoFileName, filename);
m_World->SetBufferSize(-1);
m_Outgoing_sequence = 0;

View File

@ -1,7 +1,7 @@
#pragma once
#include "archtypes.h"
#include "maintypes.h"
#include "basetypes.h"
#include "strtools.h"
#include "TokenLine.h"
#include "interface.h"

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -34,6 +38,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -45,6 +58,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -52,6 +68,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -76,11 +95,9 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
<Outputs>git.always.run</Outputs>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -105,11 +122,42 @@
</Link>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
<Outputs>git.always.run</Outputs>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DIRECTOR_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(ProjectDir)\..\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
@ -134,6 +182,7 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
</ItemGroup>

View File

@ -1,9 +1,8 @@
#pragma once
#include "osconfig.h"
#include "archtypes.h"
#include "mathlib.h"
#include "basetypes.h"
#include "FileSystem.h"
#include "strtools.h"
#include "TokenLine.h"
#include "interface.h"

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -16,195 +20,264 @@
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectDictionary.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectList.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\TokenLine.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\..\hookers\HLTV\Proxy\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Proxy\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BaseClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\byteorder.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\common.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\DemoFile.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\DirectorCmd.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\InfoString.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\mathlib.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\md5.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\munge.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\NetAddress.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\NetChannel.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\random.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\Director\src\Director.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\DemoClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\FakeClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\Master.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\Proxy.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\ProxyClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\Status.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -216,6 +289,7 @@
<ClInclude Include="..\..\..\hookers\HLTV\Proxy\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BaseClient.h" />
<ClInclude Include="..\..\common\BitBuffer.h" />
@ -269,6 +343,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -280,6 +363,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -289,6 +375,10 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>proxy</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>proxy</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -309,14 +399,10 @@
<AdditionalLibraryDirectories>$(ProjectDir)../../../lib</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
@ -357,15 +443,52 @@
</PreBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;PROXY_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\Director\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;ws2_32.lib;steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)../../../lib</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>
</Message>
</PreBuildEvent>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>

View File

@ -297,7 +297,7 @@ void DemoClient::SetWorld(IWorld *world)
void DemoClient::SetFileName(char *fileName)
{
strcopy(m_BaseFileName, fileName);
Q_strlcpy(m_BaseFileName, fileName);
}
DemoFile *DemoClient::GetDemoFile()

View File

@ -163,7 +163,7 @@ void Master::RunFrame(double time)
COM_FileBase(world->GetLevelName(), mapName);
char szHostName[MAX_PATH];
strcopy(szHostName, world->GetHostName());
Q_strlcpy(szHostName, world->GetHostName());
int slots, proxies, spectators;
m_Proxy->GetStatistics(proxies, slots, spectators);

View File

@ -236,7 +236,7 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name)
"" // text
};
strcopy(m_OffLineText, "Game is delayed. Please try again later.");
Q_strlcpy(m_OffLineText, "Game is delayed. Please try again later.");
m_System->SetTitle("HLTV - offline");
m_System->ExecuteFile("hltv.cfg");
@ -624,7 +624,7 @@ void Proxy::UpdateStatusLine()
char text[128];
char activeTime[32];
strcopy(activeTime, COM_FormatTime((float)m_World->GetTime()));
Q_strlcpy(activeTime, COM_FormatTime((float)m_World->GetTime()));
m_Network->GetFlowStats(&in, &out);
m_CurrentLoss = m_Server->GetPacketLoss();
@ -684,7 +684,7 @@ void Proxy::CMD_Status(char *cmdLine)
if (m_World->IsActive())
{
char activeTime[32];
strcopy(activeTime, COM_FormatTime((float)m_World->GetTime()));
Q_strlcpy(activeTime, COM_FormatTime((float)m_World->GetTime()));
const char *mapname = m_World->GetLevelName() + sizeof("maps/") - 1; // skip 'maps/'
m_System->Printf("Game Time %s, Mod \"%s\", Map \"%s\", Players %i\n", activeTime, m_World->GetGameDir(), mapname, m_World->GetNumPlayers());
@ -970,7 +970,7 @@ void Proxy::CMD_Name(char *cmdLine)
return;
}
strcopy(name, params.GetToken(1));
Q_strlcpy(name, params.GetToken(1));
m_Server->SetPlayerName(name);
}
@ -983,7 +983,7 @@ void Proxy::CMD_Msg(char *cmdLine)
return;
}
strcopy(m_LocalMessage.text, params.GetToken(1));
Q_strlcpy(m_LocalMessage.text, params.GetToken(1));
if (params.CountToken() == 6)
{
@ -1223,7 +1223,7 @@ void Proxy::CMD_LoopCmd(char *cmdLine)
lcmd->interval = seconds;
lcmd->lastTime = 0;
strcopy(lcmd->command, cmds);
Q_strlcpy(lcmd->command, cmds);
}
void Proxy::CMD_RconAddress(char *cmdLine)
@ -1251,7 +1251,7 @@ void Proxy::CMD_RconPassword(char *cmdLine)
return;
}
strcopy(m_RconPassword, params.GetToken(1));
Q_strlcpy(m_RconPassword, params.GetToken(1));
}
void Proxy::CMD_Rcon(char *cmdLine)
@ -1277,7 +1277,7 @@ void Proxy::CMD_Rcon(char *cmdLine)
return;
}
strcopy(m_LastRconCommand, params.GetRestOfLine(1));
Q_strlcpy(m_LastRconCommand, params.GetRestOfLine(1));
m_Socket->OutOfBandPrintf(&m_RconAddress, "challenge rcon\n");
}
@ -1372,7 +1372,7 @@ void Proxy::CMD_ProxyPassword(char *cmdLine)
return;
}
strcopy(m_ProxyPassword, params.GetToken(1));
Q_strlcpy(m_ProxyPassword, params.GetToken(1));
}
void Proxy::NewServerConnection()
@ -1849,7 +1849,7 @@ void Proxy::CMD_OffLineText(char *cmdLine)
return;
}
strcopy(m_OffLineText, params.GetToken(1));
Q_strlcpy(m_OffLineText, params.GetToken(1));
COM_RemoveEvilChars(m_OffLineText);
}
@ -1931,7 +1931,7 @@ void Proxy::CMD_SpectatorPassword(char *cmdLine)
return;
}
strcopy(m_SpectatorPassword, params.GetToken(1));
Q_strlcpy(m_SpectatorPassword, params.GetToken(1));
}
void Proxy::CMD_DispatchMode(char *cmdLine)
@ -2017,7 +2017,7 @@ resource_t *Proxy::LoadResourceFromFile(char *fileName, resourcetype_t type)
{
resource_t *newresource = (resource_t *)Mem_ZeroMalloc(sizeof(resource_t));
strcopy(newresource->szFileName, fileName);
Q_strlcpy(newresource->szFileName, fileName);
newresource->type = type;
newresource->data = m_System->LoadFile(newresource->szFileName, &newresource->nDownloadSize);
@ -2064,7 +2064,7 @@ resource_t *Proxy::AddResource(char *fileName, resourcetype_t type, char *asFile
if (resource)
{
if (asFileName) {
strcopy(resource->szFileName, asFileName);
Q_strlcpy(resource->szFileName, asFileName);
}
m_Resources.Add(resource);
@ -2105,7 +2105,7 @@ void Proxy::CMD_SignOnCommands(char *cmdLine)
return;
}
strcopy(m_SignonCommands, params.GetToken(1));
Q_strlcpy(m_SignonCommands, params.GetToken(1));
}
void Proxy::CMD_AdminPassword(char *cmdLine)
@ -2122,7 +2122,7 @@ void Proxy::CMD_AdminPassword(char *cmdLine)
return;
}
strcopy(m_AdminPassword, params.GetToken(1));
Q_strlcpy(m_AdminPassword, params.GetToken(1));
}
void Proxy::CMD_LocalMsg(char *cmdLine)
@ -2134,7 +2134,7 @@ void Proxy::CMD_LocalMsg(char *cmdLine)
return;
}
strcopy(m_LocalMessage.text, params.GetToken(1));
Q_strlcpy(m_LocalMessage.text, params.GetToken(1));
if (params.CountToken() == 6)
{
@ -2155,7 +2155,7 @@ void Proxy::ChatCommentator(char *nick, char *text)
{
BitBuffer buffer(144);
strcopy(m_CommentatorMessage.text, text);
Q_strlcpy(m_CommentatorMessage.text, text);
COM_RemoveEvilChars(m_CommentatorMessage.text);
WriteHUDMsg(&m_CommentatorMessage, &buffer);
@ -2754,7 +2754,7 @@ void Proxy::UpdateInfoMessages()
void Proxy::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
const char *Proxy::GetDescription()

View File

@ -137,7 +137,7 @@ void Status::SendStatusUpdate()
void Status::SetName(char *newName)
{
strcopy(m_Name, newName);
Q_strlcpy(m_Name, newName);
}
char *Status::GetType()

View File

@ -1,9 +1,8 @@
#pragma once
#include "basetypes.h"
#include "archtypes.h"
#include "mathlib.h"
#include "FileSystem.h"
#include "strtools.h"
#include "interface.h"
#include "IBaseSystem.h"

View File

@ -35,7 +35,7 @@ bool BaseClient::Init(IBaseSystem *system, int serial, char *name)
}
if (!name) {
strcopy(m_Name, CLIENT_INTERFACE_VERSION);
Q_strlcpy(m_Name, CLIENT_INTERFACE_VERSION);
}
SetState(CLIENT_INITIALIZING);
@ -386,7 +386,7 @@ void BaseClient::UpdateUserInfo(char *userinfostring)
m_Userinfo.SetString(userinfostring);
}
strcopy(buffer, m_Userinfo.ValueForKey("name"));
Q_strlcpy(buffer, m_Userinfo.ValueForKey("name"));
SetName(buffer);
m_ClientType = atoi(m_Userinfo.ValueForKey("*hltv"));
@ -648,7 +648,7 @@ void BaseClient::SetName(char *newName)
strcpy(temp, "unnamed");
}
strcopy(m_ClientName, temp);
Q_strlcpy(m_ClientName, temp);
m_Userinfo.SetValueForKey("name", m_ClientName);
}

View File

@ -251,7 +251,7 @@ bool DemoFile::StartRecording(char *newName)
CloseFile();
}
strcopy(m_FileName, newName);
Q_strlcpy(m_FileName, newName);
m_FileHandle = m_FileSystem->Open(m_FileName, "wb");
if (!m_FileHandle) {
@ -332,8 +332,8 @@ bool DemoFile::LoadDemo(char *demoname)
CloseFile();
strcopy(m_FileName, demoname);
_strlwr(m_FileName);
Q_strlcpy(m_FileName, demoname);
Q_strlwr(m_FileName);
if (!strstr(m_FileName, ".dem")) {
strcat(m_FileName, ".dem");
@ -384,11 +384,11 @@ bool DemoFile::LoadDemo(char *demoname)
m_Continuous = true;
memset(&m_ServerInfo, 0, sizeof(m_ServerInfo));
strcopy(m_ServerInfo.address, m_DemoChannel->m_remote_address.ToBaseString());
strcopy(m_ServerInfo.name, m_FileName);
strcopy(m_ServerInfo.map, m_demoHeader.szMapName);
strcopy(m_ServerInfo.gamedir, m_demoHeader.szDllDir);
strcopy(m_ServerInfo.description, "Demo Playback");
Q_strlcpy(m_ServerInfo.address, m_DemoChannel->m_remote_address.ToBaseString());
Q_strlcpy(m_ServerInfo.name, m_FileName);
Q_strlcpy(m_ServerInfo.map, m_demoHeader.szMapName);
Q_strlcpy(m_ServerInfo.gamedir, m_demoHeader.szDllDir);
Q_strlcpy(m_ServerInfo.description, "Demo Playback");
m_ServerInfo.activePlayers = 0;
m_ServerInfo.maxPlayers = MAX_CLIENTS;

View File

@ -1262,7 +1262,7 @@ bool NetChannel::CopyFileFragments()
}
filecontent.Reset();
strcopy(filename, filecontent.ReadString());
Q_strlcpy(filename, filecontent.ReadString());
if (!strlen(filename)) {
m_System->Printf("File fragment received with no filename\n");

View File

@ -153,14 +153,16 @@ void setupToolchain(NativeBinarySpec b) {
pchSourceSet: 'rehlds_pch'
)
}
cfg.compilerOptions.languageStandard = 'c++0x'
cfg.compilerOptions.languageStandard = 'c++11'
cfg.defines([
'_stricmp': 'strcasecmp',
'_strnicmp': 'strncasecmp',
'_strdup': 'strdup',
'_unlink': 'unlink',
'_vsnprintf': 'vsnprintf',
])
'_vsnwprintf' : 'vswprintf',
]);
if (useGcc) {
// Produce code optimized for the most common IA32/AMD64/EM64T processors.
// As new processors are deployed in the marketplace, the behavior of this option will change.
@ -183,7 +185,7 @@ void setupToolchain(NativeBinarySpec b) {
}
if (rehldsFixes) {
cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS'
cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_CHECKS', 'HAVE_OPT_STRTOOLS'
}
ToolchainConfigUtils.apply(project, cfg, b)

View File

@ -28,7 +28,6 @@
#include "precompiled.h"
BaseSystemModule::BaseSystemModule()
{
m_System = nullptr;
@ -87,7 +86,7 @@ bool BaseSystemModule::Init(IBaseSystem *system, int serial, char *name)
m_SystemTime = 0;
if (name) {
strcopy(m_Name, name);
Q_strlcpy(m_Name, name);
}
return true;

View File

@ -30,8 +30,8 @@ bool TokenLine::SetLine(const char *newLine)
return false;
}
strcopy(m_fullLine, newLine);
strcopy(m_tokenBuffer, newLine);
Q_strlcpy(m_fullLine, newLine);
Q_strlcpy(m_tokenBuffer, newLine);
// parse tokens
char *charPointer = m_tokenBuffer;

View File

@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -35,6 +39,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -44,6 +57,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -53,6 +69,10 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>hlds</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>hlds</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -83,15 +103,9 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>git.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>git.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -134,13 +148,54 @@
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>subversion.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>subversion.always.run</Inputs>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;LAUNCHER_FIXES;NDEBUG;DEDICATED;_CRT_SECURE_NO_WARNINGS;USE_BREAKPAD_HANDLER;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\src;$(ProjectDir)..\..\;$(ProjectDir)..\..\common;$(ProjectDir)..\..\engine;$(ProjectDir)..\..\public;$(ProjectDir)..\..\public\rehlds;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>
</FloatingPointModel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
<StringPooling>true</StringPooling>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
@ -150,6 +205,7 @@
<ClInclude Include="..\..\common\TextConsoleUnix.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\TextConsoleWin32.h" />
<ClInclude Include="..\src\conproc.h" />
@ -170,6 +226,7 @@
<ClCompile Include="..\..\common\TextConsoleUnix.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\TextConsoleWin32.cpp" />
<ClCompile Include="..\..\engine\mem.cpp" />
@ -178,12 +235,14 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
<ClCompile Include="..\src\sys_ded.cpp" />
<ClCompile Include="..\src\sys_linux.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\sys_window.cpp" />
<ClCompile Include="..\src\vgui\vguihelpers.cpp" />

View File

@ -1,9 +1,8 @@
#pragma once
#include "osconfig.h"
#include "archtypes.h"
#include "mathlib.h"
#include "basetypes.h"
#include "FileSystem.h"
#include "strtools.h"
#include "common.h"
#include "mem.h"

View File

@ -235,7 +235,7 @@ void SystemWrapper::CMD_UnloadModule(char *cmdLine)
SystemWrapper::library_t *SystemWrapper::GetLibrary(char *name)
{
char fixedname[MAX_PATH];
strcopy(fixedname, name);
Q_strlcpy(fixedname, name);
COM_FixSlashes(fixedname);
library_t *lib = (library_t *)m_Libraries.GetFirst();
@ -364,7 +364,7 @@ bool SystemWrapper::RegisterCommand(char *name, ISystemModule *module, int comma
cmd = (command_t *)Mem_ZeroMalloc(sizeof(command_t));
strcopy(cmd->name, name);
Q_strlcpy(cmd->name, name);
cmd->module = module;
cmd->commandID = commandID;

View File

@ -38,61 +38,6 @@ char *Info_Serverinfo(void)
return serverinfo;
}
#ifdef Q_functions
NOBODY void Q_memset(void *dest, int fill, int count);
NOBODY void Q_memcpy(void *dest, const void *src, int count);
NOBODY int Q_memcmp(void *m1, void *m2, int count);
void Q_strcpy(char *dest, const char *src)
{
char *c;
const char *s;
s = src;
for (c = dest; s; *c++ = *s++)
{
if (!c)
break;
if (!*s)
break;
}
*c = 0;
}
NOBODY void Q_strncpy(char *dest, const char *src, int count);
int Q_strlen(const char *str)
{
int result = 0;
if (str)
{
if (*str)
{
while (str[result++ + 1]);
}
}
return result;
}
NOBODY char *Q_strrchr(char *s, char c);
NOBODY void Q_strcat(char *dest, char *src);
NOBODY int Q_strcmp(const char *s1, const char *s2);
NOBODY int Q_strncmp(const char *s1, const char *s2, int count);
NOBODY int Q_strncasecmp(const char *s1, const char *s2, int n);
NOBODY int Q_strcasecmp(const char *s1, const char *s2);
NOBODY int Q_stricmp(const char *s1, const char *s2);
NOBODY int Q_strnicmp(const char *s1, const char *s2, int n);
NOBODY int Q_atoi(const char *str);
NOBODY float Q_atof(const char *str);
NOBODY char *Q_strlwr(char *src);
NOBODY int Q_FileNameCmp(char *file1, char *file2);
NOBODY char *Q_strstr(const char *s1, const char *search);
NOBODY uint64 Q_strtoull(char *str);
#endif // Q_functions
#ifndef COM_Functions_region
unsigned char COM_Nibble(char c)

View File

@ -123,123 +123,6 @@ extern cache_user_t *loadcache;
extern unsigned char *loadbuf;
extern int loadsize;
//#define Q_functions
#ifndef Q_functions
#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif
#if defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES)
#define Q_memset A_memset
#define Q_memcpy A_memcpy
#define Q_memmove A_memmove
#define Q_strlen A_strlen
#define Q_memcmp A_memcmp
#define Q_strcpy A_strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat A_strcat
#define Q_strncat strncat
#define Q_strcmp A_strcmp
#define Q_strncmp strncmp
//#define Q_strcasecmp _stricmp // Use Q_stricmp
//#define Q_strncasecmp _strnicmp // Use Q_strnicmp
#define Q_stricmp A_stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr A_strstr
#define Q_strchr strchr
#define Q_strlwr A_strtolower
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_sqrt M_sqrt
#define Q_min M_min
#define Q_max M_max
#define Q_clamp M_clamp
//#define Q_strtoull strtoull
//#define Q_FileNameCmp FileNameCmp
#define Q_vsnprintf _vsnprintf
#else
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_memmove memmove
#define Q_strlen strlen
#define Q_memcmp memcmp
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
//#define Q_strcasecmp _stricmp // Use Q_stricmp
//#define Q_strncasecmp _strnicmp // Use Q_strnicmp
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strlwr _strlwr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_sqrt sqrt
#define Q_min min
#define Q_max max
#define Q_clamp clamp
//#define Q_strtoull strtoull
//#define Q_FileNameCmp FileNameCmp
#define Q_vsnprintf _vsnprintf
#endif // defined(REHLDS_OPT_PEDANTIC) || defined(REHLDS_FIXES)
#else // Q_functions
void Q_strcpy(char *dest, const char *src);
int Q_strlen(const char *str);
NOBODY void Q_memset(void *dest, int fill, int count);
NOBODY void Q_memcpy(void *dest, const void *src, int count);
NOBODY int Q_memcmp(void *m1, void *m2, int count);
NOBODY void Q_strncpy(char *dest, const char *src, int count);
NOBODY char *Q_strrchr(char *s, char c);
NOBODY void Q_strcat(char *dest, char *src);
NOBODY int Q_strcmp(const char *s1, const char *s2);
NOBODY int Q_strncmp(const char *s1, const char *s2, int count);
NOBODY int Q_strncasecmp(const char *s1, const char *s2, int n);
NOBODY int Q_strcasecmp(const char *s1, const char *s2);
NOBODY int Q_stricmp(const char *s1, const char *s2);
NOBODY int Q_strnicmp(const char *s1, const char *s2, int n);
NOBODY int Q_atoi(const char *str);
NOBODY float Q_atof(const char *str);
NOBODY char *Q_strlwr(char *src);
NOBODY int Q_FileNameCmp(char *file1, char *file2);
NOBODY char *Q_strstr(const char *s1, const char *search);
NOBODY uint64 Q_strtoull(char *str);
#endif // Q_functions
template <size_t N>
char *strcopy(char (&dest)[N], const char *src) {
Q_strncpy(dest, src, N - 1);
dest[N - 1] = '\0';
return dest;
}
inline char *strncopy(char *dest, const char *src, size_t n) {
Q_strncpy(dest, src, n - 1);
dest[n - 1] = '\0';
return dest;
}
// strcpy that works correctly with overlapping src and dst buffers
inline char *strcpy_safe(char *dst, char *src) {
int len = Q_strlen(src);
Q_memmove(dst, src, len + 1);
return dst;
}
int build_number(void);
char *Info_Serverinfo(void);

View File

@ -125,11 +125,6 @@ const int NET_MAX_PAYLOAD = 65536;
// }
#define HEADER_BYTES (8 + MAX_STREAMS * 9)
// Pad a number so it lies on an N byte boundary.
// So PAD_NUMBER(0,4) is 0 and PAD_NUMBER(1,4) is 4
#define PAD_NUMBER(number, boundary) \
(((number) + ((boundary) - 1)) / (boundary)) * (boundary)
// Pad this to next higher 16 byte boundary
// This is the largest packet that can come in/out over the wire, before processing the header
// bytes will be stripped by the networking channel layer

View File

@ -130,14 +130,12 @@ FunctionHook g_FunctionHooks[] =
#ifndef Common_MSG_region
#ifdef Q_functions
//HOOK_DEF(0x, Q_memset),
//HOOK_DEF(0x, Q_memcpy),
//HOOK_DEF(0x, Q_memcmp),
HOOK_DEF(0x01D28AF0, Q_strcpy),
//HOOK_DEF(0x01D28AF0, Q_strcpy),
//HOOK_DEF(0x, Q_strncpy),
HOOK_DEF(0x01D28B50, Q_strlen),
//HOOK_DEF(0x01D28B50, Q_strlen),
//HOOK_DEF(0x, Q_strrchr),
//HOOK_DEF(0x, Q_strcat),
//HOOK_DEF(0x, Q_strcmp),
@ -153,8 +151,6 @@ FunctionHook g_FunctionHooks[] =
//HOOK_DEF(0x, Q_strstr),
//HOOK_DEF(0x, Q_strtoull),
#endif // Q_functions
HOOK_DEF(0x01D29290, MSG_WriteChar),
HOOK_DEF(0x01D292B0, MSG_WriteByte),
HOOK_DEF(0x01D292D0, MSG_WriteShort),

View File

@ -1,21 +1,21 @@
#pragma once
#include <ios>
class IosFlagSaver {
public:
explicit IosFlagSaver(std::ostream& _ios) :
ios(_ios),
f(_ios.flags()) {
}
~IosFlagSaver() {
ios.flags(f);
}
IosFlagSaver(const IosFlagSaver &rhs) = delete;
IosFlagSaver& operator= (const IosFlagSaver& rhs) = delete;
private:
std::ostream& ios;
std::ios::fmtflags f;
};
#pragma once
#include <ios>
class IosFlagSaver {
public:
explicit IosFlagSaver(std::ostream& _ios) :
ios(_ios),
f(_ios.flags()) {
}
~IosFlagSaver() {
ios.flags(f);
}
IosFlagSaver(const IosFlagSaver &rhs) = delete;
IosFlagSaver& operator= (const IosFlagSaver& rhs) = delete;
private:
std::ostream& ios;
std::ios::fmtflags f;
};

View File

@ -4,7 +4,7 @@
#include "maintypes.h"
#include "memory.h"
#include "model.h"
#include "iosutil.h"
#ifdef _WIN32

View File

@ -29,6 +29,10 @@
<Configuration>Release Swds Play</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -110,11 +114,13 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\hookers\engine\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\hookers\engine\main_swds.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">true</ExcludedFromBuild>
@ -136,6 +142,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">true</ExcludedFromBuild>
</ClCompile>
@ -147,6 +154,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -161,24 +169,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\public\steamid.cpp" />
<ClCompile Include="..\public\tier0\dbg.cpp" />
<ClCompile Include="..\public\tier0\platform_linux.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\public\tier0\platform_win32.cpp" />
<ClCompile Include="..\public\utlbuffer.cpp" />
<ClCompile Include="..\rehlds\FlightRecorderImpl.cpp" />
<ClCompile Include="..\rehlds\flight_recorder.cpp" />
@ -200,9 +196,11 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">precompiled.h</PrecompiledHeaderFile>
@ -225,6 +223,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\crc32c_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -235,6 +234,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\delta_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -245,6 +245,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\info_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -255,6 +256,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\mathlib_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -265,6 +267,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\rehlds_tests_shared.cpp" />
<ClCompile Include="..\unittests\security_tests.cpp">
@ -279,6 +282,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\TestRunner.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -289,6 +293,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\tmessage_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -299,6 +304,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\unittests\unicode_tests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -309,6 +315,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -477,7 +484,6 @@
<ClInclude Include="..\public\interface.h" />
<ClInclude Include="..\public\iosutil.h" />
<ClInclude Include="..\public\iregistry.h" />
<ClInclude Include="..\public\protected_things.h" />
<ClInclude Include="..\public\rehlds\archtypes.h" />
<ClInclude Include="..\public\rehlds\bspfile.h" />
<ClInclude Include="..\public\rehlds\cmd_rehlds.h" />
@ -530,11 +536,8 @@
<ClInclude Include="..\public\steam\steam_api.h" />
<ClInclude Include="..\public\steam\steam_gameserver.h" />
<ClInclude Include="..\public\string_t.h" />
<ClInclude Include="..\public\strtools.h" />
<ClInclude Include="..\public\tier0\dbg.h" />
<ClInclude Include="..\public\tier0\mem.h" />
<ClInclude Include="..\public\tier0\memalloc.h" />
<ClInclude Include="..\public\tier0\memdbgoff.h" />
<ClInclude Include="..\public\tier0\memdbgon.h" />
<ClInclude Include="..\public\tier0\platform.h" />
<ClInclude Include="..\public\utlbuffer.h" />
<ClInclude Include="..\public\utllinkedlist.h" />
@ -675,6 +678,15 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -708,6 +720,9 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>filesystem_stdio</TargetName>
@ -739,6 +754,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">
<TargetName>swds</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<TargetName>swds</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
@ -749,7 +767,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_OPT_PEDANTIC;REHLDS_SELF;HOOK_ENGINE;REHLDS_FIXES;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_OPT_PEDANTIC;REHLDS_SELF;HOOK_ENGINE;REHLDS_FIXES;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Precise</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -773,8 +791,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">
@ -787,7 +805,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;REHLDS_SELF;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Precise</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -810,8 +828,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">
@ -846,8 +864,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">
@ -860,7 +878,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Precise</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -885,8 +903,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">
@ -921,8 +939,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">
@ -935,7 +953,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
@ -957,8 +975,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">
@ -971,7 +989,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
@ -992,8 +1010,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -1008,7 +1026,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_OPT_PEDANTIC;REHLDS_SELF;HOOK_ENGINE;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_OPT_PEDANTIC;REHLDS_SELF;HOOK_ENGINE;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -1031,8 +1049,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">
@ -1071,8 +1089,8 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">
@ -1087,7 +1105,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -1115,8 +1133,52 @@
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>subversion.always.run</Outputs>
<Inputs>subversion.always.run</Inputs>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_FIXES;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>
</MinimumRequiredVersion>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>
</FixedBaseAddress>
<BaseAddress>0x4970000</BaseAddress>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild_swds.bat" (CALL "$(ProjectDir)PostBuild_swds.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -215,12 +215,6 @@
<ClCompile Include="..\public\utlbuffer.cpp">
<Filter>public</Filter>
</ClCompile>
<ClCompile Include="..\public\tier0\platform_win32.cpp">
<Filter>public\tier0</Filter>
</ClCompile>
<ClCompile Include="..\public\tier0\platform_linux.cpp">
<Filter>public\tier0</Filter>
</ClCompile>
<ClCompile Include="..\engine\sv_remoteaccess.cpp">
<Filter>engine</Filter>
</ClCompile>
@ -772,9 +766,6 @@
<ClInclude Include="..\public\basetypes.h">
<Filter>public</Filter>
</ClInclude>
<ClInclude Include="..\public\protected_things.h">
<Filter>public</Filter>
</ClInclude>
<ClInclude Include="..\public\commonmacros.h">
<Filter>public</Filter>
</ClInclude>
@ -784,18 +775,6 @@
<ClInclude Include="..\public\string_t.h">
<Filter>public</Filter>
</ClInclude>
<ClInclude Include="..\public\tier0\memalloc.h">
<Filter>public\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\tier0\mem.h">
<Filter>public\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\tier0\memdbgon.h">
<Filter>public\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\tier0\memdbgoff.h">
<Filter>public\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\utllinkedlist.h">
<Filter>public</Filter>
</ClInclude>
@ -1057,9 +1036,6 @@
<ClInclude Include="..\public\rehlds\crc32c.h">
<Filter>public\rehlds</Filter>
</ClInclude>
<ClInclude Include="..\public\iosutil.h">
<Filter>public</Filter>
</ClInclude>
<ClInclude Include="..\unittests\rehlds_tests_shared.h">
<Filter>unittests</Filter>
</ClInclude>
@ -1099,6 +1075,12 @@
<ClInclude Include="..\engine\SystemWrapper.h">
<Filter>engine\common</Filter>
</ClInclude>
<ClInclude Include="..\public\iosutil.h">
<Filter>hookers</Filter>
</ClInclude>
<ClInclude Include="..\public\strtools.h">
<Filter>public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\linux\appversion.sh">

View File

@ -1,9 +1,30 @@
//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef BASETYPES_H
#define BASETYPES_H
@ -12,9 +33,10 @@
#endif
#include "osconfig.h"
#include "protected_things.h"
#include "commonmacros.h"
#include "archtypes.h"
#include "mathlib.h"
// For backward compatibilty only...
#include "tier0/platform.h"
@ -24,45 +46,16 @@
#define NULL 0
#endif
#define ExecuteNTimes( nTimes, x ) \
{ \
static int __executeCount=0;\
if ( __executeCount < nTimes )\
{ \
x; \
++__executeCount; \
} \
}
#define ExecuteOnce( x ) ExecuteNTimes( 1, x )
// Pad a number so it lies on an N byte boundary.
// So PAD_NUMBER(0,4) is 0 and PAD_NUMBER(1,4) is 4
#define PAD_NUMBER(number, boundary) \
( ((number) + ((boundary)-1)) / (boundary) ) * (boundary)
#ifndef MATHLIB_H
// In case this ever changes
#define M_PI 3.14159265358979323846
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#endif // MATHLIB_H
(((number) + ((boundary) - 1)) / (boundary)) * (boundary)
#ifndef FALSE
#define FALSE 0
#define TRUE (!FALSE)
#endif
typedef int BOOL;
typedef int qboolean;
typedef unsigned long ULONG;
@ -72,216 +65,14 @@ typedef unsigned short word;
typedef float vec_t;
// FIXME: this should move
#ifndef __cplusplus
#define true TRUE
#define false FALSE
#endif
//-----------------------------------------------------------------------------
// look for NANs, infinities, and underflows.
// This assumes the ANSI/IEEE 754-1985 standard
//-----------------------------------------------------------------------------
#ifdef __cplusplus
inline unsigned long& FloatBits(vec_t& f)
{
return *reinterpret_cast<unsigned long*>(&f);
}
inline unsigned long const& FloatBits(vec_t const& f)
{
return *reinterpret_cast<unsigned long const*>(&f);
}
inline vec_t BitsToFloat(unsigned long i)
{
return *reinterpret_cast<vec_t*>(&i);
}
inline bool IsFinite(vec_t f)
{
return ((FloatBits(f) & 0x7F800000) != 0x7F800000);
}
inline unsigned long FloatAbsBits(vec_t f)
{
return FloatBits(f) & 0x7FFFFFFF;
}
inline float FloatMakeNegative(vec_t f)
{
return BitsToFloat(FloatBits(f) | 0x80000000);
}
#if defined( WIN32 )
//#include <math.h>
// Just use prototype from math.h
#ifdef __cplusplus
extern "C"
{
#endif
double __cdecl fabs(double);
#ifdef __cplusplus
}
#endif
// In win32 try to use the intrinsic fabs so the optimizer can do it's thing inline in the code
#pragma intrinsic( fabs )
// Also, alias float make positive to use fabs, too
// NOTE: Is there a perf issue with double<->float conversion?
inline float FloatMakePositive(vec_t f)
{
return fabs(f);
}
#else
inline float FloatMakePositive(vec_t f)
{
return BitsToFloat(FloatBits(f) & 0x7FFFFFFF);
}
#endif
inline float FloatNegate(vec_t f)
{
return BitsToFloat(FloatBits(f) ^ 0x80000000);
}
#define FLOAT32_NAN_BITS (unsigned long)0x7FC00000 // not a number!
#define FLOAT32_NAN BitsToFloat( FLOAT32_NAN_BITS )
#define VEC_T_NAN FLOAT32_NAN
#endif
// FIXME: why are these here? Hardly anyone actually needs them.
struct valve_color24
{
byte r, g, b;
};
typedef struct valve_color32_s
{
bool operator!=(const struct valve_color32_s &other) const;
byte r, g, b, a;
} valve_color32;
inline bool valve_color32::operator!=(const valve_color32 &other) const
{
return r != other.r || g != other.g || b != other.b || a != other.a;
}
struct valve_colorRGBExp32
{
byte r, g, b;
signed char exponent;
};
struct valve_colorVec
{
unsigned r, g, b, a;
};
#ifndef UNUSED
#define UNUSED(x) (x = x) // for pesky compiler / lint warnings
#endif
#ifdef __cplusplus
struct vrect_t
{
int x, y, width, height;
vrect_t *pnext;
int x, y, width, height;
vrect_t *pnext;
};
#endif
//-----------------------------------------------------------------------------
// MaterialRect_t struct - used for DrawDebugText
//-----------------------------------------------------------------------------
struct Rect_t
{
int x, y;
int width, height;
};
//-----------------------------------------------------------------------------
// Declares a type-safe handle type; you can't assign one handle to the next
//-----------------------------------------------------------------------------
// 32-bit pointer handles.
// Typesafe 8-bit and 16-bit handles.
template< class HandleType >
class CBaseIntHandle
{
public:
inline bool operator==(const CBaseIntHandle &other) { return m_Handle == other.m_Handle; }
inline bool operator!=(const CBaseIntHandle &other) { return m_Handle != other.m_Handle; }
// Only the code that doles out these handles should use these functions.
// Everyone else should treat them as a transparent type.
inline HandleType GetHandleValue() { return m_Handle; }
inline void SetHandleValue(HandleType val) { m_Handle = val; }
typedef HandleType HANDLE_TYPE;
protected:
HandleType m_Handle;
};
template< class DummyType >
class CIntHandle16 : public CBaseIntHandle < unsigned short >
{
public:
inline CIntHandle16() {}
static inline CIntHandle16<DummyType> MakeHandle(HANDLE_TYPE val)
{
return CIntHandle16<DummyType>(val);
}
protected:
inline CIntHandle16(HANDLE_TYPE val)
{
m_Handle = val;
}
};
template< class DummyType >
class CIntHandle32 : public CBaseIntHandle < unsigned long >
{
public:
inline CIntHandle32() {}
static inline CIntHandle32<DummyType> MakeHandle(HANDLE_TYPE val)
{
return CIntHandle32<DummyType>(val);
}
protected:
inline CIntHandle32(HANDLE_TYPE val)
{
m_Handle = val;
}
};
// NOTE: This macro is the same as windows uses; so don't change the guts of it
#define DECLARE_HANDLE_16BIT(name) typedef CIntHandle16< struct name##__handle * > name;
#define DECLARE_HANDLE_32BIT(name) typedef CIntHandle32< struct name##__handle * > name;
#define DECLARE_POINTER_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
#define FORWARD_DECLARE_HANDLE(name) typedef struct name##__ *name
#endif // BASETYPES_H

View File

@ -1,187 +0,0 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef PROTECTED_THINGS_H
#define PROTECTED_THINGS_H
#ifdef _WIN32
#pragma once
#endif
// This header tries to prevent people from using potentially dangerous functions
// (like the notorious non-null-terminating strncpy) and functions that will break
// VCR mode (like time, input, registry, etc).
//
// This header should be included by ALL of our source code.
// Eventually, ALL of these should be protected, but one man can only accomplish so much in
// one day AND work on features too!
#if defined( PROTECT_STRING_FUNCTIONS )
#if defined( strncpy )
#undef strncpy
#endif
#define strncpy strncpy__HEY_YOU__USE_VSTDLIB
#if defined( _snprintf )
#undef _snprintf
#endif
#define _snprintf snprintf__HEY_YOU__USE_VSTDLIB
#if defined( sprintf )
#undef sprintf
#endif
#define sprintf sprintf__HEY_YOU__USE_VSTDLIB
#if defined( _vsnprintf )
#undef _vsnprintf
#endif
#define _vsnprintf vsnprintf__HEY_YOU__USE_VSTDLIB
#if defined( strcat )
#undef strcat
#endif
#define strcat strcat__HEY_YOU__USE_VSTDLIB
#endif
#if defined( PROTECT_FILEIO_FUNCTIONS )
#if defined( fopen )
#undef fopen
#endif
#define fopen fopen_USE_FILESYSTEM_INSTEAD
#endif
#if defined( PROTECTED_THINGS_ENABLE )
#if defined( GetTickCount )
#undef GetTickCount
#endif
#define GetTickCount GetTickCount__HEY_YOU__USE_PLATFORM_LIB
#if defined( timeGetTime )
#undef timeGetTime
#endif
#define timeGetTime timeGetTime__HEY_YOU__USE_PLATFORM_LIB
#if defined( clock )
#undef clock
#endif
#define time time__HEY_YOU__USE_PLATFORM_LIB
#if defined( recvfrom )
#undef recvfrom
#endif
#define recvfrom recvfrom__HEY_YOU__USE_PLATFORM_LIB
#if defined( GetCursorPos )
#undef GetCursorPos
#endif
#define GetCursorPos GetCursorPos__HEY_YOU__USE_PLATFORM_LIB
#if defined( ScreenToClient )
#undef ScreenToClient
#endif
#define ScreenToClient ScreenToClient__HEY_YOU__USE_PLATFORM_LIB
#if defined( GetCommandLine )
#undef GetCommandLine
#endif
#define GetCommandLine GetCommandLine__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegOpenKeyEx )
#undef RegOpenKeyEx
#endif
#define RegOpenKeyEx RegOpenKeyEx__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegOpenKey )
#undef RegOpenKey
#endif
#define RegOpenKey RegOpenKey__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegSetValueEx )
#undef RegSetValueEx
#endif
#define RegSetValueEx RegSetValueEx__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegSetValue )
#undef RegSetValue
#endif
#define RegSetValue RegSetValue__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegQueryValueEx )
#undef RegQueryValueEx
#endif
#define RegQueryValueEx RegQueryValueEx__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegQueryValue )
#undef RegQueryValue
#endif
#define RegQueryValue RegQueryValue__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegCreateKeyEx )
#undef RegCreateKeyEx
#endif
#define RegCreateKeyEx RegCreateKeyEx__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegCreateKey )
#undef RegCreateKey
#endif
#define RegCreateKey RegCreateKey__HEY_YOU__USE_PLATFORM_LIB
#if defined( RegCloseKey )
#undef RegCloseKey
#endif
#define RegCloseKey RegCloseKey__HEY_YOU__USE_PLATFORM_LIB
#if defined( GetNumberOfConsoleInputEvents )
#undef GetNumberOfConsoleInputEvents
#endif
#define GetNumberOfConsoleInputEvents GetNumberOfConsoleInputEvents__HEY_YOU__USE_PLATFORM_LIB
#if defined( ReadConsoleInput )
#undef ReadConsoleInput
#endif
#define ReadConsoleInput ReadConsoleInput__HEY_YOU__USE_PLATFORM_LIB
#if defined( GetAsyncKeyState )
#undef GetAsyncKeyState
#endif
#define GetAsyncKeyState GetAsyncKeyState__HEY_YOU__USE_PLATFORM_LIB
#if defined( GetKeyState )
#undef GetKeyState
#endif
#define GetKeyState GetKeyState__HEY_YOU__USE_PLATFORM_LIB
#endif
#endif // PROTECTED_THINGS_H

View File

@ -103,8 +103,10 @@
#ifndef CDECL
#define CDECL __cdecl
#endif
#define FASTCALL __fastcall
#define STDCALL __stdcall
#define HIDDEN
#define FORCEINLINE __forceinline
#define NOINLINE __declspec(noinline)
#define ALIGN16 __declspec(align(16))
#define NORETURN __declspec(noreturn)
@ -147,9 +149,11 @@
typedef unsigned short WORD;
typedef unsigned int UNINT32;
#define FASTCALL
#define CDECL __attribute__ ((cdecl))
#define STDCALL __attribute__ ((stdcall))
#define HIDDEN __attribute__((visibility("hidden")))
#define FORCEINLINE inline
#define NOINLINE __attribute__((noinline))
#define ALIGN16 __attribute__((aligned(16)))
#define NORETURN __attribute__((noreturn))

199
rehlds/public/strtools.h Normal file
View File

@ -0,0 +1,199 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#ifdef _WIN32
const char CORRECT_PATH_SEPARATOR = '\\';
const char INCORRECT_PATH_SEPARATOR = '/';
#else
const char CORRECT_PATH_SEPARATOR = '/';
const char INCORRECT_PATH_SEPARATOR = '\\';
#endif
#if !defined(_WIN32)
inline char *_strupr(char *start)
{
char *str = start;
while (str && *str)
{
*str = (char)toupper(*str);
str++;
}
return start;
}
inline char *_strlwr(char *start)
{
char *str = start;
while (str && *str)
{
*str = (char)tolower(*str);
str++;
}
return start;
}
#endif
#if defined(ASMLIB_H) && defined(HAVE_OPT_STRTOOLS)
#define Q_memset A_memset
#define Q_memcpy A_memcpy
#define Q_memcmp A_memcmp
#define Q_memmove A_memmove
#define Q_strlen A_strlen
#define Q_strcpy A_strcpy
#define Q_strncpy strncpy
#define Q_strcat A_strcat
#define Q_strncat strncat
#define Q_strcmp A_strcmp
#define Q_strncmp strncmp
#define Q_strdup _strdup
#define Q_stricmp A_stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr A_strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr A_strtolower
#define Q_strupr A_strtoupper
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_sqrt M_sqrt
#define Q_min M_min
#define Q_max M_max
#define Q_clamp M_clamp
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_pow pow
#define Q_fmod fmod
#else
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_memcmp memcmp
#define Q_memmove memmove
#define Q_strlen strlen
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
#define Q_strdup _strdup
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr _strlwr
#define Q_strupr _strupr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_sqrt sqrt
#define Q_min min
#define Q_max max
#define Q_clamp clamp
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_pow pow
#define Q_fmod fmod
#endif // #if defined(ASMLIB_H) && defined(HAVE_OPT_STRTOOLS)
template <size_t N>
char *Q_strlcpy(char (&dest)[N], const char *src) {
Q_strncpy(dest, src, N - 1);
dest[N - 1] = '\0';
return dest;
}
inline char *Q_strnlcpy(char *dest, const char *src, size_t n) {
Q_strncpy(dest, src, n - 1);
dest[n - 1] = '\0';
return dest;
}
template <size_t N>
size_t Q_strlcat(char (&dest)[N], const char *src)
{
size_t dstlen = Q_strlen(dest);
size_t size = N - dstlen + 1;
if (!size) {
return dstlen;
}
size_t srclen = Q_strlen(src);
if (srclen > size)
srclen = size;
Q_memcpy(dst + dstlen, src, srclen);
dst[dstlen + srclen] = '\0';
return dstlen + srclen;
}
// Force slashes of either type to be = separator character
inline void Q_FixSlashes(char *pname, char separator = CORRECT_PATH_SEPARATOR)
{
while (*pname)
{
if (*pname == INCORRECT_PATH_SEPARATOR || *pname == CORRECT_PATH_SEPARATOR)
{
*pname = separator;
}
pname++;
}
}
// strcpy that works correctly with overlapping src and dst buffers
inline char *strcpy_safe(char *dst, char *src) {
int len = Q_strlen(src);
Q_memmove(dst, src, len + 1);
return dst;
}

View File

@ -19,9 +19,8 @@
#pragma once
#endif
#include "osconfig.h"
#include "basetypes.h"
#include "tier0/platform.h"
#include <math.h>
#include <stdio.h>
#include <stdarg.h>

View File

@ -1,37 +0,0 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose: Memory allocation!
//
// $NoKeywords: $
//=============================================================================
#ifndef TIER0_MEM_H
#define TIER0_MEM_H
#ifdef _WIN32
#pragma once
#endif
#include "osconfig.h"
#include <stddef.h>
#include "tier0/platform.h"
#ifdef TIER0_DLL_EXPORT
# define MEM_INTERFACE DLL_EXPORT
#else
# define MEM_INTERFACE DLL_IMPORT
#endif
//-----------------------------------------------------------------------------
// DLL-exported methods for particular kinds of memory
//-----------------------------------------------------------------------------
MEM_INTERFACE void *MemAllocScratch(int nMemSize);
MEM_INTERFACE void MemFreeScratch();
#ifdef __linux__
MEM_INTERFACE void ZeroMemory(void *mem, size_t length);
#endif
#endif /* TIER0_MEM_H */

View File

@ -1,77 +0,0 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose: This header should never be used directly from leaf code!!!
// Instead, just add the file memoverride.cpp into your project and all this
// will automagically be used
//
// $NoKeywords: $
//=============================================================================
#ifndef TIER0_MEMALLOC_H
#define TIER0_MEMALLOC_H
#ifdef _WIN32
#pragma once
#endif
#include "osconfig.h"
#include <stddef.h>
#include "tier0/mem.h"
struct _CrtMemState;
//-----------------------------------------------------------------------------
// NOTE! This should never be called directly from leaf code
// Just use new,delete,malloc,free etc. They will call into this eventually
//-----------------------------------------------------------------------------
class IMemAlloc
{
public:
// Release versions
virtual void *Alloc(size_t nSize) = 0;
virtual void *Realloc(void *pMem, size_t nSize) = 0;
virtual void Free(void *pMem) = 0;
virtual void *Expand(void *pMem, size_t nSize) = 0;
// Debug versions
virtual void *Alloc(size_t nSize, const char *pFileName, int nLine) = 0;
virtual void *Realloc(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0;
virtual void Free(void *pMem, const char *pFileName, int nLine) = 0;
virtual void *Expand(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0;
// Returns size of a particular allocation
virtual size_t GetSize(void *pMem) = 0;
// Force file + line information for an allocation
virtual void PushAllocDbgInfo(const char *pFileName, int nLine) = 0;
virtual void PopAllocDbgInfo() = 0;
// 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 int CrtSetReportMode(int nReportType, int nReportMode) = 0;
virtual int CrtIsValidHeapPointer(const void *pMem) = 0;
virtual int CrtCheckMemory(void) = 0;
virtual int CrtSetDbgFlag(int nNewFlag) = 0;
virtual void CrtMemCheckpoint(_CrtMemState *pState) = 0;
// FIXME: Make a better stats interface
virtual void DumpStats() = 0;
// FIXME: Remove when we have our own allocator
virtual void* CrtSetReportFile(int nRptType, void* hFile) = 0;
virtual void* CrtSetReportHook(void* pfnNewHook) = 0;
virtual int CrtDbgReport(int nRptType, const char * szFile,
int nLine, const char * szModule, const char * pMsg) = 0;
virtual int heapchk() = 0;
};
//-----------------------------------------------------------------------------
// Singleton interface
//-----------------------------------------------------------------------------
IMemAlloc *g_pMemAlloc;
#endif /* TIER0_MEMALLOC_H */

View File

@ -1,21 +0,0 @@
//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============
//
// Purpose: This header, which must be the final line of a .h file,
// causes all crt methods to stop using debugging versions of the memory allocators.
// NOTE: Use memdbgon.h to re-enable memory debugging.
//
// $NoKeywords: $
//=============================================================================
#ifdef MEM_DEBUG_ON
#undef malloc
#undef realloc
#undef calloc
#undef free
#undef _expand
#undef _msize
#undef new
#undef MEM_DEBUG_ON
#endif

View File

@ -1,93 +0,0 @@
//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============
//
// Purpose: This header, which must be the final include in a .cpp (or .h) file,
// causes all crt methods to use debugging versions of the memory allocators.
// NOTE: Use memdbgoff.h to disable memory debugging.
//
// $NoKeywords: $
//=============================================================================
// SPECIAL NOTE! This file must *not* use include guards; we need to be able
// to include this potentially multiple times (since we can deactivate debugging
// by including memdbgoff.h)
// SPECIAL NOTE #2: This must be the final include in a .cpp or .h file!!!
#include "osconfig.h"
#ifdef _DEBUG
#include <tchar.h>
#include <string.h>
#include <malloc.h>
#include <crtdbg.h>
#include "tier0/memdbgoff.h"
#define MEM_DEBUG_ON 1
#undef malloc
#undef realloc
#undef calloc
#undef _expand
#undef free
#undef _msize
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#if defined(__AFX_H__) && defined(DEBUG_NEW)
#define new DEBUG_NEW
#else
#undef new
#define MEMALL_DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new MEMALL_DEBUG_NEW
#endif
#undef _strdup
#undef strdup
#undef _wcsdup
#undef wcsup
#define _strdup(s) strdup_dbg(s, __FILE__, __LINE__)
#define strdup(s) strdup_dbg(s, __FILE__, __LINE__)
#define _wcsdup(s) wcsdup_dbg(s, __FILE__, __LINE__)
#define wcsdup(s) wcsdup_dbg(s, __FILE__, __LINE__)
// Make sure we don't define strdup twice
#ifndef MEM_DBG_DEFINED_STRDUP
#define MEM_DBG_DEFINED_STRDUP 1
inline char *strdup_dbg(const char *pString, const char *pFileName, unsigned nLine)
{
char *pMemory;
if (!pString)
return NULL;
if ((pMemory = (char *)_malloc_dbg(strlen(pString) + 1, _NORMAL_BLOCK, pFileName, nLine)) != NULL)
return strcpy(pMemory, pString);
return NULL;
}
inline wchar_t *wcsdup_dbg(const wchar_t *pString, const char *pFileName, unsigned nLine)
{
wchar_t *pMemory;
if (!pString)
return NULL;
if ((pMemory = (wchar_t *)_malloc_dbg((wcslen(pString) + 1) * sizeof(wchar_t), _NORMAL_BLOCK, pFileName, nLine)) != NULL)
return wcscpy(pMemory, pString);
return NULL;
}
#endif // DBMEM_DEFINED_STRDUP
#endif // _DEBUG

View File

@ -1,102 +1,40 @@
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// $Header: $
// $NoKeywords: $
//
// Extremely low-level platform-specific stuff
//=============================================================================
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef PLATFORM_H
#define PLATFORM_H
#ifdef _WIN32
#pragma once
#endif
#include "osconfig.h"
// need this for _alloca
#include <malloc.h>
// need this for memset
#include <string.h>
#include <malloc.h> // need this for _alloca
#include <string.h> // need this for memset
#include "archtypes.h"
typedef float float32;
typedef double float64;
// for when we don't care about how many bits we use
typedef unsigned int uint;
// This can be used to ensure the size of pointers to members when declaring
// a pointer type for a class that has only been forward declared
#ifdef _MSC_VER
#define SINGLE_INHERITANCE __single_inheritance
#define MULTIPLE_INHERITANCE __multiple_inheritance
#else
#define SINGLE_INHERITANCE
#define MULTIPLE_INHERITANCE
#endif
/*
FIXME: Enable this when we no longer fear change =)
// need these for the limits
#include <limits.h>
#include <float.h>
// Maximum and minimum representable values
#define INT8_MAX SCHAR_MAX
#define INT16_MAX SHRT_MAX
#define INT32_MAX LONG_MAX
#define INT64_MAX (((int64)~0) >> 1)
#define INT8_MIN SCHAR_MIN
#define INT16_MIN SHRT_MIN
#define INT32_MIN LONG_MIN
#define INT64_MIN (((int64)1) << 63)
#define UINT8_MAX ((uint8)~0)
#define UINT16_MAX ((uint16)~0)
#define UINT32_MAX ((uint32)~0)
#define UINT64_MAX ((uint64)~0)
#define UINT8_MIN 0
#define UINT16_MIN 0
#define UINT32_MIN 0
#define UINT64_MIN 0
#ifndef UINT_MIN
#define UINT_MIN UINT32_MIN
#endif
#define FLOAT32_MAX FLT_MAX
#define FLOAT64_MAX DBL_MAX
#define FLOAT32_MIN FLT_MIN
#define FLOAT64_MIN DBL_MIN
*/
// portability / compiler settings
#if defined(_WIN32) && !defined(WINDED)
#if defined(_M_IX86)
#define __i386__ 1
#endif
#elif __linux__
typedef void * HINSTANCE;
#define _MAX_PATH PATH_MAX
#endif // defined(_WIN32) && !defined(WINDED)
// Defines MAX_PATH
#ifndef MAX_PATH
#define MAX_PATH 260
@ -108,92 +46,42 @@ typedef void * HINSTANCE;
// C functions for external declarations that call the appropriate C++ methods
#ifndef EXPORT
#ifdef _WIN32
#define EXPORT _declspec( dllexport )
#else
#define EXPORT __declspec(dllexport)
#else
#define EXPORT /* */
#endif
#endif
#if defined __i386__ && !defined __linux__
#define id386 1
#else
#define id386 0
#endif // __i386__
#ifdef _WIN32
// Used for dll exporting and importing
#define DLL_EXPORT extern "C" __declspec( dllexport )
#define DLL_IMPORT extern "C" __declspec( dllimport )
#define DLL_EXPORT extern "C" __declspec(dllexport)
#define DLL_IMPORT extern "C" __declspec(dllimport)
// Can't use extern "C" when DLL exporting a class
#define DLL_CLASS_EXPORT __declspec( dllexport )
#define DLL_CLASS_IMPORT __declspec( dllimport )
#define DLL_CLASS_EXPORT __declspec(dllexport)
#define DLL_CLASS_IMPORT __declspec(dllimport)
// Can't use extern "C" when DLL exporting a global
#define DLL_GLOBAL_EXPORT extern __declspec( dllexport )
#define DLL_GLOBAL_IMPORT extern __declspec( dllimport )
#define DLL_GLOBAL_EXPORT extern __declspec(dllexport)
#define DLL_GLOBAL_IMPORT extern __declspec(dllimport)
#elif defined __linux__
// Used for dll exporting and importing
#define DLL_EXPORT extern "C"
#define DLL_IMPORT extern "C"
#define DLL_EXPORT extern "C"
#define DLL_IMPORT extern "C"
// Can't use extern "C" when DLL exporting a class
#define DLL_CLASS_EXPORT
#define DLL_CLASS_IMPORT
#define DLL_CLASS_EXPORT
#define DLL_CLASS_IMPORT
// Can't use extern "C" when DLL exporting a global
#define DLL_GLOBAL_EXPORT extern
#define DLL_GLOBAL_IMPORT extern
#define DLL_GLOBAL_EXPORT extern
#define DLL_GLOBAL_IMPORT extern
#else
#error "Unsupported Platform."
#endif
// Used for standard calling conventions
#ifdef _WIN32
#define FASTCALL __fastcall
#define FORCEINLINE __forceinline
#else
#define FASTCALL
#define FORCEINLINE inline
#endif
// Force a function call site -not- to inlined. (useful for profiling)
#define DONT_INLINE(a) (((int)(a)+1)?(a):(a))
// Pass hints to the compiler to prevent it from generating unnessecary / stupid code
// in certain situations. Several compilers other than MSVC also have an equivilent
// construct.
//
// Essentially the 'Hint' is that the condition specified is assumed to be true at
// that point in the compilation. If '0' is passed, then the compiler assumes that
// any subsequent code in the same 'basic block' is unreachable, and thus usually
// removed.
#ifdef _MSC_VER
#define HINT(THE_HINT) __assume((THE_HINT))
#else
#define HINT(THE_HINT) 0
#endif
// Marks the codepath from here until the next branch entry point as unreachable,
// and asserts if any attempt is made to execute it.
#define UNREACHABLE() { Assert(0); HINT(0); }
// In cases where no default is present or appropriate, this causes MSVC to generate
// as little code as possible, and throw an assertion in debug.
#define NO_DEFAULT default: UNREACHABLE();
#ifdef _WIN32
// Alloca defined for this platform
#define stackalloc( _size ) _alloca( _size )
#define stackfree( _p ) 0
#elif __linux__
// Alloca defined for this platform
#define stackalloc( _size ) alloca( _size )
#define stackfree( _p ) 0
#endif
#ifdef _WIN32
// Remove warnings from warning level 4.
#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed
@ -216,274 +104,22 @@ typedef void * HINSTANCE;
#pragma warning(disable : 4511) // Disable warnings about private copy constructors
#endif
#endif
//-----------------------------------------------------------------------------
// Purpose: Standard functions for handling endian-ness
//-----------------------------------------------------------------------------
//-------------------------------------
// Basic swaps
//-------------------------------------
template <typename T>
inline T WordSwapC(T w)
{
uint16 temp;
temp = ((*((uint16 *)&w) & 0xff00) >> 8);
temp |= ((*((uint16 *)&w) & 0x00ff) << 8);
return *((T*)&temp);
}
template <typename T>
inline T DWordSwapC(T dw)
{
uint32 temp;
temp = *((uint32 *)&dw) >> 24;
temp |= ((*((uint32 *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32 *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32 *)&dw) & 0x000000FF) << 24);
return *((T*)&temp);
}
//-------------------------------------
// Fast swaps
//-------------------------------------
#ifdef _MSC_VER
#define WordSwap WordSwapAsm
#define DWordSwap DWordSwapAsm
#pragma warning(push)
#pragma warning (disable:4035) // no return value
template <typename T>
inline T WordSwapAsm(T w)
{
__asm
{
mov ax, w
xchg al, ah
}
}
template <typename T>
inline T DWordSwapAsm(T dw)
{
__asm
{
mov eax, dw
bswap eax
}
}
#pragma warning(pop)
// The assembly implementation is not compatible with floats
template <>
inline float DWordSwapAsm<float>(float f)
{
return DWordSwapC(f);
}
#else
#define WordSwap WordSwapC
#define DWordSwap DWordSwapC
#endif
//-------------------------------------
// The typically used methods.
//-------------------------------------
#if defined(__i386__)
#define VALVE_LITTLE_ENDIAN 1
#endif
#ifdef _SGI_SOURCE
#define VALVE_BIG_ENDIAN 1
#endif
#if defined(VALVE_LITTLE_ENDIAN)
#define Valve_BigShort( val ) WordSwap( val )
#define Valve_BigWord( val ) WordSwap( val )
#define Valve_BigLong( val ) DWordSwap( val )
#define Valve_BigDWord( val ) DWordSwap( val )
#define Valve_BigFloat( val ) DWordSwap( val )
#define Valve_LittleShort( val ) ( val )
#define Valve_LittleWord( val ) ( val )
#define Valve_LittleLong( val ) ( val )
#define Valve_LittleDWord( val ) ( val )
#define Valve_LittleFloat( val ) ( val )
#elif defined(BIG_ENDIAN)
#define Valve_BigShort( val ) ( val )
#define Valve_BigWord( val ) ( val )
#define Valve_BigLong( val ) ( val )
#define Valve_BigDWord( val ) ( val )
#define Valve_BigFloat( val ) ( val )
#define Valve_LittleShort( val ) WordSwap( val )
#define Valve_LittleWord( val ) WordSwap( val )
#define Valve_LittleLong( val ) DWordSwap( val )
#define Valve_LittleDWord( val ) DWordSwap( val )
#define Valve_LittleFloat( val ) DWordSwap( val )
#else
// @Note (toml 05-02-02): this technique expects the compiler to
// optimize the expression and eliminate the other path. On any new
// 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 uint32 BigDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline float BigFloat(float 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 uint32 LittleDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
#endif
#ifdef TIER0_DLL_EXPORT
#define PLATFORM_INTERFACE DLL_EXPORT
#define PLATFORM_OVERLOAD DLL_GLOBAL_EXPORT
#else
#define PLATFORM_INTERFACE DLL_IMPORT
#define PLATFORM_OVERLOAD DLL_GLOBAL_IMPORT
#endif
/*
PLATFORM_INTERFACE double Plat_FloatTime(); // Returns time in seconds since the module was loaded.
PLATFORM_INTERFACE unsigned long Plat_MSTime(); // Time in milliseconds.
// b/w compatibility
#define Sys_FloatTime Plat_FloatTime
*/
// Processor Information:
struct CPUInformation
{
int m_Size; // Size of this structure, for forward compatability.
bool m_bRDTSC : 1, // Is RDTSC supported?
m_bCMOV : 1, // Is CMOV supported?
m_bFCMOV : 1, // Is FCMOV supported?
m_bSSE : 1, // Is SSE supported?
m_bSSE2 : 1, // Is SSE2 Supported?
m_b3DNow : 1, // Is 3DNow! Supported?
m_bMMX : 1, // Is MMX supported?
m_bHT : 1; // Is HyperThreading supported?
unsigned char m_nLogicalProcessors, // Number op logical processors.
m_nPhysicalProcessors; // Number of physical processors
int64 m_Speed; // In cycles per second.
char* m_szProcessorID; // Processor vendor Identification.
};
PLATFORM_INTERFACE const CPUInformation& GetCPUInformation();
//-----------------------------------------------------------------------------
// Thread related functions
//-----------------------------------------------------------------------------
// 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 char *pName = "Source Thread");
// Registers the current thread as the primary thread.
PLATFORM_INTERFACE unsigned long 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 char *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;
// Returns the ID of the currently executing thread.
PLATFORM_INTERFACE unsigned long Plat_GetCurrentThreadID();
// Returns the ID of the primary thread.
inline unsigned long Plat_GetPrimaryThreadID()
{
return Plat_PrimaryThreadID;
}
// Returns true if the current thread is the primary thread.
inline bool Plat_IsPrimaryThread()
{
//return true;
return (Plat_GetPrimaryThreadID() == Plat_GetCurrentThreadID());
}
//-----------------------------------------------------------------------------
// Security related functions
//-----------------------------------------------------------------------------
// Ensure that the hardware key's drivers have been installed.
PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyDriver();
// Ok, so this isn't a very secure way to verify the hardware key for now. It
// is primarially depending on the fact that all the binaries have been wrapped
// with the secure wrapper provided by the hardware keys vendor.
PLATFORM_INTERFACE bool Plat_VerifyHardwareKey();
// The same as above, but notifies user with a message box when the key isn't in
// and gives him an opportunity to correct the situation.
PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyPrompt();
// Can be called in real time, doesn't perform the verify every frame. Mainly just
// here to allow the game to drop out quickly when the key is removed, rather than
// allowing the wrapper to pop up it's own blocking dialog, which the engine doesn't
// like much.
PLATFORM_INTERFACE bool Plat_FastVerifyHardwareKey();
//-----------------------------------------------------------------------------
// Include additional dependant header components.
//-----------------------------------------------------------------------------
//#include "tier0/fasttimer.h"
//-----------------------------------------------------------------------------
// Just logs file and line to simple.log
//-----------------------------------------------------------------------------
void* Plat_SimpleLog(const char* file, int line);
//#define Plat_dynamic_cast Plat_SimpleLog(__FILE__,__LINE__),dynamic_cast
//-----------------------------------------------------------------------------
// Methods to invoke the constructor, copy constructor, and destructor
//-----------------------------------------------------------------------------
template <class T>
inline void Construct(T* pMemory)
inline void Construct(T *pMemory)
{
new(pMemory)T;
new(pMemory) T;
}
template <class T>
inline void CopyConstruct(T* pMemory, T const& src)
inline void CopyConstruct(T *pMemory, T const &src)
{
new(pMemory)T(src);
new(pMemory) T(src);
}
template <class T>
inline void Destruct(T* pMemory)
inline void Destruct(T *pMemory)
{
pMemory->~T();
@ -491,140 +127,3 @@ inline void Destruct(T* pMemory)
memset(pMemory, 0xDD, sizeof(T));
#endif
}
//
// GET_OUTER()
//
// A platform-independent way for a contained class to get a pointer to its
// owner. If you know a class is exclusively used in the context of some
// "outer" class, this is a much more space efficient way to get at the outer
// class than having the inner class store a pointer to it.
//
// class COuter
// {
// class CInner // Note: this does not need to be a nested class to work
// {
// void PrintAddressOfOuter()
// {
// printf( "Outer is at 0x%x\n", GET_OUTER( COuter, m_Inner ) );
// }
// };
//
// CInner m_Inner;
// friend class CInner;
// };
#define GET_OUTER( OuterType, OuterMember ) \
( ( OuterType * ) ( (char *)this - offsetof( OuterType, OuterMember ) ) )
/* TEMPLATE_FUNCTION_TABLE()
(Note added to platform.h so platforms that correctly support templated
functions can handle portions as templated functions rather than wrapped
functions)
Helps automate the process of creating an array of function
templates that are all specialized by a single integer.
This sort of thing is often useful in optimization work.
For example, using TEMPLATE_FUNCTION_TABLE, this:
TEMPLATE_FUNCTION_TABLE(int, Function, ( int blah, int blah ), 10)
{
return argument * argument;
}
is equivilent to the following:
(NOTE: the function has to be wrapped in a class due to code
generation bugs involved with directly specializing a function
based on a constant.)
template<int argument>
class FunctionWrapper
{
public:
int Function( int blah, int blah )
{
return argument*argument;
}
}
typedef int (*FunctionType)( int blah, int blah );
class FunctionName
{
public:
enum { count = 10 };
FunctionType functions[10];
};
FunctionType FunctionName::functions[] =
{
FunctionWrapper<0>::Function,
FunctionWrapper<1>::Function,
FunctionWrapper<2>::Function,
FunctionWrapper<3>::Function,
FunctionWrapper<4>::Function,
FunctionWrapper<5>::Function,
FunctionWrapper<6>::Function,
FunctionWrapper<7>::Function,
FunctionWrapper<8>::Function,
FunctionWrapper<9>::Function
};
*/
bool vtune(bool resume);
#define TEMPLATE_FUNCTION_TABLE(RETURN_TYPE, NAME, ARGS, COUNT) \
\
typedef RETURN_TYPE (FASTCALL *__Type_##NAME) ARGS; \
\
template<const int nArgument> \
struct __Function_##NAME \
{ \
static RETURN_TYPE FASTCALL Run ARGS; \
}; \
\
template <int i> \
struct __MetaLooper_##NAME : __MetaLooper_##NAME<i-1> \
{ \
__Type_##NAME func; \
inline __MetaLooper_##NAME() { func = __Function_##NAME<i>::Run; } \
}; \
\
template<> \
struct __MetaLooper_##NAME<0> \
{ \
__Type_##NAME func; \
inline __MetaLooper_##NAME() { func = __Function_##NAME<0>::Run; } \
}; \
\
class NAME \
{ \
private: \
static const __MetaLooper_##NAME<COUNT> m; \
public: \
enum { count = COUNT }; \
static const __Type_##NAME* functions; \
}; \
const __MetaLooper_##NAME<COUNT> NAME::m; \
const __Type_##NAME* NAME::functions = (__Type_##NAME*)&m; \
template<int nArgument> \
RETURN_TYPE FASTCALL __Function_##NAME<nArgument>::Run ARGS
#define LOOP_INTERCHANGE(BOOLEAN, CODE)\
if( (BOOLEAN) )\
{\
CODE;\
} else\
{\
CODE;\
}
#endif /* PLATFORM_H */

View File

@ -1,59 +0,0 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "precompiled.h"
double Plat_FloatTime()
{
struct timeval tp;
static int secbase = 0;
gettimeofday(&tp, NULL);
if (!secbase)
{
secbase = tp.tv_sec;
return (tp.tv_usec / 1000000.0);
}
return ((tp.tv_sec - secbase) + tp.tv_usec / 1000000.0);
}
unsigned long Plat_MSTime()
{
struct timeval tp;
static int secbase = 0;
gettimeofday(&tp, NULL);
if (!secbase)
{
secbase = tp.tv_sec;
return (tp.tv_usec / 1000000.0);
}
return (unsigned long)((tp.tv_sec - secbase) + tp.tv_usec / 1000000.0);
}
bool vtune(bool resume)
{
return true;
}
// -------------------------------------------------------------------------------------------------- //
// Memory stuff.
// -------------------------------------------------------------------------------------------------- //
void Plat_SetThreadName(unsigned long dwThreadID, const char *pName)
{
Assert("Plat_SetThreadName not implemented");
}

View File

@ -1,95 +0,0 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include "precompiled.h"
static LARGE_INTEGER g_PerformanceFrequency;
static LARGE_INTEGER g_MSPerformanceFrequency;
static LARGE_INTEGER g_ClockStart;
static HINSTANCE g_pVTuneDLL;
static void InitTime()
{
if (!g_PerformanceFrequency.QuadPart)
{
QueryPerformanceFrequency(&g_PerformanceFrequency);
g_MSPerformanceFrequency.QuadPart = g_PerformanceFrequency.QuadPart / 1000;
QueryPerformanceCounter(&g_ClockStart);
}
}
double Plat_FloatTime()
{
InitTime();
LARGE_INTEGER CurrentTime;
QueryPerformanceCounter(&CurrentTime);
double fRawSeconds = (double)(CurrentTime.QuadPart - g_ClockStart.QuadPart) / (double)(g_PerformanceFrequency.QuadPart);
return fRawSeconds;
}
unsigned long Plat_MSTime()
{
InitTime();
LARGE_INTEGER CurrentTime;
QueryPerformanceCounter(&CurrentTime);
return (unsigned long)((CurrentTime.QuadPart - g_ClockStart.QuadPart) / g_MSPerformanceFrequency.QuadPart);
}
void free_vtune()
{
FreeLibrary(g_pVTuneDLL);
}
bool vtune(bool resume)
{
static bool bInitialized = false;
static void(__cdecl *VTResume)(void) = NULL;
static void(__cdecl *VTPause) (void) = NULL;
// Grab the Pause and Resume function pointers from the VTune DLL the first time through:
if (!bInitialized)
{
bInitialized = true;
g_pVTuneDLL = LoadLibrary("vtuneapi.dll");
if (g_pVTuneDLL)
{
VTResume = (void(__cdecl *)())GetProcAddress(g_pVTuneDLL, "VTResume");
VTPause = (void(__cdecl *)())GetProcAddress(g_pVTuneDLL, "VTPause");
atexit(free_vtune);
}
}
// Call the appropriate function, as indicated by the argument:
if (resume && VTResume)
{
VTResume();
return true;
}
else if (!resume && VTPause)
{
VTPause();
return true;
}
return false;
}
// -------------------------------------------------------------------------------------------------- //
// Memory stuff.
// -------------------------------------------------------------------------------------------------- //

View File

@ -18,7 +18,6 @@
#pragma once
#endif
#include "osconfig.h"
#include "basetypes.h"
#include "utlmemory.h"
#include "tier0/dbg.h"

261
rehlds/public/utlmap.h Normal file
View File

@ -0,0 +1,261 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "tier0/dbg.h"
#include "utlrbtree.h"
// Purpose: An associative container. Pretty much identical to std::map.
// This is a useful macro to iterate from start to end in order in a map
#define FOR_EACH_MAP(mapName, iteratorName)\
for (int iteratorName = (mapName).FirstInorder(); (mapName).IsUtlMap && iteratorName != (mapName).InvalidIndex(); iteratorName = (mapName).NextInorder(iteratorName))
// faster iteration, but in an unspecified order
#define FOR_EACH_MAP_FAST(mapName, iteratorName)\
for (int iteratorName = 0; (mapName).IsUtlMap && iteratorName < (mapName).MaxElement(); ++iteratorName) if (!(mapName).IsValidIndex(iteratorName)) continue; else
struct base_utlmap_t
{
public:
// This enum exists so that FOR_EACH_MAP and FOR_EACH_MAP_FAST cannot accidentally
// be used on a type that is not a CUtlMap. If the code compiles then all is well.
// The check for IsUtlMap being true should be free.
// Using an enum rather than a static const bool ensures that this trick works even
// with optimizations disabled on gcc.
enum CompileTimeCheck
{
IsUtlMap = 1
};
};
template <typename K, typename T, typename I = unsigned short>
class CUtlMap: public base_utlmap_t
{
public:
typedef K KeyType_t;
typedef T ElemType_t;
typedef I IndexType_t;
// Less func typedef
// Returns true if the first parameter is "less" than the second
typedef bool (*LessFunc_t)(const KeyType_t &, const KeyType_t &);
// constructor, destructor
// Left at growSize = 0, the memory will first allocate 1 element and double in size
// at each increment.
// LessFunc_t is required, but may be set after the constructor using SetLessFunc() below
CUtlMap(int growSize = 0, int initSize = 0, LessFunc_t lessfunc = 0)
: m_Tree(growSize, initSize, CKeyLess(lessfunc))
{
if (!lessfunc) {
SetLessFunc(DefLessFunc(K));
}
}
CUtlMap(LessFunc_t lessfunc)
: m_Tree(CKeyLess(lessfunc))
{
if (!lessfunc) {
SetLessFunc(DefLessFunc(K));
}
}
void EnsureCapacity(int num) { m_Tree.EnsureCapacity(num); }
// gets particular elements
ElemType_t & Element(IndexType_t i) { return m_Tree.Element(i).elem; }
const ElemType_t & Element(IndexType_t i) const { return m_Tree.Element(i).elem; }
ElemType_t & operator[](IndexType_t i) { return m_Tree.Element(i).elem; }
const ElemType_t & operator[](IndexType_t i) const { return m_Tree.Element(i).elem; }
KeyType_t & Key(IndexType_t i) { return m_Tree.Element(i).key; }
const KeyType_t & Key(IndexType_t i) const { return m_Tree.Element(i).key; }
// Num elements
unsigned int Count() const { return m_Tree.Count(); }
// Max "size" of the vector
IndexType_t MaxElement() const { return m_Tree.MaxElement(); }
// Checks if a node is valid and in the map
bool IsValidIndex(IndexType_t i) const { return m_Tree.IsValidIndex(i); }
// Checks if the map as a whole is valid
bool IsValid() const { return m_Tree.IsValid(); }
// Invalid index
static IndexType_t InvalidIndex() { return CTree::InvalidIndex(); }
// Sets the less func
void SetLessFunc(LessFunc_t func)
{
m_Tree.SetLessFunc(CKeyLess(func));
}
// Insert method (inserts in order)
IndexType_t Insert(const KeyType_t &key, const ElemType_t &insert)
{
Node_t node;
node.key = key;
node.elem = insert;
return m_Tree.Insert(node);
}
IndexType_t Insert(const KeyType_t &key)
{
Node_t node;
node.key = key;
return m_Tree.Insert(node);
}
// Find method
IndexType_t Find(const KeyType_t &key) const
{
Node_t dummyNode;
dummyNode.key = key;
return m_Tree.Find(dummyNode);
}
// Remove methods
void RemoveAt(IndexType_t i) { m_Tree.RemoveAt(i); }
bool Remove(const KeyType_t &key)
{
Node_t dummyNode;
dummyNode.key = key;
return m_Tree.Remove(dummyNode);
}
void RemoveAll() { m_Tree.RemoveAll(); }
void Purge() { m_Tree.Purge(); }
// Purges the list and calls delete on each element in it.
void PurgeAndDeleteElements();
// Iteration
IndexType_t FirstInorder() const { return m_Tree.FirstInorder(); }
IndexType_t NextInorder(IndexType_t i) const { return m_Tree.NextInorder(i); }
IndexType_t PrevInorder(IndexType_t i) const { return m_Tree.PrevInorder(i); }
IndexType_t LastInorder() const { return m_Tree.LastInorder(); }
// If you change the search key, this can be used to reinsert the
// element into the map.
void Reinsert(const KeyType_t &key, IndexType_t i)
{
m_Tree[i].key = key;
m_Tree.Reinsert(i);
}
IndexType_t InsertOrReplace(const KeyType_t &key, const ElemType_t &insert)
{
IndexType_t i = Find(key);
if (i != InvalidIndex())
{
Element(i) = insert;
return i;
}
return Insert(key, insert);
}
void Swap(CUtlMap<K, T, I> &that)
{
m_Tree.Swap(that.m_Tree);
}
struct Node_t
{
Node_t()
{
}
Node_t(const Node_t &from)
: key(from.key),
elem(from.elem)
{
}
KeyType_t key;
ElemType_t elem;
};
class CKeyLess
{
public:
CKeyLess(LessFunc_t lessFunc) : m_LessFunc(lessFunc) {}
bool operator!() const
{
return !m_LessFunc;
}
bool operator()(const Node_t &left, const Node_t &right) const
{
return m_LessFunc(left.key, right.key);
}
LessFunc_t m_LessFunc;
};
typedef CUtlRBTree<Node_t, I, CKeyLess> CTree;
CTree *AccessTree() { return &m_Tree; }
protected:
CTree m_Tree;
};
// Purges the list and calls delete on each element in it.
template <typename K, typename T, typename I>
inline void CUtlMap<K, T, I>::PurgeAndDeleteElements()
{
for (I i = 0; i < MaxElement(); ++i)
{
if (!IsValidIndex(i))
continue;
delete Element(i);
}
Purge();
}
// This is horrible and slow and meant to be used only when you're dealing with really
// non-time/memory-critical code and desperately want to copy a whole map element-by-element
// for whatever reason.
template <typename K, typename T, typename I>
void DeepCopyMap(const CUtlMap<K, T, I> &pmapIn, CUtlMap<K, T, I> *out_pmapOut)
{
Assert(out_pmapOut);
out_pmapOut->Purge();
FOR_EACH_MAP_FAST(pmapIn, i)
{
out_pmapOut->Insert(pmapIn.Key(i), pmapIn.Element(i));
}
}

View File

@ -1,59 +1,90 @@
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// $Header: $
// $NoKeywords: $
//
// A growable memory class.
//=============================================================================
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef UTLMEMORY_H
#define UTLMEMORY_H
#ifdef _WIN32
#pragma once
#endif
#include "osconfig.h"
#include "tier0/dbg.h"
#include <string.h>
#include "tier0/platform.h"
#pragma warning (disable:4100)
#pragma warning (disable:4514)
//-----------------------------------------------------------------------------
// The CUtlMemory class:
// A growable memory class which doubles in size by default.
//-----------------------------------------------------------------------------
template< class T >
template <class T, class I = int>
class CUtlMemory
{
public:
// constructor, destructor
CUtlMemory(int nGrowSize = 0, int nInitSize = 0);
CUtlMemory(T* pMemory, int numElements);
CUtlMemory(T *pMemory, int numElements);
~CUtlMemory();
// Set the size by which the memory grows
void Init(int nGrowSize = 0, int nInitSize = 0);
class Iterator_t
{
public:
Iterator_t(I i) : m_index(i) {}
I m_index;
bool operator==(const Iterator_t it) const { return m_index == it.m_index; }
bool operator!=(const Iterator_t it) const { return m_index != it.m_index; }
};
Iterator_t First() const { return Iterator_t(IsIdxValid(0) ? 0 : InvalidIndex()); }
Iterator_t Next(const Iterator_t &it) const { return Iterator_t(IsIdxValid(it.index + 1) ? it.index + 1 : InvalidIndex()); }
I GetIndex(const Iterator_t &it) const { return it.index; }
bool IsIdxAfter(I i, const Iterator_t &it) const { return i > it.index; }
bool IsValidIterator(const Iterator_t &it) const { return IsIdxValid(it.index); }
Iterator_t InvalidIterator() const { return Iterator_t(InvalidIndex()); }
// element access
T& operator[](int i);
T const& operator[](int i) const;
T& Element(int i);
T const& Element(int i) const;
T& Element(I i);
T const& Element(I i) const;
T& operator[](I i);
T const& operator[](I i) const;
// Can we use this index?
bool IsIdxValid(int i) const;
bool IsIdxValid(I i) const;
// Specify the invalid ('null') index that we'll only return on failure
static const I INVALID_INDEX = (I)-1; // For use with COMPILE_TIME_ASSERT
static I InvalidIndex() { return INVALID_INDEX; }
// Gets the base address (can change when adding elements!)
T* Base();
T const* Base() const;
T *Base();
T const *Base() const;
// Attaches the buffer to external memory....
void SetExternalBuffer(T* pMemory, int numElements);
void SetExternalBuffer(T *pMemory, int numElements);
// Size
int NumAllocated() const;
@ -80,46 +111,54 @@ private:
EXTERNAL_BUFFER_MARKER = -1,
};
T* m_pMemory;
T *m_pMemory;
int m_nAllocationCount;
int m_nGrowSize;
};
//-----------------------------------------------------------------------------
// constructor, destructor
//-----------------------------------------------------------------------------
template< class T >
CUtlMemory<T>::CUtlMemory(int nGrowSize, int nInitAllocationCount) : m_pMemory(0),
m_nAllocationCount(nInitAllocationCount), m_nGrowSize(nGrowSize)
template <class T, class I>
CUtlMemory<T, I>::CUtlMemory(int nGrowSize, int nInitSize) : m_pMemory(0),
m_nAllocationCount(nInitSize), m_nGrowSize(nGrowSize)
{
Assert((nGrowSize >= 0) && (nGrowSize != EXTERNAL_BUFFER_MARKER));
if (m_nAllocationCount)
{
m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T));
m_pMemory = (T *)malloc(m_nAllocationCount * sizeof(T));
}
}
template< class T >
CUtlMemory<T>::CUtlMemory(T* pMemory, int numElements) : m_pMemory(pMemory),
template <class T, class I>
CUtlMemory<T, I>::CUtlMemory(T *pMemory, int numElements) : m_pMemory(pMemory),
m_nAllocationCount(numElements)
{
// Special marker indicating externally supplied memory
m_nGrowSize = EXTERNAL_BUFFER_MARKER;
}
template< class T >
CUtlMemory<T>::~CUtlMemory()
template <class T, class I>
CUtlMemory<T, I>::~CUtlMemory()
{
Purge();
}
template <class T, class I>
void CUtlMemory<T,I>::Init(int nGrowSize, int nInitSize)
{
Purge();
m_nGrowSize = nGrowSize;
m_nAllocationCount = nInitSize;
Assert(nGrowSize >= 0);
if (m_nAllocationCount)
{
m_pMemory = (T *)malloc(m_nAllocationCount * sizeof(T));
}
}
//-----------------------------------------------------------------------------
// Attaches the buffer to external memory....
//-----------------------------------------------------------------------------
template< class T >
void CUtlMemory<T>::SetExternalBuffer(T* pMemory, int numElements)
template <class T, class I>
void CUtlMemory<T, I>::SetExternalBuffer(T *pMemory, int numElements)
{
// Blow away any existing allocated memory
Purge();
@ -131,110 +170,91 @@ void CUtlMemory<T>::SetExternalBuffer(T* pMemory, int numElements)
m_nGrowSize = EXTERNAL_BUFFER_MARKER;
}
//-----------------------------------------------------------------------------
// element access
//-----------------------------------------------------------------------------
template< class T >
inline T& CUtlMemory<T>::operator[](int i)
template <class T, class I>
inline T& CUtlMemory<T, I>::operator[](I i)
{
Assert(IsIdxValid(i));
return m_pMemory[i];
}
template< class T >
inline T const& CUtlMemory<T>::operator[](int i) const
template <class T, class I>
inline T const& CUtlMemory<T, I>::operator[](I i) const
{
Assert(IsIdxValid(i));
return m_pMemory[i];
}
template< class T >
inline T& CUtlMemory<T>::Element(int i)
template <class T, class I>
inline T& CUtlMemory<T, I>::Element(I i)
{
Assert(IsIdxValid(i));
return m_pMemory[i];
}
template< class T >
inline T const& CUtlMemory<T>::Element(int i) const
template <class T, class I>
inline T const& CUtlMemory<T, I>::Element(I i) const
{
Assert(IsIdxValid(i));
return m_pMemory[i];
}
//-----------------------------------------------------------------------------
// is the memory externally allocated?
//-----------------------------------------------------------------------------
template< class T >
bool CUtlMemory<T>::IsExternallyAllocated() const
template <class T, class I>
bool CUtlMemory<T, I>::IsExternallyAllocated() const
{
return m_nGrowSize == EXTERNAL_BUFFER_MARKER;
}
template< class T >
void CUtlMemory<T>::SetGrowSize(int nSize)
template <class T, class I>
void CUtlMemory<T, I>::SetGrowSize(int nSize)
{
Assert((nSize >= 0) && (nSize != EXTERNAL_BUFFER_MARKER));
m_nGrowSize = nSize;
}
//-----------------------------------------------------------------------------
// Gets the base address (can change when adding elements!)
//-----------------------------------------------------------------------------
template< class T >
inline T* CUtlMemory<T>::Base()
template <class T, class I>
inline T *CUtlMemory<T, I>::Base()
{
return m_pMemory;
}
template< class T >
inline T const* CUtlMemory<T>::Base() const
template <class T, class I>
inline T const *CUtlMemory<T, I>::Base() const
{
return m_pMemory;
}
//-----------------------------------------------------------------------------
// Size
//-----------------------------------------------------------------------------
template< class T >
inline int CUtlMemory<T>::NumAllocated() const
template <class T, class I>
inline int CUtlMemory<T, I>::NumAllocated() const
{
return m_nAllocationCount;
}
template< class T >
inline int CUtlMemory<T>::Count() const
template <class T, class I>
inline int CUtlMemory<T, I>::Count() const
{
return m_nAllocationCount;
}
//-----------------------------------------------------------------------------
// Is element index valid?
//-----------------------------------------------------------------------------
template< class T >
inline bool CUtlMemory<T>::IsIdxValid(int i) const
template <class T, class I>
inline bool CUtlMemory<T, I>::IsIdxValid(I i) const
{
return (i >= 0) && (i < m_nAllocationCount);
return (((int)i) >= 0) && (((int) i) < m_nAllocationCount);
}
//-----------------------------------------------------------------------------
// Grows the memory
//-----------------------------------------------------------------------------
template< class T >
void CUtlMemory<T>::Grow(int num)
template <class T, class I>
void CUtlMemory<T, I>::Grow(int num)
{
Assert(num > 0);
if (IsExternallyAllocated())
{
// Can't grow a buffer whose memory was externally allocated
// Can't grow a buffer whose memory was externally allocated
Assert(0);
return;
}
@ -265,27 +285,24 @@ void CUtlMemory<T>::Grow(int num)
if (m_pMemory)
{
m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T));
m_pMemory = (T *)realloc(m_pMemory, m_nAllocationCount * sizeof(T));
}
else
{
m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T));
m_pMemory = (T *)malloc(m_nAllocationCount * sizeof(T));
}
}
//-----------------------------------------------------------------------------
// Makes sure we've got at least this much memory
//-----------------------------------------------------------------------------
template< class T >
inline void CUtlMemory<T>::EnsureCapacity(int num)
template <class T, class I>
inline void CUtlMemory<T, I>::EnsureCapacity(int num)
{
if (m_nAllocationCount >= num)
return;
if (IsExternallyAllocated())
{
// Can't grow a buffer whose memory was externally allocated
// Can't grow a buffer whose memory was externally allocated
Assert(0);
return;
}
@ -293,31 +310,25 @@ inline void CUtlMemory<T>::EnsureCapacity(int num)
m_nAllocationCount = num;
if (m_pMemory)
{
m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T));
m_pMemory = (T *)realloc(m_pMemory, m_nAllocationCount * sizeof(T));
}
else
{
m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T));
m_pMemory = (T *)malloc(m_nAllocationCount * sizeof(T));
}
}
//-----------------------------------------------------------------------------
// Memory deallocation
//-----------------------------------------------------------------------------
template< class T >
void CUtlMemory<T>::Purge()
template <class T, class I>
void CUtlMemory<T, I>::Purge()
{
if (!IsExternallyAllocated())
{
if (m_pMemory)
{
free((void*)m_pMemory);
free((void *)m_pMemory);
m_pMemory = 0;
}
m_nAllocationCount = 0;
}
}
#endif // UTLSTORAGE_H

View File

@ -16,19 +16,20 @@
#include "ed_strpool.h"
#include "memory.h"
#include "strtools.h"
// Hook stuff
#include "hookers/engine/hooklist.h"
// Valve libs stuff
#include "tier0/platform.h"
#include "tier0/dbg.h"
#include "engine.h"
#include "platform.h"
#include "RehldsRuntimeConfig.h"
#include "rehlds_debug.h"
// Valve libs stuff
#include "tier0/platform.h"
#include "tier0/dbg.h"
#include "interface.h"
#include "iregistry.h"