Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HL2] [EPISODIC] x64 and VS2022 support for the Singleplayer branch. #975

Open
wants to merge 9 commits into
base: singleplayer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*.exp
*.ilk
*.lastbuildstate
vc100.pdb
*.pdb
ipch
*.sdf
*.opensdf
Expand All @@ -29,10 +29,8 @@ obj*/
!utils/smdlexp/smdlexp.mak

# Specific Source build products
client.pdb
client.dll
client.lib
server.pdb
server.dll
server.lib

Expand All @@ -54,3 +52,9 @@ config.cfg
# shader files
*.tmp

# Our crap.
*.vpc_cache
*.filters
*.vpc_crc
.vs/
*manifest.txt
43 changes: 0 additions & 43 deletions README

This file was deleted.

71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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 with the following workload and components:
- Desktop development with C++:
- MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
- Windows 11 SDK (10.0.22621.0) or Windows 10 SDK (10.0.19041.1)
- Python 3.13 or later

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).
1 change: 1 addition & 0 deletions src/createallprojects
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +everything /mksln everything
popd
sleep infinity
3 changes: 2 additions & 1 deletion src/createallprojects.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
devtools\bin\vpc.exe /hl2 /episodic +everything /mksln everything.sln
devtools\bin\vpc.exe /2022 /hl2 /episodic +everything /mksln everything.sln
pause
1 change: 1 addition & 0 deletions src/creategameprojects
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +game /mksln games
popd
sleep infinity
3 changes: 2 additions & 1 deletion src/creategameprojects.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
devtools\bin\vpc.exe /hl2 /episodic +game /mksln games.sln
devtools\bin\vpc.exe /hl2 /2022 /episodic +game /mksln games.sln :: /define:VS2022
pause
Binary file added src/devtools/bin/ShaderCompile2.exe
Binary file not shown.
5 changes: 5 additions & 0 deletions src/devtools/bin/ShaderCompile2_readme.txt
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions src/devtools/bin/process_shaders.ps1
Original file line number Diff line number Diff line change
@@ -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()
22 changes: 22 additions & 0 deletions src/devtools/bin/texttoarray.py
Original file line number Diff line number Diff line change
@@ -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])
Binary file added src/devtools/bin/tier0.dll
Binary file not shown.
Binary file modified src/devtools/bin/vpc
Binary file not shown.
Binary file modified src/devtools/bin/vpc.exe
Binary file not shown.
Binary file added src/devtools/bin/vstdlib.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/devtools/gendbg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

OBJCOPY=objcopy
OBJCOPY=$STEAM_RUNTIME_PATH/bin/objcopy

function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
Expand Down
4 changes: 2 additions & 2 deletions src/game/client/C_WaterLODControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ END_RECV_TABLE()
//------------------------------------------------------------------------------
void C_WaterLODControl::OnDataChanged(DataUpdateType_t updateType)
{
view->SetCheapWaterStartDistance( m_flCheapWaterStartDistance );
view->SetCheapWaterEndDistance( m_flCheapWaterEndDistance );
g_pView->SetCheapWaterStartDistance( m_flCheapWaterStartDistance );
g_pView->SetCheapWaterEndDistance( m_flCheapWaterEndDistance );
}

//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/WaterLODMaterialProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void CWaterLODMaterialProxy::OnBind( void *pC_BaseEntity )
return;
}
float start, end;
view->GetWaterLODParams( start, end );
g_pView->GetWaterLODParams( start, end );
m_pCheapWaterStartDistanceVar->SetFloatValue( start );
m_pCheapWaterEndDistanceVar->SetFloatValue( end );

Expand Down
Loading