Add Team Fortress 2 SDK

This commit is contained in:
Autumn Ashton 2025-02-18 18:51:37 +00:00
parent 44f8f18cd1
commit 0759e2e8e1
5255 changed files with 1153782 additions and 222645 deletions

16
.gitattributes vendored
View File

@ -1,9 +1,5 @@
creategameprojects text buildallprojects text
createallprojects text vpc binary
xcode_ccache_wrapper text
vpc text
vpc_linux binary
vpc_osx binary
*.sh text *.sh text
*.bat text *.bat text
@ -37,15 +33,13 @@ vpc_osx binary
*.asm text *.asm text
.gitignore text .gitignore text
sourcesdk_def.mak text README.md text
smdlexp.mak text
README text
CONTRIBUTING text CONTRIBUTING text
LICENSE text LICENSE text
*.exe binary *.exe binary
*.dll binary
protoc binary protoc binary
ccache binary ccache binary
gtest_output_test_golden_lin.txt binary *_english.txt binary
mod_*_english.txt binary

448
.gitignore vendored
View File

@ -54,3 +54,451 @@ config.cfg
# shader files # shader files
*.tmp *.tmp
# GCH
*.h.gch
*.h.gch.d
*.sln
*.slnx
*.vcproj
*.vcxproj
*.vcxproj.*
*.obj
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs
mono_crash.*
.vs/*
*.pdb
*.log
*.tlog
*.exp
*.FileListAbsolute.txt
evntprov.h
generated_proto_*
*.pb.cc
*.pb.hh
*_Release/
*_Debug/
Release/x64/*
Debug/x64/*
Release_*/
Debug_*/
*.lastbuildstate
*.recipe
*_nut.h # vscript autogen file
*.vpc.sentinel
*.vpc_crc
*.vpc_cache
*_nut.h
__vpc__/
_vpc_/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml

View File

@ -36,4 +36,3 @@ fine community-maintained repositories instead:
If you are going to make a pull request, please keep them as granular as If you are going to make a pull request, please keep them as granular as
possible. Pull requests with 3-4 unrelated changes in them aren't going to possible. Pull requests with 3-4 unrelated changes in them aren't going to
be accepted. be accepted.

50
LICENSE
View File

@ -1,43 +1,23 @@
SOURCE 1 SDK LICENSE SOURCE 1 SDK LICENSE
Source SDK Copyright(c) Valve Corp. Copyright(c) Valve Corporation. All rights reserved
THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE THESE LICENSE TERMS ARE AN AGREEMENT BETWEEN YOU AND VALVE CORPORATION ("VALVE") FOR THE SOURCE 1 SDK (“SDK”).
CORPORATION ("Valve"). PLEASE READ IT BEFORE DOWNLOADING OR USING PLEASE READ THEM BEFORE DOWNLOADING OR USING THE SDK. BY USING THE SDK, YOU ACKNOWLEDGE THAT YOU HAVE READ AND AGREE
THE SOURCE ENGINE SDK ("SDK"). BY DOWNLOADING AND/OR USING THE TO BE BOUND BY THESE LICENSE TERMS. IF YOU DO NOT AGREE TO THESE TERMS, YOU MAY NOT USE THE SDK.
SOURCE ENGINE SDK YOU ACCEPT THIS LICENSE. IF YOU DO NOT AGREE TO
THE TERMS OF THIS LICENSE PLEASE DONT DOWNLOAD OR USE THE SDK.
You may, free of charge, download and use the SDK to develop a modified Valve game You may, free of charge, use, copy, and modify the SDK to develop a modified Valve game running on Valve's Source 1 engine,
running on the Source engine. You may distribute your modified Valve game in source and which game can be distributed in source and object code form if it is free and meets the terms of use for Valve games in the
object code form, but only for free. Terms of use for Valve games are found in the Steam Steam Subscriber Agreement located here: http://store.steampowered.com/subscriber_agreement/. You may also distribute the SDK
Subscriber Agreement located here: http://store.steampowered.com/subscriber_agreement/ (or any substantial portions of the SDK) and any modifications you make to the SDK in both source code and object code form,
provided you meet the following conditions: distributions of the SDK must (1) be free of charge; (2) include this LICENSE file
and thirdpartylegalnotices.txt; and (3) include the above copyright notice and the additional legal provisions below.
You may copy, modify, and distribute the SDK and any modifications you make to the DISCLAIMER OF WARRANTIES. THE SDK AND ANY OTHER MATERIAL YOU DOWNLOAD IS PROVIDED BY VALVE "AS IS" AND “AS AVAILABLE” WITHOUT
SDK in source and object code form, but only for free. Any distribution of this SDK must WARRANTY OF ANY KIND. VALVE EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND WHETHER EXPRESS OR IMPLIED,
include this LICENSE file and thirdpartylegalnotices.txt. INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, TITLE AND FITNESS FOR A PARTICULAR PURPOSE.
Any distribution of the SDK or a substantial portion of the SDK must include the above LIMITATION OF LIABILITY. VALVE AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
copyright notice and the following: OR CONSEQUENTIAL DAMAGES WHATSOEVER ) THAT MAY BE INCURRED BY YOU EVEN IF VALVE HAS BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF SUCH DAMAGES.
DISCLAIMER OF WARRANTIES. THE SOURCE SDK AND ANY
OTHER MATERIAL DOWNLOADED BY LICENSEE IS PROVIDED
"AS IS". VALVE AND ITS SUPPLIERS DISCLAIM ALL
WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED
WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT,
TITLE AND FITNESS FOR A PARTICULAR PURPOSE.
LIMITATION OF LIABILITY. IN NO EVENT SHALL VALVE OR
ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
ARISING OUT OF THE USE OF OR INABILITY TO USE THE
ENGINE AND/OR THE SDK, EVEN IF VALVE HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
If you would like to use the SDK for a commercial purpose, please contact Valve at
sourceengine@valvesoftware.com.

43
README
View File

@ -1,43 +0,0 @@
SOURCE 1 SDK LICENSE
Source SDK Copyright(c) Valve Corp.
THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE
CORPORATION ("Valve"). PLEASE READ IT BEFORE DOWNLOADING OR USING
THE SOURCE ENGINE SDK ("SDK"). BY DOWNLOADING AND/OR USING THE
SOURCE ENGINE SDK YOU ACCEPT THIS LICENSE. IF YOU DO NOT AGREE TO
THE TERMS OF THIS LICENSE PLEASE DONT DOWNLOAD OR USE THE SDK.
You may, free of charge, download and use the SDK to develop a modified Valve game
running on the Source engine. You may distribute your modified Valve game in source and
object code form, but only for free. Terms of use for Valve games are found in the Steam
Subscriber Agreement located here: http://store.steampowered.com/subscriber_agreement/
You may copy, modify, and distribute the SDK and any modifications you make to the
SDK in source and object code form, but only for free. Any distribution of this SDK must
include this LICENSE file and thirdpartylegalnotices.txt.
Any distribution of the SDK or a substantial portion of the SDK must include the above
copyright notice and the following:
DISCLAIMER OF WARRANTIES. THE SOURCE SDK AND ANY
OTHER MATERIAL DOWNLOADED BY LICENSEE IS PROVIDED
"AS IS". VALVE AND ITS SUPPLIERS DISCLAIM ALL
WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED
WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT,
TITLE AND FITNESS FOR A PARTICULAR PURPOSE.
LIMITATION OF LIABILITY. IN NO EVENT SHALL VALVE OR
ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
ARISING OUT OF THE USE OF OR INABILITY TO USE THE
ENGINE AND/OR THE SDK, EVEN IF VALVE HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
If you would like to use the SDK for a commercial purpose, please contact Valve at
sourceengine@valvesoftware.com.

67
README.md Normal file
View File

@ -0,0 +1,67 @@
# Source SDK 2013
Source code for Source SDK 2013.
Contains the game code for Half-Life 2, HL2: DM and TF2.
**Now including Team Fortress 2! ✨**
## Build instructions
Clone the repository using the following command:
`git clone https://github.com/ValveSoftware/source-sdk-2013`
### Windows
Requirements:
- Source SDK 2013 Multiplayer installed via Steam
- Visual Studio 2022
Inside the cloned directory, navigate to `src`, run:
```bat
createallprojects.bat
```
This will generate the Visual Studio project `everything.sln` which will be used to build your mod.
Then, on the menu bar, go to `Build > Build Solution`, and wait for everything to build.
You can then select the `Client (Mod Name)` project you wish to run, right click and select `Set as Startup Project` and hit the big green `> Local Windows Debugger` button on the tool bar in order to launch your mod.
The default launch options should be already filled in for the `Release` configuration.
### Linux
Requirements:
- Source SDK 2013 Multiplayer installed via Steam
- podman
Inside the cloned directory, navigate to `src`, run:
```bash
./buildallprojects
```
This will build all the projects related to the SDK and your mods automatically against the Steam Runtime.
You can then, in the root of the cloned directory, you can navigate to `game` and run your mod by launching the build launcher for your mod project, eg:
```bash
./mod_tf
```
*Mods that are distributed on Steam MUST be built against the Steam Runtime, which the above steps will automatically do for you.*
## Distributing your Mod
There is guidance on distributing your mod both on and off Steam available at the following link:
https://partner.steamgames.com/doc/sdk/uploading/distributing_source_engine
## Additional Resources
- [Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Source_SDK_2013)
## License
The SDK is licensed to users on a non-commercial basis under the [SOURCE 1 SDK LICENSE](LICENSE), which is contained in the [LICENSE](LICENSE) file in the root of the repository.
For more information, see [Distributing your Mod](#markdown-header-distributing-your-mod).

Binary file not shown.

Binary file not shown.

View File

@ -2,17 +2,17 @@
{ {
game "My First HL2MP Mod" game "My First HL2MP Mod"
title "HALF+LIFE'" title "HALF+LIFE'"
title2 "deathmatch mod" title2 "deathmatch"
type multiplayer_only type multiplayer_only
nomodels 0 nomodels 0
nohimodel 1 nohimodel 1
nocrosshair 1 nocrosshair 1
supportsvr 1
hidden_maps hidden_maps
{ {
"test_speakers" 1 "test_speakers" 1
"test_hardware" 1 "test_hardware" 1
} }
supportsvr 1
FileSystem FileSystem
@ -20,66 +20,76 @@
SteamAppId 243750 SteamAppId 243750
// //
// The code that loads this file automatically does a few things here: // Setup engine search paths.
// //
// 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin // If a search path contains "_english", and the current language is not english, then
// 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end. // another search path will be inserted above the english one by replacing "_english" with
// For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it. // the appropriate language.
// 3. For the first "Game" search path, it adds a search path called "MOD".
// 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
// //
// To debug how the engine has parsed this file, type "path" at the console.
// //
// Search paths are relative to the base directory, which is where hl2.exe is found. // Search paths are relative to the base directory, which is where hl2.exe is found.
// //
// |gameinfo_path| points at the directory where gameinfo.txt is. // |gameinfo_path| points at the directory where gameinfo.txt is.
// We always want to mount that directory relative to gameinfo.txt, so // |all_source_engine_paths| points at the directory cintaining HL2 shared content.
// people can mount stuff in c:\mymod, and the main game resources are in
// someplace like c:\program files\valve\steam\steamapps\half-life 2.
// //
SearchPaths SearchPaths
{ {
// First, mount all user customizations. This will search for VPKs and subfolders // First, mount all user customizations. This will search for VPKs and subfolders
// and mount them in alphabetical order. The easiest way to distribute a mod is to // and mount them in alphabetical order. The easiest way to distribute a mod is to
// pack up the custom content into a VPK. To "install" a mod, just drop it in this // pack up the custom content into a VPK. To "install" a mod, just drop it in this
// folder. // folder.
// //
// Note that this folder is scanned only when the game is booted. // Note that this folder is scanned only when the game is booted.
game+mod hl2mp/custom/* game+mod mod_hl2mp/custom/*
game+mod hl2/custom/*
// Now search loose files. We'll set the directory containing the gameinfo.txt file // Now search loose files. We'll set the directory containing the gameinfo.txt file
// as the first "mod" search path (after any user customizations). This is also the one // as the first "mod" search path (after any user customizations). This is also the one
// that's used when writing to the "mod" path. // that's used when writing to the "mod" path.
game+mod+mod_write+default_write_path |gameinfo_path|. mod+mod_write |gameinfo_path|.
game+game_write |gameinfo_path|.
default_write_path |gameinfo_path|.
gamebin |gameinfo_path|bin gamebin |gameinfo_path|bin
// We search VPK files before ordinary folders, because most files will be found in // We search VPK files before ordinary folders, because most files will be found in
// VPK and we can avoid making thousands of file system calls to attempt to open files // VPK and we can avoid making thousands of file system calls to attempt to open files
// in folders where they don't exist. (Searching a VPK is much faster than making an operating // in folders where they don't exist. (Searching a VPK is much faster than making an operating
// system call.) // system call.)
game_lv hl2/hl2_lv.vpk game+mod |appid_243750|hl2mp/hl2mp_english.vpk
game+mod hl2mp/hl2mp_english.vpk game+mod |appid_243750|hl2mp/hl2mp_pak.vpk
game+mod hl2mp/hl2mp_pak.vpk
game |all_source_engine_paths|hl2/hl2_english.vpk
game |all_source_engine_paths|hl2/hl2_pak.vpk
game |all_source_engine_paths|hl2/hl2_textures.vpk
game |all_source_engine_paths|hl2/hl2_sound_vo_english.vpk
game |all_source_engine_paths|hl2/hl2_sound_misc.vpk
game |all_source_engine_paths|hl2/hl2_misc.vpk
platform |all_source_engine_paths|platform/platform_misc.vpk
// Add the HL2 directory as a game search path. This is also where where writes game |appid_243750|hl2_complete/hl2_complete_textures.vpk
// to the "game" path go. game |appid_243750|hl2_complete/hl2_complete_sound_vo_english.vpk
game+game_write hl2mp game |appid_243750|hl2_complete/hl2_complete_sound_misc.vpk
game |appid_243750|hl2_complete/hl2_complete_misc.vpk
// Where the game's binaries are game |appid_243750|hl2/hl2_textures.vpk
gamebin hl2mp/bin game |appid_243750|hl2/hl2_sound_vo_english.vpk
game |appid_243750|hl2/hl2_sound_misc.vpk
game |appid_243750|hl2/hl2_misc.vpk
platform |appid_243750|platform/platform_misc.vpk
game |appid_243750|hl2mp
// Last, mount in shared HL2 loose files // Last, mount in shared HL2 loose files
game |all_source_engine_paths|hl2mp game |appid_243750|hl2_complete
game |all_source_engine_paths|hl2 game |appid_243750|hl2
platform |all_source_engine_paths|platform platform |appid_243750|platform
// Random files downloaded from gameservers go into a seperate directory, so
// that it's easy to keep those files segregated from the official game files
// or customizations intentially installed by the user.
//
// This directory is searched LAST. If you visit a server and download
// a custom model, etc, we don't want that file to override the default
// game file indefinitely (after you have left the server). Servers CAN have
// custom content that overrides the default game files, it just needs to be
// packed up in the .bsp file so that it will be mounted as a map search pack.
// The map search pack is mounted at the top of the search path list,
// but only while you are connected that server and on that map.
game+download mod_hl2mp/download
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
"GameMenu"
{
"1"
{
"label" "#GameUI_GameMenu_ResumeGame"
"command" "ResumeGame"
"OnlyInGame" "1"
}
"2"
{
"label" "#GameUI_GameMenu_Disconnect"
"command" "Disconnect"
"OnlyInGame" "1"
}
"3"
{
"label" "#GameUI_GameMenu_PlayerList"
"command" "OpenPlayerListDialog"
"OnlyInGame" "1"
}
"4"
{
"label" ""
"command" ""
"OnlyInGame" "1"
}
"5"
{
"label" "#GameUI_GameMenu_FindServers"
"command" "OpenServerBrowser"
}
"6"
{
"label" "#GameUI_GameMenu_CreateServer"
"command" "OpenCreateMultiplayerGameDialog"
}
"7"
{
"label" "#GameUI_GameMenu_ActivateVR"
"command" "engine vr_activate"
"InGameOrder" "40"
"OnlyWhenVREnabled" "1"
"OnlyWhenVRInactive" "1"
}
"8"
{
"label" "#GameUI_GameMenu_DeactivateVR"
"command" "engine vr_deactivate"
"InGameOrder" "40"
"OnlyWhenVREnabled" "1"
"OnlyWhenVRActive" "1"
}
"10"
{
"label" "#GameUI_GameMenu_Options"
"command" "OpenOptionsDialog"
}
"11"
{
"label" "#GameUI_GameMenu_Quit"
"command" "Quit"
}
}

View File

@ -55,6 +55,17 @@ event FadeInTeamLine
Animate TeamDisplay Alpha "255" Linear 0.0 0.5 Animate TeamDisplay Alpha "255" Linear 0.0 0.5
} }
event WeaponHighlight
{
Animate HudWeaponSelection Blur "7" Linear 0.0 0.0
Animate HudWeaponSelection Blur "0" Deaccel 0.01 0.75
Animate HudWeaponSelection SelectedBoxColor "250 220 0 80" Linear 0.0 0.01
Animate HudWeaponSelection SelectedBoxColor "BgColor" Deaccel 0.1 1.5
Animate HudWeaponSelection SelectedFgColor "BrightFg" Linear 0.0 0.1
Animate HudWeaponSelection SelectedFgColor "FgColor" Linear 5.0 1.5
}
event OpenWeaponSelectionMenu event OpenWeaponSelectionMenu
{ {
StopEvent CloseWeaponSelectionMenu 0.0 StopEvent CloseWeaponSelectionMenu 0.0
@ -62,7 +73,8 @@ event OpenWeaponSelectionMenu
StopEvent FadeOutWeaponSelectionMenu 0.0 StopEvent FadeOutWeaponSelectionMenu 0.0
// make the display visible // make the display visible
Animate HudWeaponSelection Alpha "128" Linear 0.0 0.1 Animate HudWeaponSelection Alpha "128" Linear 0.0 0.1 [$WIN32]
Animate HudWeaponSelection Alpha "192" Linear 0.0 0.1 [$X360]
Animate HudWeaponSelection SelectionAlpha "255" Linear 0.0 0.1 Animate HudWeaponSelection SelectionAlpha "255" Linear 0.0 0.1
Animate HudWeaponSelection FgColor "FgColor" Linear 0.0 0.1 Animate HudWeaponSelection FgColor "FgColor" Linear 0.0 0.1
Animate HudWeaponSelection TextColor "BrightFg" Linear 0.0 0.1 Animate HudWeaponSelection TextColor "BrightFg" Linear 0.0 0.1
@ -81,10 +93,14 @@ event CloseWeaponSelectionMenu
event FadeOutWeaponSelectionMenu event FadeOutWeaponSelectionMenu
{ {
// slowly hide the whole thing // slowly hide the whole thing
Animate HudWeaponSelection FgColor "0 0 0 0" Linear 0.0 1.5 Animate HudWeaponSelection FgColor "0 0 0 0" Linear 0.5 1.0
Animate HudWeaponSelection TextColor "0 0 0 0" Linear 0.0 1.5 Animate HudWeaponSelection TextColor "0 0 0 0" Linear 0.5 1.0
Animate HudWeaponSelection Alpha "0" Linear 0.0 1.5 Animate HudWeaponSelection Alpha "0" Linear 0.5 1.0
Animate HudWeaponSelection SelectionAlpha "0" Linear 0.0 1.5 Animate HudWeaponSelection SelectionAlpha "0" Linear 0.5 1.0
Animate HudWeaponSelection WeaponBoxDist1Alpha "0 0 0 0" Linear 0.0 0.5
Animate HudWeaponSelection WeaponBoxDist2Alpha "0 0 0 0" Linear 0.0 0.5
Animate HudWeaponSelection WeaponBoxDist3Alpha "0 0 0 0" Linear 0.0 0.5
} }
event SuitAuxPowerMax event SuitAuxPowerMax
@ -116,31 +132,37 @@ event SuitAuxPowerIncreasedAbove25
event SuitAuxPowerNoItemsActive event SuitAuxPowerNoItemsActive
{ {
// resize the aux power to be the smallest size // resize the aux power to be the smallest size
Animate HudSuitPower Size "102 26" Linear 0.0 0.4 Animate HudSuitPower Size "102 26" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Position "16 400" Linear 0.0 0.4 Animate HudSuitPower Position "16 400" Linear 0.0 0.4 [!$DECK]
// Animate HudSuitPower text_xpos "8" Linear 0.0 0.4 Animate HudSuitPower Size "112 30" Linear 0.0 0.4 [$DECK]
// Animate HudSuitPower text_ypos "15" Linear 0.0 0.4 Animate HudSuitPower Position "16 390" Linear 0.0 0.4 [$DECK]
} }
event SuitAuxPowerOneItemActive event SuitAuxPowerOneItemActive
{ {
// resize the aux power to fit one item // resize the aux power to fit one item
Animate HudSuitPower Size "102 36" Linear 0.0 0.4 Animate HudSuitPower Size "102 36" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Position "16 390" Linear 0.0 0.4 Animate HudSuitPower Position "16 390" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Size "112 44" Linear 0.0 0.4 [$DECK]
Animate HudSuitPower Position "16 372" Linear 0.0 0.4 [$DECK]
} }
event SuitAuxPowerTwoItemsActive event SuitAuxPowerTwoItemsActive
{ {
// resize the aux power to fit two items // resize the aux power to fit two items
Animate HudSuitPower Size "102 46" Linear 0.0 0.4 Animate HudSuitPower Size "102 46" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Position "16 380" Linear 0.0 0.4 Animate HudSuitPower Position "16 380" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Size "112 56" Linear 0.0 0.4 [$DECK]
Animate HudSuitPower Position "16 364" Linear 0.0 0.4 [$DECK]
} }
event SuitAuxPowerThreeItemsActive event SuitAuxPowerThreeItemsActive
{ {
// resize the aux power to fit three items // resize the aux power to fit three items
Animate HudSuitPower Size "102 56" Linear 0.0 0.4 Animate HudSuitPower Size "102 56" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Position "16 370" Linear 0.0 0.4 Animate HudSuitPower Position "16 370" Linear 0.0 0.4 [!$DECK]
Animate HudSuitPower Size "112 70" Linear 0.0 0.4 [$DECK]
Animate HudSuitPower Position "16 350" Linear 0.0 0.4 [$DECK]
} }
event SuitFlashlightOn event SuitFlashlightOn
@ -231,8 +253,8 @@ event HudPlayerDeath
StopEvent HealthLoop 0.0 StopEvent HealthLoop 0.0
StopEvent HealthPulse 0.0 StopEvent HealthPulse 0.0
Animate HudDamageIndicator DmgFullscreenColor "255 0 0 8" Deaccel 0.1 0.2 Animate HudDamageIndicator DmgFullscreenColor "255 0 0 96" Deaccel 0.1 0.2
Animate HudDamageIndicator DmgFullscreenColor "255 0 0 48" Deaccel 0.3 4.0 Animate HudDamageIndicator DmgFullscreenColor "255 0 0 255" Deaccel 0.3 4.0
} }
event HealthIncreasedAbove20 event HealthIncreasedAbove20
@ -501,24 +523,35 @@ event WeaponChanged
} }
// ran if we just changed to a weapon that needs clip ammo // ran if we just changed to a weapon that needs clip ammo
event WeaponUsesClips event WeaponUsesClips [!$DECK]
{ {
Animate HudAmmo Position "r150 432" Deaccel 0.0 0.4 Animate HudAmmo Position "r150 432" Deaccel 0.0 0.4
Animate HudAmmo Size "132 36" Deaccel 0.0 0.4 Animate HudAmmo Size "132 36" Deaccel 0.0 0.4
} }
event WeaponUsesClips [$DECK]
{
Animate HudAmmo Position "r162 426" Deaccel 0.0 0.4
Animate HudAmmo Size "144 42" Deaccel 0.0 0.4
}
// ran if we just changed to a weapon that does not use clip ammo // ran if we just changed to a weapon that does not use clip ammo
event WeaponDoesNotUseClips event WeaponDoesNotUseClips [!$DECK]
{ {
Animate HudAmmo Position "r118 432" Deaccel 0.0 0.4 Animate HudAmmo Position "r118 432" Deaccel 0.0 0.4
Animate HudAmmo Size "100 36" Deaccel 0.0 0.4 Animate HudAmmo Size "100 36" Deaccel 0.0 0.4
} }
event WeaponDoesNotUseClips [$DECK]
{
Animate HudAmmo Position "r130 426" Deaccel 0.0 0.4
Animate HudAmmo Size "120 42" Deaccel 0.0 0.4
}
event WeaponUsesSecondaryAmmo event WeaponUsesSecondaryAmmo
{ {
StopAnimation HudAmmo Position 0.0 StopAnimation HudAmmo Position 0.0
StopAnimation HudAmmo Size 0.0 StopAnimation HudAmmo Size 0.0
StopPanelAnimations HudAmmoSecondary 0.0 StopPanelAnimations HudAmmoSecondary 0.0
//StopPanelAnimations HudAmmo 0.0
Animate HudAmmoSecondary BgColor "250 220 0 60" Linear 0.0 0.1 Animate HudAmmoSecondary BgColor "250 220 0 60" Linear 0.0 0.1
Animate HudAmmoSecondary BgColor "BgColor" Deaccel 0.1 1.0 Animate HudAmmoSecondary BgColor "BgColor" Deaccel 0.1 1.0
@ -526,8 +559,10 @@ event WeaponUsesSecondaryAmmo
Animate HudAmmoSecondary FgColor "FgColor" Linear 0.2 1.5 Animate HudAmmoSecondary FgColor "FgColor" Linear 0.2 1.5
Animate HudAmmoSecondary Alpha 255 Linear 0.0 0.1 Animate HudAmmoSecondary Alpha 255 Linear 0.0 0.1
Animate HudAmmo Position "r222 432" Deaccel 0.0 0.5 Animate HudAmmo Position "r222 432" Deaccel 0.0 0.5 [!$DECK]
Animate HudAmmo Size "132 36" Deaccel 0.0 0.4 Animate HudAmmo Size "132 36" Deaccel 0.0 0.4 [!$DECK]
Animate HudAmmo Position "r234 426" Deaccel 0.0 0.5 [$DECK]
Animate HudAmmo Size "144 42" Deaccel 0.0 0.4 [$DECK]
} }
event WeaponDoesNotUseSecondaryAmmo event WeaponDoesNotUseSecondaryAmmo
@ -548,25 +583,54 @@ event CraneMagnetFlash
event HintMessageShow event HintMessageShow
{ {
// show the hints StopPanelAnimations HudHintDisplay 0.0
Animate HudHintDisplay Alpha 255 Linear 0.0 0.5
Animate HudHintDisplay HintSize "1" Deaccel 0.0 0.3
Animate HudHintDisplay FgColor "FgColor" Linear 0.4 0.4
// flash text // flash text
Animate HudHintDisplay FgColor "FgColor" Linear 0.0 0.01 Animate HudHintDisplay FgColor "FgColor" Linear 1.5 0.01
Animate HudHintDisplay FgColor "255 220 0 255" Linear 0.5 0.2 Animate HudHintDisplay FgColor "255 220 0 255" Linear 2.0 0.2
Animate HudHintDisplay FgColor "FgColor" Linear 0.7 0.2 Animate HudHintDisplay FgColor "FgColor" Linear 2.2 0.2
Animate HudHintDisplay FgColor "255 220 0 255" Linear 1.5 0.2 Animate HudHintDisplay FgColor "255 220 0 255" Linear 3.0 0.2
Animate HudHintDisplay FgColor "FgColor" Linear 1.7 0.2 Animate HudHintDisplay FgColor "FgColor" Linear 3.2 0.2
// hide the panel after a while // hide the panel after a while
Animate HudHintDisplay Alpha 0 Linear 12.0 1.0 Animate HudHintDisplay FgColor "255 220 0 0" Linear 10.0 0.2
Animate HudHintDisplay HintSize "0" Deaccel 10.2 0.3
} }
event HintMessageHide event HintMessageHide
{ {
Animate HudHintDisplay Alpha 0 Linear 0.0 0.5 Animate HudHintDisplay FgColor "255 220 0 0" Linear 0.0 0.2
Animate HudHintDisplay HintSize "0" Deaccel 0.2 0.3
} }
event KeyHintMessageShow
{
StopPanelAnimations HudHintKeyDisplay 0.0
// show the hints
Animate HudHintKeyDisplay Alpha 255 Linear 0.0 0.5
// flash text
Animate HudHintKeyDisplay FgColor "FgColor" Linear 0.0 0.01
Animate HudHintKeyDisplay FgColor "255 220 0 255" Linear 0.5 0.2
Animate HudHintKeyDisplay FgColor "FgColor" Linear 0.7 0.2
Animate HudHintKeyDisplay FgColor "255 220 0 255" Linear 1.5 0.2
Animate HudHintKeyDisplay FgColor "FgColor" Linear 1.7 0.2
// hide the panel after a while
Animate HudHintKeyDisplay Alpha 0 Linear 12.0 1.0
}
event KeyHintMessageHide
{
Animate HudHintKeyDisplay Alpha 0 Linear 0.0 0.5
}
event SquadMemberAdded event SquadMemberAdded
{ {
StopEvent SquadMemberDied 0.0 StopEvent SquadMemberDied 0.0
@ -638,3 +702,161 @@ event PoisonLoop
{ {
RunEvent PoisonPulse 0.0 RunEvent PoisonPulse 0.0
} }
// Commentary hud element
event ShowCommentary
{
StopEvent HideCommentary 0.0
Animate HudCommentary Alpha 255 Linear 0.0 0.5
}
event HideCommentary
{
StopEvent ShowCommentary 0.0
Animate HudCommentary Alpha 0 Linear 0.0 0.5
}
// Voting
event PulseOption1
{
Animate Option2Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option1Background_Selected Alpha 255 Linear 0.0 0.001
Animate Option1Background_Selected Alpha 128 Linear 0.5 1.5
Animate YesLeftLabel Alpha 0 Linear 1.25 1.7
Animate YesIcon Alpha 0 Linear 1.25 1.7
Animate YesRightLabel Alpha 0 Linear 1.25 1.7
Animate NoLeftLabel Alpha 0 Linear 1.25 1.7
Animate NoIcon Alpha 0 Linear 1.25 1.7
Animate NoRightLabel Alpha 0 Linear 1.25 1.7
Animate LabelOption2 Alpha 60 Linear 1.25 1.7
Animate LabelOption3 Alpha 60 Linear 1.25 1.7
Animate LabelOption4 Alpha 60 Linear 1.25 1.7
Animate LabelOption5 Alpha 60 Linear 1.25 1.7
}
event PulseOption2
{
Animate Option1Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 255 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 128 Linear 0.5 1.5
Animate YesLeftLabel Alpha 0 Linear 1.25 1.7
Animate YesIcon Alpha 0 Linear 1.25 1.7
Animate YesRightLabel Alpha 0 Linear 1.25 1.7
Animate NoLeftLabel Alpha 0 Linear 1.25 1.7
Animate NoIcon Alpha 0 Linear 1.25 1.7
Animate NoRightLabel Alpha 0 Linear 1.25 1.7
Animate LabelOption1 Alpha 60 Linear 1.25 1.7
Animate LabelOption3 Alpha 60 Linear 1.25 1.7
Animate LabelOption4 Alpha 60 Linear 1.25 1.7
Animate LabelOption5 Alpha 60 Linear 1.25 1.7
}
event PulseOption3
{
Animate Option1Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 255 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 128 Linear 0.5 1.5
Animate YesLeftLabel Alpha 0 Linear 1.25 1.7
Animate YesIcon Alpha 0 Linear 1.25 1.7
Animate YesRightLabel Alpha 0 Linear 1.25 1.7
Animate NoLeftLabel Alpha 0 Linear 1.25 1.7
Animate NoIcon Alpha 0 Linear 1.25 1.7
Animate NoRightLabel Alpha 0 Linear 1.25 1.7
Animate LabelOption1 Alpha 60 Linear 1.25 1.7
Animate LabelOption2 Alpha 60 Linear 1.25 1.7
Animate LabelOption4 Alpha 60 Linear 1.25 1.7
Animate LabelOption5 Alpha 60 Linear 1.25 1.7
}
event PulseOption4
{
Animate Option1Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 255 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 128 Linear 0.5 1.5
Animate YesLeftLabel Alpha 0 Linear 1.25 1.7
Animate YesIcon Alpha 0 Linear 1.25 1.7
Animate YesRightLabel Alpha 0 Linear 1.25 1.7
Animate NoLeftLabel Alpha 0 Linear 1.25 1.7
Animate NoIcon Alpha 0 Linear 1.25 1.7
Animate NoRightLabel Alpha 0 Linear 1.25 1.7
Animate LabelOption1 Alpha 60 Linear 1.25 1.7
Animate LabelOption2 Alpha 60 Linear 1.25 1.7
Animate LabelOption3 Alpha 60 Linear 1.25 1.7
Animate LabelOption5 Alpha 60 Linear 1.25 1.7
}
event PulseOption5
{
Animate Option1Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 255 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 128 Linear 0.5 1.5
Animate YesLeftLabel Alpha 0 Linear 1.25 1.7
Animate YesIcon Alpha 0 Linear 1.25 1.7
Animate YesRightLabel Alpha 0 Linear 1.25 1.7
Animate NoLeftLabel Alpha 0 Linear 1.25 1.7
Animate NoIcon Alpha 0 Linear 1.25 1.7
Animate NoRightLabel Alpha 0 Linear 1.25 1.7
Animate LabelOption1 Alpha 60 Linear 1.25 1.7
Animate LabelOption2 Alpha 60 Linear 1.25 1.7
Animate LabelOption3 Alpha 60 Linear 1.25 1.7
Animate LabelOption4 Alpha 60 Linear 1.25 1.7
}
event HideVoteBackgrounds
{
Animate Option1Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option2Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option3Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option4Background_Selected Alpha 0 Linear 0.0 0.001
Animate Option5Background_Selected Alpha 0 Linear 0.0 0.001
Animate YesLeftLabel Alpha 255 Linear 0.0 0.001
Animate YesIcon Alpha 255 Linear 0.0 0.001
Animate YesRightLabel Alpha 255 Linear 0.0 0.001
Animate NoLeftLabel Alpha 255 Linear 0.0 0.001
Animate NoIcon Alpha 255 Linear 0.0 0.001
Animate NoRightLabel Alpha 255 Linear 0.0 0.001
Animate LabelOption1 Alpha 255 Linear 0.0 0.001
Animate LabelOption2 Alpha 255 Linear 0.0 0.001
Animate LabelOption3 Alpha 255 Linear 0.0 0.001
Animate LabelOption4 Alpha 255 Linear 0.0 0.001
Animate LabelOption5 Alpha 255 Linear 0.0 0.001
}

View File

@ -1,6 +1,6 @@
"Resource/HudLayout.res" "Resource/HudLayout.res"
{ {
HudHealth HudHealth [!$DECK]
{ {
"fieldName" "HudHealth" "fieldName" "HudHealth"
"xpos" "16" "xpos" "16"
@ -17,6 +17,23 @@
"digit_xpos" "50" "digit_xpos" "50"
"digit_ypos" "2" "digit_ypos" "2"
} }
HudHealth [$DECK]
{
"fieldName" "HudHealth"
"xpos" "16"
"ypos" "426"
"wide" "130"
"tall" "42"
"visible" "1"
"enabled" "1"
"PaintBackgroundType" "2"
"text_xpos" "8"
"text_ypos" "23"
"digit_xpos" "66"
"digit_ypos" "0"
}
TargetID TargetID
{ {
@ -33,7 +50,8 @@
"visible" "0" "visible" "0"
"enabled" "1" "enabled" "1"
"xpos" "16" "xpos" "16"
"ypos" "415" "ypos" "410" [!$DECK]
"ypos" "400" [$DECK]
"wide" "200" "wide" "200"
"tall" "60" "tall" "60"
"text_xpos" "8" "text_xpos" "8"
@ -80,7 +98,7 @@
"text_xpos" "33" "text_xpos" "33"
} }
HudSuit HudSuit [!$DECK]
{ {
"fieldName" "HudSuit" "fieldName" "HudSuit"
"xpos" "140" "xpos" "140"
@ -92,14 +110,31 @@
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
"text_xpos" "8" "text_xpos" "8"
"text_ypos" "20" "text_ypos" "20"
"digit_xpos" "50" "digit_xpos" "50"
"digit_ypos" "2" "digit_ypos" "2"
} }
HudSuit [$DECK]
{
"fieldName" "HudSuit"
"xpos" "150"
"ypos" "426"
"wide" "120"
"tall" "42"
"visible" "1"
"enabled" "1"
HudAmmo "PaintBackgroundType" "2"
"text_xpos" "8"
"text_ypos" "23"
"digit_xpos" "56"
"digit_ypos" "0"
}
HudAmmo [!$DECK]
{ {
"fieldName" "HudAmmo" "fieldName" "HudAmmo"
"xpos" "r150" "xpos" "r150"
@ -118,8 +153,27 @@
"digit2_xpos" "98" "digit2_xpos" "98"
"digit2_ypos" "16" "digit2_ypos" "16"
} }
HudAmmo [$DECK]
{
"fieldName" "HudAmmo"
"xpos" "r150"
"ypos" "426"
"wide" "152"
"tall" "42"
"visible" "1"
"enabled" "1"
HudAmmoSecondary "PaintBackgroundType" "2"
"text_xpos" "8"
"text_ypos" "24"
"digit_xpos" "55"
"digit_ypos" "0"
"digit2_xpos" "100"
"digit2_ypos" "12"
}
HudAmmoSecondary [!$DECK]
{ {
"fieldName" "HudAmmoSecondary" "fieldName" "HudAmmoSecondary"
"xpos" "r76" "xpos" "r76"
@ -131,11 +185,30 @@
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
"digit_xpos" "10" "text_xpos" "8"
"text_ypos" "22"
"digit_xpos" "36"
"digit_ypos" "2" "digit_ypos" "2"
} }
HudAmmoSecondary [$DECK]
{
"fieldName" "HudAmmoSecondary"
"xpos" "r82"
"ypos" "426"
"wide" "70"
"tall" "42"
"visible" "1"
"enabled" "1"
HudSuitPower "PaintBackgroundType" "2"
"text_xpos" "8"
"text_ypos" "24"
"digit_xpos" "42"
"digit_ypos" "0"
}
HudSuitPower [!$DECK]
{ {
"fieldName" "HudSuitPower" "fieldName" "HudSuitPower"
"visible" "1" "visible" "1"
@ -165,23 +238,96 @@
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
} }
HudFlashlight HudSuitPower [$DECK]
{ {
"fieldName" "HudFlashlight" "fieldName" "HudSuitPower"
"visible" "0" "visible" "1"
"enabled" "1" "enabled" "1"
"xpos" "16" "xpos" "16"
"ypos" "370" "ypos" "386"
"wide" "102" "wide" "112"
"tall" "20" "tall" "54"
"AuxPowerLowColor" "255 0 0 220"
"AuxPowerHighColor" "255 220 0 220"
"AuxPowerDisabledAlpha" "70"
"BarInsetX" "8"
"BarInsetY" "18"
"BarWidth" "102"
"BarHeight" "5"
"BarChunkWidth" "6"
"BarChunkGap" "3"
"text_xpos" "8" "text_xpos" "8"
"text_ypos" "6" "text_ypos" "4"
"TextColor" "255 170 0 220" "text2_xpos" "8"
"text2_ypos" "26"
"text2_gap" "14"
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
} }
HudPosture [$WIN32]
{
"fieldName" "HudPosture"
"visible" "1"
"PaintBackgroundType" "2"
"xpos" "16"
"ypos" "316"
"tall" "35"
"wide" "36"
"font" "WeaponIconsSmall"
"icon_xpos" "8"
"icon_ypos" "-2"
}
HudPosture [$X360]
{
"fieldName" "HudPosture"
"visible" "1"
"PaintBackgroundType" "2"
"xpos" "48"
"ypos" "316"
"tall" "36"
"wide" "36"
"font" "WeaponIconsSmall"
"icon_xpos" "10"
"icon_ypos" "2"
}
HudFlashlight
{
"fieldName" "HudFlashlight"
"visible" "1"
"PaintBackgroundType" "2"
"xpos" "270" [$WIN32]
"ypos" "444" [!$DECK]
"ypos" "436" [$DECK]
"xpos_hidef" "306" [$X360] // aligned to left
"xpos_lodef" "c-18" [$X360] // centered in screen
"ypos" "428" [$X360]
"tall" "24" [!$DECK]
"tall" "30" [$DECK]
"wide" "36" [!$DECK]
"wide" "46" [$DECK]
"font" "WeaponIconsSmall" [!$DECK]
"font" "FlashlightDeck" [$DECK]
"icon_xpos" "4"
"icon_ypos" "-8" [!$DECK]
"icon_ypos" "-12" [$DECK]
"BarInsetX" "4"
"BarInsetY" "18" [!$DECK]
"BarInsetY" "22" [$DECK]
"BarWidth" "28" [!$DECK]
"BarWidth" "36" [$DECK]
"BarHeight" "2" [!$DECK]
"BarChunkWidth" "2" [!$DECK]
"BarHeight" "3" [$DECK]
"BarChunkWidth" "3" [$DECK]
"BarChunkGap" "1"
}
HudDamageIndicator HudDamageIndicator
{ {
"fieldName" "HudDamageIndicator" "fieldName" "HudDamageIndicator"
@ -205,19 +351,26 @@
"Circle1Radius" "66" "Circle1Radius" "66"
"Circle2Radius" "74" "Circle2Radius" "74"
"DashGap" "16" "DashGap" "16"
"DashHeight" "4" "DashHeight" "4" [$WIN32]
"DashHeight" "6" [$X360]
"BorderThickness" "88" "BorderThickness" "88"
} }
HudWeaponSelection HudWeaponSelection
{ {
"fieldName" "HudWeaponSelection" "fieldName" "HudWeaponSelection"
"ypos" "16" "ypos" "16" [$WIN32]
"ypos" "32" [$X360]
"visible" "1" "visible" "1"
"enabled" "1" "enabled" "1"
"SmallBoxSize" "32" "SmallBoxSize" "32"
"MediumBoxWide" "95"
"MediumBoxWide_hidef" "78"
"MediumBoxTall" "50"
"MediumBoxTall_hidef" "50"
"MediumBoxWide_lodef" "74"
"MediumBoxTall_lodef" "50"
"LargeBoxWide" "112" "LargeBoxWide" "112"
"LargeBoxTall" "80" "LargeBoxTall" "84"
"BoxGap" "8" "BoxGap" "8"
"SelectionNumberXPos" "4" "SelectionNumberXPos" "4"
"SelectionNumberYPos" "4" "SelectionNumberYPos" "4"
@ -239,16 +392,8 @@
"fieldName" "HudDeathNotice" "fieldName" "HudDeathNotice"
"visible" "1" "visible" "1"
"enabled" "1" "enabled" "1"
"xpos" "r640" "wide" "640"
"ypos" "12" "tall" "480"
"wide" "628"
"tall" "468"
"MaxDeathNotices" "4"
"LineHeight" "22"
"RightJustify" "1" // If 1, draw notices from the right
"TextFont" "Default"
} }
HudVehicle HudVehicle
@ -311,9 +456,11 @@
"visible" "1" "visible" "1"
"enabled" "1" "enabled" "1"
"xpos" "c-250" "xpos" "c-250"
"ypos" "276" "ypos" "276" [$WIN32]
"ypos" "236" [$X360]
"wide" "500" "wide" "500"
"tall" "136" "tall" "136" [$WIN32]
"tall" "176" [$X360]
"BgAlpha" "128" "BgAlpha" "128"
@ -321,21 +468,36 @@
"ItemHiddenTime" "0.2" // Nearly same as grow time so that the item doesn't start to show until growth is finished "ItemHiddenTime" "0.2" // Nearly same as grow time so that the item doesn't start to show until growth is finished
"ItemFadeInTime" "0.15" // Once ItemHiddenTime is finished, takes this much longer to fade in "ItemFadeInTime" "0.15" // Once ItemHiddenTime is finished, takes this much longer to fade in
"ItemFadeOutTime" "0.3" "ItemFadeOutTime" "0.3"
"topoffset" "0" [$WIN32]
"topoffset" "0" [$X360]
} }
HudHistoryResource HudChat
{
"fieldName" "HudChat"
"visible" "0"
"enabled" "1"
"xpos" "0"
"ypos" "0"
"wide" "4"
"tall" "4"
}
HudHistoryResource [$WIN32]
{ {
"fieldName" "HudHistoryResource" "fieldName" "HudHistoryResource"
"visible" "1" "visible" "1"
"enabled" "1" "enabled" "1"
"xpos" "r252" "xpos" "r272" [$DECK]
"xpos" "r252" [!$DECK]
"ypos" "40" "ypos" "40"
"wide" "248" "wide" "248"
"tall" "320" "tall" "320"
"history_gap" "56" "history_gap" "64" [$DECK]
"icon_inset" "28" "history_gap" "56" [!$DECK]
"icon_inset" "38"
"text_inset" "36"
"text_inset" "26" "text_inset" "26"
"NumberFont" "HudNumbersSmall" "NumberFont" "HudNumbersSmall"
} }
@ -380,8 +542,8 @@
"fieldName" "HudPredictionDump" "fieldName" "HudPredictionDump"
"visible" "1" "visible" "1"
"enabled" "1" "enabled" "1"
"wide" "640" "wide" "3840"
"tall" "480" "tall" "1080"
} }
HudHintDisplay HudHintDisplay
@ -389,8 +551,29 @@
"fieldName" "HudHintDisplay" "fieldName" "HudHintDisplay"
"visible" "0" "visible" "0"
"enabled" "1" "enabled" "1"
"xpos" "r120" "xpos" "c-240"
"ypos" "r340" "ypos" "c60"
"xpos" "r148" [$X360]
"ypos" "r338" [$X360]
"wide" "480"
"tall" "100"
"HintSize" "1"
"text_xpos" "8"
"text_ypos" "8"
"center_x" "0" // center text horizontally
"center_y" "-1" // align text on the bottom
"paintbackground" "0"
}
HudHintKeyDisplay
{
"fieldName" "HudHintKeyDisplay"
"visible" "0"
"enabled" "1"
"xpos" "r120" [$WIN32]
"ypos" "r340" [$WIN32]
"xpos" "r148" [$X360]
"ypos" "r338" [$X360]
"wide" "100" "wide" "100"
"tall" "200" "tall" "200"
"text_xpos" "8" "text_xpos" "8"
@ -402,7 +585,8 @@
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
} }
HudSquadStatus
HudSquadStatus [!$DECK]
{ {
"fieldName" "HudSquadStatus" "fieldName" "HudSquadStatus"
"visible" "1" "visible" "1"
@ -420,14 +604,33 @@
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
} }
HudSquadStatus [$DECK]
{
"fieldName" "HudSquadStatus"
"visible" "1"
"enabled" "1"
"xpos" "r160"
"ypos" "372"
"wide" "144"
"tall" "46"
"text_xpos" "8"
"text_ypos" "28"
"SquadIconColor" "255 220 0 160"
"IconInsetX" "8"
"IconInsetY" "-10"
"IconGap" "39"
HudPoisonDamageIndicator "PaintBackgroundType" "2"
}
HudPoisonDamageIndicator [!$DECK]
{ {
"fieldName" "HudPoisonDamageIndicator" "fieldName" "HudPoisonDamageIndicator"
"visible" "0" "visible" "0"
"enabled" "1" "enabled" "1"
"xpos" "16" "xpos" "16"
"ypos" "346" "ypos" "338"
"wide" "136" "wide" "136"
"tall" "38" "tall" "38"
"text_xpos" "8" "text_xpos" "8"
@ -436,6 +639,21 @@
"TextColor" "255 170 0 220" "TextColor" "255 170 0 220"
"PaintBackgroundType" "2" "PaintBackgroundType" "2"
} }
HudPoisonDamageIndicator [$DECK]
{
"fieldName" "HudPoisonDamageIndicator"
"visible" "0"
"enabled" "1"
"xpos" "16"
"ypos" "262"
"wide" "190"
"tall" "42"
"text_xpos" "8"
"text_ypos" "8"
"text_ygap" "14"
"TextColor" "255 170 0 220"
"PaintBackgroundType" "2"
}
HudCredits HudCredits
{ {
"fieldName" "HudCredits" "fieldName" "HudCredits"
@ -448,58 +666,93 @@
"TextColor" "255 255 255 192" "TextColor" "255 255 255 192"
} }
"HudChat"
{
"ControlName" "EditablePanel"
"fieldName" "HudChat"
"visible" "1"
"enabled" "1"
"xpos" "10"
"ypos" "275"
"wide" "320"
"tall" "120"
"PaintBackgroundType" "2"
}
AchievementNotificationPanel
{
"fieldName" "AchievementNotificationPanel"
"visible" "0"
"enabled" "0"
}
HudHintKeyDisplay
{
"fieldName" "HudHintKeyDisplay"
"visible" "0"
"enabled" "0"
}
HUDAutoAim HUDAutoAim
{ {
"fieldName" "HUDAutoAim" "fieldName" "HUDAutoAim"
"visible" "0" "visible" "1"
"enabled" "0" "enabled" "1"
} "wide" "640" [$WIN32]
"tall" "480" [$WIN32]
HudHDRDemo "wide" "960" [$X360]
{ "tall" "720" [$X360]
"fieldName" "HudHDRDemo"
"visible" "0"
"enabled" "0"
} }
HudCommentary HudCommentary
{ {
"fieldName" "HudCommentary" "fieldName" "HudCommentary"
"visible" "0" "xpos" "c-190"
"enabled" "0" "ypos" "350"
"wide" "380"
"tall" "40"
"visible" "1"
"enabled" "1"
"PaintBackgroundType" "2"
"bar_xpos" "50"
"bar_ypos" "20"
"bar_height" "8"
"bar_width" "320"
"speaker_xpos" "50"
"speaker_ypos" "8"
"count_xpos_from_right" "10" // Counts from the right side
"count_ypos" "8"
"icon_texture" "vgui/hud/icon_commentary"
"icon_xpos" "0"
"icon_ypos" "0"
"icon_width" "40"
"icon_height" "40"
} }
"CHudVote" HudHDRDemo
{
"fieldName" "HudHDRDemo"
"xpos" "0"
"ypos" "0"
"wide" "640"
"tall" "480"
"visible" "1"
"enabled" "1"
"Alpha" "255"
"PaintBackgroundType" "2"
"BorderColor" "0 0 0 255"
"BorderLeft" "16"
"BorderRight" "16"
"BorderTop" "16"
"BorderBottom" "64"
"BorderCenter" "0"
"TextColor" "255 255 255 255"
"LeftTitleY" "422"
"RightTitleY" "422"
}
AchievementNotificationPanel
{
"fieldName" "AchievementNotificationPanel"
"visible" "1"
"enabled" "1"
"xpos" "0"
"ypos" "180"
"wide" "f10" [$WIN32]
"wide" "f60" [$X360]
"tall" "100"
}
CHudVote
{ {
"fieldName" "CHudVote" "fieldName" "CHudVote"
"visible" "0" "xpos" "0"
"enabled" "0" "ypos" "0"
"wide" "640"
"tall" "480"
"visible" "1"
"enabled" "1"
"bgcolor_override" "0 0 0 0"
"PaintBackgroundType" "0" // rounded corners
} }
} }

View File

@ -449,7 +449,7 @@
"Weapon_PhysCannon.Launch" "Weapon_PhysCannon.Launch"
{ {
"channel" "CHAN_WEAPON" "channel" "CHAN_WEAPON"
"volume" "0.57" "volume" "0.27"
"soundlevel" "SNDLVL_GUNFIRE" "soundlevel" "SNDLVL_GUNFIRE"
"pitch" "110,120" "pitch" "110,120"
@ -471,17 +471,17 @@
"rndwave" "rndwave"
{ {
"wave" "weapons/physcannon/superphys_launch1.wav" "wave" ")weapons/physcannon/superphys_launch1.wav"
"wave" "weapons/physcannon/superphys_launch2.wav" "wave" ")weapons/physcannon/superphys_launch2.wav"
"wave" "weapons/physcannon/superphys_launch3.wav" "wave" ")weapons/physcannon/superphys_launch3.wav"
"wave" "weapons/physcannon/superphys_launch4.wav" "wave" ")weapons/physcannon/superphys_launch4.wav"
} }
} }
"Weapon_PhysCannon.Charge" "Weapon_PhysCannon.Charge"
{ {
"channel" "CHAN_ITEM" "channel" "CHAN_ITEM"
"volume" "0.42" "volume" "0.22"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"wave" ")weapons/physcannon/physcannon_charge.wav" "wave" ")weapons/physcannon/physcannon_charge.wav"
} }
@ -493,13 +493,13 @@
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"pitch" "70,80" "pitch" "70,80"
"wave" "weapons/physcannon/physcannon_charge.wav" "wave" ")weapons/physcannon/physcannon_charge.wav"
} }
"Weapon_PhysCannon.DryFire" "Weapon_PhysCannon.DryFire"
{ {
"channel" "CHAN_WEAPON" "channel" "CHAN_WEAPON"
"volume" "0.42" "volume" "0.22"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"wave" ")weapons/physcannon/physcannon_dryfire.wav" "wave" ")weapons/physcannon/physcannon_dryfire.wav"
@ -512,13 +512,13 @@
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"pitch" "70,80" "pitch" "70,80"
"wave" "weapons/physcannon/physcannon_dryfire.wav" "wave" ")weapons/physcannon/physcannon_dryfire.wav"
} }
"Weapon_PhysCannon.Pickup" "Weapon_PhysCannon.Pickup"
{ {
"channel" "CHAN_WEAPON" "channel" "CHAN_WEAPON"
"volume" "0.42" "volume" "0.22"
"soundlevel" "SNDLVL_105dB" "soundlevel" "SNDLVL_105dB"
"wave" ")weapons/physcannon/physcannon_pickup.wav" "wave" ")weapons/physcannon/physcannon_pickup.wav"
@ -531,13 +531,13 @@
"soundlevel" "SNDLVL_105dB" "soundlevel" "SNDLVL_105dB"
"pitch" "70,80" "pitch" "70,80"
"wave" "weapons/physcannon/physcannon_pickup.wav" "wave" ")weapons/physcannon/physcannon_pickup.wav"
} }
"Weapon_PhysCannon.OpenClaws" "Weapon_PhysCannon.OpenClaws"
{ {
"channel" "CHAN_VOICE" "channel" "CHAN_VOICE"
"volume" "0.42" "volume" "0.2"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"wave" ")weapons/physcannon/physcannon_claws_open.wav" "wave" ")weapons/physcannon/physcannon_claws_open.wav"
@ -546,7 +546,7 @@
"Weapon_PhysCannon.CloseClaws" "Weapon_PhysCannon.CloseClaws"
{ {
"channel" "CHAN_VOICE" "channel" "CHAN_VOICE"
"volume" "0.42" "volume" "0.2"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"wave" ")weapons/physcannon/physcannon_claws_close.wav" "wave" ")weapons/physcannon/physcannon_claws_close.wav"
@ -555,7 +555,7 @@
"Weapon_PhysCannon.Drop" "Weapon_PhysCannon.Drop"
{ {
"channel" "CHAN_WEAPON" "channel" "CHAN_WEAPON"
"volume" "0.42" "volume" "0.22"
"soundlevel" "SNDLVL_105dB" "soundlevel" "SNDLVL_105dB"
"wave" ")weapons/physcannon/physcannon_drop.wav" "wave" ")weapons/physcannon/physcannon_drop.wav"
@ -568,13 +568,13 @@
"soundlevel" "SNDLVL_105dB" "soundlevel" "SNDLVL_105dB"
"pitch" "50,60" "pitch" "50,60"
"wave" "weapons/physcannon/physcannon_drop.wav" "wave" ")weapons/physcannon/physcannon_drop.wav"
} }
"Weapon_PhysCannon.HoldSound" "Weapon_PhysCannon.HoldSound"
{ {
"channel" "CHAN_STATIC" "channel" "CHAN_STATIC"
"volume" "1.0" "volume" "0.4"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"wave" "weapons/physcannon/hold_loop.wav" "wave" "weapons/physcannon/hold_loop.wav"
@ -599,21 +599,21 @@
"rndwave" "rndwave"
{ {
"wave" "weapons/physcannon/superphys_small_zap1.wav" "wave" ")weapons/physcannon/superphys_small_zap1.wav"
"wave" "weapons/physcannon/superphys_small_zap2.wav" "wave" ")weapons/physcannon/superphys_small_zap2.wav"
"wave" "weapons/physcannon/superphys_small_zap3.wav" "wave" ")weapons/physcannon/superphys_small_zap3.wav"
"wave" "weapons/physcannon/superphys_small_zap4.wav" "wave" ")weapons/physcannon/superphys_small_zap4.wav"
} }
} }
"Weapon_PhysCannon.TooHeavy" "Weapon_PhysCannon.TooHeavy"
{ {
"channel" "CHAN_WEAPON" "channel" "CHAN_WEAPON"
"volume" "0.8" "volume" "0.4"
"soundlevel" "SNDLVL_NORM" "soundlevel" "SNDLVL_NORM"
"pitch" "100" "pitch" "100"
"wave" "weapons/physcannon/physcannon_tooheavy.wav" "wave" ")weapons/physcannon/physcannon_tooheavy.wav"
} }
// weapon_physgun.txt // weapon_physgun.txt

View File

@ -40,9 +40,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "e" "character" "e"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "e"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "q" "character" "q"
} }
"crosshair" "crosshair"

View File

@ -51,14 +51,19 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "l" "character" "l"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "l"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "u" "character" "u"
} }
"ammo2" "ammo2"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "z" "character" "z"
} }
"crosshair" "crosshair"

View File

@ -42,9 +42,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "g" "character" "g"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "g"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmallSecondary"
"character" "w" "character" "w"
} }
"crosshair" "crosshair"

View File

@ -43,20 +43,7 @@ WeaponData
"font" "WeaponIcons" "font" "WeaponIcons"
"character" "c" "character" "c"
} }
"ammo2"
{
"file" "sprites/640hud7"
"x" "48"
"y" "72"
"width" "24"
"height" "24"
}
"crosshair" "crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
"autoaim"
{ {
"file" "sprites/crosshairs" "file" "sprites/crosshairs"
"x" "0" "x" "0"
@ -64,5 +51,13 @@ WeaponData
"width" "24" "width" "24"
"height" "24" "height" "24"
} }
"autoaim"
{
"file" "sprites/crosshairs"
"x" "48"
"y" "72"
"width" "24"
"height" "24"
}
} }
} }

View File

@ -41,9 +41,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "k" "character" "k"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "k"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "v" "character" "v"
} }
"crosshair" "crosshair"

View File

@ -53,14 +53,6 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "m" "character" "m"
} }
"ammo"
{
"file" "sprites/a_icons1"
"x" "0"
"y" "0"
"width" "32"
"height" "32"
}
"crosshair" "crosshair"
{ {
"font" "Crosshairs" "font" "Crosshairs"

View File

@ -45,9 +45,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "d" "character" "d"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "d"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "p" "character" "p"
} }
"crosshair" "crosshair"

View File

@ -48,9 +48,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "i" "character" "i"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "i"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmallSecondary"
"character" "x" "character" "x"
} }
"crosshair" "crosshair"

View File

@ -45,9 +45,14 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "b" "character" "b"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "b"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "s" "character" "s"
} }
"crosshair" "crosshair"

View File

@ -31,6 +31,11 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "o" "character" "o"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "o"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIcons"

View File

@ -50,14 +50,19 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "a" "character" "a"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "a"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmall"
"character" "r" "character" "r"
} }
"ammo2" "ammo2"
{ {
"font" "WeaponIcons" "font" "WeaponIconsSmallSecondary"
"character" "t" "character" "t"
} }
"crosshair" "crosshair"

View File

@ -40,6 +40,11 @@ WeaponData
"font" "WeaponIconsSelected" "font" "WeaponIconsSelected"
"character" "n" "character" "n"
} }
"weapon_small"
{
"font" "WeaponIconsSmall"
"character" "n"
}
"ammo" "ammo"
{ {
"font" "WeaponIcons" "font" "WeaponIcons"
@ -54,6 +59,11 @@ WeaponData
"height" "24" "height" "24"
} }
"crosshair" "crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
"autoaim"
{ {
"file" "sprites/crosshairs" "file" "sprites/crosshairs"
"x" "0" "x" "0"
@ -61,13 +71,5 @@ WeaponData
"width" "24" "width" "24"
"height" "24" "height" "24"
} }
"autoaim"
{
"file" "sprites/crosshairs"
"x" "48"
"y" "72"
"width" "24"
"height" "24"
}
} }
} }

6
game/mod_hl2mp/steam.inf Normal file
View File

@ -0,0 +1,6 @@
PatchVersion=2000
ClientVersion=2000
ServerVersion=2000
ProductName=mod_hl2mp
appID=243750
ServerAppID=244310

81
game/mod_tf/gameinfo.txt Normal file
View File

@ -0,0 +1,81 @@
"GameInfo"
{
game "Frog Fortress 2"
type multiplayer_only
nomodels 1
nohimodel 1
nocrosshair 0
hidden_maps
{
"test_speakers" 1
"test_hardware" 1
}
nodegraph 0
GameData "tf.fgd"
AdditionalLocalization "tf"
InstancePath "maps/instances/"
advcrosshair 1
supportsvr 0
ReplayRequired 1
DependsOnAppID 440
FileSystem
{
SteamAppId 243750
SearchPaths
{
// First, mount all user customizations. This will search for VPKs and subfolders
// and mount them in alphabetical order. The easiest way to distribute a mod is to
// pack up the custom content into a VPK. To "install" a mod, just drop it in this
// folder.
//
// Note that this folder is scanned only when the game is booted.
game+mod mod_tf/custom/*
// Enable this if you want to load your TF custom content.
//game+mod |appid_440|tf/custom/*
// Now search loose files. We'll set the directory containing the gameinfo.txt file
// as the first "mod" search path (after any user customizations). This is also the one
// that's used when writing to the "mod" path.
mod+mod_write |gameinfo_path|.
game+game_write |gameinfo_path|.
default_write_path |gameinfo_path|.
gamebin |gameinfo_path|bin
// We search VPK files before ordinary folders, because most files will be found in
// VPK and we can avoid making thousands of file system calls to attempt to open files
// in folders where they don't exist. (Searching a VPK is much faster than making an operating
// system call.)
game_lv |appid_440|tf/tf2_lv.vpk
game+mod |appid_440|tf/tf2_textures.vpk
game+mod |appid_440|tf/tf2_sound_vo_english.vpk
game+mod |appid_440|tf/tf2_sound_misc.vpk
game+mod+vgui |appid_440|tf/tf2_misc.vpk
game |appid_243750|hl2/hl2_textures.vpk
game |appid_243750|hl2/hl2_sound_vo_english.vpk
game |appid_243750|hl2/hl2_sound_misc.vpk
game+vgui |appid_243750|hl2/hl2_misc.vpk
platform+vgui |appid_243750|platform/platform_misc.vpk
// Last, mount in shared HL2 and TF2 loose files
game |appid_440|tf
game |appid_243750|hl2
platform |appid_243750|platform
// Random files downloaded from gameservers go into a seperate directory, so
// that it's easy to keep those files segregated from the official game files
// or customizations intentially installed by the user.
//
// This directory is searched LAST. If you visit a server and download
// a custom model, etc, we don't want that file to override the default
// game file indefinitely (after you have left the server). Servers CAN have
// custom content that overrides the default game files, it just needs to be
// packed up in the .bsp file so that it will be mounted as a map search pack.
// The map search pack is mounted at the top of the search path list,
// but only while you are connected that server and on that map.
game+download mod_tf/download
}
}
}

View File

@ -0,0 +1,6 @@
"UnlitGeneric"
{
"$basetexture" "logo\new_tf2_logo"
"$translucent" 1
"$ignorez" 1
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
"Resource/UI/CharInfoPanel.res"
{
"character_info"
{
"ControlName" "EditablePanel"
"fieldName" "character_info"
"xpos" "0"
"ypos" "0"
"wide" "f0"
"tall" "480"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"settitlebarvisible" "1"
"PaintBackgroundType" "0"
"bgcolor_override" "46 43 42 0"
"infocus_bgcolor_override" "46 43 42 0"
"outoffocus_bgcolor_override" "46 43 42 0"
"title" "#CharInfoAndSetup"
"title_font" "HudFontMediumBold"
"titletextinsetX" "40"
"titletextinsetY" "0"
"titlebarfgcolor_override" "200 187 161 255"
"titlebardisabledfgcolor_override" "200 187 161 255"
"titlebarbgcolor_override" "46 43 42 255"
"clientinsetx_override" "0"
"sheetinset_bottom" "40"
}
"BackgroundHeader"
{
"ControlName" "ImagePanel"
"fieldName" "BackgroundHeader"
"xpos" "0"
"ypos" "0"
"zpos" "-2"
"wide" "f0"
"tall" "120"
"visible" "1"
"enabled" "1"
"image" "loadout_header"
"tileImage" "1"
}
"BackgroundFooter"
{
"ControlName" "ImagePanel"
"fieldName" "BackgroundFooter"
"xpos" "0"
"ypos" "420"
"zpos" "1"
"wide" "f0"
"tall" "60"
"visible" "1"
"enabled" "1"
"image" "loadout_bottom_gradient"
"tileImage" "1"
}
"FooterLine"
{
"ControlName" "ImagePanel"
"fieldName" "FooterLine"
"xpos" "0"
"ypos" "420"
"zpos" "2"
"wide" "f0"
"tall" "10"
"visible" "1"
"enabled" "1"
"image" "loadout_solid_line"
"scaleImage" "1"
}
"Sheet"
{
"ControlName" "EditablePanel"
"fieldName" "Sheet"
"tabxindent" "80"
"tabxdelta" "10"
"tabwidth" "240"
"tabheight" "20"
"transition_time" "0"
"yoffset" "14"
"HeaderLine"
{
"ControlName" "ImagePanel"
"fieldName" "HeaderLine"
"xpos" "0"
"ypos" "32"
"zpos" "5"
"wide" "f0"
"tall" "10"
"visible" "1"
"enabled" "1"
"image" "loadout_solid_line"
"scaleImage" "1"
}
"tabskv"
{
"textinsetx" "40"
"font" "HudFontMediumSmallBold"
"selectedcolor" "200 187 161 255"
"unselectedcolor" "130 120 104 255"
"defaultBgColor_override" "46 43 42 255"
"paintbackground" "0"
"activeborder_override" "OutlinedGreyBox"
"normalborder_override" "OutlinedDullGreyBox"
}
}
"BackButton"
{
"ControlName" "CExButton"
"fieldName" "BackButton"
"xpos" "c-295"
"ypos" "437"
"zpos" "2"
"wide" "100"
"tall" "25"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labelText" "#TF_BackCarat"
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "0"
"Command" "back"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
}
"ClearButton"
{
"ControlName" "CExImageButton"
"fieldName" "ClearButton"
"xpos" "c-150"
"ypos" "437"
"zpos" "2"
"wide" "25"
"tall" "25"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labelText" ""
"image_drawcolor" "235 226 202 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "5"
"ypos" "5"
"zpos" "1"
"wide" "15"
"tall" "15"
"visible" "1"
"enabled" "1"
"image" "glyph_workshop_delete"
"scaleImage" "1"
}
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "0"
"Command" "clear_loadout_ui"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
}
"ResetButton"
{
"ControlName" "CExImageButton"
"fieldName" "ResetButton"
"xpos" "c-185"
"ypos" "437"
"zpos" "2"
"wide" "25"
"tall" "25"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labelText" ""
"image_drawcolor" "235 226 202 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "5"
"ypos" "5"
"zpos" "1"
"wide" "15"
"tall" "15"
"visible" "1"
"enabled" "1"
"image" "glyph_server"
"scaleImage" "1"
}
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "0"
"Command" "reset_loadout_ui"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
}
"LocalInfo"
{
"ControlName" "Label"
"fieldName" "LocalInfo"
"xpos" "c-115"
"ypos" "438"
"zpos" "2"
"wide" "640"
"tall" "25"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labelText" "#TF_SDK_LocalLoadout"
"image_drawcolor" "235 226 202 255"
"font" "HudFontSmall"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"default" "0"
}
"NotificationsPresentPanel"
{
"ControlName" "CNotificationsPresentPanel"
"fieldName" "NotificationsPresentPanel"
"xpos" "r200"
"ypos" "10"
"zpos" "10000"
"wide" "190"
"tall" "50"
"visible" "0"
"enabled" "1"
}
}

View File

@ -0,0 +1,865 @@
"Resource/UI/MatchMakingDashboard.res"
{
"MMDashboard"
{
"fieldName" "MMDashboard"
"visible" "1"
"enabled" "1"
"xpos" "cs-0.5"
"ypos" "-5"
"zpos" "10001"
"wide" "f0"
"tall" "35"
"keyboardinputenabled" "0"
"collapsed_height" "0"
"expanded_height" "35"
"resize_time" "0.2"
}
"TopBar"
{
"ControlName" "EditablePanel"
"fieldName" "TopBar"
"xpos" "cs-0.5"
"ypos" "0"
"zpos" "1"
"wide" "f0"
"tall" "35"
"visible" "1"
"proportionaltoparent" "1"
"pinCorner" "2"
"autoResize" "1"
"Gradient"
{
"ControlName" "ImagePanel"
"fieldName" "Gradient"
"xpos" "0"
"ypos" "0"
"wide" "p0.5"
"tall" "f6"
"zpos" "0"
"visible" "1"
"enabled" "1"
"rotation" "2"
"proportionaltoparent" "1"
"scaleimage" "1"
"mouseinputenabled" "0"
"alpha" "100"
"image" "gradient_pure_black"
}
"BGPanel"
{
"ControlName" "EditablePanel"
"fieldName" "BGPanel"
"xpos" "cs-0.5"
"ypos" "0"
"zpos" "-1"
"wide" "p1.1"
"tall" "f5"
"visible" "1"
"PaintBackgroundType" "2"
"border" "ReplayDefaultBorder"
"proportionaltoparent" "1"
}
"OuterShadow"
{
"ControlName" "EditablePanel"
"fieldName" "OuterShadow"
"xpos" "cs-0.5"
"ypos" "cs-0.5"
"zpos" "-2"
"wide" "p1.1"
"tall" "p1"
"visible" "1"
"PaintBackgroundType" "2"
"border" "OuterShadowBorder"
"proportionaltoparent" "1"
}
"ToggleChatButton"
{
"ControlName" "CExImageButton"
"fieldName" "ToggleChatButton"
"xpos" "0"
"ypos" "0"
"zpos" "100"
"wide" "40"
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallestBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"Command" "toggle_chat"
"proportionaltoparent" "1"
"labeltext" ""
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"roundedcorners" "0"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"image_drawcolor" "TanLight"
"image_armedcolor" "TanLight"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "cs-0.5"
"ypos" "rs1-2"
"zpos" "1"
"wide" "20"
"tall" "20"
"visible" "1"
"enabled" "1"
"scaleImage" "1"
"proportionaltoparent" "1"
"image" "glyph_chat"
}
}
"PartySlot0"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot0"
"xpos" "40"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "0"
}
"PartySlot1"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot1"
"xpos" "64"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "1"
}
"PartySlot2"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot2"
"xpos" "88"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "2"
}
"PartySlot3"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot3"
"xpos" "112"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "3"
}
"PartySlot4"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot4"
"xpos" "136"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "4"
}
"PartySlot5"
{
"ControlName" "CDashboardPartyMember"
"fieldName" "PartySlot5"
"xpos" "160"
"ypos" "rs1-6"
"zpos" "100"
"wide" "o1"
"tall" "24"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"proportionaltoparent" "1"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"party_slot" "5"
}
"QueueContainer"
{
"ControlName" "EditablePanel"
"fieldName" "QueueContainer"
"xpos" "cs-0.5"
"ypos" "-50"
"zpos" "111"
"wide" "220"
"tall" "f0"
"visible" "1"
"proportionaltoparent" "1"
"OuterShadow"
{
"ControlName" "Panel"
"fieldName" "OuterShadow"
"xpos" "0"
"ypos" "0"
"zpos" "-1"
"wide" "f0"
"tall" "f0"
"visible" "1"
"proportionaltoparent" "1"
"border" "OuterShadowBorderThin"
}
"BGPanel"
{
"ControlName" "Panel"
"fieldName" "BGPanel"
"xpos" "cs-0.5"
"ypos" "cs-0.5"
"zpos" "0"
"wide" "f4"
"tall" "f4"
"visible" "1"
"proportionaltoparent" "1"
"border" "ReplayDefaultBorder"
}
"QueueLogoButton"
{
"ControlName" "Button"
"fieldName" "QueueLogoButton"
"xpos" "0"
"ypos" "1"
"zpos" "10"
"wide" "o1"
"tall" "f0"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labeltext" ""
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "1"
"Command" "queue_logo_clicked"
"proportionaltoparent" "1"
"actionsignallevel" "3"
"button_activation_type" "1"
"paintbackground" "0"
"paintborder" "0"
}
"CTFLogoPanel"
{
"ControlName" "CTFLogoPanel"
"fieldname" "CTFLogoPanel"
"xpos" "0"
"ypos" "1"
"zpos" "5"
"wide" "o1"
"tall" "f0"
"visible" "1"
"proportionaltoparent" "1"
"radius" "10"
"velocity" "100"
"fgcolor_override" "TFOrange"
}
"QueueText"
{
"ControlName" "CAutoFittingLabel"
"fieldName" "QueueText"
"xpos" "33"
"ypos" "1"
"wide" "f55"
"zpos" "100"
"tall" "f0"
"visible" "1"
"enabled" "1"
"font" "HudFontSmallestBold"
"fgcolor_override" "TanLight"
"textAlignment" "west"
"labelText" "%queue_state%"
"proportionaltoparent" "1"
"mouseinputenabled" "0"
"fonts"
{
"0"
{
"font" "HudFontSmallestBold" // TF2 Build 11
}
"1"
{
"font" "StorePromotionsTitle" // TF2 Build 10
}
"2"
{
"font" "FontStorePrice" // TF2 Build 9
}
}
}
"MultiQueuesManageButton"
{
"ControlName" "CExImageButton"
"fieldName" "MultiQueuesManageButton"
"xpos" "rs1-6"
"ypos" "11"
"zpos" "10"
"wide" "14"
"tall" "14"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labeltext" ""
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"Command" "manage_queues"
"proportionaltoparent" "1"
"actionsignallevel" "3"
"paintbackground" "0"
"defaultFgColor_override" "46 43 42 255"
"armedFgColor_override" "235 226 202 255"
"depressedFgColor_override" "46 43 42 255"
"image_drawcolor" "117 107 94 255"
"image_armedcolor" "200 80 60 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "0"
"ypos" "0"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"image" "glyph_options"
"scaleImage" "1"
}
}
"CloseButton"
{
"ControlName" "CExImageButton"
"fieldName" "CloseButton"
"xpos" "rs1-6"
"ypos" "11"
"zpos" "10"
"wide" "14"
"tall" "14"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"labeltext" ""
"font" "HudFontSmallBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"default" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"Command" "leave_queue"
"proportionaltoparent" "1"
"actionsignallevel" "3"
"paintbackground" "0"
"defaultFgColor_override" "46 43 42 255"
"armedFgColor_override" "235 226 202 255"
"depressedFgColor_override" "46 43 42 255"
"image_drawcolor" "117 107 94 255"
"image_armedcolor" "200 80 60 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "0"
"ypos" "0"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"image" "close_button"
"scaleImage" "1"
}
}
}
"JoinPartyLobbyContainer"
{
"ControlName" "EditablePanel"
"fieldName" "JoinPartyLobbyContainer"
"xpos" "cs-0.5"
"ypos" "-50"
"zpos" "110"
"wide" "220"
"tall" "f0"
"visible" "1"
"proportionaltoparent" "1"
"OuterShadow"
{
"ControlName" "Panel"
"fieldName" "OuterShadow"
"xpos" "0"
"ypos" "0"
"zpos" "-1"
"wide" "f0"
"tall" "f0"
"visible" "1"
"proportionaltoparent" "1"
"border" "OuterShadowBorderThin"
}
"BGPanel"
{
"ControlName" "Panel"
"fieldName" "BGPanel"
"xpos" "cs-0.5"
"ypos" "cs-0.5"
"zpos" "0"
"wide" "f6"
"tall" "f6"
"visible" "1"
"proportionaltoparent" "1"
"border" "ReplayDefaultBorder"
}
"PromptText"
{
"ControlName" "Label"
"fieldName" "PromptText"
"xpos" "cs-0.5"
"ypos" "1"
"wide" "f35"
"zpos" "100"
"tall" "f0"
"visible" "1"
"enabled" "1"
"font" "HudFontSmallestBold"
"fgcolor_override" "TanLight"
"textAlignment" "west"
"labelText" "#TF_MM_JoinPartyLobby_Prompt"
"proportionaltoparent" "1"
"mouseinputenabled" "0"
}
"JoinNowButton"
{
"ControlName" "CExButton"
"fieldName" "JoinNowButton"
"xpos" "rs1-10"
"ypos" "rs1-9"
"wide" "40"
"zpos" "100"
"tall" "15"
if_queued
{
"xpos" "cs-0.5"
"wide" "150"
}
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallestBold"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"Command" "join_party_match"
"proportionaltoparent" "1"
"labeltext" "#TF_MM_JoinPartyLobby_Join"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "3"
"armedBgColor_override" "CreditsGreen"
"defaultBgColor_override" "SaleGreen"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
}
}
"QuitButton"
{
"ControlName" "CExImageButton"
"fieldName" "QuitButton"
"xpos" "rs1"
"ypos" "0"
"zpos" "100"
"wide" "30"
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallBold"
"textAlignment" "west"
"textinsetx" "0"
"dulltext" "0"
"brighttext" "0"
"Command" "quit"
"proportionaltoparent" "1"
"labeltext" ""
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"RoundedCorners" "0"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"armedBgColor_override" "192 28 0 150"
"defaultBgColor_override" "192 28 0 50"
"defaultFgColor_override" "TanLight"
"armedFgColor_override" "TanLight"
"image_drawcolor" "TanLight"
"image_armedcolor" "TanLight"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "cs-0.5"
"ypos" "rs1-5"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"scaleImage" "1"
"proportionaltoparent" "1"
"image" "glyph_quit"
"drawcolor_override" "TanLight"
}
}
"DisconnectButton"
{
"ControlName" "CExImageButton"
"fieldName" "DisconnectButton"
"xpos" "rs1"
"ypos" "0"
"zpos" "100"
"wide" "110"
"wide" "110" [!$POSIX]
"wide" "115" [$POSIX]
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallBold"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"Command" "quit"
"proportionaltoparent" "1"
"labeltext" "#TF_Disconnect"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"RoundedCorners" "0"
"textinsety" "2.5"
"textinsetx" "26"
"use_proportional_insets" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"armedBgColor_override" "192 28 0 150"
"defaultBgColor_override" "192 28 0 50"
"defaultFgColor_override" "TanLight"
"armedFgColor_override" "TanLight"
"image_drawcolor" "TanLight"
"image_armedcolor" "TanLight"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "6"
"ypos" "rs1-5"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"scaleImage" "1"
"proportionaltoparent" "1"
"image" "glyph_disconnect"
"drawcolor_override" "TanLight"
}
}
"ResumeButton"
{
"ControlName" "CExImageButton"
"fieldName" "ResumeButton"
"xpos" "rs1-31-131"
"ypos" "0"
"zpos" "100"
"wide" "90" [!$POSIX]
"wide" "95" [$POSIX]
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "0"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallBold"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"Command" "resume_game"
"proportionaltoparent" "1"
"labeltext" "#MMenu_ResumeGame"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"roundedcorners" "1"
"textinsety" "2.5"
"textinsetx" "26"
"use_proportional_insets" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
// "armedBgColor_override" "CreditsGreen"
// "defaultBgColor_override" "GreenSolid"
"defaultFgColor_override" "TanLight"
"armedFgColor_override" "TanLight"
"image_drawcolor" "235 226 202 255"
"image_armedcolor" "235 226 202 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "6"
"ypos" "10"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"scaleImage" "1"
"proportionaltoparent" "1"
"image" "icon_resume"
"drawcolor_override" "TanLight"
}
}
"FindAGameButton"
{
"ControlName" "CExImageButton"
"fieldName" "FindAGameButton"
"xpos" "rs1-31"
"ypos" "0"
"zpos" "100"
"wide" "115" [!$POSIX]
"wide" "120" [$POSIX]
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallBold"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"Command" "find_game"
"proportionaltoparent" "1"
"labeltext" "#MMenu_FindAGame"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"roundedcorners" "1"
"textinsety" "2.5"
"textinsetx" "26"
"use_proportional_insets" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"armedBgColor_override" "CreditsGreen"
"defaultBgColor_override" "GreenSolid"
"defaultFgColor_override" "TanLight"
"armedFgColor_override" "TanLight"
"image_drawcolor" "235 226 202 255"
"image_armedcolor" "235 226 202 255"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "6"
"ypos" "10"
"zpos" "1"
"wide" "14"
"tall" "14"
"visible" "1"
"enabled" "1"
"scaleImage" "1"
"proportionaltoparent" "1"
"image" "glyph_multiplayer"
"drawcolor_override" "TanLight"
}
}
"HostGameButton"
{
"ControlName" "CExImageButton"
"fieldName" "HostGameButton"
"xpos" "rs1-145"
"ypos" "0"
"zpos" "100"
"wide" "115"
"tall" "f6"
"autoResize" "0"
"pinCorner" "3"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"font" "HudFontSmallBold"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"Command" "create_server"
"proportionaltoparent" "1"
"labeltext" "#MMenu_HostAGame"
"mouseinputenabled" "1"
"keyboardinputenabled" "0"
"actionsignallevel" "2"
"roundedcorners" "1"
"textinsety" "2.5"
"textinsetx" "15"
"use_proportional_insets" "1"
"sound_depressed" "UI/buttonclick.wav"
"sound_released" "UI/buttonclickrelease.wav"
"armedBgColor_override" "LighterDarkBrown"
"defaultBgColor_override" "DarkBrown"
"defaultFgColor_override" "TanLight"
"armedFgColor_override" "TanLight"
"image_drawcolor" "235 226 202 255"
"image_armedcolor" "235 226 202 255"
}
}
}

6
game/mod_tf/steam.inf Normal file
View File

@ -0,0 +1,6 @@
PatchVersion=2000
ClientVersion=2000
ServerVersion=2000
ProductName=mod_tf
appID=243750
ServerAppID=244310

View File

@ -0,0 +1,912 @@
The Source engine and Valve games use Third Party code for certain functions. The
required legal notices for using such code are reproduced below in accordance with
Valve<EFBFBD>s obligations to provide such notices:
************************************************************************************
Xzip/Xunzip:
************************************************************************************
// This is version 2002-Feb-16 of the Info-ZIP copyright and license. The
// definitive version of this document should be available at
// ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely.
//
// Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
//
// For the purposes of this copyright and license, "Info-ZIP" is defined as
// the following set of individuals:
//
// Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
// Jean-loup Gailly, Hunter Goatley, Ian Gorman, Chris Herborth, Dirk Haase,
// Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
// David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
// Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
// Kai Uwe Rommel, Steve Salisbury, Dave Smith, Christian Spieler,
// Antoine Verheijen, Paul von Behren, Rich Wales, Mike White
//
// This software is provided "as is", without warranty of any kind, express
// or implied. In no event shall Info-ZIP or its contributors be held liable
// for any direct, indirect, incidental, special or consequential damages
// arising out of the use of or inability to use this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. Redistributions of source code must retain the above copyright notice,
// definition, disclaimer, and this list of conditions.
//
// 2. Redistributions in binary form (compiled executables) must reproduce
// the above copyright notice, definition, disclaimer, and this list of
// conditions in documentation and/or other materials provided with the
// distribution. The sole exception to this condition is redistribution
// of a standard UnZipSFX binary as part of a self-extracting archive;
// that is permitted without inclusion of this license, as long as the
// normal UnZipSFX banner has not been removed from the binary or disabled.
//
// 3. Altered versions--including, but not limited to, ports to new
// operating systems, existing ports with new graphical interfaces, and
// dynamic, shared, or static library versions--must be plainly marked
// as such and must not be misrepresented as being the original source.
// Such altered versions also must not be misrepresented as being
// Info-ZIP releases--including, but not limited to, labeling of the
// altered versions with the names "Info-ZIP" (or any variation thereof,
// including, but not limited to, different capitalizations),
// "Pocket UnZip", "WiZ" or "MacZip" without the explicit permission of
// Info-ZIP. Such altered versions are further prohibited from
// misrepresentative use of the Zip-Bugs or Info-ZIP e-mail addresses or
// of the Info-ZIP URL(s).
//
// 4. Info-ZIP retains the right to use the names "Info-ZIP", "Zip", "UnZip",
// "UnZipSFX", "WiZ", "Pocket UnZip", "Pocket Zip", and "MacZip" for its
// own source and binary releases.
//
///////////////////////////////////////////////////////////////////////////////
************************************************************************************
JPEG image support:
************************************************************************************
The Source engine and SDK also make use of library functions for working with .jpg
files. Specifically, the Source engine jpeg library is based in part on the work of
the Independent JPEG Group (IJG). The original source code and project files for the IJG's
JPEG libraries may be found at: http://www.ijg.org/files/jpegsrc.v6b.tar.gz
The following is the README. File from that archive and is produced in accordance with the legal
notices required by the library:
The Independent JPEG Group's JPEG software
==========================================
README for release 6b of 27-Mar-1998
====================================
This distribution contains the sixth public release of the Independent JPEG
Group's free JPEG software. You are welcome to redistribute this software and
to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
Serious users of this software (particularly those incorporating it into
larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to
our electronic mailing list. Mailing list members are notified of updates
and have a chance to participate in technical discussions, etc.
This software is the work of Tom Lane, Philip Gladstone, Jim Boucher,
Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi,
Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG
Group.
IJG is not affiliated with the official ISO JPEG standards committee.
DOCUMENTATION ROADMAP
=====================
This file contains the following sections:
OVERVIEW General description of JPEG and the IJG software.
LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
REFERENCES Where to learn more about JPEG.
ARCHIVE LOCATIONS Where to find newer versions of this software.
RELATED SOFTWARE Other stuff you should get.
FILE FORMAT WARS Software *not* to get.
TO DO Plans for future IJG releases.
Other documentation files in the distribution are:
User documentation:
install.doc How to configure and install the IJG software.
usage.doc Usage instructions for cjpeg, djpeg, jpegtran,
rdjpgcom, and wrjpgcom.
*.1 Unix-style man pages for programs (same info as usage.doc).
wizard.doc Advanced usage instructions for JPEG wizards only.
change.log Version-to-version change highlights.
Programmer and internal documentation:
libjpeg.doc How to use the JPEG library in your own programs.
example.c Sample code for calling the JPEG library.
structure.doc Overview of the JPEG library's internal structure.
filelist.doc Road map of IJG files.
coderules.doc Coding style rules --- please read if you contribute code.
Please read at least the files install.doc and usage.doc. Useful information
can also be found in the JPEG FAQ (Frequently Asked Questions) article. See
ARCHIVE LOCATIONS below to find out where to obtain the FAQ article.
If you want to understand how the JPEG code works, we suggest reading one or
more of the REFERENCES, then looking at the documentation files (in roughly
the order listed) before diving into the code.
OVERVIEW
========
This package contains C software to implement JPEG image compression and
decompression. JPEG (pronounced "jay-peg") is a standardized compression
method for full-color and gray-scale images. JPEG is intended for compressing
"real-world" scenes; line drawings, cartoons and other non-realistic images
are not its strong suit. JPEG is lossy, meaning that the output image is not
exactly identical to the input image. Hence you must not use JPEG if you
have to have identical output bits. However, on typical photographic images,
very good compression levels can be obtained with no visible change, and
remarkably high compression levels are possible if you can tolerate a
low-quality image. For more details, see the references, or just experiment
with various compression settings.
This software implements JPEG baseline, extended-sequential, and progressive
compression processes. Provision is made for supporting all variants of these
processes, although some uncommon parameter settings aren't implemented yet.
For legal reasons, we are not distributing code for the arithmetic-coding
variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting
the hierarchical or lossless processes defined in the standard.
We provide a set of library routines for reading and writing JPEG image files,
plus two sample applications "cjpeg" and "djpeg", which use the library to
perform conversion between JPEG and some other popular image file formats.
The library is intended to be reused in other applications.
In order to support file conversion and viewing software, we have included
considerable functionality beyond the bare JPEG coding/decoding capability;
for example, the color quantization modules are not strictly part of JPEG
decoding, but they are essential for output to colormapped file formats or
colormapped displays. These extra functions can be compiled out of the
library if not required for a particular application. We have also included
"jpegtran", a utility for lossless transcoding between different JPEG
processes, and "rdjpgcom" and "wrjpgcom", two simple applications for
inserting and extracting textual comments in JFIF files.
The emphasis in designing this software has been on achieving portability and
flexibility, while also making it fast enough to be useful. In particular,
the software is not intended to be read as a tutorial on JPEG. (See the
REFERENCES section for introductory material.) Rather, it is intended to
be reliable, portable, industrial-strength code. We do not claim to have
achieved that goal in every aspect of the software, but we strive for it.
We welcome the use of this software as a component of commercial products.
No royalty is required, but we do ask for an acknowledgement in product
documentation, as described under LEGAL ISSUES.
LEGAL ISSUES
============
In plain English:
1. We don't promise that this software works. (But if you find any bugs,
please let us know!)
2. You can use this software for whatever you want. You don't have to pay us.
3. You may not pretend that you wrote this software. If you use it in a
program, you must acknowledge somewhere in your documentation that
you've used the IJG code.
In legalese:
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-1998, Thomas G. Lane.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
software (or portions thereof) for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code for this software is distributed, then this
README file must be included, with this copyright and no-warranty notice
unaltered; and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
(2) If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
(3) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
These conditions apply to any software derived from or based on the IJG code,
not just to the unmodified library. If you use our work, you ought to
acknowledge us.
Permission is NOT granted for the use of any IJG author's name or company name
in advertising or publicity relating to this software or products derived from
it. This software may be referred to only as "the Independent JPEG Group's
software".
We specifically permit and encourage the use of this software as the basis of
commercial products, provided that all warranty or liability claims are
assumed by the product vendor.
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
ansi2knr.c is NOT covered by the above copyright and conditions, but instead
by the usual distribution terms of the Free Software Foundation; principally,
that you must include source code if you redistribute it. (See the file
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
of any program generated from the IJG code, this does not limit you more than
the foregoing paragraphs do.
The Unix configuration script "configure" was produced with GNU Autoconf.
It is copyright by the Free Software Foundation but is freely distributable.
The same holds for its supporting scripts (config.guess, config.sub,
ltconfig, ltmain.sh). Another support script, install-sh, is copyright
by M.I.T. but is also freely distributable.
It appears that the arithmetic coding option of the JPEG spec is covered by
patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
legally be used without obtaining one or more licenses. For this reason,
support for arithmetic coding has been removed from the free JPEG software.
(Since arithmetic coding provides only a marginal gain over the unpatented
Huffman mode, it is unlikely that very many implementations will support it.)
So far as we are aware, there are no patent restrictions on the remaining
code.
The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent, GIF reading support has
been removed altogether, and the GIF writer has been simplified to produce
"uncompressed GIFs". This technique does not use the LZW algorithm; the
resulting GIF files are larger than usual, but are readable by all standard
GIF decoders.
We are required to state that
"The Graphics Interchange Format(c) is the Copyright property of
CompuServe Incorporated. GIF(sm) is a Service Mark property of
CompuServe Incorporated."
REFERENCES
==========
We highly recommend reading one or more of these references before trying to
understand the innards of the JPEG software.
The best short technical introduction to the JPEG compression algorithm is
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
(Adjacent articles in that issue discuss MPEG motion picture compression,
applications of JPEG, and related topics.) If you don't have the CACM issue
handy, a PostScript file containing a revised version of Wallace's article is
available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually
a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
omits the sample images that appeared in CACM, but it includes corrections
and some added material. Note: the Wallace article is copyright ACM and IEEE,
and it may not be used for commercial purposes.
A somewhat less technical, more leisurely introduction to JPEG can be found in
"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
good explanations and example C code for a multitude of compression methods
including JPEG. It is an excellent source if you are comfortable reading C
code but don't know much about data compression in general. The book's JPEG
sample code is far from industrial-strength, but when you are ready to look
at a full implementation, you've got one here...
The best full description of JPEG is the textbook "JPEG Still Image Data
Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published
by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp.
The book includes the complete text of the ISO JPEG standards (DIS 10918-1
and draft DIS 10918-2). This is by far the most complete exposition of JPEG
in existence, and we highly recommend it.
The JPEG standard itself is not available electronically; you must order a
paper copy through ISO or ITU. (Unless you feel a need to own a certified
official copy, we recommend buying the Pennebaker and Mitchell book instead;
it's much cheaper and includes a great deal of useful explanatory material.)
In the USA, copies of the standard may be ordered from ANSI Sales at (212)
642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI
doesn't take credit card orders, but Global does.) It's not cheap: as of
1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7%
shipping/handling. The standard is divided into two parts, Part 1 being the
actual specification, while Part 2 covers compliance testing methods. Part 1
is titled "Digital Compression and Coding of Continuous-tone Still Images,
Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of
Continuous-tone Still Images, Part 2: Compliance testing" and has document
numbers ISO/IEC IS 10918-2, ITU-T T.83.
Some extensions to the original JPEG standard are defined in JPEG Part 3,
a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG
currently does not support any Part 3 extensions.
The JPEG standard does not specify all details of an interchangeable file
format. For the omitted details we follow the "JFIF" conventions, revision
1.02. A copy of the JFIF spec is available from:
Literature Department
C-Cube Microsystems, Inc.
1778 McCarthy Blvd.
Milpitas, CA 95035
phone (408) 944-6300, fax (408) 944-6314
A PostScript version of this document is available by FTP at
ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text
version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing
the figures.
The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
(Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or
from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision
of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
uses our library to implement TIFF/JPEG per the Note. libtiff is available
from ftp://ftp.sgi.com/graphics/tiff/.
ARCHIVE LOCATIONS
=================
The "official" archive site for this software is ftp.uu.net (Internet
address 192.48.96.9). The most recent released version can always be found
there in directory graphics/jpeg. This particular version will be archived
as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have
direct Internet access, UUNET's archives are also available via UUCP; contact
help@uunet.uu.net for information on retrieving files that way.
Numerous Internet sites maintain copies of the UUNET files. However, only
ftp.uu.net is guaranteed to have the latest official version.
You can also obtain this software in DOS-compatible "zip" archive format from
the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or
on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12
"JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net
release.
The JPEG FAQ (Frequently Asked Questions) article is a useful source of
general information about JPEG. It is updated constantly and therefore is
not included in this distribution. The FAQ is posted every two weeks to
Usenet newsgroups comp.graphics.misc, news.answers, and other groups.
It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/
and other news.answers archive sites, including the official news.answers
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
with body
send usenet/news.answers/jpeg-faq/part1
send usenet/news.answers/jpeg-faq/part2
RELATED SOFTWARE
================
Numerous viewing and image manipulation programs now support JPEG. (Quite a
few of them use this library to do so.) The JPEG FAQ described above lists
some of the more popular free and shareware viewers, and tells where to
obtain them on Internet.
If you are on a Unix machine, we highly recommend Jef Poskanzer's free
PBMPLUS software, which provides many useful operations on PPM-format image
files. In particular, it can convert PPM images to and from a wide range of
other formats, thus making cjpeg/djpeg considerably more useful. The latest
version is distributed by the NetPBM group, and is available from numerous
sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/.
Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is;
you are likely to have difficulty making it work on any non-Unix machine.
A different free JPEG implementation, written by the PVRG group at Stanford,
is available from ftp://havefun.stanford.edu/pub/jpeg/. This program
is designed for research and experimentation rather than production use;
it is slower, harder to use, and less portable than the IJG code, but it
is easier to read and modify. Also, the PVRG code supports lossless JPEG,
which we do not. (On the other hand, it doesn't do progressive JPEG.)
FILE FORMAT WARS
================
Some JPEG programs produce files that are not compatible with our library.
The root of the problem is that the ISO JPEG committee failed to specify a
concrete file format. Some vendors "filled in the blanks" on their own,
creating proprietary formats that no one else could read. (For example, none
of the early commercial JPEG implementations for the Macintosh were able to
exchange compressed files.)
The file format we have adopted is called JFIF (see REFERENCES). This format
has been agreed to by a number of major commercial JPEG vendors, and it has
become the de facto standard. JFIF is a minimal or "low end" representation.
We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF
Technical Note #2) for "high end" applications that need to record a lot of
additional data about an image. TIFF/JPEG is fairly new and not yet widely
supported, unfortunately.
The upcoming JPEG Part 3 standard defines a file format called SPIFF.
SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should
be able to read the most common variant of SPIFF. SPIFF has some technical
advantages over JFIF, but its major claim to fame is simply that it is an
official standard rather than an informal one. At this point it is unclear
whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto
standard. IJG intends to support SPIFF once the standard is frozen, but we
have not decided whether it should become our default output format or not.
(In any case, our decoder will remain capable of reading JFIF indefinitely.)
Various proprietary file formats incorporating JPEG compression also exist.
We have little or no sympathy for the existence of these formats. Indeed,
one of the original reasons for developing this free software was to help
force convergence on common, open format standards for JPEG files. Don't
use a proprietary file format!
TO DO
=====
The major thrust for v7 will probably be improvement of visual quality.
The current method for scaling the quantization tables is known not to be
very good at low Q values. We also intend to investigate block boundary
smoothing, "poor man's variable quantization", and other means of improving
quality-vs-file-size performance without sacrificing compatibility.
In future versions, we are considering supporting some of the upcoming JPEG
Part 3 extensions --- principally, variable quantization and the SPIFF file
format.
As always, speeding things up is of great interest.
Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net.
************************************************************************************
Celt Codec:
************************************************************************************
Copyright 2001-2009 Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, and other contributors
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************************
SPEEX Codes:
************************************************************************************
SPEEX <20> 2002-2003, Jean-Marc Valin/Xiph.Org Foundation
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the Xiph.org Foundation nor the names of its contributors may be
used to endorse or promote products derived from this software without specific prior
written permission.
This software is provided by the copyright holders and contributors <20>as is<69> and any express or
implied warranties, including, but not limited to, the implied warranties of merchantability and
fitness for a particular purpose are disclaimed. In no event shall the foundation or contributors be
liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including,
but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or
business interruption) however caused and on any theory of liability, whether in contract, strict
liability, or tort (including negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
************************************************************************************
google-perftools:
************************************************************************************
http://code.google.com/p/gperftools/
Copyright (c) 2012, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For Google libjingle:
http://sourceforge.net/projects/libjingle/
Copyright (c) 2004--2005, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
************************************************************************************
CakePHP:
************************************************************************************
CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
Copyright 2005-2007, Cake Software Foundation, Inc.
1785 E. Sahara Avenue, Suite 490-204
Las Vegas, Nevada 89104
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
************************************************************************************
LZMA
************************************************************************************
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
************************************************************************************
Fast Pow Function
************************************************************************************
/*
* (c) Ian Stephenson
*
* ian@dctsystems.co.uk
*
* Fast pow() reference implementation
*/
Used with permission from author
For libantlr3c:
// [The "BSD licence"]
// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
// http://www.temporal-wave.com
// http://www.linkedin.com/in/jimidle
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************************
Autodesk<EFBFBD> FBX<42>:
************************************************************************************
<09>This software contains Autodesk<73> FBX<42> code developed by Autodesk, Inc. Copyright 2012 Autodesk, Inc.
All rights, reserved. Such code is provided <20>as is<69> and Autodesk, Inc. disclaims any and all warranties,
whether express or implied, including without limitation the implied warranties of merchantability, fitness for a
particular purpose or non-infringement of third party rights. In no event shall Autodesk, Inc. be liable for any
direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however
caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or
otherwise) arising in any way out of such code.<2E>
************************************************************************************
OpenSSL:
************************************************************************************
* This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
/* ====================================================================
* Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be
used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*
*/
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an
acknowledgement:
* "This product includes software written by Tim Hudson
(tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
************************************************************************************
Google protocol buffers
************************************************************************************
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
************************************************************************************
Google Snappy
************************************************************************************
// Copyright 2005 Google Inc. All Rights Reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************************
VAudio MiniMP3
************************************************************************************
Copyright 2022 Joshua Ashton and Josh Dowell
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
************************************************************************************
Godot Engine
************************************************************************************
Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

23
src/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build All Projects",
"type": "shell",
"command": "./buildallprojects",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": ["relative", "${workspaceFolder}"]
},
"presentation": {
"reveal": "always",
"panel": "shared"
}
}
]
}

38
src/buildallprojects Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail
script=$(readlink -f -- "$0")
pushd "$(dirname -- "$script")" > /dev/null
source sdk_container
run_in_sniper "$@"
if [ $# -eq 0 ]; then
export VPC_NINJA_BUILD_MODE="release"
else
if [[ "$1" == "debug" ]]; then
export VPC_NINJA_BUILD_MODE="debug"
elif [[ "$1" == "release" ]]; then
export VPC_NINJA_BUILD_MODE="release"
else
echo "Usage: $0 [debug|release]"
exit 1
fi
fi
solution_out="_vpc_/ninja/sdk_everything_$VPC_NINJA_BUILD_MODE"
if [[ ! -e "$solution_out.ninja" ]]; then
devtools/bin/vpc /hl2mp /tf /linux64 /ninja /define:SOURCESDK +everything /mksln "$solution_out"
# Generate compile commands.
ninja -f "$solution_out.ninja" -t compdb > compile_commands.json
# Remove some unsupported clang commands.
sed -i 's/-fpredictive-commoning//g; s/-fvar-tracking-assignments//g' compile_commands.json
sed -i 's|/my_mod/src|.|g' compile_commands.json
fi
ninja -f "$solution_out.ninja" -j$(nproc)
popd

View File

@ -0,0 +1,45 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//===========================================================================//
#ifndef IGAMECONSOLE_H
#define IGAMECONSOLE_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/interface.h"
namespace vgui
{
typedef uintp VPANEL;
}
//-----------------------------------------------------------------------------
// Purpose: interface to game/dev console
//-----------------------------------------------------------------------------
abstract_class IGameConsole : public IBaseInterface
{
public:
// activates the console, makes it visible and brings it to the foreground
virtual void Activate() = 0;
virtual void Initialize() = 0;
// hides the console
virtual void Hide() = 0;
// clears the console
virtual void Clear() = 0;
// return true if the console has focus
virtual bool IsConsoleVisible() = 0;
virtual void SetParent( vgui::VPANEL parent ) = 0;
};
#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
#endif // IGAMECONSOLE_H

View File

@ -0,0 +1,243 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include <stdio.h>
#include <malloc.h>
#include "ObjectList.h"
#include "tier1/strtools.h"
//#include "port.h"
//#include "mem.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ObjectList::ObjectList()
{
head = tail = current = NULL;
number = 0;
}
ObjectList::~ObjectList()
{
Clear( false );
}
bool ObjectList::AddHead(void * newObject)
{
// create new element
element_t * newElement = (element_t *) calloc(1, sizeof(element_t));
if (newElement == NULL )
return false; // out of memory
// insert element
newElement->object = newObject;
if (head)
{
newElement->next = head;
head->prev = newElement;
};
head = newElement;
// if list was empty set new tail
if (tail==NULL) tail = head;
number++;
return true;
}
void * ObjectList::RemoveHead()
{
void * retObj;
// check head is present
if (head)
{
retObj = head->object;
element_t * newHead = head->next;
if (newHead) newHead->prev = NULL;
// if only one element is in list also update tail
// if we remove this prev element
if (tail==head) tail = NULL;
free(head);
head = newHead;
number--;
} else
retObj = NULL;
return retObj;
}
bool ObjectList::AddTail(void * newObject)
{
element_t * newElement = (element_t *) calloc(1, sizeof(element_t));
if (newElement == NULL)
return false; // out of memory;
newElement->object = newObject;
if (tail)
{
newElement->prev = tail;
tail->next = newElement;
}
tail = newElement;
// if list was empty set new head
if (head==NULL) head = tail;
number++;
return true;
}
void * ObjectList::RemoveTail()
{
void * retObj;
// check tail is present
if (tail)
{
retObj = tail->object;
element_t * newTail = tail->prev;
if (newTail) newTail->next = NULL;
// if only one element is in list also update tail
// if we remove this prev element
if (head==tail) head = NULL;
free(tail);
tail = newTail;
number--;
} else
retObj = NULL;
return retObj;
}
bool ObjectList::IsEmpty()
{
return ( head == NULL );
}
int ObjectList::CountElements()
{
return number;
}
bool ObjectList::Contains(void * object)
{
element_t * e = head;
while(e && e->object!=object) { e = e->next;}
if ( e )
{
current = e;
return true;
}
else
{
return false;
}
}
void ObjectList::Clear( bool freeElementsMemory )
{
element_t * ne;
element_t * e = head;
while(e)
{
ne = e->next;
if ( freeElementsMemory && e->object )
free( e->object );
free(e);
e = ne;
}
head = tail = current = NULL;
number = 0;
}
bool ObjectList::Remove( void * object )
{
element_t * e = head;
while(e && e->object!=object) { e = e->next;}
if (e!=NULL)
{
if (e->prev) e->prev->next = e->next;
if (e->next) e->next->prev = e->prev;
if (head==e) head = e->next;
if (tail==e) tail = e->prev;
if (current == e) current= e->next;
free(e);
number--;
}
return (e!=NULL);
}
void ObjectList::Init()
{
head = tail = current = NULL;
number = 0;
}
void * ObjectList::GetFirst()
{
if (head)
{
current = head->next;
return head->object;
}
else
{
current = NULL;
return NULL;
};
}
void * ObjectList::GetNext()
{
void * retObj = NULL;
if (current)
{
retObj = current->object;
current = current->next;
}
return retObj;
}
bool ObjectList::Add(void *newObject)
{
return AddTail( newObject );
}

View File

@ -0,0 +1,58 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// ObjectList.h: interface for the ObjectList class.
//
//////////////////////////////////////////////////////////////////////
#ifndef OBJECTLIST_H
#define OBJECTLIST_H
#pragma once
#include "IObjectContainer.h" // Added by ClassView
class ObjectList : public IObjectContainer
{
public:
void Init();
bool Add( void * newObject );
void * GetFirst();
void * GetNext();
ObjectList();
virtual ~ObjectList();
void Clear( bool freeElementsMemory );
int CountElements();
void * RemoveTail();
void * RemoveHead();
bool AddTail(void * newObject);
bool AddHead(void * newObject);
bool Remove(void * object);
bool Contains(void * object);
bool IsEmpty();
typedef struct element_s {
element_s * prev; // pointer to the last element or NULL
element_s * next; // pointer to the next elemnet or NULL
void * object; // the element's object
} element_t;
protected:
element_t * head; // first element in list
element_t * tail; // last element in list
element_t * current; // current element in list
int number;
};
#endif // !defined

View File

@ -0,0 +1,131 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Basic random number generator
//
// $NoKeywords: $
//===========================================================================//
#include <time.h>
#include "Random.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define IA 16807
#define IM 2147483647
#define IQ 127773
#define IR 2836
#define NTAB 32
#define NDIV (1+(IM-1)/NTAB)
static long idum = 0;
void SeedRandomNumberGenerator(long lSeed)
{
if (lSeed)
{
idum = lSeed;
}
else
{
idum = -time(NULL);
}
if (1000 < idum)
{
idum = -idum;
}
else if (-1000 < idum)
{
idum -= 22261048;
}
}
long ran1(void)
{
int j;
long k;
static long iy=0;
static long iv[NTAB];
if (idum <= 0 || !iy)
{
if (-(idum) < 1) idum=1;
else idum = -(idum);
for (j=NTAB+7;j>=0;j--)
{
k=(idum)/IQ;
idum=IA*(idum-k*IQ)-IR*k;
if (idum < 0) idum += IM;
if (j < NTAB) iv[j] = idum;
}
iy=iv[0];
}
k=(idum)/IQ;
idum=IA*(idum-k*IQ)-IR*k;
if (idum < 0) idum += IM;
j=iy/NDIV;
iy=iv[j];
iv[j] = idum;
return iy;
}
// fran1 -- return a random floating-point number on the interval [0,1)
//
#define AM (1.0/IM)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)
float fran1(void)
{
float temp = (float)AM*ran1();
if (temp > RNMX) return (float)RNMX;
else return temp;
}
#ifndef _XBOX
float RandomFloat( float flLow, float flHigh )
{
if (idum == 0)
{
SeedRandomNumberGenerator(0);
}
float fl = fran1(); // float in [0,1)
return (fl * (flHigh-flLow)) + flLow; // float in [low,high)
}
#endif
long RandomLong( long lLow, long lHigh )
{
if (idum == 0)
{
SeedRandomNumberGenerator(0);
}
unsigned long maxAcceptable;
unsigned long x = lHigh-lLow+1;
unsigned long n;
if (x <= 0 || MAX_RANDOM_RANGE < x-1)
{
return lLow;
}
// The following maps a uniform distribution on the interval [0,MAX_RANDOM_RANGE]
// to a smaller, client-specified range of [0,x-1] in a way that doesn't bias
// the uniform distribution unfavorably. Even for a worst case x, the loop is
// guaranteed to be taken no more than half the time, so for that worst case x,
// the average number of times through the loop is 2. For cases where x is
// much smaller than MAX_RANDOM_RANGE, the average number of times through the
// loop is very close to 1.
//
maxAcceptable = MAX_RANDOM_RANGE - ((MAX_RANDOM_RANGE+1) % x );
do
{
n = ran1();
} while (n > maxAcceptable);
return lLow + (n % x);
}

View File

@ -0,0 +1,30 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generalized 32-bit random number generator
// Range is 0x00000000 - 0x7FFFFFFF
//
// $NoKeywords: $
//=============================================================================//
#ifndef RANDOM_H
#define RANDOM_H
#ifdef _WIN32
#pragma once
#endif
// the random number seeding is automatic
#define MAX_RANDOM_RANGE 0x7FFFFFFFUL
// restarts random generator
// setting lSeed to 0 causes the current time to be used as the seed
// random number generator will automatically seed itself on first use with current time if this is not called
extern void SeedRandomNumberGenerator(long lSeed = 0);
// returns a random integer of range [low, high]
extern long RandomLong( long lLow, long lHigh );
// returns a random float of range [low, high)
extern float RandomFloat( float flLow, float flHigh );
#endif // RANDOM_H

View File

@ -0,0 +1,334 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "cvarslider.h"
#include <stdio.h>
#include "tier1/KeyValues.h"
#include "tier1/convar.h"
#include <vgui/IVGui.h>
#include <vgui_controls/PropertyPage.h>
#define CVARSLIDER_SCALE_FACTOR 100.0f
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
using namespace vgui;
DECLARE_BUILD_FACTORY( CCvarSlider );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCvarSlider::CCvarSlider( Panel *parent, const char *name ) : Slider( parent, name )
{
SetupSlider( 0, 1, "", false );
m_bCreatedInCode = false;
AddActionSignalTarget( this );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCvarSlider::CCvarSlider( Panel *parent, const char *panelName, char const *caption,
float minValue, float maxValue, char const *cvarname, bool bAllowOutOfRange )
: Slider( parent, panelName )
{
AddActionSignalTarget( this );
SetupSlider( minValue, maxValue, cvarname, bAllowOutOfRange );
// For backwards compatability. Ignore .res file settings for forced setup sliders.
m_bCreatedInCode = true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::SetupSlider( float minValue, float maxValue, const char *cvarname, bool bAllowOutOfRange )
{
// make sure min/max don't go outside cvar range if there's one
UIConVarRef var( g_pVGui->GetVGUIEngine(), cvarname, true );
if ( var.IsValid() )
{
float flCVarMin;
if ( var.GetMin( flCVarMin ) )
{
minValue = m_bUseConVarMinMax ? flCVarMin : MAX( minValue, flCVarMin );
}
float flCVarMax;
if ( var.GetMax( flCVarMax ) )
{
maxValue = m_bUseConVarMinMax ? flCVarMax : MIN( maxValue, flCVarMax );
}
}
m_flMinValue = minValue;
m_flMaxValue = maxValue;
// scale by CVARSLIDER_SCALE_FACTOR
SetRange( (int)( CVARSLIDER_SCALE_FACTOR * minValue ), (int)( CVARSLIDER_SCALE_FACTOR * maxValue ) );
char szMin[ 32 ];
char szMax[ 32 ];
Q_snprintf( szMin, sizeof( szMin ), "%.2f", minValue );
Q_snprintf( szMax, sizeof( szMax ), "%.2f", maxValue );
SetTickCaptions( szMin, szMax );
Q_strncpy( m_szCvarName, cvarname, sizeof( m_szCvarName ) );
m_bModifiedOnce = false;
m_bAllowOutOfRange = bAllowOutOfRange;
// Set slider to current value
Reset();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CCvarSlider::~CCvarSlider()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::ApplySettings( KeyValues *inResourceData )
{
BaseClass::ApplySettings( inResourceData );
if ( !m_bCreatedInCode )
{
float minValue = inResourceData->GetFloat( "minvalue", 0 );
float maxValue = inResourceData->GetFloat( "maxvalue", 1 );
const char *cvarname = inResourceData->GetString( "cvar_name", "" );
bool bAllowOutOfRange = inResourceData->GetInt( "allowoutofrange", 0 ) != 0;
SetupSlider( minValue, maxValue, cvarname, bAllowOutOfRange );
if ( GetParent() )
{
// HACK: If our parent is a property page, we want the dialog containing it
if ( dynamic_cast<vgui::PropertyPage*>(GetParent()) && GetParent()->GetParent() )
{
GetParent()->GetParent()->AddActionSignalTarget( this );
}
else
{
GetParent()->AddActionSignalTarget( this );
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Get control settings for editing
//-----------------------------------------------------------------------------
void CCvarSlider::GetSettings( KeyValues *outResourceData )
{
BaseClass::GetSettings(outResourceData);
if ( !m_bCreatedInCode )
{
outResourceData->SetFloat( "minvalue", m_flMinValue );
outResourceData->SetFloat( "maxvalue", m_flMaxValue );
outResourceData->SetString( "cvar_name", m_szCvarName );
outResourceData->SetInt( "allowoutofrange", m_bAllowOutOfRange );
}
}
void CCvarSlider::SetCVarName( char const *cvarname )
{
Q_strncpy( m_szCvarName, cvarname, sizeof( m_szCvarName ) );
m_bModifiedOnce = false;
// Set slider to current value
Reset();
}
void CCvarSlider::SetMinMaxValues( float minValue, float maxValue, bool bSetTickDisplay )
{
SetRange( (int)( CVARSLIDER_SCALE_FACTOR * minValue ), (int)( CVARSLIDER_SCALE_FACTOR * maxValue ) );
if ( bSetTickDisplay )
{
char szMin[ 32 ];
char szMax[ 32 ];
Q_snprintf( szMin, sizeof( szMin ), "%.2f", minValue );
Q_snprintf( szMax, sizeof( szMax ), "%.2f", maxValue );
SetTickCaptions( szMin, szMax );
}
// Set slider to current value
Reset();
}
void CCvarSlider::SetTickColor( Color color )
{
m_TickColor = color;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::Paint()
{
// Get engine's current value
// float curvalue = engine->pfnGetCvarFloat( m_szCvarName );
UIConVarRef var( g_pVGui->GetVGUIEngine(), m_szCvarName, true );
if ( !var.IsValid() )
return;
float curvalue = var.GetFloat();
// did it get changed from under us?
if (curvalue != m_fStartValue)
{
int val = (int)( CVARSLIDER_SCALE_FACTOR * curvalue );
m_fStartValue = curvalue;
m_fCurrentValue = curvalue;
SetValue( val );
m_iStartValue = GetValue();
}
BaseClass::Paint();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::ApplyChanges()
{
if (m_bModifiedOnce)
{
m_iStartValue = GetValue();
if (m_bAllowOutOfRange)
{
m_fStartValue = m_fCurrentValue;
}
else
{
m_fStartValue = (float) m_iStartValue / CVARSLIDER_SCALE_FACTOR;
}
//engine->Cvar_SetValue( m_szCvarName, m_fStartValue );
UIConVarRef var( g_pVGui->GetVGUIEngine(), m_szCvarName, true );
if ( !var.IsValid() )
return;
var.SetValue( (float)m_fStartValue );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CCvarSlider::GetSliderValue()
{
if (m_bAllowOutOfRange)
{
return m_fCurrentValue;
}
else
{
return ((float)GetValue())/ CVARSLIDER_SCALE_FACTOR;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::SetSliderValue(float fValue)
{
int nVal = (int)( CVARSLIDER_SCALE_FACTOR * fValue );
SetValue( nVal, false);
// remember this slider value
m_iLastSliderValue = GetValue();
if (m_fCurrentValue != fValue)
{
m_fCurrentValue = fValue;
m_bModifiedOnce = true;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::Reset()
{
// Set slider to current value
// m_fStartValue = engine->pfnGetCvarFloat( m_szCvarName );
UIConVarRef var( g_pVGui->GetVGUIEngine(), m_szCvarName, true );
if ( !var.IsValid() )
{
m_fCurrentValue = m_fStartValue = 0.0f;
SetValue( 0, false );
m_iStartValue = GetValue();
m_iLastSliderValue = m_iStartValue;
return;
}
m_fStartValue = var.GetFloat();
m_fCurrentValue = m_fStartValue;
int value = (int)( CVARSLIDER_SCALE_FACTOR * m_fStartValue );
SetValue( value, false );
m_iStartValue = GetValue();
m_iLastSliderValue = m_iStartValue;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CCvarSlider::HasBeenModified()
{
if (GetValue() != m_iStartValue)
{
m_bModifiedOnce = true;
}
return m_bModifiedOnce;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : position -
//-----------------------------------------------------------------------------
void CCvarSlider::OnSliderMoved()
{
if (HasBeenModified())
{
if (m_iLastSliderValue != GetValue())
{
m_iLastSliderValue = GetValue();
m_fCurrentValue = ((float) m_iLastSliderValue)/CVARSLIDER_SCALE_FACTOR;
}
// tell parent that we've been modified
PostActionSignal(new KeyValues("ControlModified"));
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCvarSlider::OnSliderDragEnd( void )
{
if ( !m_bCreatedInCode )
{
ApplyChanges();
}
}

View File

@ -0,0 +1,63 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CVARSLIDER_H
#define CVARSLIDER_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/Slider.h>
class CCvarSlider : public vgui::Slider
{
DECLARE_CLASS_SIMPLE( CCvarSlider, vgui::Slider );
public:
CCvarSlider( vgui::Panel *parent, const char *panelName );
CCvarSlider( vgui::Panel *parent, const char *panelName, char const *caption,
float minValue, float maxValue, char const *cvarname, bool bAllowOutOfRange=false );
~CCvarSlider();
void SetupSlider( float minValue, float maxValue, const char *cvarname, bool bAllowOutOfRange );
void SetCVarName( char const *cvarname );
void SetMinMaxValues( float minValue, float maxValue, bool bSetTickdisplay = true );
void SetTickColor( Color color );
virtual void Paint();
virtual void ApplySettings( KeyValues *inResourceData );
virtual void GetSettings( KeyValues *outResourceData );
void ApplyChanges();
float GetSliderValue();
void SetSliderValue(float fValue);
void Reset();
bool HasBeenModified();
private:
MESSAGE_FUNC( OnSliderMoved, "SliderMoved" );
MESSAGE_FUNC( OnSliderDragEnd, "SliderDragEnd" );
CPanelAnimationVar( bool, m_bUseConVarMinMax, "use_convar_minmax", "0" );
bool m_bAllowOutOfRange;
bool m_bModifiedOnce;
float m_fStartValue;
int m_iStartValue;
int m_iLastSliderValue;
float m_fCurrentValue;
char m_szCvarName[ 64 ];
bool m_bCreatedInCode;
float m_flMinValue;
float m_flMaxValue;
};
#endif // CVARSLIDER_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,156 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef SCRIPTOBJECT_H
#define SCRIPTOBJECT_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/Panel.h>
class CPanelListPanel;
#define SCRIPT_VERSION 1.0f
typedef void * FileHandle_t;
enum objtype_t
{
O_BADTYPE,
O_BOOL,
O_NUMBER,
O_LIST,
O_STRING,
O_OBSOLETE,
O_SLIDER,
O_CATEGORY,
O_BUTTON,
};
typedef struct
{
objtype_t type;
char szDescription[32];
} objtypedesc_t;
class CScriptListItem
{
public:
CScriptListItem();
CScriptListItem( char const *strItem, char const *strValue );
char szItemText[128];
char szValue[256];
CScriptListItem *pNext;
};
class CScriptObject : public vgui::Panel
{
public:
void AddItem( CScriptListItem *pItem );
void RemoveAndDeleteAllItems( void );
CScriptObject( void );
~CScriptObject();
bool ReadFromBuffer( const char **pBuffer, bool isNewObject );
void WriteToConfig();
void WriteToFile( FileHandle_t fp );
void WriteToScriptFile( FileHandle_t fp );
void SetCurValue( char const *strValue );
objtype_t GetType( char *pszType );
objtype_t type;
char cvarname[64 ];
char prompt[ 256 ];
char tooltip[ 256 ];
CScriptListItem *pListItems;
float fMin, fMax;
char defValue[ 128 ]; // Default value string
float fdefValue; // Float version of default value.
char curValue[ 128 ];
float fcurValue;
bool bSetInfo; // Prepend "Setinfo" to keyvalue pair in config?
// Linked list of default list box items.
CScriptObject *pNext;
};
abstract_class CDescription
{
public:
CDescription( void );
virtual ~CDescription();
bool ReadFromBuffer( const char **pBuffer, bool bAllowNewObject );
bool InitFromFile( const char *pszFileName, bool bAllowNewObject = true );
void TransferCurrentValues( const char *pszConfigFile );
void AddObject( CScriptObject *pItem );
void WriteToConfig();
void WriteToFile( FileHandle_t fp );
void WriteToScriptFile( FileHandle_t fp );
virtual void WriteScriptHeader( FileHandle_t fp ) = 0; // Clients must implement this.
virtual void WriteFileHeader( FileHandle_t fp ) = 0; // Clients must implement this.
void setDescription( const char *pszDesc );
void setHint( const char *pszHint );
const char *GetDescription( void ) { return m_pszDescriptionType; };
const char *getHint( void ) { return m_pszHintText; } ;
public:
CScriptObject *pObjList;
CScriptObject *FindObject( const char *pszObjectName );
private:
char *m_pszHintText;
char *m_pszDescriptionType;
};
namespace vgui
{
class Label;
class Panel;
}
class mpcontrol_t : public vgui::Panel
{
public:
mpcontrol_t( vgui::Panel *parent, char const *panelName );
virtual void OnSizeChanged( int wide, int tall ) OVERRIDE;
objtype_t type;
vgui::Panel *pControl;
vgui::Label *pPrompt;
CScriptObject *pScrObj;
mpcontrol_t *next;
};
class CInfoDescription : public CDescription
{
public:
CInfoDescription( void );
virtual void WriteScriptHeader( FileHandle_t fp ) OVERRIDE;
virtual void WriteFileHeader( FileHandle_t fp ) OVERRIDE;
};
void UTIL_StripInvalidCharacters( char *pszInput, int maxlen );
#endif // SCRIPTOBJECT_H

View File

@ -0,0 +1,57 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef ISERVERBROWSER_H
#define ISERVERBROWSER_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
//-----------------------------------------------------------------------------
// Purpose: Interface to server browser module
//-----------------------------------------------------------------------------
abstract_class IServerBrowser
{
public:
// activates the server browser window, brings it to the foreground
virtual bool Activate() = 0;
// joins a game directly
virtual bool JoinGame( uint32 unGameIP, uint16 usGamePort, const char *pszConnectCode ) = 0;
// joins a specified game - game info dialog will only be opened if the server is fully or passworded
virtual bool JoinGame( uint64 ulSteamIDFriend, const char *pszConnectCode ) = 0;
// opens a game info dialog to watch the specified server; associated with the friend 'userName'
virtual bool OpenGameInfoDialog( uint64 ulSteamIDFriend, const char *pszConnectCode ) = 0;
// forces the game info dialog closed
virtual void CloseGameInfoDialog( uint64 ulSteamIDFriend ) = 0;
// closes all the game info dialogs
virtual void CloseAllGameInfoDialogs() = 0;
/// Given a map name, strips off some stuff and returns the "friendly" name of the map.
/// Returns the cleaned out map name into the caller's buffer, and returns the friendly
/// game type name.
virtual const char *GetMapFriendlyNameAndGameType( const char *pszMapName, char *szFriendlyMapName, int cchFriendlyName ) = 0;
// Enable filtering of workshop maps, requires the game/tool loading us to feed subscription data. This is a
// slightly ugly workaround to TF2 not yet having native workshop UI in quickplay, once that is in place this should
// either be stripped back out or expanded to be directly aware of the steam workshop without being managed.
virtual void SetWorkshopEnabled( bool bManaged ) = 0;
virtual void AddWorkshopSubscribedMap( const char *pszMapName ) = 0;
virtual void RemoveWorkshopSubscribedMap( const char *pszMapName ) = 0;
};
#define SERVERBROWSER_INTERFACE_VERSION "ServerBrowser005"
#endif // ISERVERBROWSER_H

View File

@ -0,0 +1,290 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
//#include "..\..\serverbrowser\pch_serverbrowser.h"
#undef _snprintf // needed since matchmakingtypes.h inlines a bare _snprintf
#include "convar.h"
#include "KeyValues.h"
#include "filesystem.h"
#include "steam/steamclientpublic.h"
#include "steam/matchmakingtypes.h"
#include <time.h>
#include "blacklisted_server_manager.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBlacklistedServerManager::CBlacklistedServerManager()
{
m_iNextServerID = 0;
}
//-----------------------------------------------------------------------------
// Purpose: Reset the list of blacklisted servers to empty.
//-----------------------------------------------------------------------------
void CBlacklistedServerManager::Reset( void )
{
m_Blacklist.RemoveAll();
m_iNextServerID = 0;
}
//-----------------------------------------------------------------------------
// Purpose: Appends all the servers inside the specified file to the blacklist.
// Returns count of appended servers, zero for failure.
//-----------------------------------------------------------------------------
int CBlacklistedServerManager::LoadServersFromFile( const char *pszFilename, bool bResetTimes )
{
KeyValues *pKV = new KeyValues( "serverblacklist" );
if ( !pKV->LoadFromFile( g_pFullFileSystem, pszFilename, "MOD" ) )
return 0;
int count = 0;
for ( KeyValues *pData = pKV->GetFirstSubKey(); pData != NULL; pData = pData->GetNextKey() )
{
const char *pszName = pData->GetString( "name" );
uint32 ulDate = pData->GetInt( "date" );
if ( bResetTimes )
{
time_t today;
time( &today );
ulDate = today;
}
const char *pszNetAddr = pData->GetString( "addr" );
if ( pszNetAddr && pszNetAddr[0] && pszName && pszName[0] )
{
int iIdx = m_Blacklist.AddToTail();
m_Blacklist[iIdx].m_nServerID = m_iNextServerID++;
V_strncpy( m_Blacklist[iIdx].m_szServerName, pszName, sizeof( m_Blacklist[iIdx].m_szServerName ) );
m_Blacklist[iIdx].m_ulTimeBlacklistedAt = ulDate;
m_Blacklist[iIdx].m_NetAdr.SetFromString( pszNetAddr );
++count;
}
}
pKV->deleteThis();
return count;
}
//-----------------------------------------------------------------------------
// Purpose: save blacklist to disk
//-----------------------------------------------------------------------------
void CBlacklistedServerManager::SaveToFile( const char *pszFilename )
{
KeyValues *pKV = new KeyValues( "serverblacklist" );
for ( int i = 0; i < m_Blacklist.Count(); i++ )
{
KeyValues *pSubKey = new KeyValues( "server" );
pSubKey->SetString( "name", m_Blacklist[i].m_szServerName );
pSubKey->SetInt( "date", m_Blacklist[i].m_ulTimeBlacklistedAt );
pSubKey->SetString( "addr", m_Blacklist[i].m_NetAdr.ToString() );
pKV->AddSubKey( pSubKey );
}
pKV->SaveToFile( g_pFullFileSystem, pszFilename, "MOD" );
pKV->deleteThis();
}
//-----------------------------------------------------------------------------
// Purpose: Add the given server to the blacklist. Return added server.
//-----------------------------------------------------------------------------
blacklisted_server_t *CBlacklistedServerManager::AddServer( gameserveritem_t &server )
{
// Make sure we don't already have this IP in the list somewhere
netadr_t netAdr( server.m_NetAdr.GetIP(), server.m_NetAdr.GetConnectionPort() );
// Don't let them add reserved addresses to their blacklists
if ( netAdr.IsReservedAdr() )
return NULL;
int iIdx = m_Blacklist.AddToTail();
V_strncpy( m_Blacklist[iIdx].m_szServerName, server.GetName(), sizeof( m_Blacklist[iIdx].m_szServerName ) );
time_t today;
time( &today );
m_Blacklist[iIdx].m_ulTimeBlacklistedAt = today;
m_Blacklist[iIdx].m_NetAdr = netAdr;
m_Blacklist[iIdx].m_nServerID = m_iNextServerID++;
return &m_Blacklist[iIdx];
}
//-----------------------------------------------------------------------------
// Purpose: Add the given server to the blacklist. Return added server.
//-----------------------------------------------------------------------------
blacklisted_server_t *CBlacklistedServerManager::AddServer( const char *serverName, uint32 serverIP, int serverPort )
{
netadr_t netAdr( serverIP, serverPort );
// Don't let them add reserved addresses to their blacklists
if ( netAdr.IsReservedAdr() )
return NULL;
int iIdx = m_Blacklist.AddToTail();
V_strncpy( m_Blacklist[iIdx].m_szServerName, serverName, sizeof( m_Blacklist[iIdx].m_szServerName ) );
time_t today;
time( &today );
m_Blacklist[iIdx].m_ulTimeBlacklistedAt = today;
m_Blacklist[iIdx].m_NetAdr = netAdr;
m_Blacklist[iIdx].m_nServerID = m_iNextServerID++;
return &m_Blacklist[iIdx];
}
//-----------------------------------------------------------------------------
// Purpose: Add the given server to the blacklist. Return added server.
//-----------------------------------------------------------------------------
blacklisted_server_t *CBlacklistedServerManager::AddServer( const char *serverName, const char *netAddressString, uint32 timestamp )
{
netadr_t netAdr( netAddressString );
// Don't let them add reserved addresses to their blacklists
if ( netAdr.IsReservedAdr() )
return NULL;
int iIdx = m_Blacklist.AddToTail();
V_strncpy( m_Blacklist[iIdx].m_szServerName, serverName, sizeof( m_Blacklist[iIdx].m_szServerName ) );
m_Blacklist[iIdx].m_ulTimeBlacklistedAt = timestamp;
m_Blacklist[iIdx].m_NetAdr = netAdr;
m_Blacklist[iIdx].m_nServerID = m_iNextServerID++;
return &m_Blacklist[iIdx];
}
//-----------------------------------------------------------------------------
// Purpose: Remove server with matching 'server id' from list
//-----------------------------------------------------------------------------
void CBlacklistedServerManager::RemoveServer( int iServerID )
{
for ( int i = 0; i < m_Blacklist.Count(); i++ )
{
if ( m_Blacklist[i].m_nServerID == iServerID )
{
m_Blacklist.Remove(i);
break;
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Given a serverID, return its blacklist entry
//-----------------------------------------------------------------------------
blacklisted_server_t *CBlacklistedServerManager::GetServer( int iServerID )
{
for ( int i = 0; i < m_Blacklist.Count(); i++ )
{
if ( m_Blacklist[i].m_nServerID == iServerID )
return &m_Blacklist[i];
}
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if given server is blacklisted
//-----------------------------------------------------------------------------
bool CBlacklistedServerManager::IsServerBlacklisted( const gameserveritem_t &server ) const
{
return IsServerBlacklisted( server.m_NetAdr.GetIP(), server.m_NetAdr.GetConnectionPort(), server.GetName() );
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if given server is blacklisted
//-----------------------------------------------------------------------------
bool CBlacklistedServerManager::IsServerBlacklisted( uint32 serverIP, int serverPort, const char *serverName ) const
{
netadr_t netAdr( serverIP, serverPort );
ConVarRef sb_showblacklists( "sb_showblacklists" );
for ( int i = 0; i < m_Blacklist.Count(); i++ )
{
if ( m_Blacklist[i].m_NetAdr.ip[3] == 0 )
{
if ( m_Blacklist[i].m_NetAdr.CompareClassCAdr( netAdr ) )
{
if ( sb_showblacklists.IsValid() && sb_showblacklists.GetBool() )
{
Msg( "Blacklisted '%s' (%s), due to rule '%s' (Class C).\n", serverName, netAdr.ToString(), m_Blacklist[i].m_NetAdr.ToString() );
}
return true;
}
}
else
{
if ( m_Blacklist[i].m_NetAdr.CompareAdr( netAdr, (m_Blacklist[i].m_NetAdr.GetPort() == 0) ) )
{
if ( sb_showblacklists.IsValid() && sb_showblacklists.GetBool() )
{
Msg( "Blacklisted '%s' (%s), due to rule '%s'.\n", serverName, netAdr.ToString(), m_Blacklist[i].m_NetAdr.ToString() );
}
return true;
}
}
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if the given server is allowed to be blacklisted at all
//-----------------------------------------------------------------------------
bool CBlacklistedServerManager::CanServerBeBlacklisted( gameserveritem_t &server ) const
{
return CanServerBeBlacklisted( server.m_NetAdr.GetIP(), server.m_NetAdr.GetConnectionPort(), server.GetName() );
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if the given server is allowed to be blacklisted at all
//-----------------------------------------------------------------------------
bool CBlacklistedServerManager::CanServerBeBlacklisted( uint32 serverIP, int serverPort, const char *serverName ) const
{
netadr_t netAdr( serverIP, serverPort );
if ( !netAdr.IsValid() )
return false;
// Don't let them add reserved addresses to their blacklists
if ( netAdr.IsReservedAdr() )
return false;
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Returns vector of blacklisted servers
//-----------------------------------------------------------------------------
const CUtlVector< blacklisted_server_t > &CBlacklistedServerManager::GetServerVector( void ) const
{
return m_Blacklist;
}

View File

@ -0,0 +1,74 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef BLACKLISTEDSERVERMANAGER_H
#define BLACKLISTEDSERVERMANAGER_H
#ifdef _WIN32
#pragma once
#endif
#include "platform.h"
#include "netadr.h"
#include "utlvector.h"
#define BLACKLIST_DEFAULT_SAVE_FILE "cfg/server_blacklist.txt"
class gameserveritem_t;
struct blacklisted_server_t
{
int m_nServerID;
char m_szServerName[64];
uint32 m_ulTimeBlacklistedAt;
netadr_t m_NetAdr;
};
//-----------------------------------------------------------------------------
// Purpose: Collection of blacklisted servers
//-----------------------------------------------------------------------------
class CBlacklistedServerManager
{
public:
CBlacklistedServerManager();
void Reset( void );
blacklisted_server_t *AddServer( gameserveritem_t &server );
blacklisted_server_t *AddServer( const char *serverName, uint32 serverIP, int serverPort );
blacklisted_server_t *AddServer( const char *serverName, const char *netAddressString, uint32 timestamp );
void RemoveServer( int iServerID ); // remove server with matching 'server id' from list
void SaveToFile( const char *filename );
int LoadServersFromFile( const char *pszFilename, bool bResetTimes ); // returns count of appended servers, zero for failure
blacklisted_server_t *GetServer( int iServerID ); // return server with matching 'server id'
int GetServerCount( void ) const;
const CUtlVector< blacklisted_server_t > &GetServerVector( void ) const;
bool IsServerBlacklisted( const gameserveritem_t &server ) const;
bool IsServerBlacklisted( uint32 serverIP, int serverPort, const char *serverName ) const;
bool CanServerBeBlacklisted( gameserveritem_t &server ) const;
bool CanServerBeBlacklisted( uint32 serverIP, int serverPort, const char *serverName ) const;
private:
CUtlVector< blacklisted_server_t > m_Blacklist;
int m_iNextServerID; // for vgui use
};
inline int CBlacklistedServerManager::GetServerCount( void ) const
{
return m_Blacklist.Count();
}
#endif // BLACKLISTEDSERVERMANAGER_H

2144
src/common/imageutils.cpp Normal file

File diff suppressed because it is too large Load Diff

102
src/common/imageutils.h Normal file
View File

@ -0,0 +1,102 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#ifndef IMAGECONVERSION_H
#define IMAGECONVERSION_H
#ifdef _WIN32
#pragma once
#endif
#include "tier0/basetypes.h"
class CUtlBuffer;
struct Bitmap_t;
enum ConversionErrorType
{
CE_SUCCESS,
CE_MEMORY_ERROR,
CE_CANT_OPEN_SOURCE_FILE,
CE_ERROR_PARSING_SOURCE,
CE_SOURCE_FILE_FORMAT_NOT_SUPPORTED,
CE_SOURCE_FILE_TGA_FORMAT_NOT_SUPPORTED,
CE_SOURCE_FILE_BMP_FORMAT_NOT_SUPPORTED,
CE_SOURCE_FILE_SIZE_NOT_SUPPORTED,
CE_ERROR_WRITING_OUTPUT_FILE,
CE_ERROR_LOADING_DLL
};
enum ImageFileFormat
{
kImageFileFormat_PNG,
kImageFileFormat_JPG,
};
struct TGAHeader {
byte identsize; // size of ID field that follows 18 byte header (0 usually)
byte colourmaptype; // type of colour map 0=none, 1=has palette
byte imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
short colourmapstart; // first colour map entry in palette
short colourmaplength; // number of colours in palette
byte colourmapbits; // number of bits per palette entry 15,16,24,32
short xstart; // image x origin
short ystart; // image y origin
short width; // image width in pixels
short height; // image height in pixels
byte bits; // image bits per pixel 8,16,24,32
byte descriptor; // image descriptor bits (vh flip bits)
};
ConversionErrorType ImgUtl_ConvertJPEGToTGA( const char *jpgPath, const char *tgaPath, bool bRequirePowerOfTwoSize = true );
ConversionErrorType ImgUtl_ConvertBMPToTGA( const char *bmpPath, const char *tgaPath );
ConversionErrorType ImgUtl_ConvertTGA( const char *tgaPath, int nMaxWidth = -1, int nMaxHeight = -1 );
unsigned char *ImgUtl_ReadVTFAsRGBA( const char *vtfPath, int &width, int &height, ConversionErrorType &errcode );
unsigned char *ImgUtl_ReadTGAAsRGBA( const char *tgaPath, int &width, int &height, ConversionErrorType &errcode, TGAHeader &tgaHeader );
unsigned char *ImgUtl_ReadJPEGAsRGBA( const char *jpegPath, int &width, int &height, ConversionErrorType &errcode );
unsigned char *ImgUtl_ReadBMPAsRGBA( const char *bmpPath, int &width, int &height, ConversionErrorType &errcode );
unsigned char *ImgUtl_ReadPNGAsRGBA( const char *bmpPath, int &width, int &height, ConversionErrorType &errcode );
unsigned char *ImgUtl_ReadPNGAsRGBAFromBuffer( CUtlBuffer &buffer, int &width, int &height, ConversionErrorType &errcode );
unsigned char *ImgUtl_ReadImageAsRGBA( const char *path, int &width, int &height, ConversionErrorType &errcode );
ConversionErrorType ImgUtl_StretchRGBAImage( const unsigned char *srcBuf, const int srcWidth, const int srcHeight, unsigned char *destBuf, const int destWidth, const int destHeight );
ConversionErrorType ImgUtl_PadRGBAImage( const unsigned char *srcBuf, const int srcWidth, const int srcHeight, unsigned char *destBuf, const int destWidth, const int destHeight );
ConversionErrorType ImgUtl_ConvertTGAToVTF( const char *tgaPath, int nMaxWidth = -1, int nMaxHeight = -1 );
ConversionErrorType ImgUtl_WriteGenericVMT( const char *vtfPath, const char *pMaterialsSubDir );
ConversionErrorType ImgUtl_WriteRGBAAsPNGToBuffer( const unsigned char *pRGBAData, int nWidth, int nHeight, CUtlBuffer &bufOutData, bool bIncludesAlpha = true );
ConversionErrorType ImgUtl_WriteRGBAAsJPEGToBuffer( const unsigned char *pRGBAData, int nWidth, int nHeight, CUtlBuffer &bufOutData, int nStride = 0 );
//
// Converts pInPath (which can be a TGA, BMP, or JPG file) to a VTF in pMaterialsSubDir, where
// pMaterialsSubDir is a directory located relative to the game/materials directory. If the
// output directory doesn't exist, it will be created. Dumps a generic VMT in pMaterialsSubDir
// as well.
//
ConversionErrorType ImgUtl_ConvertToVTFAndDumpVMT( const char *pInPath, const char *pMaterialsSubDir,
int nMaxWidth = -1, int nMaxHeight = -1 );
/// Load from image file. We use the file extension to
/// decide what file format to use
ConversionErrorType ImgUtl_LoadBitmap( const char *pszFilename, Bitmap_t &bitmap );
/// Load an image direct from memory buffer
ConversionErrorType ImgUtl_LoadBitmapFromBuffer( CUtlBuffer &fileData, Bitmap_t &bitmap, ImageFileFormat eImageFileFormat );
/// Save a bitmap to memory buffer
ConversionErrorType ImgUtl_SaveBitmapToBuffer( CUtlBuffer &fileData, const Bitmap_t &bitmap, ImageFileFormat eImageFileFormat );
/// Load a PNG direct from memory buffer
ConversionErrorType ImgUtl_LoadPNGBitmapFromBuffer( CUtlBuffer &fileData, Bitmap_t &bitmap );
/// Get the size of a PNG from a buffer
ConversionErrorType ImgUtl_GetPNGSize( CUtlBuffer &fileData, uint32_t &uWidth, uint32_t &uHeight );
/// Save a bitmap in PNG format to memory buffer
ConversionErrorType ImgUtl_SavePNGBitmapToBuffer( CUtlBuffer &fileData, const Bitmap_t &bitmap );
/// Resize a bitmap. This currently only works for RGBA images!
ConversionErrorType ImgUtl_ResizeBitmap( Bitmap_t &destBitmap, int nWidth, int nHeight, const Bitmap_t *pImgSource = NULL );
#endif // IMAGECONVERSION_H

View File

@ -32,31 +32,32 @@ static const Language_t s_LanguageNames[] =
{ {
{ "None", "none", "None", "none", k_Lang_None, 0 }, { "None", "none", "None", "none", k_Lang_None, 0 },
{ "English", "english", "#GameUI_Language_English", "en_US", k_Lang_English, 1033 }, { "English", "english", "#GameUI_Language_English", "en_US", k_Lang_English, 1033 },
{ "German", "german", "#GameUI_Language_German", "de_DE", k_Lang_German, 1031 } , { "German", "german", "#GameUI_Language_German", "de_DE", k_Lang_German, 1031 },
{ "French", "french", "#GameUI_Language_French", "fr_FR", k_Lang_French, 1036 } , { "French", "french", "#GameUI_Language_French", "fr_FR", k_Lang_French, 1036 },
{ "Italian", "italian", "#GameUI_Language_Italian", "it_IT", k_Lang_Italian, 1040 } , { "Italian", "italian", "#GameUI_Language_Italian", "it_IT", k_Lang_Italian, 1040 },
{ "Korean", "koreana", "#GameUI_Language_Korean", "ko_KR", k_Lang_Korean, 1042 } , { "Korean", "koreana", "#GameUI_Language_Korean", "ko_KR", k_Lang_Korean, 1042 },
{ "Spanish", "spanish", "#GameUI_Language_Spanish", "es_ES", k_Lang_Spanish, 1034 }, { "Spanish", "spanish", "#GameUI_Language_Spanish", "es_ES", k_Lang_Spanish, 1034 },
{ "Simplified_Chinese", "schinese", "#GameUI_Language_Simplified_Chinese", "zh_CN", k_Lang_Simplified_Chinese, 2052 }, { "Simplified_Chinese", "schinese", "#GameUI_Language_Simplified_Chinese", "zh_CN", k_Lang_Simplified_Chinese, 2052 },
{ "Traditional_Chinese", "tchinese", "#GameUI_Language_Traditional_Chinese", "zh_TW", k_Lang_Traditional_Chinese, 1028 }, { "Traditional_Chinese", "tchinese", "#GameUI_Language_Traditional_Chinese", "zh_TW", k_Lang_Traditional_Chinese, 1028 },
{ "Russian", "russian", "#GameUI_Language_Russian", "ru_RU", k_Lang_Russian, 1049 } , { "Russian", "russian", "#GameUI_Language_Russian", "ru_RU", k_Lang_Russian, 1049 },
{ "Thai", "thai", "#GameUI_Language_Thai", "th_TH", k_Lang_Thai, 1054 } , { "Thai", "thai", "#GameUI_Language_Thai", "th_TH", k_Lang_Thai, 1054 },
{ "Japanese", "japanese", "#GameUI_Language_Japanese", "ja_JP", k_Lang_Japanese, 1041 } , { "Japanese", "japanese", "#GameUI_Language_Japanese", "ja_JP", k_Lang_Japanese, 1041 },
{ "Portuguese", "portuguese", "#GameUI_Language_Portuguese", "pt_PT", k_Lang_Portuguese, 2070 } , { "Portuguese", "portuguese", "#GameUI_Language_Portuguese", "pt_PT", k_Lang_Portuguese, 2070 },
{ "Polish", "polish", "#GameUI_Language_Polish", "pl_PL", k_Lang_Polish, 1045 } , { "Polish", "polish", "#GameUI_Language_Polish", "pl_PL", k_Lang_Polish, 1045 },
{ "Danish", "danish", "#GameUI_Language_Danish", "da_DK", k_Lang_Danish, 1030 } , { "Danish", "danish", "#GameUI_Language_Danish", "da_DK", k_Lang_Danish, 1030 },
{ "Dutch", "dutch", "#GameUI_Language_Dutch", "nl_NL", k_Lang_Dutch, 1043 } , { "Dutch", "dutch", "#GameUI_Language_Dutch", "nl_NL", k_Lang_Dutch, 1043 },
{ "Finnish", "finnish", "#GameUI_Language_Finnish", "fi_FI", k_Lang_Finnish, 1035 } , { "Finnish", "finnish", "#GameUI_Language_Finnish", "fi_FI", k_Lang_Finnish, 1035 },
{ "Norwegian", "norwegian", "#GameUI_Language_Norwegian", "no_NO", k_Lang_Norwegian, 1044 } , { "Norwegian", "norwegian", "#GameUI_Language_Norwegian", "no_NO", k_Lang_Norwegian, 1044 },
{ "Swedish", "swedish", "#GameUI_Language_Swedish", "sv_SE", k_Lang_Swedish, 1053 } , { "Swedish", "swedish", "#GameUI_Language_Swedish", "sv_SE", k_Lang_Swedish, 1053 },
{ "Romanian", "romanian", "#GameUI_Language_Romanian", "ro_RO", k_Lang_Romanian, 1048 } , { "Romanian", "romanian", "#GameUI_Language_Romanian", "ro_RO", k_Lang_Romanian, 1048 },
{ "Turkish", "turkish", "#GameUI_Language_Turkish", "tr_TR", k_Lang_Turkish, 1055 } , { "Turkish", "turkish", "#GameUI_Language_Turkish", "tr_TR", k_Lang_Turkish, 1055 },
{ "Hungarian", "hungarian", "#GameUI_Language_Hungarian", "hu_HU", k_Lang_Hungarian, 1038 } , { "Hungarian", "hungarian", "#GameUI_Language_Hungarian", "hu_HU", k_Lang_Hungarian, 1038 },
{ "Czech", "czech", "#GameUI_Language_Czech", "cs_CZ", k_Lang_Czech, 1029 } , { "Czech", "czech", "#GameUI_Language_Czech", "cs_CZ", k_Lang_Czech, 1029 },
{ "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } , { "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 },
{ "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } , { "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 },
{ "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 }, { "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 },
{ "Ukrainian", "ukrainian", "#GameUI_Language_Ukrainian", "uk_UA", k_Lang_Ukrainian, 1058 }, { "Ukrainian", "ukrainian", "#GameUI_Language_Ukrainian", "uk_UA", k_Lang_Ukrainian, 1058 },
{ "Latam_Spanish", "latam", "#GameUI_Language_Latam_Spanish", "es_419", k_Lang_Latam_Spanish, 1034 },
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -41,6 +41,7 @@ enum ELanguage
k_Lang_Bulgarian, k_Lang_Bulgarian,
k_Lang_Greek, k_Lang_Greek,
k_Lang_Ukrainian, k_Lang_Ukrainian,
k_Lang_Latam_Spanish,
k_Lang_MAX k_Lang_MAX
}; };

View File

@ -32,6 +32,14 @@ unsigned char *pInput,
unsigned int inputSize, unsigned int inputSize,
unsigned int *pOutputSize ); unsigned int *pOutputSize );
//-----------------------------------------------------------------------------
// Above, but returns null if compression would not yield a size improvement
//-----------------------------------------------------------------------------
unsigned char *LZMA_OpportunisticCompress(
unsigned char *pInput,
unsigned int inputSize,
unsigned int *pOutputSize );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Decoding glue. Returns TRUE if succesful. // Decoding glue. Returns TRUE if succesful.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -0,0 +1,200 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#include "movieobjects/timeutils.h"
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include <math.h>
////////////////////////////////////////////////////////////////////////////////////////
//
// DmeFramerate_t
//
// exact (rational) representation of common framerates - any integral or ntsc framerate
//
////////////////////////////////////////////////////////////////////////////////////////
DmeFramerate_t::DmeFramerate_t( float fps )
{
SetFramerate( fps );
}
DmeFramerate_t::DmeFramerate_t( int fps /*= 0*/ ) :
m_num( fps ), m_den( 10000 )
{
}
DmeFramerate_t::DmeFramerate_t( int nNumerator, int nDenominator ) :
m_num( nNumerator ), m_den( nDenominator * 10000 )
{
}
void DmeFramerate_t::SetFramerate( float flFrameRate )
{
if ( IsIntegralValue( flFrameRate ) )
{
SetFramerate( RoundFloatToInt( flFrameRate ) );
}
else if ( IsIntegralValue( flFrameRate * 1001.0f / 1000.0f ) ) // 1001 is the ntsc divisor (30*1000/1001 = 29.97, etc)
{
SetFramerateNTSC( RoundFloatToInt( flFrameRate * 1001.0f / 1000.0f ) );
}
else
{
Assert( 0 );
SetFramerate( RoundFloatToInt( flFrameRate ) );
}
}
void DmeFramerate_t::SetFramerate( int fps )
{
m_num = fps;
m_den = 10000;
}
// other (uncommon) options besides 30(29.97 - ntsc video) are 24 (23.976 - ntsc film) and 60 (59.94 - ntsc progressive)
void DmeFramerate_t::SetFramerateNTSC( int multiplier /*= 30*/ )
{
// ntsc = 30 fps * 1000 / 1001
// = ( 30 / 10000 fptms ) * 1000 / 1001
// = 30 / 10010
m_num = multiplier;
m_den = 10010;
}
float DmeFramerate_t::GetFramesPerSecond() const
{
return 10000.0f * m_num / float( m_den );
}
////////////////////////////////////////////////////////////////////////////////////////
//
// DmeTime_t
//
// representing time as integral tenths of a millisecond (tms)
//
////////////////////////////////////////////////////////////////////////////////////////
DmeTime_t::DmeTime_t( int frame, DmeFramerate_t framerate )
{
int64 num = int64( framerate.m_num );
int64 prod = frame * int64( framerate.m_den );
// add signed offset to force integer truncation (towards 0) to give us truncation towards -inf
if ( frame < 0 )
{
prod -= num - 1;
}
m_tms = int( prod / num ); // round tms towards 0
}
// float operators - comment these out to find potentially incorrect uses of DmeTime_t
DmeTime_t DmeTime_t::operator*=( float f )
{
m_tms = int( floor( m_tms * f + 0.5f ) );
return *this;
}
DmeTime_t DmeTime_t::operator/=( float f )
{
m_tms = int( floor( m_tms / f + 0.5f ) );
return *this;
}
// helper methods
void DmeTime_t::Clamp( DmeTime_t lo, DmeTime_t hi )
{
m_tms = clamp( m_tms, lo.m_tms, hi.m_tms );
}
bool DmeTime_t::IsInRange( DmeTime_t lo, DmeTime_t hi ) const
{
return m_tms >= lo.m_tms && m_tms < hi.m_tms;
}
// helper functions
float GetFractionOfTimeBetween( DmeTime_t t, DmeTime_t start, DmeTime_t end, bool bClamp /*= false*/ )
{
return GetFractionOfTime( t - start, end - start, bClamp );
}
float GetFractionOfTime( DmeTime_t t, DmeTime_t duration, bool bClamp /*= false*/ )
{
if ( duration == DMETIME_ZERO )
return 0.0f;
if ( bClamp )
{
t.Clamp( DMETIME_ZERO, duration );
}
return t.m_tms / float( duration.m_tms );
}
int FrameForTime( DmeTime_t t, DmeFramerate_t framerate )
{
return t.CurrentFrame( framerate );
}
// framerate-dependent conversions to/from frames
int DmeTime_t::CurrentFrame( DmeFramerate_t framerate, bool bRoundDown ) const
{
int64 den = int64( framerate.m_den );
int64 num = int64( framerate.m_num );
int64 prod = int64( m_tms ) * num;
// times within this range are considered on a frame: (frame*den/num - 1, frame*den/num]
// this follows from the truncation towards -inf behavior of the frame,framerate constructor above
// the following logic is there to ensure the above rule,
// while working around the truncation towards 0 behavior of integer divide
if ( m_tms < 0 )
{
if ( bRoundDown )
prod -= den - num;
}
else
{
if ( bRoundDown )
prod += num - 1;
else
prod += den - 1;
}
return int( prod / den );
}
DmeTime_t DmeTime_t::TimeAtCurrentFrame( DmeFramerate_t framerate, bool bRoundDown ) const
{
int frame = CurrentFrame( framerate, bRoundDown );
return DmeTime_t( frame, framerate );
}
DmeTime_t DmeTime_t::TimeAtNextFrame( DmeFramerate_t framerate ) const
{
// since we always round towards -inf, go to next frame whether we're on a frame or not
int frame = CurrentFrame( framerate, true );
return DmeTime_t( frame + 1, framerate );
}
DmeTime_t DmeTime_t::TimeAtPrevFrame( DmeFramerate_t framerate ) const
{
int frame = CurrentFrame( framerate, false );
return DmeTime_t( frame - 1, framerate ); // we're exactly on a frame
}
int DmeTime_t::RoundSecondsToTMS( float sec )
{
return floor( 10000.0f * sec + 0.5f ); // round at half-tms boundary
}
int DmeTime_t::RoundSecondsToTMS( double sec )
{
return floor( 10000.0 * sec + 0.5 ); // round at half-tms boundary
}

31
src/common/protoutils.cpp Normal file
View File

@ -0,0 +1,31 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#include "cbase.h"
#include "protoutils.h"
#include "google/protobuf/message.h"
//-----------------------------------------------------------------------------
bool ValveProtoUtils::MessageHasExactFields( const google::protobuf::Message &msg,
std::initializer_list<int> fields )
{
auto &desc = *msg.GetDescriptor();
return ValveProtoUtils::MessageHasExactFields( desc, std::move( fields ) );
}
//-----------------------------------------------------------------------------
bool ValveProtoUtils::MessageHasExactFields( const google::protobuf::Descriptor &msgDesc,
std::initializer_list<int> fields )
{
int nFields = msgDesc.field_count();
if ( nFields != (int)fields.size() )
{ return false; }
for ( int field : fields )
{
if ( msgDesc.FindFieldByNumber( field ) == nullptr )
{ return false; }
}
return true;
}

19
src/common/protoutils.h Normal file
View File

@ -0,0 +1,19 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
#ifndef VALVE_PROTO_UTILS_H
#define VALVE_PROTO_UTILS_H
#ifdef _WIN32
#pragma once
#endif
#include <initializer_list>
namespace google { namespace protobuf { class Message; class Descriptor; }; };
namespace ValveProtoUtils {
// Allows you to assert a message messages this field list for code that should be checked upon message changes
bool MessageHasExactFields( const google::protobuf::Descriptor &desc, std::initializer_list<int> fields );
bool MessageHasExactFields( const google::protobuf::Message &msg, std::initializer_list<int> fields );
};
#endif // VALVE_PROTO_UTILS_H

View File

@ -37,7 +37,7 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#define BUILD_CURL ( defined( WIN32 ) && !defined( _X360 ) ) || defined( POSIX ) #define BUILD_CURL ( defined( WIN32 ) && _MSC_VER < 1900 && !defined( _X360 ) ) || defined( POSIX )
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@ -0,0 +1,234 @@
//========= Copyright Valve Corporation, 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.
//
//*****************************************************************************
//
// Contents:
//
// CSimpleBitString
//
// Authors: chrisn
//
// Target restrictions:
//
// Tool restrictions:
//
// Things to do:
//
//*****************************************************************************
//*****************************************************************************
//
// Include files required to build and use this module.
//
//*****************************************************************************
// Precompiled header (must come first - includes project common headers)
//#include "stdafx.h"
#include "tier0/platform.h"
#include "tier1/utlvector.h"
#include "simplebitstring.h"
//*****************************************************************************
//
// Class definitions:
//
//*****************************************************************************
//
// class CSimpleBitString::iterator
//
//-----------------------------------------------------------------------------
//
// Function:
//
//-----------------------------------------------------------------------------
void CSimpleBitString::AppendBits( uint64 u64Data, uint32 NumSignificantLowBitsOfData )
{
Assert
(
NumSignificantLowBitsOfData <= 64
);
while ( NumSignificantLowBitsOfData > 0 )
{
// Clear top bits of data
if ( NumSignificantLowBitsOfData < 64 )
u64Data &= ( (1ULL << NumSignificantLowBitsOfData) - 1 ); // will fail for 64 bits
uint32 Idx = m_uNumBits / 8;
uint32 NumUsedBitsInLastByte = m_uNumBits % 8;
uint32 NumAvailableBitsInLastByte = 8 - NumUsedBitsInLastByte;
uint32 NumBitsToPutInThisByte
= min( NumAvailableBitsInLastByte, NumSignificantLowBitsOfData );
uint8 BitsForThisByte
= ( u64Data >> (NumSignificantLowBitsOfData - NumBitsToPutInThisByte) )
& ( (1ULL << NumBitsToPutInThisByte) - 1 );
m_vecU8[Idx] |= ( BitsForThisByte
<< ( NumAvailableBitsInLastByte - NumBitsToPutInThisByte ) );
m_uNumBits += NumBitsToPutInThisByte;
NumAvailableBitsInLastByte -= NumBitsToPutInThisByte;
if ( NumAvailableBitsInLastByte == 0 )
{
m_vecU8[ m_vecU8.AddToTail() ] = 0x00;
}
// We've used the top N bits of data
NumSignificantLowBitsOfData -= NumBitsToPutInThisByte;
}
}
//-----------------------------------------------------------------------------
//
// Function:
//
//-----------------------------------------------------------------------------
void CSimpleBitString::AppendBits( const uint8 * pData, uint32 NumBitsOfData )
{
Assert( pData );
uint32 NumBytes = NumBitsOfData / 8;
for ( uint32 i = 0; i < NumBytes; ++i )
{
AppendBits( *(pData++), 8 );
}
uint32 NumTailBits = NumBitsOfData % 8;
AppendBits( (*pData) >> (8U - NumTailBits), NumTailBits );
}
//-----------------------------------------------------------------------------
//
// Function:
//
//-----------------------------------------------------------------------------
void CSimpleBitString::ReversiblyObfusticateBitsFromStart( uint NumBits, const uint8 * pObfusticationData, size_t uSizeOfObfusticationData )
{
Assert( pObfusticationData );
if ( NumBits > m_uNumBits
|| NumBits > uSizeOfObfusticationData * 8
)
{
AssertMsg( false, "ReversiblyObfusticateBitsFromStart(): Bad NumBits" );
return; // bugbug taylor bool return
}
uint8 * pBits = & m_vecU8[0];
uint NumBytes = NumBits / 8;
for ( uint i = 0; i < NumBytes; ++i )
{
*(pBits++) ^= *(pObfusticationData++);
}
uint NumTailBits = NumBits % 8;
if ( NumTailBits > 0 )
{
*pBits ^= ( *(pObfusticationData++) & (((1U << NumTailBits) - 1) << (8U - NumTailBits) ) );
}
}
//-----------------------------------------------------------------------------
//
// Function:
//
//-----------------------------------------------------------------------------
uint8 CSimpleBitString::GetByteChecksumFromStart( uint NumBits ) const
{
if ( NumBits > m_uNumBits )
{
AssertMsg( false, "GenerateByteChecksumFromStart(): Bad NumBits" );
return 0;
}
uint8 u8Checksum = 0;
const uint8 * pBits = & m_vecU8[0];
uint NumBytes = NumBits / 8;
for ( uint i = 0; i < NumBytes; ++i )
{
u8Checksum += *(pBits++);
}
uint NumTailBits = NumBits % 8;
if ( NumTailBits > 0 )
{
u8Checksum += ( *(pBits) & (((1U << NumTailBits) - 1) << (8U - NumTailBits) ) );
}
return u8Checksum;
}
//
// class CSimpleBitString::iterator
//
uint32 CSimpleBitString::iterator::GetNextBits( uint32 NumBitsToGet )
{
Assert
(
NumBitsToGet <= 32
);
return static_cast<uint32>( GetNextBits64( NumBitsToGet ) );
}
uint64 CSimpleBitString::iterator::GetNextBits64( uint32 NumBitsToGet )
{
Assert
(
NumBitsToGet <= 64
);
if ( m_uNextBitIdx + NumBitsToGet > m_rSimpleBitString.m_uNumBits )
{
AssertMsg( false, "Not enough bits in CSimpleBitString" );
return 0;
}
uint64 u64Data = 0;
while ( NumBitsToGet > 0 )
{
uint32 Idx = m_uNextBitIdx / 8;
Assert( Idx < (uint32)m_rSimpleBitString.m_vecU8.Count() );
uint32 NumConsumedBitsInThisByte = m_uNextBitIdx % 8;
uint32 NumAvailableBitsInThisByte = 8 - NumConsumedBitsInThisByte;
uint32 NumBitsToGetFromThisByte
= min( NumAvailableBitsInThisByte, NumBitsToGet );
uint8 BitsFromThisByte
= ( m_rSimpleBitString.m_vecU8[Idx] >> (NumAvailableBitsInThisByte - NumBitsToGetFromThisByte) )
& ( (1UL << NumBitsToGetFromThisByte) - 1 );
u64Data <<= NumBitsToGetFromThisByte;
u64Data |= BitsFromThisByte;
m_uNextBitIdx += NumBitsToGetFromThisByte;
NumBitsToGet -= NumBitsToGetFromThisByte;
}
return u64Data;
}

View File

@ -0,0 +1,159 @@
//========= Copyright Valve Corporation, 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.
//
//*****************************************************************************
//
// Contents:
//
// CSimpleBitString
//
// Authors:
//
// Target restrictions:
//
// Tool restrictions:
//
// Things to do:
//
//
//
//*****************************************************************************
#ifndef INCLUDED_COMMON_SIMPLEBITSTRING_H
#define INCLUDED_COMMON_SIMPLEBITSTRING_H
#if defined(_MSC_VER) && (_MSC_VER > 1000)
#pragma once
#endif
//*****************************************************************************
//
// Include files required by this header.
//
// Note: Do NOT place any 'using' directives or declarations in header files -
// put them at the top of the source files that require them.
// Use fully-qualified names in header files.
//
//*****************************************************************************
// All precompiled headers (Stable.h) include this first to give use a common
// place for including order-dependent library headers (things that need to go first).
class CSimpleBitString
{
public:
explicit CSimpleBitString( uint32 ReserveNumBits = 0 )
:
m_uNumBits( 0 ),
m_vecU8()
{
m_vecU8.EnsureCapacity( (ReserveNumBits / 8) + 1 );
m_vecU8[ m_vecU8.AddToTail() ] = 0x00; // always need 1 byte
}
void clear()
{
m_uNumBits = 0;
m_vecU8.RemoveAll();
m_vecU8[ m_vecU8.AddToTail() ] = 0x00; // always need 1 byte
}
void AppendBits( uint64 data, uint32 NumSignificantLowBitsOfData );
void AppendBits( const uint8 * pData, uint32 NumBitsOfData );
void ReversiblyObfusticateBitsFromStart( uint32 NumBits, const uint8 * pObfusticationData, size_t uSizeOfObfusticationData );
uint8 GetByteChecksumFromStart( uint32 NumBits ) const;
uint GetCurrNumBits() const
{
return m_uNumBits;
}
const uint8 * data() const
{
return & m_vecU8[0];
}
size_t size() const
{
return m_vecU8.Count();
}
private:
uint32 m_uNumBits;
CUtlVector<uint8> m_vecU8;
public:
// Iterator class for retrieving bits
class iterator
{
public:
explicit iterator( const CSimpleBitString & bs )
:
m_rSimpleBitString( bs ),
m_uNextBitIdx( 0 )
{
}
void ResetToStart()
{
m_uNextBitIdx = 0;
}
uint32 GetNumConsumedBits() const
{
return m_uNextBitIdx;
}
uint32 GetNumRemainingBits() const
{
return m_rSimpleBitString.m_uNumBits - m_uNextBitIdx;
}
uint32 GetNextBits( uint32 NumBitsToGet );
uint64 GetNextBits64( uint32 NumBitsToGet );
void SkipNextBits( uint32 NumBitsToSkip )
{
if ( m_uNextBitIdx + NumBitsToSkip > m_rSimpleBitString.m_uNumBits )
{
AssertMsg( false, "Not enough bits in CSimpleBitString" );
NumBitsToSkip = 0;
}
m_uNextBitIdx += NumBitsToSkip;
}
bool operator ==( const iterator & other ) const
{
return (& m_rSimpleBitString == & other.m_rSimpleBitString)
&& m_uNextBitIdx == other.m_uNextBitIdx;
}
void DoAssertClassInvariant() const;
private:
const CSimpleBitString & m_rSimpleBitString; //lint !e1725 reference
uint32 m_uNextBitIdx;
};
friend class iterator;
};
#endif

740
src/common/steamid.cpp Normal file
View File

@ -0,0 +1,740 @@
//========= Copyright <20> 1996-2004, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if defined( STEAM ) || defined( HL1 )
#include "stdafx.h"
#else
#include <stdio.h>
#include "dbg.h"
#include "steamcommon.h"
#include "steam/steamclientpublic.h"
#include "strtools.h"
#endif
#ifdef HL1
#include "steamcommon.h"
#include "steam/steamclientpublic.h"
#endif
#ifndef UINT64_MAX
#define UINT64_MAX ((uint64)-1)
#endif
static const char *DecimalToUint64( const char *pchStr, uint64 unLimit,
uint64 *punVal )
{
const char *pchStart = pchStr;
uint64 unVal = 0;
while ( *pchStr >= '0' && *pchStr <= '9' )
{
uint64 unNext = unVal * 10;
if ( unNext < unVal )
{
// 64-bit overflow.
return NULL;
}
unVal = unNext + (uint64)( *pchStr - '0' );
if ( unVal > unLimit )
{
// Limit overflow.
return NULL;
}
pchStr++;
}
if ( pchStr == pchStart )
{
// No number at all.
return NULL;
}
*punVal = unVal;
return pchStr;
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : pchSteamID - text representation of a Steam ID
//-----------------------------------------------------------------------------
CSteamID::CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse /* = k_EUniverseInvalid */ )
{
SetFromString( pchSteamID, eDefaultUniverse );
}
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from a string
// Input : pchSteamID - text representation of a Steam ID
//-----------------------------------------------------------------------------
void CSteamID::SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse )
{
uint nAccountID = 0;
uint nInstance = 1;
EUniverse eUniverse = eDefaultUniverse;
EAccountType eAccountType = k_EAccountTypeIndividual;
#ifdef DBGFLAG_ASSERT
// TF Merge -- Assert is debug-only and we have unused variable warnings on :-/
const char *pchSteamIDString = pchSteamID;
#endif
CSteamID StrictID;
StrictID.SetFromStringStrict( pchSteamID, eDefaultUniverse );
if ( *pchSteamID == '[' )
pchSteamID++;
// BUGBUG Rich use the Q_ functions
if ( *pchSteamID == 'A' || *pchSteamID == 'a' )
{
// This is test only
if ( *pchSteamID == 'A' )
eAccountType = k_EAccountTypeAnonGameServer;
else
{
eAccountType = k_EAccountTypeAnonUser;
nInstance = 0;
}
pchSteamID++; // skip the A
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
if ( strchr( pchSteamID, '(' ) )
sscanf( strchr( pchSteamID, '(' ), "(%u)", &nInstance );
const char *pchColon = strchr( pchSteamID, ':' );
if ( pchColon && *pchColon != 0 && strchr( pchColon+1, ':' ))
{
sscanf( pchSteamID, "%u:%u:%u", (uint*)&eUniverse, &nAccountID, &nInstance );
}
else if ( pchColon )
{
sscanf( pchSteamID, "%u:%u", (uint*)&eUniverse, &nAccountID );
}
else
{
sscanf( pchSteamID, "%u", &nAccountID );
}
if ( nAccountID == 0 )
{
// i dont care what number you entered
CreateBlankAnonLogon(eUniverse);
}
else
{
InstancedSet( nAccountID, nInstance, eUniverse, eAccountType );
}
// Catch cases where we're allowing sloppy input that we
// might not want to allow.
AssertMsg1( this->operator==( StrictID ), "Steam ID does not pass strict parsing: '%s'", pchSteamIDString );
return;
}
else if (*pchSteamID == 'G')
{
pchSteamID++; // skip the G
eAccountType = k_EAccountTypeGameServer;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'C')
{
pchSteamID++; // skip the C
eAccountType = k_EAccountTypeContentServer;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'g')
{
pchSteamID++; // skip the g
eAccountType = k_EAccountTypeClan;
nInstance = 0;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'c')
{
pchSteamID++; // skip the c
eAccountType = k_EAccountTypeChat;
nInstance = k_EChatInstanceFlagClan;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'L')
{
pchSteamID++; // skip the c
eAccountType = k_EAccountTypeChat;
nInstance = k_EChatInstanceFlagLobby;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'T')
{
pchSteamID++; // skip the T
eAccountType = k_EAccountTypeChat;
nInstance = 0; // Anon chat
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'U')
{
pchSteamID++; // skip the U
eAccountType = k_EAccountTypeIndividual;
nInstance = 1;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
else if (*pchSteamID == 'i')
{
pchSteamID++; // skip the i
eAccountType = k_EAccountTypeInvalid;
nInstance = 1;
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
if ( strchr( pchSteamID, ':' ) )
{
if (*pchSteamID == '[')
pchSteamID++; // skip the optional [
sscanf( pchSteamID, "%u:%u", (uint*)&eUniverse, &nAccountID );
if ( eUniverse == k_EUniverseInvalid )
eUniverse = eDefaultUniverse;
}
else
{
uint64 unVal64 = 0;
sscanf( pchSteamID, "%llu", &unVal64 );
if ( unVal64 > UINT32_MAX )
{
// Assume a full 64-bit Steam ID.
SetFromUint64( unVal64 );
// Catch cases where we're allowing sloppy input that we
// might not want to allow.
AssertMsg1( this->operator==( StrictID ), "Steam ID does not pass strict parsing: '%s'", pchSteamIDString );
return;
}
else
{
nAccountID = (uint)unVal64;
}
}
Assert( (eUniverse > k_EUniverseInvalid) && (eUniverse < k_EUniverseMax) );
InstancedSet( nAccountID, nInstance, eUniverse, eAccountType );
// Catch cases where we're allowing sloppy input that we
// might not want to allow.
AssertMsg1( this->operator==( StrictID ), "Steam ID does not pass strict parsing: '%s'", pchSteamIDString );
}
// SetFromString allows many partially-correct strings, constraining how
// we might be able to change things in the future.
// SetFromStringStrict requires the exact string forms that we support
// and is preferred when the caller knows it's safe to be strict.
// Returns whether the string parsed correctly. The ID may
// still be invalid even if the string parsed correctly.
// If the string didn't parse correctly the ID will always be invalid.
bool CSteamID::SetFromStringStrict( const char *pchSteamID, EUniverse eDefaultUniverse )
{
uint nAccountID = 0;
uint nInstance = 1;
uint unMaxVal = 2;
EUniverse eUniverse = eDefaultUniverse;
EAccountType eAccountType = k_EAccountTypeIndividual;
char chPrefix;
bool bBracket = false;
bool bValid = true;
uint64 unVal[3];
const char *pchEnd;
// Start invalid.
Clear();
if ( !pchSteamID )
{
return false;
}
if ( *pchSteamID == '[' )
{
pchSteamID++;
bBracket = true;
}
chPrefix = *pchSteamID;
switch( chPrefix )
{
case 'A':
// This is test only
eAccountType = k_EAccountTypeAnonGameServer;
unMaxVal = 3;
break;
case 'a':
// This is test only
eAccountType = k_EAccountTypeAnonUser;
nInstance = 0;
unMaxVal = 3;
break;
case 'G':
eAccountType = k_EAccountTypeGameServer;
break;
case 'C':
eAccountType = k_EAccountTypeContentServer;
break;
case 'g':
eAccountType = k_EAccountTypeClan;
nInstance = 0;
break;
case 'c':
eAccountType = k_EAccountTypeChat;
nInstance = k_EChatInstanceFlagClan;
break;
case 'L':
eAccountType = k_EAccountTypeChat;
nInstance = k_EChatInstanceFlagLobby;
break;
case 'T':
eAccountType = k_EAccountTypeChat;
nInstance = 0; // Anon chat
break;
case 'U':
eAccountType = k_EAccountTypeIndividual;
nInstance = 1;
break;
case 'i':
eAccountType = k_EAccountTypeInvalid;
nInstance = 1;
break;
default:
// We're reserving other leading characters so
// this should only be the plain-digits case.
if (chPrefix < '0' || chPrefix > '9')
{
bValid = false;
}
chPrefix = 0;
break;
}
if ( chPrefix )
{
pchSteamID++; // skip the prefix
if (*pchSteamID == '-' || *pchSteamID == ':')
pchSteamID++; // skip the optional - or :
}
uint unIdx = 0;
for (;;)
{
pchEnd = DecimalToUint64( pchSteamID, UINT64_MAX, &unVal[unIdx] );
if ( !pchEnd )
{
bValid = false;
break;
}
unIdx++;
// For 'A' we can have a trailing instance, which must
// be the end of the string.
if ( *pchEnd == '(' &&
chPrefix == 'A' )
{
if ( unIdx > 2 )
{
// Two instance IDs provided.
bValid = false;
}
pchEnd = DecimalToUint64( pchEnd + 1, k_unSteamAccountInstanceMask, &unVal[2] );
if ( !pchEnd ||
*pchEnd != ')' )
{
bValid = false;
break;
}
else
{
nInstance = (uint)unVal[2];
pchEnd++;
if ( *pchEnd == ':' )
{
// Not expecting more values.
bValid = false;
break;
}
}
}
if ( *pchEnd != ':' )
{
if ( bBracket )
{
if ( *pchEnd != ']' ||
*(pchEnd + 1) != 0 )
{
bValid = false;
}
}
else if ( *pchEnd != 0 )
{
bValid = false;
}
break;
}
if ( unIdx >= unMaxVal )
{
bValid = false;
break;
}
pchSteamID = pchEnd + 1;
}
if ( unIdx > 2 )
{
if ( unVal[2] <= k_unSteamAccountInstanceMask )
{
nInstance = (uint)unVal[2];
}
else
{
bValid = false;
}
}
if ( unIdx > 1 )
{
if ( unVal[0] >= k_EUniverseInvalid &&
unVal[0] < k_EUniverseMax )
{
eUniverse = (EUniverse)unVal[0];
if ( eUniverse == k_EUniverseInvalid )
eUniverse = eDefaultUniverse;
}
else
{
bValid = false;
}
if ( unVal[1] <= k_unSteamAccountIDMask )
{
nAccountID = (uint)unVal[1];
}
else
{
bValid = false;
}
}
else if ( unIdx > 0 )
{
if ( unVal[0] <= k_unSteamAccountIDMask )
{
nAccountID = (uint)unVal[0];
}
else if ( !chPrefix )
{
if ( bValid )
{
SetFromUint64( unVal[0] );
}
return bValid;
}
else
{
bValid = false;
}
}
else
{
bValid = false;
}
if ( bValid )
{
if ( chPrefix == 'A' )
{
if ( nAccountID == 0 )
{
// i dont care what number you entered
CreateBlankAnonLogon(eUniverse);
return bValid;
}
}
InstancedSet( nAccountID, nInstance, eUniverse, eAccountType );
}
return bValid;
}
#if defined( INCLUDED_STEAM2_USERID_STRUCTS )
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from a Steam2 ID string
// Input: pchSteam2ID - Steam2 ID (as a string #:#:#) to convert
// eUniverse - universe this ID belongs to
// Output: true if successful, false otherwise
//-----------------------------------------------------------------------------
bool SteamIDFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse, CSteamID *pSteamIDOut )
{
Assert( pchSteam2ID );
// Convert the Steam2 ID string to a Steam2 ID structure
TSteamGlobalUserID steam2ID;
steam2ID.m_SteamInstanceID = 0;
steam2ID.m_SteamLocalUserID.Split.High32bits = 0;
steam2ID.m_SteamLocalUserID.Split.Low32bits = 0;
const char *pchTSteam2ID = pchSteam2ID;
// Customer support is fond of entering steam IDs in the following form: STEAM_n:x:y
const char *pchOptionalLeadString = "STEAM_";
if ( V_strnicmp( pchSteam2ID, pchOptionalLeadString, V_strlen( pchOptionalLeadString ) ) == 0 )
pchTSteam2ID = pchSteam2ID + V_strlen( pchOptionalLeadString );
char cExtraCharCheck = 0;
int cFieldConverted = sscanf( pchTSteam2ID, "%hu:%u:%u%c", &steam2ID.m_SteamInstanceID,
&steam2ID.m_SteamLocalUserID.Split.High32bits, &steam2ID.m_SteamLocalUserID.Split.Low32bits, &cExtraCharCheck );
// Validate the conversion ... a special case is steam2 instance ID 1 which is reserved for special DoD handling
if ( cExtraCharCheck != 0 || cFieldConverted == EOF || cFieldConverted < 2 || ( cFieldConverted < 3 && steam2ID.m_SteamInstanceID != 1 ) )
return false;
// Now convert to steam ID from the Steam2 ID structure
*pSteamIDOut = SteamIDFromSteam2UserID( &steam2ID, eUniverse );
return true;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: Renders the steam ID to a buffer. NOTE: for convenience of calling
// code, this code returns a pointer to a static buffer and is NOT thread-safe.
// Output: buffer with rendered Steam ID
//-----------------------------------------------------------------------------
const char * CSteamID::Render() const
{
// longest length of returned string is k_cBufLen
// [A:%u:%u:%u]
// %u == 10 * 3 + 6 == 36, plus terminator == 37
const int k_cBufLen = 37;
const int k_cBufs = 4; // # of static bufs to use (so people can compose output with multiple calls to Render() )
static char rgchBuf[k_cBufs][k_cBufLen];
static int nBuf = 0;
char * pchBuf = rgchBuf[nBuf]; // get pointer to current static buf
nBuf ++; // use next buffer for next call to this method
nBuf %= k_cBufs;
if ( k_EAccountTypeAnonGameServer == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[A:%u:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID, m_steamid.m_comp.m_unAccountInstance );
}
else if ( k_EAccountTypeGameServer == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[G:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeMultiseat == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[M:%u:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID, m_steamid.m_comp.m_unAccountInstance );
}
else if ( k_EAccountTypePending == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[P:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeContentServer == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[C:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeClan == m_steamid.m_comp.m_EAccountType )
{
// 'g' for "group"
V_snprintf( pchBuf, k_cBufLen, "[g:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeChat == m_steamid.m_comp.m_EAccountType )
{
if ( m_steamid.m_comp.m_unAccountInstance & k_EChatInstanceFlagClan )
{
V_snprintf( pchBuf, k_cBufLen, "[c:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( m_steamid.m_comp.m_unAccountInstance & k_EChatInstanceFlagLobby )
{
V_snprintf( pchBuf, k_cBufLen, "[L:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else // Anon chat
{
V_snprintf( pchBuf, k_cBufLen, "[T:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
}
else if ( k_EAccountTypeInvalid == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[I:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeIndividual == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[U:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else if ( k_EAccountTypeAnonUser == m_steamid.m_comp.m_EAccountType )
{
V_snprintf( pchBuf, k_cBufLen, "[a:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
else
{
V_snprintf( pchBuf, k_cBufLen, "[i:%u:%u]", m_steamid.m_comp.m_EUniverse, m_steamid.m_comp.m_unAccountID );
}
return pchBuf;
}
//-----------------------------------------------------------------------------
// Purpose: Renders the passed-in steam ID to a buffer. NOTE: for convenience of calling
// code, this code returns a pointer to a static buffer and is NOT thread-safe.
// Input: 64-bit representation of Steam ID to render
// Output: buffer with rendered Steam ID
//-----------------------------------------------------------------------------
const char * CSteamID::Render( uint64 ulSteamID )
{
CSteamID steamID( ulSteamID );
return steamID.Render();
}
//-----------------------------------------------------------------------------
// Purpose: some steamIDs are for internal use only
// This is really debug code, but we run with asserts on in retail, so ...
//-----------------------------------------------------------------------------
bool CSteamID::BValidExternalSteamID() const
{
if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypePending )
return false;
if ( m_steamid.m_comp.m_EAccountType != k_EAccountTypeAnonGameServer && m_steamid.m_comp.m_EAccountType != k_EAccountTypeContentServer && m_steamid.m_comp.m_EAccountType != k_EAccountTypeAnonUser )
{
if ( m_steamid.m_comp.m_unAccountID == 0 && m_steamid.m_comp.m_unAccountInstance == 0 )
return false;
}
return true;
}
#ifdef STEAM
//-----------------------------------------------------------------------------
// Purpose: Returns the matching chat steamID, with the default instance of 0
// Input: SteamID, either a Clan or a Chat type
// Output: SteamID with account type changed to chat, and the Clan flag set.
// If account type was not chat to start with, instance will be set to 0
//-----------------------------------------------------------------------------
CSteamID ChatIDFromSteamID( const CSteamID &steamID )
{
if ( steamID.GetEAccountType() == k_EAccountTypeChat )
return steamID;
return ChatIDFromClanID( steamID );
}
//-----------------------------------------------------------------------------
// Purpose: Returns the matching chat steamID, with the default instance of 0
// Input: SteamID, either a Clan type or a Chat type w/ the Clan flag set
// Output: SteamID with account type changed to clan.
// If account type was not clan to start with, instance will be set to 0
//-----------------------------------------------------------------------------
CSteamID ClanIDFromSteamID( const CSteamID &steamID )
{
if ( steamID.GetEAccountType() == k_EAccountTypeClan )
return steamID;
return ClanIDFromChatID( steamID );
}
// Asserts steamID type before conversion
CSteamID ChatIDFromClanID( const CSteamID &steamIDClan )
{
Assert( steamIDClan.GetEAccountType() == k_EAccountTypeClan );
return CSteamID( steamIDClan.GetAccountID(), k_EChatInstanceFlagClan, steamIDClan.GetEUniverse(), k_EAccountTypeChat );
}
// Asserts steamID type before conversion
CSteamID ClanIDFromChatID( const CSteamID &steamIDChat )
{
Assert( steamIDChat.GetEAccountType() == k_EAccountTypeChat );
Assert( k_EChatInstanceFlagClan & steamIDChat.GetUnAccountInstance() );
return CSteamID( steamIDChat.GetAccountID(), 0, steamIDChat.GetEUniverse(), k_EAccountTypeClan );
}
//-----------------------------------------------------------------------------
// Purpose: CGameID "hidden" functions
// move these somewhere else maybe
//-----------------------------------------------------------------------------
CGameID::CGameID( const char *pchGameID )
{
m_ulGameID = 0;
sscanf( pchGameID, "%llu", &m_ulGameID );
switch ( m_gameID.m_nType )
{
case k_EGameIDTypeApp:
case k_EGameIDTypeGameMod:
case k_EGameIDTypeShortcut:
case k_EGameIDTypeP2P:
break;
default:
AssertMsg( false, "Unknown GameID type" );
m_ulGameID = 0;
break;
}
}
// renders this Game ID to string
const char * CGameID::Render() const
{
// longest buffer is log10(2**64) == 20 + 1 == 21
const int k_cBufLen = 21;
const int k_cBufs = 4; // # of static bufs to use (so people can compose output with multiple calls to Render() )
static char rgchBuf[k_cBufs][k_cBufLen];
static int nBuf = 0;
char * pchBuf = rgchBuf[nBuf]; // get pointer to current static buf
nBuf ++; // use next buffer for next call to this method
nBuf %= k_cBufs;
V_snprintf( pchBuf, k_cBufLen, "%llu", m_ulGameID );
return pchBuf;
}
// static method to render a uint64 representation of a Game ID to a string
const char * CGameID::Render( uint64 ulGameID )
{
CGameID nGameID( ulGameID );
return nGameID.Render();
}
#endif

View File

@ -16,10 +16,10 @@
#undef ALIGN4 #undef ALIGN4
#undef ALIGN16 #undef ALIGN16
#undef ALIGN32 #undef ALIGN32
#define ALIGN4( a ) a = (byte *)((int)((byte *)a + 3) & ~ 3) #define ALIGN4( a ) a = (byte *)((intp)((byte *)a + 3) & ~ 3)
#define ALIGN16( a ) a = (byte *)((int)((byte *)a + 15) & ~ 15) #define ALIGN16( a ) a = (byte *)((intp)((byte *)a + 15) & ~ 15)
#define ALIGN32( a ) a = (byte *)((int)((byte *)a + 31) & ~ 31) #define ALIGN32( a ) a = (byte *)((intp)((byte *)a + 31) & ~ 31)
#define ALIGN64( a ) a = (byte *)((int)((byte *)a + 63) & ~ 63) #define ALIGN64( a ) a = (byte *)((intp)((byte *)a + 63) & ~ 63)
// Fixup macros create variables that may not be referenced // Fixup macros create variables that may not be referenced
#pragma warning( push ) #pragma warning( push )
@ -860,9 +860,9 @@ void ByteswapAnimData( mstudioanimdesc_t *pAnimDesc, int section, byte *&pDataSr
if ( pAnimation->flags & STUDIO_ANIM_ANIMPOS ) if ( pAnimation->flags & STUDIO_ANIM_ANIMPOS )
{ {
int offset = (byte*)pAnimation->pPosV() - (byte*)pAnimation; int offsetAnim = (byte*)pAnimation->pPosV() - (byte*)pAnimation;
pDataSrc = (byte*)pAnimationSrc + offset; pDataSrc = (byte*)pAnimationSrc + offsetAnim;
pDataDest = (byte*)pAnimationDest + offset; pDataDest = (byte*)pAnimationDest + offsetAnim;
mstudioanim_valueptr_t *posvptr = (mstudioanim_valueptr_t*)pDataSrc; mstudioanim_valueptr_t *posvptr = (mstudioanim_valueptr_t*)pDataSrc;
WriteObjects<mstudioanim_valueptr_t>( &pDataDest, &pDataSrc ); WriteObjects<mstudioanim_valueptr_t>( &pDataDest, &pDataSrc );
@ -994,7 +994,7 @@ int ByteswapIKRules( studiohdr_t *&pHdrSrc, int numikrules, int numFrames, byte
if ( pIKRule->szattachmentindex ) if ( pIKRule->szattachmentindex )
{ {
SET_INDEX_POINTERS( pData, pIKRule, szattachmentindex ) SET_INDEX_POINTERS( pData, pIKRule, szattachmentindex )
int size = strlen( (char*)pDataSrc ) + 1; int size = V_strlen( (char*)pDataSrc ) + 1;
WriteBuffer<char>( pDataDest, pDataSrc, size ); WriteBuffer<char>( pDataDest, pDataSrc, size );
} }
} }
@ -1073,10 +1073,10 @@ int ByteswapANIFile( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, c
{ {
int numsections = pAnimDesc->numframes / pAnimDesc->sectionframes + 2; int numsections = pAnimDesc->numframes / pAnimDesc->sectionframes + 2;
for ( int i = 0; i < numsections; ++i ) for ( int iSec = 0; iSec < numsections; ++iSec )
{ {
int block = pAnimDesc->pSection( i )->animblock; int block = pAnimDesc->pSection( iSec )->animblock;
int index = pAnimDesc->pSection( i )->animindex; int index = pAnimDesc->pSection( iSec )->animindex;
if ( block != 0 ) if ( block != 0 )
{ {
@ -1093,7 +1093,7 @@ int ByteswapANIFile( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, c
byte *pDataSrc = pBlockBaseSrc + index; byte *pDataSrc = pBlockBaseSrc + index;
byte *pDataDest = pBlockBaseDest + index; byte *pDataDest = pBlockBaseDest + index;
ByteswapAnimData( pAnimDesc, i, pDataSrc, pDataDest ); ByteswapAnimData( pAnimDesc, iSec, pDataSrc, pDataDest );
} }
} }
} }
@ -1228,8 +1228,8 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
V_memcpy( pNewDest, pDestBase, pAnimBlock->datastart ); V_memcpy( pNewDest, pDestBase, pAnimBlock->datastart );
pNewDest += pAnimBlock->datastart; pNewDest += pAnimBlock->datastart;
int padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 ); int padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase; padding -= (uintp)pNewDest - (uintp)pNewDestBase;
pNewDest += padding; pNewDest += padding;
// iterate and compress anim blocks // iterate and compress anim blocks
@ -1240,7 +1240,7 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
void *pInput = (byte *)pDestBase + pAnimBlock->datastart; void *pInput = (byte *)pDestBase + pAnimBlock->datastart;
int inputSize = pAnimBlock->dataend - pAnimBlock->datastart; int inputSize = pAnimBlock->dataend - pAnimBlock->datastart;
pAnimBlock->datastart = (unsigned int)pNewDest - (unsigned int)pNewDestBase; pAnimBlock->datastart = (uintp)pNewDest - (uintp)pNewDestBase;
void *pOutput; void *pOutput;
int outputSize; int outputSize;
@ -1257,11 +1257,11 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
pNewDest += inputSize; pNewDest += inputSize;
} }
padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 ); padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase; padding -= (uintp)pNewDest - (uintp)pNewDestBase;
pNewDest += padding; pNewDest += padding;
pAnimBlock->dataend = (unsigned int)pNewDest - (unsigned int)pNewDestBase; pAnimBlock->dataend = (uintp)pNewDest - (uintp)pNewDestBase;
} }
fixedFileSize = pNewDest - pNewDestBase; fixedFileSize = pNewDest - pNewDestBase;
@ -1418,10 +1418,10 @@ int ByteswapMDLFile( void *pDestBase, void *pSrcBase, const int fileSize )
int index = pAnimDesc->pSection( i )->animindex; int index = pAnimDesc->pSection( i )->animindex;
// Base address of the animation in the animblock // Base address of the animation in the animblock
byte *pDataSrc = (byte *)pAnimDescSrc + index; byte *pDataSrcAnim = (byte *)pAnimDescSrc + index;
byte *pDataDest = (byte *)pAnimDescDest + index; byte *pDataDestAnim = (byte *)pAnimDescDest + index;
ByteswapAnimData( pAnimDesc, i, pDataSrc, pDataDest ); ByteswapAnimData( pAnimDesc, i, pDataSrcAnim, pDataDestAnim );
} }
} }
} }
@ -1580,7 +1580,7 @@ int ByteswapMDLFile( void *pDestBase, void *pSrcBase, const int fileSize )
if ( pIKRule->szattachmentindex ) if ( pIKRule->szattachmentindex )
{ {
SET_INDEX_POINTERS( pData, pIKRule, szattachmentindex ) SET_INDEX_POINTERS( pData, pIKRule, szattachmentindex )
int size = strlen( (char*)pDataSrc ) + 1; int size = V_strlen( (char*)pDataSrc ) + 1;
WriteBuffer<char>( pDataDest, pDataSrc, size ); WriteBuffer<char>( pDataDest, pDataSrc, size );
} }
} }
@ -1957,7 +1957,7 @@ int ByteswapMDLFile( void *pDestBase, void *pSrcBase, const int fileSize )
for ( int i = 0; i < numCdTextures; ++i ) for ( int i = 0; i < numCdTextures; ++i )
{ {
char *pPath = (char*)pHdrDest + SrcNative( &((int *)pDataSrc)[i] ); char *pPath = (char*)pHdrDest + SrcNative( &((int *)pDataSrc)[i] );
int len = strlen( pPath ); int len = V_strlen( pPath );
if ( len >= 2 && ( pPath[len-1] == '\\' || pPath[len-1] == '/' ) && ( pPath[len-2] == '\\' || pPath[len-2] == '/' ) ) if ( len >= 2 && ( pPath[len-1] == '\\' || pPath[len-1] == '/' ) && ( pPath[len-2] == '\\' || pPath[len-2] == '/' ) )
{ {
pPath[len-1] = '\0'; pPath[len-1] = '\0';
@ -2068,7 +2068,7 @@ int ByteswapStudioFile( const char *pFilename, void *pOutBase, const void *pFile
void ProcessANIFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc ) void ProcessANIFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
{ {
studiohdr_t *pHdr = g_pHdr; studiohdr_t *pHdr = g_pHdr;
byte *pData = (byte*)pDataBase; //byte *pData = (byte*)pDataBase;
byte *pSrcBase = (byte*)g_pDataSrcBase; byte *pSrcBase = (byte*)g_pDataSrcBase;
// Since the animblocks and animdescs are native data, trick the system // Since the animblocks and animdescs are native data, trick the system
@ -2088,7 +2088,7 @@ void ProcessANIFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
mstudioanimdesc_t *pAnimDesc = pHdr->pLocalAnimdesc( 0 ); mstudioanimdesc_t *pAnimDesc = pHdr->pLocalAnimdesc( 0 );
for ( int i = 0; i < pHdr->numlocalanim; ++i, ++pAnimDesc ) for ( int i = 0; i < pHdr->numlocalanim; ++i, ++pAnimDesc )
{ {
mstudioanimblock_t *pAnimBlock = pHdr->pAnimBlock( pAnimDesc->animblock ); pAnimBlock = pHdr->pAnimBlock( pAnimDesc->animblock );
byte *pBlockBase = (byte*)pSrcBase + pAnimBlock->datastart; byte *pBlockBase = (byte*)pSrcBase + pAnimBlock->datastart;
ProcessFieldByName( pBlockBase, pAnimDesc, &mstudioanimdesc_t::m_DataMap, "animindex", pfnProcessFunc ); ProcessFieldByName( pBlockBase, pAnimDesc, &mstudioanimdesc_t::m_DataMap, "animindex", pfnProcessFunc );
@ -2133,7 +2133,7 @@ void ProcessANIFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pBlockBase + pAnimDesc->animblockikruleindex; pData = (byte*)pBlockBase + pAnimDesc->animblockikruleindex;
mstudioikrule_t *pIKRule = (mstudioikrule_t *)pData; mstudioikrule_t *pIKRule = (mstudioikrule_t *)pData;
for ( int i = 0; i < pAnimDesc->numikrules; ++i, ++pIKRule ) for ( int iIK = 0; iIK < pAnimDesc->numikrules; ++iIK, ++pIKRule )
{ {
ProcessFields( pIKRule, &mstudioikrule_t::m_DataMap, pfnProcessFunc ); ProcessFields( pIKRule, &mstudioikrule_t::m_DataMap, pfnProcessFunc );
} }
@ -2227,7 +2227,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
/** HITBOXES **/ /** HITBOXES **/
pData = (byte*)pHitboxSet + SrcNative( &pHitboxSet->hitboxindex ); pData = (byte*)pHitboxSet + SrcNative( &pHitboxSet->hitboxindex );
mstudiobbox_t *pBBox = (mstudiobbox_t*)pData; mstudiobbox_t *pBBox = (mstudiobbox_t*)pData;
for ( int i = 0; i < SrcNative( &pHitboxSet->numhitboxes ); ++i, ++pBBox ) for ( int iHit = 0; iHit < SrcNative( &pHitboxSet->numhitboxes ); ++iHit, ++pBBox )
{ {
ProcessFields( pBBox, &mstudiobbox_t::m_DataMap, pfnProcessFunc ); ProcessFields( pBBox, &mstudiobbox_t::m_DataMap, pfnProcessFunc );
} }
@ -2275,7 +2275,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pAnimDesc + SrcNative( &pAnimDesc->ikruleindex ); pData = (byte*)pAnimDesc + SrcNative( &pAnimDesc->ikruleindex );
mstudioikrule_t *pIKRule = (mstudioikrule_t *)pData; mstudioikrule_t *pIKRule = (mstudioikrule_t *)pData;
for ( int i = 0; i < SrcNative( &pAnimDesc->numikrules ); ++i, ++pIKRule ) for ( int iIK = 0; iIK < SrcNative( &pAnimDesc->numikrules ); ++iIK, ++pIKRule )
{ {
ProcessFields( pIKRule, &mstudioikrule_t::m_DataMap, pfnProcessFunc ); ProcessFields( pIKRule, &mstudioikrule_t::m_DataMap, pfnProcessFunc );
} }
@ -2294,7 +2294,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pHdr + SrcNative( &pSequenceHdr->eventindex ); pData = (byte*)pHdr + SrcNative( &pSequenceHdr->eventindex );
mstudioevent_t *pEvent = (mstudioevent_t*)pData; mstudioevent_t *pEvent = (mstudioevent_t*)pData;
for ( int i = 0; i < SrcNative( &pSequenceHdr->numevents ); ++i, ++pEvent ) for ( int iEvent = 0; iEvent < SrcNative( &pSequenceHdr->numevents ); ++iEvent, ++pEvent )
{ {
ProcessFields( pSequenceHdr, &mstudioevent_t::m_DataMap, pfnProcessFunc ); ProcessFields( pSequenceHdr, &mstudioevent_t::m_DataMap, pfnProcessFunc );
} }
@ -2310,9 +2310,9 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
/** MODEL INFO **/ /** MODEL INFO **/
byte *pData = (byte*)pBodypart + SrcNative( &pBodypart->modelindex ); byte *pDataModel = (byte*)pBodypart + SrcNative( &pBodypart->modelindex );
mstudiomodel_t *pModel = (mstudiomodel_t*)pData; mstudiomodel_t *pModel = (mstudiomodel_t*)pDataModel;
for ( int i = 0; i < SrcNative( &pBodypart->nummodels ); ++i, ++pModel ) for ( int iModel = 0; iModel < SrcNative( &pBodypart->nummodels ); ++iModel, ++pModel )
{ {
ProcessFields( pModel, &mstudiomodel_t::m_DataMap, pfnProcessFunc ); ProcessFields( pModel, &mstudiomodel_t::m_DataMap, pfnProcessFunc );
@ -2320,7 +2320,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pModel + SrcNative( &pModel->meshindex ); pData = (byte*)pModel + SrcNative( &pModel->meshindex );
mstudiomesh_t *pMesh = (mstudiomesh_t*)pData; mstudiomesh_t *pMesh = (mstudiomesh_t*)pData;
for ( int i = 0; i < SrcNative( &pModel->nummeshes ); ++i, ++pMesh ) for ( int iMesh = 0; iMesh < SrcNative( &pModel->nummeshes ); ++iMesh, ++pMesh )
{ {
ProcessFields( pMesh, &mstudiomesh_t::m_DataMap, pfnProcessFunc ); ProcessFields( pMesh, &mstudiomesh_t::m_DataMap, pfnProcessFunc );
@ -2331,7 +2331,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pMesh + SrcNative( &pMesh->flexindex ); pData = (byte*)pMesh + SrcNative( &pMesh->flexindex );
mstudioflex_t *pFlex = (mstudioflex_t*)pData; mstudioflex_t *pFlex = (mstudioflex_t*)pData;
for ( int i = 0; i < SrcNative( &pMesh->numflexes ); ++i, ++pFlex ) for ( int iFlesh = 0; iFlesh < SrcNative( &pMesh->numflexes ); ++iFlesh, ++pFlex )
{ {
ProcessFields( pFlex, &mstudioflex_t::m_DataMap, pfnProcessFunc ); ProcessFields( pFlex, &mstudioflex_t::m_DataMap, pfnProcessFunc );
} }
@ -2341,7 +2341,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData= (byte*)pModel + SrcNative( &pModel->eyeballindex ); pData= (byte*)pModel + SrcNative( &pModel->eyeballindex );
mstudioeyeball_t *pEyeball = (mstudioeyeball_t*)pData; mstudioeyeball_t *pEyeball = (mstudioeyeball_t*)pData;
for ( int i = 0; i < SrcNative( &pModel->numeyeballs ); ++i, ++pEyeball ) for ( int iEye = 0; iEye < SrcNative( &pModel->numeyeballs ); ++iEye, ++pEyeball )
{ {
ProcessFields( pEyeball, &mstudioeyeball_t::m_DataMap, pfnProcessFunc ); ProcessFields( pEyeball, &mstudioeyeball_t::m_DataMap, pfnProcessFunc );
} }
@ -2445,7 +2445,7 @@ void ProcessMDLFields( void *pDataBase, datadescProcessFunc_t pfnProcessFunc )
pData = (byte*)pHdr + SrcNative( &pStudioHdr2->srcbonetransformindex ); pData = (byte*)pHdr + SrcNative( &pStudioHdr2->srcbonetransformindex );
mstudiosrcbonetransform_t *pSrcBoneTransform = (mstudiosrcbonetransform_t*)pData; mstudiosrcbonetransform_t *pSrcBoneTransform = (mstudiosrcbonetransform_t*)pData;
for ( int i = 0; i < SrcNative( &pStudioHdr2->numsrcbonetransform ); ++i, ++pSrcBoneTransform ) for ( int iBone = 0; iBone < SrcNative( &pStudioHdr2->numsrcbonetransform ); ++iBone, ++pSrcBoneTransform )
{ {
ProcessFields( pSrcBoneTransform, &mstudiosrcbonetransform_t::m_DataMap, pfnProcessFunc ); ProcessFields( pSrcBoneTransform, &mstudiosrcbonetransform_t::m_DataMap, pfnProcessFunc );
} }
@ -2522,14 +2522,27 @@ BEGIN_BYTESWAP_DATADESC( studiohdr_t )
DEFINE_FIELD( contents, FIELD_INTEGER ), DEFINE_FIELD( contents, FIELD_INTEGER ),
DEFINE_FIELD( numincludemodels, FIELD_INTEGER ), DEFINE_FIELD( numincludemodels, FIELD_INTEGER ),
DEFINE_INDEX( includemodelindex, FIELD_INTEGER ), DEFINE_INDEX( includemodelindex, FIELD_INTEGER ),
#ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_virtualModel, FIELD_INTEGER ), // void*
#else
DEFINE_FIELD( virtualModel, FIELD_INTEGER ), // void* DEFINE_FIELD( virtualModel, FIELD_INTEGER ), // void*
#endif
DEFINE_INDEX( szanimblocknameindex, FIELD_INTEGER ), DEFINE_INDEX( szanimblocknameindex, FIELD_INTEGER ),
DEFINE_FIELD( numanimblocks, FIELD_INTEGER ), DEFINE_FIELD( numanimblocks, FIELD_INTEGER ),
DEFINE_INDEX( animblockindex, FIELD_INTEGER ), DEFINE_INDEX( animblockindex, FIELD_INTEGER ),
#ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_animblockModel, FIELD_INTEGER ), // void*
#else
DEFINE_FIELD( animblockModel, FIELD_INTEGER ), // void* DEFINE_FIELD( animblockModel, FIELD_INTEGER ), // void*
#endif
DEFINE_INDEX( bonetablebynameindex, FIELD_INTEGER ), DEFINE_INDEX( bonetablebynameindex, FIELD_INTEGER ),
#ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_pVertexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_pIndexBase, FIELD_INTEGER ), // void*
#else
DEFINE_FIELD( pVertexBase, FIELD_INTEGER ), // void* DEFINE_FIELD( pVertexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( pIndexBase, FIELD_INTEGER ), // void* DEFINE_FIELD( pIndexBase, FIELD_INTEGER ), // void*
#endif
DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte
DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte
DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte

View File

@ -14,8 +14,7 @@
#include "strtools.h" #include "strtools.h"
#include "steam/steamclientpublic.h" #include "steam/steamclientpublic.h"
#if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H ) #if !defined( INCLUDED_STEAM_STEAMUSERIDTYPES_H )
#define INCLUDED_STEAM2_USERID_STRUCTS #include "steamcommon.h"
#include "SteamCommon.h"
#endif #endif
#define IDTYPE_WON 0 #define IDTYPE_WON 0

185
src/common/vscript_utils.h Normal file
View File

@ -0,0 +1,185 @@
//===== Copyright <20> 1996-2011, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//
//===========================================================================//
#ifndef COMMON_VSCRIPT_UTILS_H
#define COMMON_VSCRIPT_UTILS_H
#ifdef _WIN32
#pragma once
#endif
#include "KeyValues.h"
#include "fmtstr.h"
#define KV_VARIANT_SCRATCH_BUF_SIZE 128
inline KeyValues * ScriptTableToKeyValues( IScriptVM *pVM, char const *szName, HSCRIPT hTable );
inline HSCRIPT ScriptTableFromKeyValues( IScriptVM *pVM, KeyValues *kv, HSCRIPT hTable = INVALID_HSCRIPT );
inline bool ScriptVmKeyValueToVariant( IScriptVM *pVM, KeyValues *val, ScriptVariant_t &varValue, char chScratchBuffer[KV_VARIANT_SCRATCH_BUF_SIZE] )
{
switch ( val->GetDataType() )
{
case KeyValues::TYPE_STRING:
varValue = val->GetString();
return true;
case KeyValues::TYPE_INT:
varValue = val->GetInt();
return true;
case KeyValues::TYPE_FLOAT:
varValue = val->GetFloat();
return true;
case KeyValues::TYPE_UINT64:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%llu", val->GetUint64() );
varValue = chScratchBuffer;
return true;
case KeyValues::TYPE_NONE:
varValue = ScriptTableFromKeyValues( pVM, val );
return true;
default:
Warning( "ScriptVmKeyValueToVariant failed to package parameter %s (type %d)\n", val->GetName(), val->GetDataType() );
return false;
}
}
inline bool ScriptVmStringFromVariant( ScriptVariant_t &varValue, char chScratchBuffer[KV_VARIANT_SCRATCH_BUF_SIZE] )
{
switch ( varValue.GetType() )
{
case FIELD_INTEGER:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%d", ( int ) varValue );
return true;
case FIELD_FLOAT:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%f", ( float ) varValue );
return true;
case FIELD_BOOLEAN:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%d", ( bool ) varValue );
return true;
case FIELD_CHARACTER:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%c", ( char ) varValue );
return true;
case FIELD_CSTRING:
V_snprintf( chScratchBuffer, KV_VARIANT_SCRATCH_BUF_SIZE, "%s", ( const char * ) varValue );
return true;
default:
Warning( "ScriptVmStringFromVariant failed to unpack parameter variant type %d\n", varValue.GetType() );
return false;
}
}
inline KeyValues * ScriptVmKeyValueFromVariant( IScriptVM *pVM, ScriptVariant_t &varValue )
{
KeyValues *val = NULL;
switch ( varValue.GetType() )
{
case FIELD_INTEGER:
val = new KeyValues( "" );
val->SetInt( NULL, ( int ) varValue );
return val;
case FIELD_FLOAT:
val = new KeyValues( "" );
val->SetFloat( NULL, ( float ) varValue );
return val;
case FIELD_BOOLEAN:
val = new KeyValues( "" );
val->SetInt( NULL, ( ( bool ) varValue ) ? 1 : 0 );
return val;
case FIELD_CHARACTER:
val = new KeyValues( "" );
val->SetString( NULL, CFmtStr( "%c", ( char ) varValue ) );
return val;
case FIELD_CSTRING:
val = new KeyValues( "" );
val->SetString( NULL, ( char const * ) varValue );
return val;
case FIELD_HSCRIPT:
return ScriptTableToKeyValues( pVM, "", ( HSCRIPT ) varValue );
default:
Warning( "ScriptVmKeyValueFromVariant failed to unpack parameter variant type %d\n", varValue.GetType() );
return NULL;
}
}
inline KeyValues * ScriptTableToKeyValues( IScriptVM *pVM, char const *szName, HSCRIPT hTable )
{
if ( !szName )
szName = "";
KeyValues *kv = new KeyValues( szName );
if ( hTable && pVM )
{
ScriptVariant_t varKey, varValue;
for ( int nIterator = 0;
( nIterator = pVM->GetKeyValue( hTable, nIterator, &varKey, &varValue ) ) != -1;
pVM->ReleaseValue( varKey ), pVM->ReleaseValue( varValue ) )
{
char chScratchBuffer[ KV_VARIANT_SCRATCH_BUF_SIZE ] = {0};
ScriptVmStringFromVariant( varKey, chScratchBuffer );
if ( !chScratchBuffer[0] )
{
Assert( 0 );
continue;
}
KeyValues *sub = ScriptVmKeyValueFromVariant( pVM, varValue );
if ( !sub )
{
Assert( 0 );
// sub->deleteThis();
// continue;
// still proceed - it will be a key with no data
sub = new KeyValues( "" );
}
sub->SetName( chScratchBuffer );
kv->AddSubKey( sub );
}
}
return kv;
}
inline HSCRIPT ScriptTableFromKeyValues( IScriptVM *pVM, KeyValues *kv, HSCRIPT hTable )
{
if ( !kv || !pVM )
return NULL;
if ( hTable == INVALID_HSCRIPT )
{
ScriptVariant_t varTable;
pVM->CreateTable( varTable );
hTable = varTable;
}
for ( KeyValues *val = kv->GetFirstSubKey(); val; val = val->GetNextKey() )
{
ScriptVariant_t varValue;
char chScratchBuffer[ KV_VARIANT_SCRATCH_BUF_SIZE ];
if ( !ScriptVmKeyValueToVariant( pVM, val, varValue, chScratchBuffer ) )
continue;
#ifdef SCRIPTTABLE_SCRIPT_LOWERCASE_ALL_TABLE_KEYS
char chNameBuffer[ KV_VARIANT_SCRATCH_BUF_SIZE ];
V_strncpy( chNameBuffer, val->GetName(), KV_VARIANT_SCRATCH_BUF_SIZE );
V_strlower( chNameBuffer );
#else
char const *chNameBuffer = val->GetName();
#endif
pVM->SetValue( hTable, chNameBuffer, varValue );
}
return hTable;
}
#endif // COMMON_VSCRIPT_UTILS_H

View File

@ -1,5 +0,0 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2mp +everything /mksln everything
popd

View File

@ -1 +1 @@
devtools\bin\vpc.exe /hl2mp +everything /mksln everything.sln devtools\bin\vpc.exe /hl2mp /tf /define:SOURCESDK +everything /mksln everything.sln

View File

@ -1,5 +0,0 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2mp +game /mksln games
popd

View File

@ -1 +0,0 @@
devtools\bin\vpc.exe /hl2mp +game /mksln games.sln

View File

@ -1,46 +0,0 @@
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) $(SDKROOT)/usr/include/malloc
ARCHS = i386
ONLY_ACTIVE_ARCH = NO
COPY_PHASE_STRIP = NO
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
DEAD_CODE_STRIPPING = YES
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_OBJC_EXCEPTIONS = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_REUSE_STRINGS = YES
// CPP11_NO_LIBCXX is used to gate some C++11 features that require that we
// switch to libc++. We haven't switched to libc++11 because we have been unable
// to find a clean way to build libcef_dll_wrapper with libc++.
// We currently build libcef for Steam which needs to run on 10.5, and Xcode
// does not support linking with libc++ and targeting 10.5.
// Once libcef_dll_wrapper has been built with libc++, and you rebuild protobuf
// with libc++ (which is trivial), you can remove CPP11_NO_LIBCXX and add the
// following line to the xcconfig:
// CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = _DLL_EXT=.dylib NO_MALLOC_OVERRIDE=1 VPROF_LEVEL=1 NO_HOOK_MALLOC=1 PNG_NO_PEDANTIC_WARNINGS CPP11_NO_LIBCXX
BASE_CFLAGS= -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE -ftemplate-depth=512
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO
WARNING_CFLAGS = -Wno-deprecated-writable-strings -Wno-switch-enum -Wno-switch -Wno-unused-value -Wno-parentheses -Wno-logical-op-parentheses -Wno-c++11-narrowing
// CLANG - and use the ccache wrapper
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
CC = $(SOURCE_ROOT)/devtools/bin/osx32/xcode_ccache_wrapper
LDPLUSPLUS = $(DT_TOOLCHAIN_DIR)/usr/bin/clang++
CLANG_WARN_CXX0X_EXTENSIONS = NO
CLANG_CXX_LANGUAGE_STANDARD = gnu++11
// include <memory.h> gets confused, 'cause ivp has one, and the system has one, and only one
// gets into the header map, so sacrifice speed for corectness.
USE_HEADERMAP = NO
SDKROOT = macosx10.9
MACOSX_DEPLOYMENT_TARGET = 10.5
GCC_FAST_MATH = YES

Binary file not shown.

View File

@ -0,0 +1,5 @@
Where does this come from?
https://github.com/Joshua-Ashton/ShaderCompile2
based on https://github.com/SCell555/ShaderCompile with some slight edits for compatibility. Thanks SCell! :D

View File

@ -1,22 +0,0 @@
use File::DosGlob;
@ARGV = map {
my @g = File::DosGlob::glob($_) if /[*?]/;
@g ? @g : $_;
} @ARGV;
open FILE, ">__tmpshaderlist.txt";
foreach $arg (@ARGV)
{
if( $arg =~ m/\.fxc$/i || $arg =~ m/\.vsh$/i || $arg =~ m/\.psh$/i )
{
print $arg . "\n";
print FILE $arg . "\n";
}
}
close FILE;
system "buildshaders.bat __tmpshaderlist";
unlink "__tmpshaderlist.txt";

View File

@ -1,116 +0,0 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub GetShaderBase
{
my $shadername = shift;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
$g_x360 = 0;
$g_vcsext = ".vcs";
while( 1 )
{
$inputbase = shift;
if( $inputbase =~ m/-x360/ )
{
$g_x360 = 1;
$g_vcsext = ".360.vcs";
}
else
{
last;
}
}
# rip the txt off the end if it's there.
$inputbase =~ s/\.txt//i;
my @srcfiles = &LoadShaderListFile( $inputbase );
foreach $srcfile ( @srcfiles )
{
my $shadertype = &GetShaderType( $srcfile );
my $shaderbase = &GetShaderBase( $srcfile );
my $shadersrc = &GetShaderSrc( $srcfile );
my $vcsFileName = "..\\..\\..\\game\\hl2\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
# print "shadersrc: $shadersrc vcsFileName: $vcsFileName\n";
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
{
next; # skip _ps20 files for 360
}
&CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 1 );
}

View File

@ -1,75 +0,0 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
use Cwd;
use String::CRC32;
my $txtfilename = shift;
my $arg = shift;
my $is360 = 0;
my $platformextension = "";
if( $arg =~ m/-x360/i )
{
$is360 = 1;
$platformextension = ".360";
}
open TXTFILE, "<$txtfilename";
my $src;
my $dst;
while( $src = <TXTFILE> )
{
# get rid of comments
$src =~ s,//.*,,g;
# skip blank lines
if( $src =~ m/^\s*$/ )
{
next;
}
# Get rid of newlines.
$src =~ s/\n//g;
# Save off the shader source filename.
my $dst = $src;
$dst =~ s/_tmp//gi;
# Does the dst exist?
my $dstexists = -e $dst;
my $srcexists = -e $src;
# What are the time stamps for the src and dst?
my $srcmodtime = ( stat $src )[9];
my $dstmodtime = ( stat $dst )[9];
# Open for edit or add if different than what is in perforce already.
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
{
# Make the target writable if it exists
if( $dstexists )
{
MakeFileWritable( $dst );
}
my $dir = $dst;
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
my $filename = $1;
# create the target directory if it doesn't exist
if( !$dstexists )
{
&MakeDirHier( $dir, 0777 );
}
# copy the file to its targets. . . we want to see STDERR here if there is an error.
my $cmd = "copy $src $dst > nul";
# print STDERR "$cmd\n";
system $cmd;
MakeFileReadOnly( $dst );
}
}
close TXTFILE;

View File

@ -1,172 +0,0 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
use Cwd;
use String::CRC32;
sub ReadInputFileWithIncludes
{
local( $filename ) = shift;
local( *INPUT );
local( $output );
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
$output.= ReadInputFileWithIncludes( $1 );
}
else
{
$output .= $line;
}
}
close INPUT;
return $output;
}
sub PatchCRC
{
my $filename = shift;
my $crc = shift;
# print STDERR "PatchCRC( $filename, $crc )\n";
local( *FP );
open FP, "+<$filename" || die;
binmode( FP );
seek FP, 6 * 4, 0;
my $uInt = "I";
if( $filename =~ m/360/ )
{
$uInt = "N";
}
print FP pack $uInt, $crc;
close FP;
}
my $txtfilename = shift;
my $arg = shift;
my $is360 = 0;
my $platformextension = "";
if( $arg =~ m/-x360/i )
{
$is360 = 1;
$platformextension = ".360";
}
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
my $changelistnumber = `valve_p4_create_changelist.cmd ..\\..\\..\\game\\hl2\\shaders \"Shader Auto Checkout VCS\"`;
# Get rid of the newline
$changelistnumber =~ s/\n//g;
my $changelistarg = "";
if( $changelistnumber != 0 )
{
$changelistarg = "-c $changelistnumber"
}
open TXTFILE, "<$txtfilename";
my $src;
my $dst;
while( $src = <TXTFILE> )
{
# get rid of comments
$src =~ s,//.*,,g;
# skip blank lines
if( $src =~ m/^\s*$/ )
{
next;
}
# Get rid of newlines.
$src =~ s/\n//g;
# Save off the shader source filename.
my $shadersrcfilename = $src;
$shadersrcfilename =~ s/-----.*$//;
# use only target basename.
$src =~ s/^.*-----//;
# where the binary vcs file is
my $spath = "";
if ( $shadersrcfilename =~ m@\.fxc@i )
{
$spath = "shaders\\fxc\\";
}
if ( $shadersrcfilename =~ m@\.vsh@i )
{
$spath = "shaders\\vsh\\";
}
if ( $shadersrcfilename =~ m@\.psh@i )
{
$spath = "shaders\\psh\\";
}
# make the source have path and extension
$src = $spath . $src . $platformextension . ".vcs";
# build the dest filename.
$dst = $src;
$dst =~ s/shaders\\/..\\..\\..\\game\\hl2\\shaders\\/i;
# Does the dst exist?
my $dstexists = -e $dst;
my $srcexists = -e $src;
# What are the time stamps for the src and dst?
my $srcmodtime = ( stat $src )[9];
my $dstmodtime = ( stat $dst )[9];
# Write $dst to a file so that we can do perforce stuff to it later.
local( *VCSLIST );
open VCSLIST, ">>vcslist.txt" || die;
print VCSLIST $dst . "\n";
close VCSLIST;
# Open for edit or add if different than what is in perforce already.
if( !$dstexists || ( $srcmodtime != $dstmodtime ) )
{
if ( $srcexists && $shadersrcfilename =~ m@\.fxc@i )
{
# Get the CRC for the source file.
my $srccode = ReadInputFileWithIncludes( $shadersrcfilename );
my $crc = crc32( $srccode );
# Patch the source VCS file with the CRC32 of the source code used to build that file.
PatchCRC( $src, $crc );
}
# Make the target vcs writable if it exists
if( $dstexists )
{
MakeFileWritable( $dst );
}
my $dir = $dst;
$dir =~ s,([^/\\]*$),,; # rip the filename off the end
my $filename = $1;
# create the target directory if it doesn't exist
if( !$dstexists )
{
&MakeDirHier( $dir, 0777 );
}
# copy the file to its targets. . . we want to see STDERR here if there is an error.
my $cmd = "copy $src $dst > nul";
# print STDERR "$cmd\n";
system $cmd;
MakeFileReadOnly( $dst );
}
}
close TXTFILE;

Binary file not shown.

View File

@ -1,110 +0,0 @@
#!perl
use File::Find;
&BuildRemapTable;
find(\&convert, "." );
sub convert
{
return unless (/\.pcf$/i);
return if (/^tmp\.pcf$/i);
return if (/^tmp2\.pcf$/i);
return if (/360\.pcf$/i);
print STDERR "process ", $File::Find::name," ($_) dir=",`cd`," \n";
my $fname=$_;
print `p4 edit $fname`;
print `dmxconvert -i $_ -o tmp.pcf -oe keyvalues2`;
open(TMP, "tmp.pcf" ) || return;
open(OUT, ">tmp2.pcf" ) || die;
while(<TMP>)
{
s/[\n\r]//g;
if ( (/^(\s*\"functionName\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
length($map{$2}) )
{
$_=$1.$map{$2}.'"'.$3;
}
if ( (/^(\s*\"name\"\s*\"string\"\s*\")(.*)\"(.*)$/) &&
length($map{$2}) )
{
$_=$1.$map{$2}.'"'.$3;
}
print OUT "$_\n";
}
close OUT;
close TMP;
print `dmxconvert -i tmp2.pcf -o $fname -ie keyvalues2 -oe binary`;
unlink "tmp.pcf";
unlink "tmp2.pcf";
}
sub BuildRemapTable
{
$map{"alpha_fade"}= "Alpha Fade and Decay";
$map{"alpha_fade_in_random"}= "Alpha Fade In Random";
$map{"alpha_fade_out_random"}= "Alpha Fade Out Random";
$map{"basic_movement"}= "Movement Basic";
$map{"color_fade"}= "Color Fade";
$map{"controlpoint_light"}= "Color Light From Control Point";
$map{"Dampen Movement Relative to Control Point"}= "Movement Dampen Relative to Control Point";
$map{"Distance Between Control Points Scale"}= "Remap Distance Between Two Control Points to Scalar";
$map{"Distance to Control Points Scale"}= "Remap Distance to Control Point to Scalar";
$map{"lifespan_decay"}= "Lifespan Decay";
$map{"lock to bone"}= "Movement Lock to Bone";
$map{"postion_lock_to_controlpoint"}= "Movement Lock to Control Point";
$map{"maintain position along path"}= "Movement Maintain Position Along Path";
$map{"Match Particle Velocities"}= "Movement Match Particle Velocities";
$map{"Max Velocity"}= "Movement Max Velocity";
$map{"noise"}= "Noise Scalar";
$map{"vector noise"}= "Noise Vector";
$map{"oscillate_scalar"}= "Oscillate Scalar";
$map{"oscillate_vector"}= "Oscillate Vector";
$map{"Orient Rotation to 2D Direction"}= "Rotation Orient to 2D Direction";
$map{"radius_scale"}= "Radius Scale";
$map{"Random Cull"}= "Cull Random";
$map{"remap_scalar"}= "Remap Scalar";
$map{"rotation_movement"}= "Rotation Basic";
$map{"rotation_spin"}= "Rotation Spin Roll";
$map{"rotation_spin yaw"}= "Rotation Spin Yaw";
$map{"alpha_random"}= "Alpha Random";
$map{"color_random"}= "Color Random";
$map{"create from parent particles"}= "Position From Parent Particles";
$map{"Create In Hierarchy"}= "Position In CP Hierarchy";
$map{"random position along path"}= "Position Along Path Random";
$map{"random position on model"}= "Position on Model Random";
$map{"sequential position along path"}= "Position Along Path Sequential";
$map{"position_offset_random"}= "Position Modify Offset Random";
$map{"position_warp_random"}= "Position Modify Warp Random";
$map{"position_within_box"}= "Position Within Box Random";
$map{"position_within_sphere"}= "Position Within Sphere Random";
$map{"Inherit Velocity"}= "Velocity Inherit from Control Point";
$map{"Initial Repulsion Velocity"}= "Velocity Repulse from World";
$map{"Initial Velocity Noise"}= "Velocity Noise";
$map{"Initial Scalar Noise"}= "Remap Noise to Scalar";
$map{"Lifespan from distance to world"}= "Lifetime from Time to Impact";
$map{"Pre-Age Noise"}= "Lifetime Pre-Age Noise";
$map{"lifetime_random"}= "Lifetime Random";
$map{"radius_random"}= "Radius Random";
$map{"random yaw"}= "Rotation Yaw Random";
$map{"Randomly Flip Yaw"}= "Rotation Yaw Flip Random";
$map{"rotation_random"}= "Rotation Random";
$map{"rotation_speed_random"}= "Rotation Speed Random";
$map{"sequence_random"}= "Sequence Random";
$map{"second_sequence_random"}= "Sequence Two Random";
$map{"trail_length_random"}= "Trail Length Random";
$map{"velocity_random"}= "Velocity Random";
}

View File

@ -1,949 +0,0 @@
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub ReadInputFile
{
local( $filename ) = shift;
local( *INPUT );
local( @output );
open INPUT, "<$filename" || die;
local( $line );
local( $linenum ) = 1;
while( $line = <INPUT> )
{
# print "LINE: $line";
# $line =~ s/\n//g;
# local( $postfix ) = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
# $postfix .= "; LINEINFO($filename)($linenum)\n";
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
push @output, &ReadInputFile( $1 );
}
else
{
# push @output, $line . $postfix;
push @output, $line;
}
$linenum++;
}
close INPUT;
# print "-----------------\n";
# print @output;
# print "-----------------\n";
return @output;
}
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
$generateListingFile = 0;
$spewCombos = 0;
@startTimes = times;
$startTime = time;
$g_produceCppClasses = 1;
$g_produceCompiledVcs = 1;
while( 1 )
{
$fxc_filename = shift;
if( $fxc_filename =~ m/-source/ )
{
shift;
}
elsif( $fxc_filename =~ m/-nv3x/i )
{
$nvidia = 1;
}
elsif( $fxc_filename =~ m/-ps20a/i )
{
$ps2a = 1;
}
elsif( $fxc_filename =~ m/-x360/i )
{
# enable x360
$g_x360 = 1;
}
elsif( $fxc_filename =~ m/-novcs/i )
{
$g_produceCompiledVcs = 0;
}
elsif( $fxc_filename =~ m/-nocpp/i )
{
$g_produceCppClasses = 0;
}
else
{
last;
}
}
$argstring = $fxc_filename;
$fxc_basename = $fxc_filename;
$fxc_basename =~ s/^.*-----//;
$fxc_filename =~ s/-----.*$//;
$debug = 0;
$forcehalf = 0;
sub ToUpper
{
local( $in ) = shift;
$in =~ tr/a-z/A-Z/;
return $in;
}
sub CreateCCodeToSpewDynamicCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename dynamic index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $varname ) = "m_n" . $name;
$out .= "( $scale * $varname ) + ";
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
$out .= "0;\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= ";\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
return $out;
}
sub CreateCCodeToSpewStaticCombo
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename static index\" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tint shaderID = ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $varname ) = "m_n" . $name;
$out .= "( $scale * $varname ) + ";
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
$out .= "0;\n";
# $out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
# $out .= "\t\tOutputDebugString( tmp );\n\n";
if( scalar( @staticDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= ";\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
return $out;
}
sub WriteHelperVar
{
local( $name ) = shift;
local( $min ) = shift;
local( $max ) = shift;
local( $varname ) = "m_n" . $name;
local( $boolname ) = "m_b" . $name;
push @outputHeader, "private:\n";
push @outputHeader, "\tint $varname;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\tbool $boolname;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "public:\n";
# int version of set function
push @outputHeader, "\tvoid Set" . $name . "( int i )\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
push @outputHeader, "\t\t$varname = i;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "\t}\n";
# bool version of set function
push @outputHeader, "\tvoid Set" . $name . "( bool i )\n";
push @outputHeader, "\t{\n";
# push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
push @outputHeader, "\t\t$varname = i ? 1 : 0;\n";
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif\n";
push @outputHeader, "\t}\n";
}
sub WriteStaticBoolExpression
{
local( $prefix ) = shift;
local( $operator ) = shift;
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
if( $i )
{
push @outputHeader, " $operator ";
}
local( $name ) = @staticDefineNames[$i];
local( $boolname ) = "m_b" . $name;
push @outputHeader, "$prefix$boolname";
}
push @outputHeader, ";\n";
}
sub WriteDynamicBoolExpression
{
local( $prefix ) = shift;
local( $operator ) = shift;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
if( $i )
{
push @outputHeader, " $operator ";
}
local( $name ) = @dynamicDefineNames[$i];
local( $boolname ) = "m_b" . $name;
push @outputHeader, "$prefix$boolname";
}
push @outputHeader, ";\n";
}
sub WriteDynamicHelperClasses
{
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Dynamic_Index";
push @outputHeader, "class $classname\n";
push @outputHeader, "{\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$name = $dynamicDefineNames[$i];
$min = $dynamicDefineMin[$i];
$max = $dynamicDefineMax[$i];
&WriteHelperVar( $name, $min, $max );
}
push @outputHeader, "public:\n";
# push @outputHeader, "void SetPixelShaderIndex( IShaderAPI *pShaderAPI ) { pShaderAPI->SetPixelShaderIndex( GetIndex() ); }\n";
push @outputHeader, "\t$classname()\n";
push @outputHeader, "\t{\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $boolname ) = "m_b" . $name;
local( $varname ) = "m_n" . $name;
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tint GetIndex()\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
foreach $skip (@perlskipcodeindividual)
{
# can't do this static and dynamic can see each other.
# $skip =~ s/\$/m_n/g;
# $skip =~ s/defined//g;
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
# print "\t\tAssert( !( $skip ) );\n";
}
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
push @outputHeader, "#ifdef _DEBUG\n";
if( scalar( @dynamicDefineNames ) > 0 )
{
push @outputHeader, "\t\tbool bAllDynamicVarsDefined = ";
WriteDynamicBoolExpression( "", "&&" );
}
if( scalar( @dynamicDefineNames ) > 0 )
{
push @outputHeader, "\t\tAssert( bAllDynamicVarsDefined );\n";
}
push @outputHeader, "#endif // _DEBUG\n";
if( $spewCombos && scalar( @dynamicDefineNames ) )
{
push @outputHeader, &CreateCCodeToSpewDynamicCombo();
}
push @outputHeader, "\t\treturn ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
local( $varname ) = "m_n" . $name;
push @outputHeader, "( $scale * $varname ) + ";
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
push @outputHeader, "0;\n";
push @outputHeader, "\t}\n";
push @outputHeader, "};\n";
push @outputHeader, "\#define shaderDynamicTest_" . $basename . " ";
my $prefix;
my $shaderType = &GetShaderType( $fxc_filename );
if( $shaderType =~ m/^vs/i )
{
$prefix = "vsh_";
}
else
{
$prefix = "psh_";
}
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $name ) = @dynamicDefineNames[$i];
push @outputHeader, $prefix . "forgot_to_set_dynamic_" . $name . " + ";
}
push @outputHeader, "0\n";
}
sub WriteStaticHelperClasses
{
local( $basename ) = $fxc_basename;
$basename =~ tr/A-Z/a-z/;
local( $classname ) = $basename . "_Static_Index";
push @outputHeader, "#include \"shaderlib/cshader.h\"\n";
push @outputHeader, "class $classname\n";
push @outputHeader, "{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$name = $staticDefineNames[$i];
$min = $staticDefineMin[$i];
$max = $staticDefineMax[$i];
&WriteHelperVar( $name, $min, $max );
}
push @outputHeader, "public:\n";
# push @outputHeader, "void SetShaderIndex( IShaderShadow *pShaderShadow ) { pShaderShadow->SetPixelShaderIndex( GetIndex() ); }\n";
push @outputHeader, "\t$classname( )\n";
push @outputHeader, "\t{\n";
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $boolname ) = "m_b" . $name;
local( $varname ) = "m_n" . $name;
if ( length( $staticDefineInit{$name} ) )
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = true;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = $staticDefineInit{$name};\n";
}
else
{
push @outputHeader, "#ifdef _DEBUG\n";
push @outputHeader, "\t\t$boolname = false;\n";
push @outputHeader, "#endif // _DEBUG\n";
push @outputHeader, "\t\t$varname = 0;\n";
}
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tint GetIndex()\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
foreach $skip (@perlskipcodeindividual)
{
$skip =~ s/\$/m_n/g;
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
}
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
push @outputHeader, "#ifdef _DEBUG\n";
if( scalar( @staticDefineNames ) > 0 )
{
push @outputHeader, "\t\tbool bAllStaticVarsDefined = ";
WriteStaticBoolExpression( "", "&&" );
}
if( scalar( @staticDefineNames ) > 0 )
{
push @outputHeader, "\t\tAssert( bAllStaticVarsDefined );\n";
}
push @outputHeader, "#endif // _DEBUG\n";
if( $spewCombos && scalar( @staticDefineNames ) )
{
push @outputHeader, &CreateCCodeToSpewStaticCombo();
}
push @outputHeader, "\t\treturn ";
local( $scale ) = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
local( $varname ) = "m_n" . $name;
push @outputHeader, "( $scale * $varname ) + ";
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
push @outputHeader, "0;\n";
push @outputHeader, "\t}\n";
push @outputHeader, "};\n";
push @outputHeader, "\#define shaderStaticTest_" . $basename . " ";
my $prefix;
my $shaderType = &GetShaderType( $fxc_filename );
if( $shaderType =~ m/^vs/i )
{
$prefix = "vsh_";
}
else
{
$prefix = "psh_";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $name ) = @staticDefineNames[$i];
push @outputHeader, $prefix . "forgot_to_set_static_" . $name . " + " unless (length($staticDefineInit{$name} ));
}
push @outputHeader, "0\n";
}
sub GetNewMainName
{
local( $shadername ) = shift;
local( $combo ) = shift;
local( $i );
$shadername =~ s/\./_/g;
local( $name ) = $shadername;
for( $i = 0; $i < scalar( @defineNames ); $i++ )
{
local( $val ) = ( $combo % ( $defineMax[$i] - $defineMin[$i] + 1 ) ) + $defineMin[$i];
$name .= "_" . $defineNames[$i] . "_" . $val;
$combo = $combo / ( $defineMax[$i] - $defineMin[$i] + 1 );
}
# return $name;
return "main";
}
sub RenameMain
{
local( $shadername ) = shift;
local( $combo ) = shift;
local( $name ) = &GetNewMainName( $shadername, $combo );
return "/Dmain=$name /E$name ";
}
sub GetShaderType
{
local( $shadername ) = shift; # hack - use global variables
$shadername = $fxc_basename;
if( $shadername =~ m/ps30/i )
{
if( $debug )
{
return "ps_3_sw";
}
else
{
return "ps_3_0";
}
}
elsif( $shadername =~ m/ps20b/i )
{
return "ps_2_b";
}
elsif( $shadername =~ m/ps20/i )
{
if( $debug )
{
return "ps_2_sw";
}
else
{
if( $ps2a )
{
return "ps_2_a";
}
else
{
return "ps_2_0";
}
}
}
elsif( $shadername =~ m/ps14/i )
{
return "ps_1_4";
}
elsif( $shadername =~ m/ps11/i )
{
return "ps_1_1";
}
elsif( $shadername =~ m/vs30/i )
{
if( $debug )
{
return "vs_3_sw";
}
else
{
return "vs_3_0";
}
}
elsif( $shadername =~ m/vs20/i )
{
if( $debug )
{
return "vs_2_sw";
}
else
{
return "vs_2_0";
}
}
elsif( $shadername =~ m/vs14/i )
{
return "vs_1_1";
}
elsif( $shadername =~ m/vs11/i )
{
return "vs_1_1";
}
else
{
die "\n\nSHADERNAME = $shadername\n\n";
}
}
sub CalcNumCombos
{
local( $i, $numCombos );
$numCombos = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$numCombos *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
return $numCombos;
}
sub CalcNumDynamicCombos
{
local( $i, $numCombos );
$numCombos = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
return $numCombos;
}
sub CreateCFuncToCreateCompileCommandLine
{
local( $out ) = "";
$out .= "\t\tOutputDebugString( \"compiling src:$fxc_filename vcs:$fxc_basename \" );\n";
$out .= "\t\tchar tmp[128];\n";
$out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tstatic PrecompiledShaderByteCode_t byteCode;\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tint nCombo = shaderID;\n";
}
# $out .= "\tvoid BuildCompileCommandLine( int nCombo, char *pResult, int maxLength )\n";
# $out .= "\t{\n";
$out .= "\t\tD3DXMACRO ";
$out .= "defineMacros";
$out .= "[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) + 1; # add 1 for null termination
$out .= "];\n";
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
{
$out .= "\t\tchar tmpStringBuf[1024];\n";
$out .= "\t\tchar *pTmpString = tmpStringBuf;\n\n";
}
local( $i );
my $type = GetShaderType( $fxc_filename );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= " );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i;
$out .= "]";
$out .= "\.Name = ";
$out .= "\"$dynamicDefineNames[$i]\";\n";
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
$out .= ";\n";
$out .= "\t\tUNUSED( n$dynamicDefineNames[$i] );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i;
$out .= "]";
$out .= "\.Definition = ";
$out .= "pTmpString;\n";
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= " );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i + scalar( @dynamicDefineNames );
$out .= "]";
$out .= "\.Name = ";
$out .= "\"$staticDefineNames[$i]\";\n";
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
$out .= ";\n";
$out .= "\t\tUNUSED( n$staticDefineNames[$i] );\n";
$out .= "\t\tdefineMacros";
$out .= "[";
$out .= $i + scalar( @dynamicDefineNames );
$out .= "]";
$out .= "\.Definition = ";
$out .= "pTmpString;\n";
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
$out .= "=\" );\n";
$out .= "\t\tOutputDebugString( tmp );\n";
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
$out .= "\n";
}
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
$cskipcode = $perlskipcode;
$cskipcode =~ s/\$/n/g;
$out .= "\t\tif( $cskipcode )\n\t\t{\n";
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
$out .= "\t\t\treturn byteCode;\n";
$out .= "\t\t}\n";
$out .= "\t\t// Must null terminate macros.\n";
$out .= "\t\tdefineMacros[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
$out .= "]";
$out .= ".Name = NULL;\n";
$out .= "\t\tdefineMacros[";
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
$out .= "]";
$out .= ".Definition = NULL;\n\n";
$out .= "\t\tLPD3DXBUFFER pShader; // NOTE: THESE LEAK!!!\n";
$out .= "\t\tLPD3DXBUFFER pErrorMessages; // NOTE: THESE LEAK!!!\n";
$out .= "\t\tHRESULT hr = D3DXCompileShaderFromFile( \"u:\\\\hl2_e3_2004\\\\src_e3_2004\\\\materialsystem\\\\stdshaders\\\\$fxc_filename\",\n\t\t\tdefineMacros,\n\t\t\tNULL, // LPD3DXINCLUDE \n\t\t\t\"main\",\n\t\t\t\"$type\",\n\t\t\t0, // DWORD Flags\n\t\t\t&pShader,\n\t\t\t&pErrorMessages,\n\t\t\tNULL // LPD3DXCONSTANTTABLE *ppConstantTable\n\t\t\t );\n";
$out .= "\t\tif( hr != D3D_OK )\n";
$out .= "\t\t{\n";
$out .= "\t\t\tconst char *pErrorMessageString = ( const char * )pErrorMessages->GetBufferPointer();\n";
$out .= "\t\t\tOutputDebugString( pErrorMessageString );\n";
$out .= "\t\t\tOutputDebugString( \"\\n\" );\n";
$out .= "\t\t\tAssert( 0 );\n";
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
$out .= "\t\t}\n";
$out .= "\t\telse\n";
$out .= "\t\t{\n";
$out .= "\t\t\tbyteCode.m_pRawData = pShader->GetBufferPointer();\n";
$out .= "\t\t\tbyteCode.m_nSizeInBytes = pShader->GetBufferSize();\n";
$out .= "\t\t}\n";
$out .= "\t\treturn byteCode;\n";
return $out;
}
#print "--------\n";
if ( $g_x360 )
{
$fxctmp = "fxctmp9_360_tmp";
}
else
{
$fxctmp = "fxctmp9_tmp";
}
if( !stat $fxctmp )
{
mkdir $fxctmp, 0777 || die $!;
}
# suck in an input file (using includes)
#print "$fxc_filename...";
@fxc = ReadInputFile( $fxc_filename );
# READ THE TOP OF THE FILE TO FIND SHADER COMBOS
foreach $line ( @fxc )
{
$line="" if ($g_x360 && ($line=~/\[PC\]/)); # line marked as [PC] when building for x360
$line="" if (($g_x360 == 0) && ($line=~/\[XBOX\]/)); # line marked as [XBOX] when building for pc
if ( $fxc_basename =~ m/_ps(\d+\w?)$/i )
{
my $psver = $1;
$line="" if (($line =~/\[ps\d+\w?\]/i) && ($line!~/\[ps$psver\]/i)); # line marked for a version of compiler and not what we build
}
if ( $fxc_basename =~ m/_vs(\d+\w?)$/i )
{
my $vsver = $1;
$line="" if (($line =~/\[vs\d+\w?\]/i) && ($line!~/\[vs$vsver\]/i)); # line marked for a version of compiler and not what we build
}
my $init_expr;
$init_expr = $1 if ( $line=~/\[\=([^\]]+)\]/); # parse default init expression for combos
$line=~s/\[[^\[\]]*\]//; # cut out all occurrences of
# square brackets and whatever is
# inside all these modifications
# to the line are seen later when
# processing skips and centroids
next if( $line =~ m/^\s*$/ );
if( $line =~ m/^\s*\/\/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print STDERR "STATIC: \"$name\" \"$min..$max\"\n";
push @staticDefineNames, $name;
push @staticDefineMin, $min;
push @staticDefineMax, $max;
$staticDefineInit{$name}=$init_expr;
}
elsif( $line =~ m/^\s*\/\/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print STDERR "DYNAMIC: \"$name\" \"$min..$max\"\n";
push @dynamicDefineNames, $name;
push @dynamicDefineMin, $min;
push @dynamicDefineMax, $max;
}
}
# READ THE WHOLE FILE AND FIND SKIP STATEMENTS
foreach $line ( @fxc )
{
if( $line =~ m/^\s*\/\/\s*SKIP\s*\s*\:\s*(.*)$/ )
{
# print $1 . "\n";
$perlskipcode .= "(" . $1 . ")||";
push @perlskipcodeindividual, $1;
}
}
if( defined $perlskipcode )
{
$perlskipcode .= "0";
$perlskipcode =~ s/\n//g;
}
else
{
$perlskipcode = "0";
}
# READ THE WHOLE FILE AND FIND CENTROID STATEMENTS
foreach $line ( @fxc )
{
if( $line =~ m/^\s*\/\/\s*CENTROID\s*\:\s*TEXCOORD(\d+)\s*$/ )
{
$centroidEnable{$1} = 1;
# print "CENTROID: $1\n";
}
}
if( $spewCombos )
{
push @outputHeader, "#include \"windows.h\"\n";
}
#push @outputHeader, "\#include \"shaderlib\\baseshader.h\"\n";
#push @outputHeader, "IShaderDynamicAPI *CBaseShader::s_pShaderAPI;\n";
# Go ahead an compute the mask of samplers that need to be centroid sampled
$centroidMask = 0;
foreach $centroidRegNum ( keys( %centroidEnable ) )
{
# print "THING: $samplerName $centroidRegNum\n";
$centroidMask += 1 << $centroidRegNum;
}
#printf "0x%x\n", $centroidMask;
$numCombos = &CalcNumCombos();
#print "$numCombos combos\n";
if( $g_produceCompiledVcs && !$dynamic_compile )
{
open FOUT, ">>filelistgen.txt" || die "can't open filelistgen.txt";
print FOUT "**** generated by fxc_prep.pl ****\n";
print FOUT "#BEGIN " . $fxc_basename . "\n";
print FOUT "$fxc_filename" . "\n";
print FOUT "#DEFINES-D:\n";
for( $i = 0; $i < scalar( @dynamicDefineNames ); \$i++ )
{
print FOUT "$dynamicDefineNames[$i]=";
print FOUT $dynamicDefineMin[$i];
print FOUT "..";
print FOUT $dynamicDefineMax[$i];
print FOUT "\n";
}
print FOUT "#DEFINES-S:\n";
for( $i = 0; $i < scalar( @staticDefineNames ); \$i++ )
{
print FOUT "$staticDefineNames[$i]=";
print FOUT $staticDefineMin[$i];
print FOUT "..";
print FOUT $staticDefineMax[$i];
print FOUT "\n";
}
print FOUT "#SKIP:\n";
print FOUT "$perlskipcode\n";
print FOUT "#COMMAND:\n";
# first line
print FOUT "fxc.exe ";
print FOUT "/DTOTALSHADERCOMBOS=$numCombos ";
print FOUT "/DCENTROIDMASK=$centroidMask ";
print FOUT "/DNUMDYNAMICCOMBOS=" . &CalcNumDynamicCombos() . " ";
print FOUT "/DFLAGS=0x0 "; # Nothing here for now.
print FOUT "\n";
#defines go here
# second line
print FOUT &RenameMain( $fxc_filename, $i );
print FOUT "/T" . &GetShaderType( $fxc_filename ) . " ";
print FOUT "/DSHADER_MODEL_" . &ToUpper( &GetShaderType( $fxc_filename ) ) . "=1 ";
if( $nvidia )
{
print FOUT "/DNV3X=1 "; # enable NV3X codepath
}
if ( $g_x360 )
{
print FOUT "/D_X360=1 "; # shaders can identify X360 centric code
# print FOUT "/Xbe:2- "; # use the less-broken old back end
}
if( $debug )
{
print FOUT "/Od "; # disable optimizations
print FOUT "/Zi "; # enable debug info
}
# print FOUT "/Zi "; # enable debug info
print FOUT "/nologo ";
# print FOUT "/Fhtmpshader.h ";
print FOUT "/Foshader.o ";
print FOUT "$fxc_filename";
print FOUT ">output.txt 2>&1";
print FOUT "\n";
#end of command line
print FOUT "#END\n";
print FOUT "**** end ****\n";
close FOUT;
}
if ( $g_produceCppClasses )
{
# Write out the C++ helper class for picking shader combos
&WriteStaticHelperClasses();
&WriteDynamicHelperClasses();
my $incfilename = "$fxctmp\\$fxc_basename" . ".inc";
&WriteFile( $incfilename, join( "", @outputHeader ) );
}
if( $generateListingFile )
{
my $listFileName = "$fxctmp/$fxc_basename" . ".lst";
print "writing $listFileName\n";
if( !open FILE, ">$listFileName" )
{
die;
}
print FILE @listingOutput;
close FILE;
}
@endTimes = times;
$endTime = time;
#printf "Elapsed user time: %.2f seconds!\n", $endTimes[0] - $startTimes[0];
#printf "Elapsed system time: %.2f seconds!\n", $endTimes[1] - $startTimes[1];
#printf "Elapsed child user time: %.2f seconds!\n", $endTimes[2] - $startTimes[2];
#printf "Elapsed child system time: %.2f seconds!\n", $endTimes[3] - $startTimes[3];
#printf "Elapsed total time: %.2f seconds!\n", $endTime - $startTime;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
#!/bin/bash
exec $(dirname $0)/ccache "${DT_TOOLCHAIN_DIR}"/usr/bin/clang -Qunused-arguments "$@"

View File

@ -0,0 +1,31 @@
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipeline=$true)][System.IO.FileInfo]$File,
[Parameter(Mandatory=$true)][string]$Version,
[Parameter(Mandatory=$false)][switch]$Dynamic,
[Parameter(Mandatory=$false)][System.UInt32]$Threads
)
if ($Version -notin @("20b", "30", "40", "41", "50", "51")) {
return
}
$fileList = $File.OpenText()
while ($null -ne ($line = $fileList.ReadLine())) {
if ($line -match '^\s*$' -or $line -match '^\s*//') {
continue
}
if ($Dynamic) {
& "$PSScriptRoot\ShaderCompile2" "-dynamic" "-ver" $Version "-shaderpath" $File.DirectoryName $line
continue
}
if ($Threads -ne 0) {
& "$PSScriptRoot\ShaderCompile2" "-threads" $Threads "-ver" $Version "-shaderpath" $File.DirectoryName $line
continue
}
& "$PSScriptRoot\ShaderCompile2" "-ver" $Version "-shaderpath" $File.DirectoryName $line
}
$fileList.Close()

View File

@ -1,333 +0,0 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
sub BuildDefineOptions
{
local( $output );
local( $combo ) = shift;
local( $i );
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) ) + $dynamicDefineMin[$i];
$output .= "/D$dynamicDefineNames[$i]=$val ";
$combo = $combo / ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 );
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
local( $val ) = ( $combo % ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) ) + $staticDefineMin[$i];
$output .= "/D$staticDefineNames[$i]=$val ";
$combo = $combo / ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 );
}
return $output;
}
sub CalcNumCombos
{
local( $i, $numCombos );
$numCombos = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
{
$numCombos *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
}
return $numCombos;
}
sub CalcNumDynamicCombos
{
local( $i, $numCombos );
$numCombos = 1;
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
{
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
}
return $numCombos;
}
$g_dx9 = 1;
while( 1 )
{
$psh_filename = shift;
if( $psh_filename =~ m/-source/ )
{
$g_SourceDir = shift;
}
elsif( $psh_filename =~ m/-x360/ )
{
$g_x360 = 1;
}
else
{
last;
}
}
$psh_filename =~ s/-----.*$//;
# Get the shader binary version number from a header file.
open FILE, "<$g_SourceDir\\public\\materialsystem\\shader_vcs_version.h" || die;
while( $line = <FILE> )
{
if( $line =~ m/^\#define\s+SHADER_VCS_VERSION_NUMBER\s+(\d+)\s*$/ )
{
$shaderVersion = $1;
last;
}
}
if( !defined $shaderVersion )
{
die "couldn't get shader version from shader_vcs_version.h";
}
close FILE;
local( @staticDefineNames );
local( @staticDefineMin );
local( @staticDefineMax );
local( @dynamicDefineNames );
local( @dynamicDefineMin );
local( @dynamicDefineMax );
# Parse the combos.
open PSH, "<$psh_filename";
while( <PSH> )
{
last if( !m,^;, );
s,^;\s*,,;
if( m/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print "\"STATIC: $name\" \"$min..$max\"\n";
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
push @staticDefineNames, $name;
push @staticDefineMin, $min;
push @staticDefineMax, $max;
}
elsif( m/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
{
local( $name, $min, $max );
$name = $1;
$min = $2;
$max = $3;
# print "\"DYNAMIC: $name\" \"$min..$max\"\n";
if (/\[(.*)\]/)
{
$platforms=$1;
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
}
push @dynamicDefineNames, $name;
push @dynamicDefineMin, $min;
push @dynamicDefineMax, $max;
}
}
close PSH;
$numCombos = &CalcNumCombos();
$numDynamicCombos = &CalcNumDynamicCombos();
print "$psh_filename\n";
#print "$numCombos combos\n";
#print "$numDynamicCombos dynamic combos\n";
if( $g_x360 )
{
$pshtmp = "pshtmp9_360";
}
elsif( $g_dx9 )
{
$pshtmp = "pshtmp9";
}
else
{
$pshtmp = "pshtmp8";
}
$basename = $psh_filename;
$basename =~ s/\.psh$//i;
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
{
my $tempFilename = "shader$shaderCombo.o";
unlink $tempFilename;
if( $g_x360 )
{
$cmd = "$g_SourceDir\\x360xdk\\bin\\win32\\psa /D_X360=1 /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
}
else
{
$cmd = "$g_SourceDir\\dx9sdk\\utilities\\psa /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
}
if( !stat $pshtmp )
{
mkdir $pshtmp, 0777 || die $!;
}
# print $cmd . "\n";
system $cmd || die $!;
# Make sure a file got generated because sometimes the die above won't happen on compile errors.
my $filesize = (stat $tempFilename)[7];
if ( !$filesize )
{
die "Error compiling shader$shaderCombo.o";
}
push @outputHeader, @hdr;
}
$basename =~ s/\.fxc//gi;
push @outputHeader, "static PrecompiledShaderByteCode_t " . $basename . "_pixel_shaders[" . $numCombos . "] = \n";
push @outputHeader, "{\n";
local( $j );
for( $j = 0; $j < $numCombos; $j++ )
{
local( $thing ) = "pixelShader_" . $basename . "_" . $j;
push @outputHeader, "\t{ " . "$thing, sizeof( $thing ) },\n";
}
push @outputHeader, "};\n";
push @outputHeader, "struct $basename" . "PixelShader_t : public PrecompiledShader_t\n";
push @outputHeader, "{\n";
push @outputHeader, "\t$basename" . "PixelShader_t()\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\tm_nFlags = 0;\n";
push @outputHeader, "\t\tm_pByteCode = " . $basename . "_pixel_shaders;\n";
push @outputHeader, "\t\tm_nShaderCount = $numCombos;\n";
#push @outputHeader, "\t\tm_nDynamicCombos = m_nShaderCount;\n";
push @outputHeader, "\t\t// NOTE!!! psh_prep.pl shaders are always static combos!\n";
push @outputHeader, "\t\tm_nDynamicCombos = 1;\n";
push @outputHeader, "\t\tm_pName = \"$basename\";\n";
if( $basename =~ /vs\d\d/ ) # hack
{
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_VERTEX_SHADER, this );\n";
}
else
{
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_PIXEL_SHADER, this );\n";
}
push @outputHeader, "\t}\n";
push @outputHeader, "\tvirtual const PrecompiledShaderByteCode_t &GetByteCode( int shaderID )\n";
push @outputHeader, "\t{\n";
push @outputHeader, "\t\treturn m_pByteCode[shaderID];\n";
push @outputHeader, "\t}\n";
push @outputHeader, "};\n";
push @outputHeader, "static $basename" . "PixelShader_t $basename" . "_PixelShaderInstance;\n";
&MakeDirHier( "shaders/psh" );
my $vcsName = "";
if( $g_x360 )
{
$vcsName = $basename . ".360.vcs";
}
else
{
$vcsName = $basename . ".vcs";
}
open COMPILEDSHADER, ">shaders/psh/$vcsName" || die;
binmode( COMPILEDSHADER );
#
# Write out the part of the header that we know. . we'll write the rest after writing the object code.
#
#print $numCombos . "\n";
# Pack arguments
my $sInt = "i";
my $uInt = "I";
if ( $g_x360 )
{
# Change arguments to "big endian long"
$sInt = "N";
$uInt = "N";
}
open PSH, "<$psh_filename";
my $crc = crc32( *PSH );
close PSH;
#print STDERR "crc for $psh_filename: $crc\n";
# version
print COMPILEDSHADER pack $sInt, 4;
# totalCombos
print COMPILEDSHADER pack $sInt, $numCombos;
# dynamic combos
print COMPILEDSHADER pack $sInt, $numDynamicCombos;
# flags
print COMPILEDSHADER pack $uInt, 0x0; # nothing here for now.
# centroid mask
print COMPILEDSHADER pack $uInt, 0;
# reference size for diffs
print COMPILEDSHADER pack $uInt, 0;
# crc32 of the source code
print COMPILEDSHADER pack $uInt, $crc;
my $beginningOfDir = tell COMPILEDSHADER;
# Write out a blank directionary. . we'll fill it in later.
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack $sInt, 0;
# size
print COMPILEDSHADER pack $sInt, 0;
}
my $startByteCode = tell COMPILEDSHADER;
my @byteCodeStart;
my @byteCodeSize;
# Write out the shader object code.
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
{
my $filename = "shader$shaderCombo\.o";
my $filesize = (stat $filename)[7];
$byteCodeStart[$shaderCombo] = tell COMPILEDSHADER;
$byteCodeSize[$shaderCombo] = $filesize;
open SHADERBYTECODE, "<$filename";
binmode SHADERBYTECODE;
my $bin;
my $numread = read SHADERBYTECODE, $bin, $filesize;
# print "filename: $filename numread: $numread filesize: $filesize\n";
close SHADERBYTECODE;
unlink $filename;
print COMPILEDSHADER $bin;
}
# Seek back to the directory and write it out.
seek COMPILEDSHADER, $beginningOfDir, 0;
for( $i = 0; $i < $numCombos; $i++ )
{
# offset from beginning of file.
print COMPILEDSHADER pack $sInt, $byteCodeStart[$i];
# size
print COMPILEDSHADER pack $sInt, $byteCodeSize[$i];
}
close COMPILEDSHADER;

View File

@ -1,36 +0,0 @@
#! perl
my $fname=shift || die "format is shaderinfo blah.vcs";
open(SHADER, $fname) || die "can't open $fname";
binmode SHADER;
read(SHADER,$header,20);
($ver,$ntotal,$ndynamic,$flags,$centroidmask)=unpack("LLLLL",$header);
#print "Version $ver total combos=$ntotal, num dynamic combos=$ndynamic,\n flags=$flags, centroid mask=$centroidmask\n";
read(SHADER,$refsize,4);
$refsize=unpack("L",$refsize);
#print "Size of reference shader for diffing=$refsize\n";
seek(SHADER,$refsize,1);
$nskipped_combos=0;
for(1..$ntotal)
{
read(SHADER,$combodata,8);
($ofs,$combosize)=unpack("LL",$combodata);
if ( $ofs == 0xffffffff)
{
$nskipped_combos++;
}
else
{
}
}
#print "$nskipped_combos skipped, for an actual total of ",$ntotal-$nskipped_combos,"\n";
#print "Real to skipped ratio = ",($ntotal-$nskipped_combos)/$ntotal,"\n";
# csv output - name, real combos, virtual combos, dynamic combos
my $real_combos=$ntotal-$nskipped_combos;
print "$fname,$real_combos,$ntotal,$ndynamic\n";

View File

@ -1,54 +0,0 @@
$infilename = shift;
$outfilename1 = shift;
$outfilename2 = shift;
open INPUT, $infilename || die;
@input = <INPUT>;
close INPUT;
open MERGEDMINE, ">$outfilename1" || die;
open MERGEDTHEIRS, ">$outfilename2" || die;
for( $i = 0; $i < scalar( @input ); $i++ )
{
$line = $input[$i];
if( $line =~ m/^(.*)<<<<<<</ )
{
$first = 1;
$second = 0;
print MERGEDMINE $1;
print MERGEDTHEIRS $1;
next;
}
# Make sure that we are in a split block so that comments with ======= don't mess us up.
if( $line =~ m/^(.*)=======$/ && $first == 1 )
{
$first = 0;
$second = 1;
print MERGEDMINE $1;
next;
}
if( $line =~ m/^(.*)>>>>>>>/ )
{
$first = $second = 0;
print MERGEDTHEIRS $1;
next;
}
if( $first )
{
print MERGEDMINE $line;
}
elsif( $second )
{
print MERGEDTHEIRS $line;
}
else
{
print MERGEDMINE $line;
print MERGEDTHEIRS $line;
}
}
close MERGEDMINE;
close MERGEDTHEIRS;

22
src/devtools/bin/texttoarray.py Executable file
View File

@ -0,0 +1,22 @@
import sys
def main(filename, objname):
with open(filename, 'rb') as file:
data = file.read()
output = f"static unsigned char {objname}[] = {{\n "
for i in range(len(data)):
output += f"0x{data[i]:02x},"
if i % 20 == 19:
output += "\n "
output += "0x00\n};\n"
print(output)
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: python texttoarray.py <filename> <name>")
sys.exit(1)
main(sys.argv[1], sys.argv[2])

BIN
src/devtools/bin/tier0.dll Normal file

Binary file not shown.

View File

@ -1,6 +0,0 @@
foreach $_ (sort <> )
{
next if( defined( $prevline ) && $_ eq $prevline );
$prevline = $_;
print;
}

View File

@ -1,305 +0,0 @@
use String::CRC32;
BEGIN {use File::Basename; push @INC, dirname($0); }
require "valve_perl_helpers.pl";
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
$depnum = 0;
$baseSourceDir = ".";
my %dep;
sub GetAsmShaderDependencies_R
{
local( $shadername ) = shift;
local( *SHADER );
open SHADER, "<$shadername";
while( <SHADER> )
{
if( m/^\s*\#\s*include\s+\"(.*)\"/ )
{
# make sure it isn't in there already.
if( !defined( $dep{$1} ) )
{
$dep{$1} = 1;
GetAsmShaderDependencies_R( $1 );
}
}
}
close SHADER;
}
sub GetAsmShaderDependencies
{
local( $shadername ) = shift;
undef %dep;
GetAsmShaderDependencies_R( $shadername );
# local( $i );
# foreach $i ( keys( %dep ) )
# {
# print "$shadername depends on $i\n";
# }
return keys( %dep );
}
sub GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub GetShaderBase
{
my $shadername = shift;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
sub DoAsmShader
{
my $argstring = shift;
my $shadername = &GetShaderSrc( $argstring );
my $shaderbase = &GetShaderBase( $argstring );
my $shadertype = &GetShaderType( $argstring );
my $incfile = "";
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
$incfile = $shadertype . "tmp9" . $g_tmpfolder . "\\$shaderbase.inc ";
}
my $vcsfile = $shaderbase . $g_vcsext;
my $bWillCompileVcs = 1;
if( ( $shadertype eq "fxc") && $dynamic_compile )
{
$bWillCompileVcs = 0;
}
if( $shadercrcpass{$argstring} )
{
$bWillCompileVcs = 0;
}
if( $bWillCompileVcs )
{
&output_makefile_line( $incfile . "shaders\\$shadertype\\$vcsfile: $shadername @dep\n") ;
}
else
{
# psh files don't need a rule at this point since they don't have inc files and we aren't compiling a vcs.
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
&output_makefile_line( $incfile . ": $shadername @dep\n") ;
}
}
my $x360switch = "";
my $moreswitches = "";
if( !$bWillCompileVcs && $shadertype eq "fxc" )
{
$moreswitches .= "-novcs ";
}
if( $g_x360 )
{
$x360switch = "-x360";
if( $bWillCompileVcs && ( $shaderbase =~ m/_ps20$/i ) )
{
$moreswitches .= "-novcs ";
$bWillCompileVcs = 0;
}
}
# if we are psh and we are compiling the vcs, we don't need this rule.
if( !( $shadertype eq "psh" && !$bWillCompileVcs ) )
{
&output_makefile_line( "\tperl $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $moreswitches $x360switch -source \"$g_SourceDir\" $argstring\n") ;
}
if( $bWillCompileVcs )
{
&output_makefile_line( "\techo $shadername>> filestocopy.txt\n") ;
my $dep;
foreach $dep( @dep )
{
&output_makefile_line( "\techo $dep>> filestocopy.txt\n") ;
}
}
&output_makefile_line( "\n") ;
}
if( scalar( @ARGV ) == 0 )
{
die "Usage updateshaders.pl shaderprojectbasename\n\tie: updateshaders.pl stdshaders_dx6\n";
}
$g_x360 = 0;
$g_tmpfolder = "_tmp";
$g_vcsext = ".vcs";
while( 1 )
{
$inputbase = shift;
if( $inputbase =~ m/-source/ )
{
$g_SourceDir = shift;
}
elsif( $inputbase =~ m/-x360/ )
{
$g_x360 = 1;
$g_tmpfolder = "_360_tmp";
$g_vcsext = ".360.vcs";
}
elsif( $inputbase =~ m/-execute/ )
{
$g_execute = 1;
}
elsif( $inputbase =~ m/-nv3x/ )
{
$nv3x = 1;
}
else
{
last;
}
}
my @srcfiles = &LoadShaderListFile( $inputbase );
open MAKEFILE, ">makefile\.$inputbase";
open COPYFILE, ">makefile\.$inputbase\.copy";
open INCLIST, ">inclist.txt";
open VCSLIST, ">vcslist.txt";
# make a default dependency that depends on all of the shaders.
&output_makefile_line( "default: ") ;
foreach $shader ( @srcfiles )
{
my $shadertype = &GetShaderType( $shader );
my $shaderbase = &GetShaderBase( $shader );
my $shadersrc = &GetShaderSrc( $shader );
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
{
# We only generate inc files for fxc and vsh files.
my $incFileName = "$shadertype" . "tmp9" . $g_tmpfolder . "\\" . $shaderbase . "\.inc";
&output_makefile_line( " $incFileName" );
&output_inclist_line( "$incFileName\n" );
}
my $vcsfile = $shaderbase . $g_vcsext;
my $compilevcs = 1;
if( $shadertype eq "fxc" && $dynamic_compile )
{
$compilevcs = 0;
}
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
{
$compilevcs = 0;
}
if( $compilevcs )
{
my $vcsFileName = "..\\..\\..\\game\\hl2\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
# We want to check for perforce operations even if the crc matches in the event that a file has been manually reverted and needs to be checked out again.
&output_vcslist_line( "$vcsFileName\n" );
$shadercrcpass{$shader} = &CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 0 );
if( $shadercrcpass{$shader} )
{
$compilevcs = 0;
}
}
if( $compilevcs )
{
&output_makefile_line( " shaders\\$shadertype\\$vcsfile" );
# emit a list of vcs files to copy to the target since we want to build them.
&output_copyfile_line( GetShaderSrc($shader) . "-----" . GetShaderBase($shader) . "\n" );
}
}
&output_makefile_line( "\n\n") ;
# Insert all of our vertex shaders and depencencies
$lastshader = "";
foreach $shader ( @srcfiles )
{
my $currentshader = &GetShaderSrc( $shader );
if ( $lastshader ne $currentshader )
{
$lastshader = $currentshader;
@dep = &GetAsmShaderDependencies( $lastshader );
}
&DoAsmShader( $shader );
}
close VCSLIST;
close INCLIST;
close COPYFILE;
close MAKEFILE;
# nuke the copyfile if it is zero length
if( ( stat "makefile\.$inputbase\.copy" )[7] == 0 )
{
unlink "makefile\.$inputbase\.copy";
}
sub output_makefile_line
{
local ($_)=@_;
print MAKEFILE $_;
}
sub output_copyfile_line
{
local ($_)=@_;
print COPYFILE $_;
}
sub output_vcslist_line
{
local ($_)=@_;
print VCSLIST $_;
}
sub output_inclist_line
{
local ($_)=@_;
print INCLIST $_;
}

View File

@ -1,558 +0,0 @@
sub BackToForwardSlash
{
my( $path ) = shift;
$path =~ s,\\,/,g;
return $path;
}
sub RemoveFileName
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,/[^/]*$,,;
return $in;
}
sub RemovePath
{
my( $in ) = shift;
$in = &BackToForwardSlash( $in );
$in =~ s,^(.*)/([^/]*)$,$2,;
return $in;
}
sub MakeDirHier
{
my( $in ) = shift;
# print "MakeDirHier( $in )\n";
$in = &BackToForwardSlash( $in );
my( @path );
while( $in =~ m,/, ) # while $in still has a slash
{
my( $end ) = &RemovePath( $in );
push @path, $end;
# print $in . "\n";
$in = &RemoveFileName( $in );
}
my( $i );
my( $numelems ) = scalar( @path );
my( $curpath );
for( $i = $numelems - 1; $i >= 0; $i-- )
{
$curpath .= "/" . $path[$i];
my( $dir ) = $in . $curpath;
if( !stat $dir )
{
# print "mkdir $dir\n";
mkdir $dir, 0777;
}
}
}
sub FileExists
{
my $filename = shift;
my @statresult = stat $filename;
my $iswritable = @statresult != 0;
return $iswritable;
}
sub MakeFileWritable
{
my $filename = shift;
if ( &FileExists( $filename ) )
{
chmod 0666, $filename || die;
}
}
sub MakeFileReadOnly
{
my $filename = shift;
chmod 0444, $filename || die;
}
# Run a command and get stdout and stderr to an array
sub RunCommand
{
my $cmd = shift;
# print STDERR "command: $cmd\n";
system "$cmd > cmdout.txt 2>&1" || die;
local( *FILE );
open FILE, "<cmdout.txt" || die;
my @output = <FILE>;
# print STDERR "command output: @output\n";
close FILE;
unlink "cmdout.txt" || die;
return @output;
}
sub PerforceEditOrAdd
{
return;
my $filename = shift;
my $changelistarg = shift;
# Is the file on the client?
my $cmd = "p4 fstat \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $p4output = join "", @p4output;
if( $p4output =~ m/no such file/ )
{
# not on client. . add
my $cmd = "p4 add $changelistarg $filename";
my @p4output = &RunCommand( $cmd );
my $p4output = join "", @p4output;
if( $p4output =~ m/opened for add/ )
{
print $p4output;
return;
}
print "ERROR: $p4output";
return;
}
# The file is known to be on the client at this point.
# Is it open for edit?
if( $p4output =~ m/action edit/ )
{
# Is is open for edit, let's see if it's still different.
# check for opened files that are not different from the revision in the depot.
my $cmd = "p4 diff -sr \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
# check for empty string
if( !( $outputstring =~ m/^\s*$/ ) )
{
my $cmd = "p4 revert \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
print $outputstring;
return;
}
}
# check for unopened files that are different from the revision in the depot.
my $cmd = "p4 diff -se \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $outputstring = join "", @p4output;
# check for empty string
if( $outputstring =~ m/^\s*$/ )
{
&MakeFileReadOnly( $filename );
return;
}
# We need to edit the file since it is known to be different here.
my $cmd = "p4 edit $changelistarg \"$filename\"";
my @p4output = &RunCommand( $cmd );
my $line;
foreach $line ( @p4output )
{
if( $line =~ m/not on client/ )
{
#print "notonclient...";
print "ERROR: @p4output\n";
return;
}
if( $line =~ m/currently opened for edit/ )
{
return;
}
if( $line =~ m/opened for edit/ )
{
print $line;
}
}
}
sub FileIsWritable
{
local( $filename ) = shift;
local( @statresult ) = stat $filename;
local( $mode, $iswritable );
$mode = oct( $statresult[2] );
$iswritable = ( $mode & 2 ) != 0;
return $iswritable;
}
sub TouchFile
{
my $filename = shift;
if( !&FileExists( $filename ) )
{
if( !open FILE, ">$filename" )
{
die;
}
close FILE;
}
my $now = time;
local( *FILE );
utime $now, $now, $filename;
}
sub FileExistsInPerforce
{
my $filename = shift;
my @output = &RunCommand( "p4 fstat $filename" );
my $line;
foreach $line (@output)
{
if( $line =~ m/no such file/ )
{
return 0;
}
}
return 1;
}
sub PerforceWriteFile
{
my $filename = shift;
my $filecontents = shift;
# my $changelistname = shift;
# Get the changelist number for the Shader Auto Checkout changelist. Will create the changelist if it doesn't exist.
# my $changelistnumber = `valve_p4_create_changelist.cmd . \"$changelistname\"`;
# Get rid of the newline
# $changelistnumber =~ s/\n//g;
# my $changelistarg = "";
# if( $changelistnumber != 0 )
# {
# $changelistarg = "-c $changelistnumber"
# }
# Make the target vcs writable if it exists
MakeFileWritable( $filename );
# Write the file.
local( *FP );
open FP, ">$filename";
print FP $filecontents;
close FP;
# Do whatever needs to happen with perforce for this file.
# &PerforceEditOrAdd( $filename, $changelistarg );
}
sub WriteFile
{
my $filename = shift;
my $filecontents = shift;
# Make the target vcs writable if it exists
MakeFileWritable( $filename );
# Write the file.
local( *FP );
open FP, ">$filename";
print FP $filecontents;
close FP;
}
sub PrintCleanPerforceOutput
{
my $line;
while( $line = shift )
{
if( $line =~ m/currently opened/i )
{
next;
}
if( $line =~ m/already opened for edit/i )
{
next;
}
if( $line =~ m/also opened/i )
{
next;
}
if( $line =~ m/add of existing file/i )
{
next;
}
print $line;
}
}
# HACK!!!! Need to pass something in to do this rather than hard coding.
sub NormalizePerforceFilename
{
my $line = shift;
# remove newlines.
$line =~ s/\n//;
# downcase.
$line =~ tr/[A-Z]/[a-z]/;
# backslash to forwardslash
$line =~ s,\\,/,g;
# for inc files HACK!
$line =~ s/^.*(fxctmp9.*)/$1/i;
$line =~ s/^.*(vshtmp9.*)/$1/i;
# for vcs files. HACK!
$line =~ s,^.*game/hl2/shaders/,,i;
return $line;
}
sub MakeSureFileExists
{
local( $filename ) = shift;
local( $testexists ) = shift;
local( $testwrite ) = shift;
local( @statresult ) = stat $filename;
if( !@statresult && $testexists )
{
die "$filename doesn't exist!\n";
}
local( $mode, $iswritable );
$mode = oct( $statresult[2] );
$iswritable = ( $mode & 2 ) != 0;
if( !$iswritable && $testwrite )
{
die "$filename isn't writable!\n";
}
}
sub LoadShaderListFile_GetShaderType
{
my $shadername = shift;
my $shadertype;
if( $shadername =~ m/\.vsh/i )
{
$shadertype = "vsh";
}
elsif( $shadername =~ m/\.psh/i )
{
$shadertype = "psh";
}
elsif( $shadername =~ m/\.fxc/i )
{
$shadertype = "fxc";
}
else
{
die;
}
return $shadertype;
}
sub LoadShaderListFile_GetShaderSrc
{
my $shadername = shift;
if ( $shadername =~ m/^(.*)-----/i )
{
return $1;
}
else
{
return $shadername;
}
}
sub LoadShaderListFile_GetShaderBase
{
my $shadername = shift;
if ( $shadername =~ m/-----(.*)$/i )
{
return $1;
}
else
{
my $shadertype = &LoadShaderListFile_GetShaderType( $shadername );
$shadername =~ s/\.$shadertype//i;
return $shadername;
}
}
sub LoadShaderListFile
{
my $inputbase = shift;
my @srcfiles;
&MakeSureFileExists( "$inputbase.txt", 1, 0 );
open SHADERLISTFILE, "<$inputbase.txt" || die;
my $line;
while( $line = <SHADERLISTFILE> )
{
$line =~ s/\/\/.*$//; # remove comments "//..."
$line =~ s/^\s*//; # trim leading whitespace
$line =~ s/\s*$//; # trim trailing whitespace
next if( $line =~ m/^\s*$/ );
if( $line =~ m/\.fxc/ || $line =~ m/\.vsh/ || $line =~ m/\.psh/ )
{
my $shaderbase = &LoadShaderListFile_GetShaderBase( $line );
if( $ENV{"DIRECTX_FORCE_MODEL"} =~ m/^30$/i ) # forcing all shaders to be ver. 30
{
my $targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps30/i;
$targetbase =~ s/_ps20b/_ps30/i;
$targetbase =~ s/_ps20/_ps30/i;
$targetbase =~ s/_vs20/_vs30/i;
$targetbase =~ s/_vsxx/_vs30/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
else
{
if( $shaderbase =~ m/_ps2x/i )
{
my $targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps20/i;
push @srcfiles, ( $line . "-----" . $targetbase );
$targetbase = $shaderbase;
$targetbase =~ s/_ps2x/_ps20b/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
elsif( $shaderbase =~ m/_vsxx/i )
{
my $targetbase = $shaderbase;
$targetbase =~ s/_vsxx/_vs11/i;
push @srcfiles, ( $line . "-----" . $targetbase );
$targetbase = $shaderbase;
$targetbase =~ s/_vsxx/_vs20/i;
push @srcfiles, ( $line . "-----" . $targetbase );
}
else
{
push @srcfiles, ( $line . "-----" . $shaderbase );
}
}
}
}
close SHADERLISTFILE;
return @srcfiles;
}
sub ReadInputFileWithIncludes
{
local( $filename ) = shift;
# print STDERR "ReadInputFileWithIncludes: $filename\n";
local( *INPUT );
local( $output );
# print STDERR "before open\n";
open INPUT, "<$filename" || die;
# print STDERR "after open\n";
local( $line );
while( $line = <INPUT> )
{
# print STDERR $line;
if( $line =~ m/\#include\s+\"(.*)\"/i )
{
$output.= ReadInputFileWithIncludes( $1 );
}
else
{
$output .= $line;
}
}
close INPUT;
return $output;
}
sub GetCRCFromSourceFile
{
my $filename = shift;
my $data = &ReadInputFileWithIncludes( $filename );
# print STDERR $data;
$crc = crc32( $data );
# print STDERR "GetCRCFromSourceFile: $crc\n";
return $crc;
}
sub GetCRCFromVCSFile
{
my $filename = shift;
# print STDERR "GetCRCFromVCSFile $filename\n";
local( *FP );
open FP, "<$filename" || die "GetCRCFromVCSFile: can't open file $filename\n";
binmode( FP );
# unpack arguments
my $sInt = "i";
my $uInt = "I";
if( $filename =~ m/\.360\./ )
{
# Change arguments to "big endian long"
$sInt = "N";
$uInt = "N";
}
my $header;
read FP, $header, 7 * 4 || die "updateshaders.pl:GetCRCFromVCSFile: can't read header for $filename\n";
my $version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc;
($version,$numCombos,$numDynamicCombos,$flags,$centroidMask,$refSize,$crc) = unpack "$sInt$sInt$sInt$uInt$uInt$uInt$uInt", $header;
unless( $version == 4 || $version == 5 || $version == 6 )
{
print STDERR "ERROR: GetCRCFromVCSFile: $filename is version $version\n";
return 0;
}
# print STDERR "version: $version\n";
# print STDERR "numCombos: $numCombos\n";
# print STDERR "numDynamicCombos: $numDynamicCombos\n";
# print STDERR "flags: $flags\n";
# print STDERR "centroidMask: $centroidMask\n";
# print STDERR "refSize: $refSize\n";
# print STDERR "GetCRCFromVCSFile: $crc\n";
close( FP );
return $crc;
}
sub CheckCRCAgainstTarget
{
my $srcFileName = shift;
my $vcsFileName = shift;
my $warn = shift;
# Make sure both files exist.
# print STDERR "$srcFileName doesn't exist\n" if( !( -e $srcFileName ) );
# print STDERR "$vcsFileName doesn't exist\n" if( !( -e $vcsFileName ) );
if( !( -e $srcFileName ) )
{
if( $warn )
{
print "$srcFileName missing\n";
}
return 0;
}
if( !( -e $vcsFileName ) )
{
if( $warn )
{
print "$vcsFileName missing\n";
}
return 0;
}
# print STDERR "CheckCRCAgainstTarget( $srcFileName, $vcsFileName );\n";
# print STDERR "vcsFileName: $vcsFileName\n";
# print STDERR "vcsFileName: $srcFileName\n";
my $vcsCRC = &GetCRCFromVCSFile( $vcsFileName );
my $srcCRC = &GetCRCFromSourceFile( $srcFileName );
if( $warn && ( $vcsCRC != $srcCRC ) )
{
print "$vcsFileName checksum ($vcsCRC) != $srcFileName checksum: ($srcCRC)\n";
}
# return 0; # use this to skip crc checking.
# if( $vcsCRC == $srcCRC )
# {
# print STDERR "CRC passed for $srcFileName $vcsFileName $vcsCRC\n";
# }
return $vcsCRC == $srcCRC;
}
1;

Binary file not shown.

BIN
src/devtools/bin/vpc.exe Normal file → Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More