mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
Compare commits
270 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0abdcbd1f8 | ||
|
|
c20848902e | ||
|
|
f1d3d2c5ce | ||
|
|
c6d941f0cf | ||
|
|
11230fe98f | ||
|
|
170e1ad5af | ||
|
|
100d21196b | ||
|
|
46ca2d2cc5 | ||
|
|
0563a5beb3 | ||
|
|
6d35e339cb | ||
|
|
8a8ed75084 | ||
|
|
fbeb10e8c2 | ||
|
|
be174cc027 | ||
|
|
d1cf753f22 | ||
|
|
6ede21aa14 | ||
|
|
59a1cc899b | ||
|
|
ee7c5d9da1 | ||
|
|
88520e8db5 | ||
|
|
e73bcd57c0 | ||
|
|
cd376711bf | ||
|
|
ca0037a402 | ||
|
|
7aee21b689 | ||
|
|
348ca5b107 | ||
|
|
136d306d1d | ||
|
|
3c14e1d1db | ||
|
|
c058c2e3d4 | ||
|
|
1812e8743d | ||
|
|
036daa2ac8 | ||
|
|
480a0b4a0a | ||
|
|
693769cbd4 | ||
|
|
00fe03b61b | ||
|
|
b761d9a1eb | ||
|
|
3728c7eeee | ||
|
|
dc80060757 | ||
|
|
909bb5936f | ||
|
|
0da7507c64 | ||
|
|
0a195fe3c7 | ||
|
|
64e22fc031 | ||
|
|
1375da7f70 | ||
|
|
6b37906c85 | ||
|
|
6c7dff77c5 | ||
|
|
86a432bdeb | ||
|
|
cb469c4f86 | ||
|
|
dd0be25ab6 | ||
|
|
4471e0ccca | ||
|
|
adece0e39b | ||
|
|
9aed85b4c7 | ||
|
|
3a78a26652 | ||
|
|
498349bbcf | ||
|
|
8b83362c61 | ||
|
|
32caf088ef | ||
|
|
a34006f8ff | ||
|
|
20b9fd3228 | ||
|
|
320aa3f9c0 | ||
|
|
f445addcd5 | ||
|
|
44b00a1fa7 | ||
|
|
909ba41890 | ||
|
|
b5ca9095b0 | ||
|
|
c22a199a5b | ||
|
|
2395b456e2 | ||
|
|
d7414930ff | ||
|
|
796555fad5 | ||
|
|
1e749952db | ||
|
|
e191be3a75 | ||
|
|
ba3bad68c8 | ||
|
|
2bc7e09f65 | ||
|
|
896ac87f04 | ||
|
|
b5c0202647 | ||
|
|
5f5c5f13c9 | ||
|
|
b13af4cd8d | ||
|
|
f64309ba6f | ||
|
|
67ecfe7ddb | ||
|
|
77f7efdf6e | ||
|
|
7d681567d1 | ||
|
|
553a0aca53 | ||
|
|
556fcbf7bd | ||
|
|
3a5ea35c0b | ||
|
|
2fb6f27cd1 | ||
|
|
f57196a481 | ||
|
|
c03569a4e8 | ||
|
|
c8aaab48ad | ||
|
|
a850c722cc | ||
|
|
b9cadc4599 | ||
|
|
eb74c4227f | ||
|
|
ba981a13e0 | ||
|
|
eee7b3c598 | ||
|
|
441bdf628a | ||
|
|
309ef2cea2 | ||
|
|
8b31da2e0a | ||
|
|
59f158b13a | ||
|
|
2301c8d6ee | ||
|
|
0427fa1537 | ||
|
|
f5e5cca2aa | ||
|
|
5c0537f008 | ||
|
|
a2f37d2613 | ||
|
|
f532d90b78 | ||
|
|
785d164d29 | ||
|
|
15823b1cb4 | ||
|
|
d0c317c8b4 | ||
|
|
21ebda05c2 | ||
|
|
8d208dca16 | ||
|
|
03a06cead9 | ||
|
|
a2278f8ef2 | ||
|
|
494c5c3eb3 | ||
|
|
594f53d275 | ||
|
|
9fbb0e6705 | ||
|
|
d1e4a526c0 | ||
|
|
ac38588a56 | ||
|
|
8690c7a3f5 | ||
|
|
cfddef484c | ||
|
|
e804fd3d2a | ||
|
|
976f8d7f76 | ||
|
|
2eb3f234ea | ||
|
|
785025f23c | ||
|
|
29d2320ca3 | ||
|
|
c992ee4d75 | ||
|
|
6247ff4eff | ||
|
|
1570ed1242 | ||
|
|
cc970df3ad | ||
|
|
b1e3885bbb | ||
|
|
0f2ab942e1 | ||
|
|
e32e23de5a | ||
|
|
f1eaf8a268 | ||
|
|
13d9eacbb7 | ||
|
|
da3a865a0a | ||
|
|
5e17f2b08f | ||
|
|
c05a0d4d29 | ||
|
|
54aa6f94dd | ||
|
|
8ce4376a60 | ||
|
|
b342d128d2 | ||
|
|
7d94019722 | ||
|
|
a9e65b46b8 | ||
|
|
96e3a66e5c | ||
|
|
bf75212034 | ||
|
|
f49a106f04 | ||
|
|
37bb98b1f8 | ||
|
|
3461766659 | ||
|
|
2e28361a06 | ||
|
|
824d757771 | ||
|
|
8dc25ed24d | ||
|
|
d4dfb1abe5 | ||
|
|
bae3141481 | ||
|
|
8a7ea5b6f0 | ||
|
|
65d74f53e5 | ||
|
|
3c1bc4ce88 | ||
|
|
a9d06e7612 | ||
|
|
78d5965ba5 | ||
|
|
d113938736 | ||
|
|
92e9d6636d | ||
|
|
7fb7838738 | ||
|
|
a3a2210de3 | ||
|
|
e200cab1fb | ||
|
|
92d8ed539a | ||
|
|
cb9ca3cc3c | ||
|
|
1065df5efd | ||
|
|
20012304bd | ||
|
|
349b366143 | ||
|
|
64ea01a960 | ||
|
|
1ebf093713 | ||
|
|
34fd263625 | ||
|
|
a7a8d25a17 | ||
|
|
7bf3f70e92 | ||
|
|
d37cdaf78c | ||
|
|
a88a1ef72d | ||
|
|
7484fe8fba | ||
|
|
d5fdd9be1f | ||
|
|
1bb0227ff0 | ||
|
|
4c2632710c | ||
|
|
518a366c7e | ||
|
|
07878ad7a7 | ||
|
|
a483c8c88a | ||
|
|
cd74d12812 | ||
|
|
eda5ad606b | ||
|
|
ddefef65ae | ||
|
|
062db741bd | ||
|
|
d46c2da175 | ||
|
|
1c6200666f | ||
|
|
c9666413b2 | ||
|
|
2575786a6e | ||
|
|
149a6280b0 | ||
|
|
340d75c350 | ||
|
|
8d9a0e5142 | ||
|
|
22f0cbd8f7 | ||
|
|
5d443b6452 | ||
|
|
83f8f37dc1 | ||
|
|
cc886ab614 | ||
|
|
4273266950 | ||
|
|
658a0aee7f | ||
|
|
9898c2cf49 | ||
|
|
ddb5d9f3a8 | ||
|
|
f227b3abc0 | ||
|
|
3920da2d9f | ||
|
|
bfbb31aa58 | ||
|
|
799be40018 | ||
|
|
152eb8dd19 | ||
|
|
c168c0fde1 | ||
|
|
af3c90e2a8 | ||
|
|
12e6ef88c3 | ||
|
|
28d74cec56 | ||
|
|
02efd0b41a | ||
|
|
5bf337479f | ||
|
|
3816cdb3e4 | ||
|
|
e54339bb5c | ||
|
|
98d867393c | ||
|
|
8dd9a3c097 | ||
|
|
61d30be6b3 | ||
|
|
7aa85c0b0c | ||
|
|
3574395843 | ||
|
|
13b333dcf6 | ||
|
|
bead08fc7c | ||
|
|
073fb20b66 | ||
|
|
7adca8280c | ||
|
|
61183eaba3 | ||
|
|
477b0460e8 | ||
|
|
dd18105c92 | ||
|
|
585f2467c2 | ||
|
|
0c3e4ea495 | ||
|
|
afe0c95cea | ||
|
|
e84f072278 | ||
|
|
ca0bbab8c0 | ||
|
|
6530b8806c | ||
|
|
294057e3a1 | ||
|
|
a57abb2ca7 | ||
|
|
f0d6680977 | ||
|
|
49f7b987f5 | ||
|
|
444d0847b6 | ||
|
|
005bd9e95c | ||
|
|
dfcf0349ca | ||
|
|
45a7a809db | ||
|
|
48852c5ee8 | ||
|
|
60ac4a9e26 | ||
|
|
5351f581f1 | ||
|
|
e719dd1440 | ||
|
|
1d5ca223de | ||
|
|
3170552b3d | ||
|
|
18692e21a4 | ||
|
|
ae0ccc72b4 | ||
|
|
f5eb8cd55b | ||
|
|
db1c71994b | ||
|
|
96df096303 | ||
|
|
9669221d37 | ||
|
|
480ed6d74c | ||
|
|
1d2614d75f | ||
|
|
1c5f540751 | ||
|
|
f4fe79346e | ||
|
|
cb5bfbb3da | ||
|
|
f41050583e | ||
|
|
85fa167e17 | ||
|
|
b9723b6504 | ||
|
|
2e64de57c6 | ||
|
|
feaf4160e8 | ||
|
|
93fd0014b4 | ||
|
|
22f07e3649 | ||
|
|
398a3917dc | ||
|
|
04fa16902f | ||
|
|
b0e42ef650 | ||
|
|
b0d7ee16c1 | ||
|
|
b9ece2888b | ||
|
|
d1b29a6f94 | ||
|
|
a43da12f9b | ||
|
|
4607a106d0 | ||
|
|
de9fd0cbaf | ||
|
|
2e3315cd39 | ||
|
|
f7b1b9c4b6 | ||
|
|
2572bc94c7 | ||
|
|
47f1aa6565 | ||
|
|
fdde14b93e | ||
|
|
975eea832d | ||
|
|
09ecdade70 | ||
|
|
e8b40f6091 |
@@ -10,19 +10,56 @@ pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
image: Visual Studio 2017
|
||||
clone_depth: 10
|
||||
install:
|
||||
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cinst msbuild-sonarqube-runner }
|
||||
- ps: >
|
||||
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
|
||||
{
|
||||
cinst msbuild-sonarqube-runner;
|
||||
cinst opencover.portable;
|
||||
}
|
||||
|
||||
before_build:
|
||||
- cmd: py -3.5 -m pip install --user requests
|
||||
- cmd: py -3.5 Tools\download_godotsharp.py
|
||||
- cmd: py -3.5 RUN_THIS.py --no-prompt
|
||||
- cmd: nuget restore SpaceStation14.sln
|
||||
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { MSBuild.SonarQube.Runner.exe begin /k:"ss14" /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=$env:sonarqubekey" /d:"sonar.organization=space-wizards" }
|
||||
- ps: >
|
||||
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
|
||||
{
|
||||
SonarScanner.MSBuild.exe begin /k:"ss14" /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=$env:sonarqubekey" /d:"sonar.organization=space-wizards" /d:"sonar.exclusions=SFML/**" /d:sonar.cs.nunit.reportsPaths="$(Get-Location)\nunitTestResult.xml" /d:sonar.cs.opencover.reportsPaths="$(Get-Location)\coverage_report.xml";
|
||||
}
|
||||
|
||||
platform: x64
|
||||
configuration: Debug
|
||||
|
||||
cache:
|
||||
- packages -> **\packages.config
|
||||
- Dependencies
|
||||
- SS14.Client.Godot\.mono\assemblies\GodotSharp.dll
|
||||
- SS14.Client.Godot\.mono\assemblies\LAST_MODIFIED
|
||||
|
||||
build:
|
||||
project: SpaceStation14.sln
|
||||
parallel: true
|
||||
parallel: false
|
||||
verbosity: minimal
|
||||
|
||||
after_build:
|
||||
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { MSBuild.SonarQube.Runner.exe end /d:"sonar.login=$env:sonarqubekey" }
|
||||
- cmd: py -3.5 Resources\buildResourcePack.py --resources-dir .\Resources --out .\Resources\ResourcePack.zip --atlas-tool .\Tools\AtlasTool.exe --no-animations --to-stderr
|
||||
build_script:
|
||||
- ps: msbuild SpaceStation14.sln /verbosity:minimal /nologo /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Platform=x64 /p:Configuration=Debug /p:AppVeyor=yes
|
||||
|
||||
test_script:
|
||||
- ps: >
|
||||
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
|
||||
{
|
||||
OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\bin\UnitTesting\SS14.UnitTesting.dll --result:nunitTestResult.xml" -output:".\coverage_report.xml";
|
||||
}
|
||||
else
|
||||
{
|
||||
nunit3-console.exe .\bin\UnitTesting\SS14.UnitTesting.dll;
|
||||
}
|
||||
|
||||
after_test:
|
||||
- ps: >
|
||||
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
|
||||
{
|
||||
SonarScanner.MSBuild.exe end /d:"sonar.login=$env:sonarqubekey";
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"phabricator.uri": "http://phab.nexisonline.net",
|
||||
"project.name": "Space Station 14"
|
||||
}
|
||||
@@ -7,5 +7,8 @@ indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8-bom
|
||||
|
||||
[*.{csproj,xml,yml,dll.config}]
|
||||
[*.{csproj,xml,yml,dll.config,targets}]
|
||||
indent_size = 2
|
||||
|
||||
[*.gdsl]
|
||||
indent_style = tab
|
||||
|
||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -3,7 +3,7 @@
|
||||
|
||||
# These owners will be the default owners for everything in the repo.
|
||||
# * @defunkt
|
||||
* @PJB3005 @Silvertorch5
|
||||
* @Acruid @PJB3005 @Silvertorch5
|
||||
|
||||
# Order is important. The last matching pattern has the most precedence.
|
||||
# So if a pull request only touches javascript files, only these owners
|
||||
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -75,4 +75,17 @@ project.lock.json
|
||||
# Created by NUnit.
|
||||
TestResult.xml
|
||||
|
||||
NetSerializerDebug.dll
|
||||
NetSerializerDebug.dll
|
||||
|
||||
# We're not gonna ship Mac extlibs with the repo due to size. (11 MB)
|
||||
Third-Party/extlibs/Mac/
|
||||
# Or the automatically-fetched Windows natives, for that matter.
|
||||
Third-Party/extlibs/Windows/
|
||||
|
||||
# Actually I'll make this folder because SS14.Shared.Bsdiff isn't third-party is it?
|
||||
Dependencies/
|
||||
|
||||
# Python stuff
|
||||
__pycache__
|
||||
.mypy_cache
|
||||
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "SS14.Shared.Bsdiff"]
|
||||
path = SS14.Shared.Bsdiff
|
||||
url = https://github.com/space-wizards/ss14.shared.bsdiff.git
|
||||
31
.travis.yml
31
.travis.yml
@@ -5,17 +5,34 @@ sudo: false
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
#- osx
|
||||
|
||||
before_install:
|
||||
- if [ $TRAVIS_OS_NAME = osx ]; then brew update && brew install python3; fi
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- deadsnakes
|
||||
|
||||
packages:
|
||||
- python3.6
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- packages/
|
||||
- Dependencies/
|
||||
- SS14.Client.Godot/.mono/assemblies/
|
||||
|
||||
#before_install:
|
||||
# - if [ $TRAVIS_OS_NAME = osx ]; then brew update && brew upgrade python; fi
|
||||
|
||||
before_script:
|
||||
- "python3 ./Resources/buildResourcePack.py --resources-dir ./Resources --out ./Resources/ResourcePack.zip --no-atlas --no-animations --to-stderr"
|
||||
- "if [ $TRAVIS_OS_NAME = linux ]; then pyenv shell 3.6; fi"
|
||||
- "pip3 install --user requests"
|
||||
- "nuget restore SpaceStation14.sln"
|
||||
- "python3.6 RUN_THIS.py --no-prompt"
|
||||
- "Tools/download_godotsharp.py"
|
||||
|
||||
script:
|
||||
- "msbuild /p:Configuration=Release /p:HEADLESS=1 SpaceStation14.sln"
|
||||
- "cd packages/NUnit.ConsoleRunner.3.6.1/tools"
|
||||
- "mono --debug nunit3-console.exe ../../../SS14.UnitTesting/bin/Release/SS14.UnitTesting.dll"
|
||||
- "msbuild /p:Configuration=Debug /p:Platform=x64 /p:HEADLESS=1 /nologo /m /p:AllowMissingMacNatives=yes SpaceStation14.sln /p:Python=python3.6"
|
||||
- "cd packages/NUnit.ConsoleRunner.3.7.0/tools"
|
||||
- "mono --debug nunit3-console.exe ../../../bin/UnitTesting/SS14.UnitTesting.dll"
|
||||
|
||||
|
||||
1
BuildChecker/.gitignore
vendored
Normal file
1
BuildChecker/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INSTALLED_HOOKS_VERSION
|
||||
45
BuildChecker/BuildChecker.csproj
Normal file
45
BuildChecker/BuildChecker.csproj
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This is a dummy .csproj file to check things like submodules.
|
||||
Better this than other errors.
|
||||
|
||||
If you want to create this kind of file yourself, you have to create an empty .NET application,
|
||||
Then strip it of everything until you have the <Project> tags.
|
||||
VS refuses to load the project if you make a bare project file and use Add -> Existing Project... for some reason.
|
||||
|
||||
You want to handle the Build, Clean and Rebuild tasks to prevent missing task errors on build.
|
||||
|
||||
If you want to learn more about these kinds of things, check out Microsoft's official documentation about MSBuild:
|
||||
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
|
||||
-->
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Choose>
|
||||
<When Condition="'$(Python)' == ''">
|
||||
<PropertyGroup>
|
||||
<Python>python3</Python>
|
||||
<Python Condition="'$(OS)'=='Windows_NT' Or '$(OS)'=='Windows'">py -3</Python>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{D0DA124B-5580-4345-A02B-9F051F78915F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworkMoniker>.NETFramework, Version=v4.6.1</TargetFrameworkMoniker>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' " />
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' " />
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<Target Name="Build">
|
||||
<Exec Command="$(Python) git_helper.py" CustomErrorRegularExpression="^Error" />
|
||||
</Target>
|
||||
<Target Name="Rebuild" DependsOnTargets="Build" />
|
||||
<Target Name="Clean">
|
||||
<Message Importance="low" Text="Ignoring 'Clean' target." />
|
||||
</Target>
|
||||
<Target Name="Compile" />
|
||||
<Target Name="CoreCompile" />
|
||||
</Project>
|
||||
105
BuildChecker/git_helper.py
Executable file
105
BuildChecker/git_helper.py
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env python3
|
||||
# Installs git hooks, updates them, updates submodules, that kind of thing.
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
BUILD_CHECKER_PATH = Path(Path(__file__).resolve().parent)
|
||||
SS14_ROOT_PATH = Path(BUILD_CHECKER_PATH.parent)
|
||||
SOLUTION_PATH = Path(SS14_ROOT_PATH/"SpaceStation14.sln")
|
||||
CURRENT_HOOKS_VERSION = "2" # If this doesn't match the saved version we overwrite them all.
|
||||
QUIET = "--quiet" in sys.argv
|
||||
NO_HOOKS = "--nohooks" in sys.argv
|
||||
|
||||
def run_command(command: List[str], capture: bool = False) -> subprocess.CompletedProcess:
|
||||
"""
|
||||
Runs a command with pretty output.
|
||||
"""
|
||||
text = ' '.join(command)
|
||||
if not QUIET:
|
||||
print("$ {}".format(text))
|
||||
|
||||
sys.stdout.flush()
|
||||
|
||||
completed = None
|
||||
|
||||
if capture:
|
||||
completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH), stdout=subprocess.PIPE)
|
||||
else:
|
||||
completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH))
|
||||
|
||||
if completed.returncode != 0:
|
||||
raise RuntimeError("Error: command exited with code {}!".format(completed.returncode))
|
||||
|
||||
return completed
|
||||
|
||||
|
||||
def update_submodules():
|
||||
"""
|
||||
Updates all submodules.
|
||||
"""
|
||||
|
||||
status = run_command(["git", "submodule", "update", "--init", "--recursive"], capture=True)
|
||||
|
||||
if status.stdout.decode().strip():
|
||||
print("Git submodules changed. Reloading solution.")
|
||||
reset_solution()
|
||||
|
||||
def install_hooks():
|
||||
"""
|
||||
Installs the necessary git hooks into .git/hooks.
|
||||
"""
|
||||
|
||||
# Read version file.
|
||||
hooks_version_file = BUILD_CHECKER_PATH/"INSTALLED_HOOKS_VERSION"
|
||||
|
||||
if os.path.isfile(str(hooks_version_file)):
|
||||
with open(str(hooks_version_file), "r") as f:
|
||||
if f.read() == CURRENT_HOOKS_VERSION:
|
||||
if not QUIET:
|
||||
print("No hooks change detected.")
|
||||
return
|
||||
|
||||
with open(str(hooks_version_file), "w") as f:
|
||||
f.write(CURRENT_HOOKS_VERSION)
|
||||
|
||||
print("Hooks need updating.")
|
||||
|
||||
hooks_target_dir = SS14_ROOT_PATH/".git"/"hooks"
|
||||
hooks_source_dir = BUILD_CHECKER_PATH/"hooks"
|
||||
|
||||
if not os.path.exists(str(hooks_target_dir)):
|
||||
os.makedirs(str(hooks_target_dir))
|
||||
|
||||
# Clear entire tree since we need to kill deleted files too.
|
||||
for filename in os.listdir(str(hooks_target_dir)):
|
||||
os.remove(str(hooks_target_dir/filename))
|
||||
|
||||
for filename in os.listdir(str(hooks_source_dir)):
|
||||
print("Copying hook {}".format(filename))
|
||||
shutil.copyfile(str(hooks_source_dir/filename), str(hooks_target_dir/filename))
|
||||
|
||||
|
||||
def reset_solution():
|
||||
"""
|
||||
Force VS to think the solution has been changed to prompt the user to reload it,
|
||||
thus fixing any load errors.
|
||||
"""
|
||||
|
||||
with SOLUTION_PATH.open("r") as f:
|
||||
content = f.read()
|
||||
|
||||
with SOLUTION_PATH.open("w") as f:
|
||||
f.write(content)
|
||||
|
||||
def main():
|
||||
if not NO_HOOKS:
|
||||
install_hooks()
|
||||
update_submodules()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
19
BuildChecker/hooks/post-checkout
Normal file
19
BuildChecker/hooks/post-checkout
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
gitroot=`git rev-parse --show-toplevel`
|
||||
|
||||
cd "$gitroot/BuildChecker"
|
||||
|
||||
if [ -f "git_helper.py" ]
|
||||
then
|
||||
if [[ `uname` == MINGW* || `uname` == CYGWIN* ]]; then
|
||||
# Windows
|
||||
# Can't update hooks from here because we are a hook,
|
||||
# and the file is read only while it's used.
|
||||
# Thanks Windows.
|
||||
py -3 git_helper.py --quiet --nohooks
|
||||
else
|
||||
# Not Windows, so probably some other Unix thing.
|
||||
python3 git_helper.py --quiet
|
||||
fi
|
||||
fi
|
||||
5
BuildChecker/hooks/post-merge
Normal file
5
BuildChecker/hooks/post-merge
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Just call post-checkout since it does the same thing.
|
||||
gitroot=`git rev-parse --show-toplevel`
|
||||
bash "$gitroot/.git/hooks/post-checkout"
|
||||
@@ -1,4 +0,0 @@
|
||||
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
|
||||
@echo on
|
||||
call prebuild-2010.cmd
|
||||
call msbuild SpaceStation14.sln /t:Build /p:Configuration=Release;Platform=x86
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
prebuild-nant.sh
|
||||
|
||||
nant
|
||||
|
||||
#nunit-console Bin/SS14.Test.dll -nodots -xml=NUnit.Results.xml
|
||||
echo NUnit disabled.
|
||||
|
||||
#7za a SS14.7z Bin/*
|
||||
echo Packaging disabled.
|
||||
@@ -1,2 +0,0 @@
|
||||
cd bin\client
|
||||
start SpaceStation14.exe
|
||||
@@ -1,2 +0,0 @@
|
||||
cd bin\server
|
||||
start SpaceStation14_Server.exe
|
||||
@@ -1,164 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// DES encryption
|
||||
/// </summary>
|
||||
public class NetDESEncryption : INetEncryption
|
||||
{
|
||||
private readonly byte[] m_key;
|
||||
private readonly byte[] m_iv;
|
||||
private readonly int m_bitSize;
|
||||
private static readonly List<int> m_keysizes;
|
||||
private static readonly List<int> m_blocksizes;
|
||||
|
||||
static NetDESEncryption()
|
||||
{
|
||||
|
||||
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
|
||||
List<int> temp = new List<int>();
|
||||
foreach (KeySizes keysize in des.LegalKeySizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_keysizes = temp;
|
||||
temp = new List<int>();
|
||||
foreach (KeySizes keysize in des.LegalBlockSizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_blocksizes = temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetDESEncryption(byte[] key, byte[] iv)
|
||||
{
|
||||
if (!m_keysizes.Contains(key.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
if (!m_blocksizes.Contains(iv.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid iv size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_blocksizes)));
|
||||
|
||||
m_key = key;
|
||||
m_iv = iv;
|
||||
m_bitSize = m_key.Length * 8;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetDESEncryption(string key, int bitsize)
|
||||
{
|
||||
if (!m_keysizes.Contains(bitsize))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
byte[] entropy = Encoding.UTF32.GetBytes(key);
|
||||
// I know hardcoding salts is bad, but in this case I think it is acceptable.
|
||||
HMACSHA512 hmacsha512 = new HMACSHA512(Convert.FromBase64String("i88NEiez3c50bHqr3YGasDc4p8jRrxJAaiRiqixpvp4XNAStP5YNoC2fXnWkURtkha6M8yY901Gj07IRVIRyGL=="));
|
||||
hmacsha512.Initialize();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
entropy = hmacsha512.ComputeHash(entropy);
|
||||
}
|
||||
int keylen = bitsize / 8;
|
||||
m_key = new byte[keylen];
|
||||
Buffer.BlockCopy(entropy, 0, m_key, 0, keylen);
|
||||
m_iv = new byte[m_blocksizes[0] / 8];
|
||||
|
||||
Buffer.BlockCopy(entropy, entropy.Length - m_iv.Length - 1, m_iv, 0, m_iv.Length);
|
||||
m_bitSize = bitsize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetDESEncryption(string key)
|
||||
: this(key, m_keysizes[0])
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt outgoing message
|
||||
/// </summary>
|
||||
public bool Encrypt(NetOutgoingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (DESCryptoServiceProvider desCryptoServiceProvider = new DESCryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = desCryptoServiceProvider.CreateEncryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypt incoming message
|
||||
/// </summary>
|
||||
public bool Decrypt(NetIncomingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (DESCryptoServiceProvider desCryptoServiceProvider = new DESCryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = desCryptoServiceProvider.CreateDecryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// RC2 encryption
|
||||
/// </summary>
|
||||
public class NetRC2Encryption : INetEncryption
|
||||
{
|
||||
private readonly byte[] m_key;
|
||||
private readonly byte[] m_iv;
|
||||
private readonly int m_bitSize;
|
||||
private static readonly List<int> m_keysizes;
|
||||
private static readonly List<int> m_blocksizes;
|
||||
|
||||
static NetRC2Encryption()
|
||||
{
|
||||
|
||||
RC2CryptoServiceProvider rc2 = new RC2CryptoServiceProvider();
|
||||
List<int> temp = new List<int>();
|
||||
foreach (KeySizes keysize in rc2.LegalKeySizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_keysizes = temp;
|
||||
temp = new List<int>();
|
||||
foreach (KeySizes keysize in rc2.LegalBlockSizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_blocksizes = temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetRC2Encryption constructor
|
||||
/// </summary>
|
||||
public NetRC2Encryption(byte[] key, byte[] iv)
|
||||
{
|
||||
if (!m_keysizes.Contains(key.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
if (!m_blocksizes.Contains(iv.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid iv size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_blocksizes)));
|
||||
|
||||
m_key = key;
|
||||
m_iv = iv;
|
||||
m_bitSize = m_key.Length * 8;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetRC2Encryption constructor
|
||||
/// </summary>
|
||||
public NetRC2Encryption(string key, int bitsize)
|
||||
{
|
||||
if (!m_keysizes.Contains(bitsize))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
byte[] entropy = Encoding.UTF32.GetBytes(key);
|
||||
// I know hardcoding salts is bad, but in this case I think it is acceptable.
|
||||
HMACSHA512 hmacsha512 = new HMACSHA512(Convert.FromBase64String("i88NEiez3c50bHqr3YGasDc4p8jRrxJAaiRiqixpvp4XNAStP5YNoC2fXnWkURtkha6M8yY901Gj07IRVIRyGL=="));
|
||||
hmacsha512.Initialize();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
entropy = hmacsha512.ComputeHash(entropy);
|
||||
}
|
||||
int keylen = bitsize / 8;
|
||||
m_key = new byte[keylen];
|
||||
Buffer.BlockCopy(entropy, 0, m_key, 0, keylen);
|
||||
m_iv = new byte[m_blocksizes[0] / 8];
|
||||
|
||||
Buffer.BlockCopy(entropy, entropy.Length - m_iv.Length - 1, m_iv, 0, m_iv.Length);
|
||||
m_bitSize = bitsize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetRC2Encryption constructor
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public NetRC2Encryption(string key)
|
||||
: this(key, m_keysizes[0])
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt outgoing message
|
||||
/// </summary>
|
||||
public bool Encrypt(NetOutgoingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (RC2CryptoServiceProvider rc2CryptoServiceProvider = new RC2CryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = rc2CryptoServiceProvider.CreateEncryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypt incoming message
|
||||
/// </summary>
|
||||
public bool Decrypt(NetIncomingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (RC2CryptoServiceProvider rc2CryptoServiceProvider = new RC2CryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = rc2CryptoServiceProvider.CreateDecryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Triple DES encryption
|
||||
/// </summary>
|
||||
public class NetTripleDESEncryption : INetEncryption
|
||||
{
|
||||
private readonly byte[] m_key;
|
||||
private readonly byte[] m_iv;
|
||||
private readonly int m_bitSize;
|
||||
private static readonly List<int> m_keysizes;
|
||||
private static readonly List<int> m_blocksizes;
|
||||
|
||||
static NetTripleDESEncryption()
|
||||
{
|
||||
|
||||
TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
|
||||
List<int> temp = new List<int>();
|
||||
foreach (KeySizes keysize in tripleDES.LegalKeySizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_keysizes = temp;
|
||||
temp = new List<int>();
|
||||
foreach (KeySizes keysize in tripleDES.LegalBlockSizes)
|
||||
{
|
||||
for (int i = keysize.MinSize; i <= keysize.MaxSize; i += keysize.SkipSize)
|
||||
{
|
||||
|
||||
if (!temp.Contains(i))
|
||||
temp.Add(i);
|
||||
if (i == keysize.MaxSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_blocksizes = temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetTriplsDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetTripleDESEncryption(byte[] key, byte[] iv)
|
||||
{
|
||||
if (!m_keysizes.Contains(key.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
if (!m_blocksizes.Contains(iv.Length * 8))
|
||||
throw new NetException(string.Format("Not a valid iv size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_blocksizes)));
|
||||
|
||||
m_key = key;
|
||||
m_iv = iv;
|
||||
m_bitSize = m_key.Length * 8;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetTriplsDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetTripleDESEncryption(string key, int bitsize)
|
||||
{
|
||||
if (!m_keysizes.Contains(bitsize))
|
||||
throw new NetException(string.Format("Not a valid key size. (Valid values are: {0})", NetUtility.MakeCommaDelimitedList(m_keysizes)));
|
||||
|
||||
byte[] entropy = Encoding.UTF32.GetBytes(key);
|
||||
// I know hardcoding salts is bad, but in this case I think it is acceptable.
|
||||
HMACSHA512 hmacsha512 = new HMACSHA512(Convert.FromBase64String("i88NEiez3c50bHqr3YGasDc4p8jRrxJAaiRiqixpvp4XNAStP5YNoC2fXnWkURtkha6M8yY901Gj07IRVIRyGL=="));
|
||||
hmacsha512.Initialize();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
entropy = hmacsha512.ComputeHash(entropy);
|
||||
}
|
||||
int keylen = bitsize / 8;
|
||||
m_key = new byte[keylen];
|
||||
Buffer.BlockCopy(entropy, 0, m_key, 0, keylen);
|
||||
m_iv = new byte[m_blocksizes[0] / 8];
|
||||
|
||||
Buffer.BlockCopy(entropy, entropy.Length - m_iv.Length - 1, m_iv, 0, m_iv.Length);
|
||||
m_bitSize = bitsize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetTriplsDESEncryption constructor
|
||||
/// </summary>
|
||||
public NetTripleDESEncryption(string key)
|
||||
: this(key, m_keysizes[0])
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt outgoing message
|
||||
/// </summary>
|
||||
public bool Encrypt(NetOutgoingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = tripleDESCryptoServiceProvider.CreateEncryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypt incoming message
|
||||
/// </summary>
|
||||
public bool Decrypt(NetIncomingMessage msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
// nested usings are fun!
|
||||
using (TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider { KeySize = m_bitSize, Mode = CipherMode.CBC })
|
||||
{
|
||||
using (ICryptoTransform cryptoTransform = tripleDESCryptoServiceProvider.CreateDecryptor(m_key, m_iv))
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform,
|
||||
CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(msg.m_data, 0, msg.m_data.Length);
|
||||
}
|
||||
msg.m_data = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Example class; not very good encryption
|
||||
/// </summary>
|
||||
public class NetXorEncryption : INetEncryption
|
||||
{
|
||||
private byte[] m_key;
|
||||
|
||||
/// <summary>
|
||||
/// NetXorEncryption constructor
|
||||
/// </summary>
|
||||
public NetXorEncryption(byte[] key)
|
||||
{
|
||||
m_key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NetXorEncryption constructor
|
||||
/// </summary>
|
||||
public NetXorEncryption(string key)
|
||||
{
|
||||
m_key = Encoding.UTF8.GetBytes(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt an outgoing message
|
||||
/// </summary>
|
||||
public bool Encrypt(NetOutgoingMessage msg)
|
||||
{
|
||||
int numBytes = msg.LengthBytes;
|
||||
for (int i = 0; i < numBytes; i++)
|
||||
{
|
||||
int offset = i % m_key.Length;
|
||||
msg.m_data[i] = (byte)(msg.m_data[i] ^ m_key[offset]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypt an incoming message
|
||||
/// </summary>
|
||||
public bool Decrypt(NetIncomingMessage msg)
|
||||
{
|
||||
int numBytes = msg.LengthBytes;
|
||||
for (int i = 0; i < numBytes; i++)
|
||||
{
|
||||
int offset = i % m_key.Length;
|
||||
msg.m_data[i] = (byte)(msg.m_data[i] ^ m_key[offset]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
@@ -6,72 +6,65 @@
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{59250BAF-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ApplicationIcon />
|
||||
<AssemblyKeyContainerName />
|
||||
<AssemblyName>Lidgren.Network</AssemblyName>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>
|
||||
</AppDesignerFolder>
|
||||
<AppDesignerFolder />
|
||||
<RootNamespace>Lidgren.Network</RootNamespace>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<StartupObject />
|
||||
<StartArguments />
|
||||
<FileUpgradeFlags />
|
||||
<ConfigurationOverrideFile />
|
||||
<TargetFrameworkProfile />
|
||||
<DocumentationFile />
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<OutputPath>..\bin\Lidgren\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<NoStdLib>False</NoStdLib>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>False</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>False</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<Optimize>False</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<Optimize>True</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp">
|
||||
@@ -107,18 +100,6 @@
|
||||
<Compile Include="Encryption\NetBlockEncryptionBase.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Encryption\NetDESEncryption.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Encryption\NetRC2Encryption.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Encryption\NetTripleDESEncryption.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Encryption\NetXorEncryption.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Encryption\NetXteaEncryption.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
@@ -70,7 +70,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (i == mag.Length)
|
||||
{
|
||||
// sign = 0;
|
||||
m_magnitude = ZeroMagnitude;
|
||||
}
|
||||
else
|
||||
@@ -241,17 +240,6 @@ namespace Lidgren.Network
|
||||
}
|
||||
}
|
||||
|
||||
// Note: This is the previous (slower) algorithm
|
||||
// while (index < value.Length)
|
||||
// {
|
||||
// char c = value[index];
|
||||
// string s = c.ToString();
|
||||
// int i = Int32.Parse(s, style);
|
||||
//
|
||||
// b = b.Multiply(r).Add(ValueOf(i));
|
||||
// index++;
|
||||
// }
|
||||
|
||||
m_magnitude = b.m_magnitude;
|
||||
}
|
||||
|
||||
@@ -390,7 +378,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (sign == 0)
|
||||
{
|
||||
//sign = 0;
|
||||
m_magnitude = ZeroMagnitude;
|
||||
}
|
||||
else
|
||||
@@ -727,7 +714,6 @@ namespace Lidgren.Network
|
||||
int cBitLength = yBitLength;
|
||||
if (shift > 0)
|
||||
{
|
||||
// iCount = ShiftLeft(One.magnitude, shift);
|
||||
iCount = new int[(shift >> 5) + 1];
|
||||
iCount[0] = 1 << (shift % 32);
|
||||
|
||||
@@ -758,8 +744,7 @@ namespace Lidgren.Network
|
||||
if (++xStart == x.Length)
|
||||
return count;
|
||||
}
|
||||
|
||||
//xBitLength = calcBitLength(xStart, x);
|
||||
|
||||
xBitLength = 32 * (x.Length - xStart - 1) + BitLen(x[xStart]);
|
||||
|
||||
if (xBitLength <= yBitLength)
|
||||
@@ -797,8 +782,7 @@ namespace Lidgren.Network
|
||||
cBitLength -= shift;
|
||||
iCount = ShiftRightInPlace(iCountStart, iCount, shift);
|
||||
}
|
||||
|
||||
//cStart = c.Length - ((cBitLength + 31) / 32);
|
||||
|
||||
while (c[cStart] == 0)
|
||||
{
|
||||
++cStart;
|
||||
@@ -1000,7 +984,6 @@ namespace Lidgren.Network
|
||||
if (x.m_sign < 0)
|
||||
{
|
||||
x.m_sign = 1;
|
||||
//x = m.Subtract(x);
|
||||
x.m_magnitude = doSubBigLil(m.m_magnitude, x.m_magnitude);
|
||||
}
|
||||
|
||||
@@ -1105,7 +1088,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
if (m_magnitude.Length <= m.m_magnitude.Length)
|
||||
{
|
||||
//zAccum = new int[m.magnitude.Length * 2];
|
||||
zVal = new int[m.m_magnitude.Length];
|
||||
m_magnitude.CopyTo(zVal, zVal.Length - m_magnitude.Length);
|
||||
}
|
||||
@@ -1115,8 +1097,7 @@ namespace Lidgren.Network
|
||||
// in normal practice we'll never see ..
|
||||
//
|
||||
NetBigInteger tmp = Remainder(m);
|
||||
|
||||
//zAccum = new int[m.magnitude.Length * 2];
|
||||
|
||||
zVal = new int[m.m_magnitude.Length];
|
||||
tmp.m_magnitude.CopyTo(zVal, zVal.Length - tmp.m_magnitude.Length);
|
||||
}
|
||||
@@ -1225,10 +1206,6 @@ namespace Lidgren.Network
|
||||
int[] w,
|
||||
int[] x)
|
||||
{
|
||||
// Note: this method allows w to be only (2 * x.Length - 1) words if result will fit
|
||||
// if (w.Length != 2 * x.Length)
|
||||
// throw new ArgumentException("no I don't think so...");
|
||||
|
||||
ulong u1, u2, c;
|
||||
|
||||
int wBase = w.Length - 1;
|
||||
@@ -1649,8 +1626,7 @@ namespace Lidgren.Network
|
||||
if (++xStart == x.Length)
|
||||
return x;
|
||||
}
|
||||
|
||||
//xBitLength = calcBitLength(xStart, x);
|
||||
|
||||
xBitLength = 32 * (x.Length - xStart - 1) + BitLen(x[xStart]);
|
||||
|
||||
if (xBitLength <= yBitLength)
|
||||
@@ -1686,8 +1662,7 @@ namespace Lidgren.Network
|
||||
c = ShiftRightInPlace(cStart, c, shift);
|
||||
cBitLength -= shift;
|
||||
}
|
||||
|
||||
//cStart = c.Length - ((cBitLength + 31) / 32);
|
||||
|
||||
while (c[cStart] == 0)
|
||||
{
|
||||
++cStart;
|
||||
@@ -1919,12 +1894,6 @@ namespace Lidgren.Network
|
||||
if (n >= BitLength)
|
||||
return (m_sign < 0 ? One.Negate() : Zero);
|
||||
|
||||
// int[] res = (int[]) magnitude.Clone();
|
||||
//
|
||||
// res = ShiftRightInPlace(0, res, n);
|
||||
//
|
||||
// return new BigInteger(sign, res, true);
|
||||
|
||||
int resultLength = (BitLength - n + 31) >> 5;
|
||||
int[] res = new int[resultLength];
|
||||
|
||||
@@ -1980,8 +1949,7 @@ namespace Lidgren.Network
|
||||
{
|
||||
m = (x[--iT] & IMASK) - (y[--iV] & IMASK) + borrow;
|
||||
x[iT] = (int)m;
|
||||
|
||||
// borrow = (m < 0) ? -1 : 0;
|
||||
|
||||
borrow = (int)(m >> 63);
|
||||
}
|
||||
while (iV > yStart);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#define UNSAFE
|
||||
//#define UNSAFE
|
||||
//#define BIGENDIAN
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Lidgren.Network
|
||||
NetException.Assert(((numberOfBits > 0) && (numberOfBits < 9)), "Read() can only read between 1 and 8 bits");
|
||||
|
||||
int bytePtr = readBitOffset >> 3;
|
||||
int startReadAtIndex = readBitOffset - (bytePtr * 8); // (readBitOffset % 8);
|
||||
int startReadAtIndex = readBitOffset - (bytePtr * 8);
|
||||
|
||||
if (startReadAtIndex == 0 && numberOfBits == 8)
|
||||
return fromBuffer[bytePtr];
|
||||
@@ -70,7 +70,7 @@ namespace Lidgren.Network
|
||||
public static void ReadBytes(byte[] fromBuffer, int numberOfBytes, int readBitOffset, byte[] destination, int destinationByteOffset)
|
||||
{
|
||||
int readPtr = readBitOffset >> 3;
|
||||
int startReadAtIndex = readBitOffset - (readPtr * 8); // (readBitOffset % 8);
|
||||
int startReadAtIndex = readBitOffset - (readPtr * 8);
|
||||
|
||||
if (startReadAtIndex == 0)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
|
||||
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
|
||||
@@ -181,7 +181,6 @@ namespace Lidgren.Network
|
||||
public UInt32 PeekUInt32(int numberOfBits)
|
||||
{
|
||||
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadUInt() can only read between 1 and 32 bits");
|
||||
//NetException.Assert(m_bitLength - m_readBitPtr >= numberOfBits, "tried to read past buffer size");
|
||||
|
||||
UInt32 retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
|
||||
return retval;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
@@ -255,7 +255,6 @@ namespace Lidgren.Network
|
||||
public UInt32 ReadUInt32(int numberOfBits)
|
||||
{
|
||||
NetException.Assert(numberOfBits > 0 && numberOfBits <= 32, "ReadUInt32(bits) can only read between 1 and 32 bits");
|
||||
//NetException.Assert(m_bitLength - m_readBitPtr >= numberOfBits, "tried to read past buffer size");
|
||||
|
||||
UInt32 retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
|
||||
m_readPosition += numberOfBits;
|
||||
@@ -470,9 +469,6 @@ namespace Lidgren.Network
|
||||
int num2 = 0;
|
||||
while (true)
|
||||
{
|
||||
//if (num2 == 0x23)
|
||||
// throw new FormatException("Bad 7-bit encoded integer");
|
||||
|
||||
byte num3 = this.ReadByte();
|
||||
num1 |= ((UInt64)num3 & 0x7f) << num2;
|
||||
num2 += 7;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -94,8 +94,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
m_peer.VerifyNetworkThread();
|
||||
|
||||
//m_peer.LogDebug("Executing disconnect");
|
||||
|
||||
// clear send queues
|
||||
for (int i = 0; i < m_sendChannels.Length; i++)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -131,8 +131,6 @@ namespace Lidgren.Network
|
||||
rchan.m_resendDelay = resendDelay;
|
||||
}
|
||||
|
||||
// m_peer.LogVerbose("Timeout deadline pushed to " + m_timeoutDeadline);
|
||||
|
||||
// notify the application that average rtt changed
|
||||
if (m_peer.m_configuration.IsMessageTypeEnabled(NetIncomingMessageType.ConnectionLatencyUpdated))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -74,13 +74,11 @@ namespace Lidgren.Network
|
||||
{
|
||||
// we've never encountered failure; expand by 25% each time
|
||||
tryMTU = (int)((float)m_currentMTU * 1.25f);
|
||||
//m_peer.LogDebug("Trying MTU " + tryMTU);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we HAVE encountered failure; so try in between
|
||||
tryMTU = (int)(((float)m_smallestFailedMTU + (float)m_largestSuccessfulMTU) / 2.0f);
|
||||
//m_peer.LogDebug("Trying MTU " + m_smallestFailedMTU + " <-> " + m_largestSuccessfulMTU + " = " + tryMTU);
|
||||
}
|
||||
|
||||
if (tryMTU > c_protocolMaxMTU)
|
||||
@@ -88,7 +86,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (tryMTU == m_largestSuccessfulMTU)
|
||||
{
|
||||
//m_peer.LogDebug("Found optimal MTU - exiting");
|
||||
FinalizeMTU(m_largestSuccessfulMTU);
|
||||
return;
|
||||
}
|
||||
@@ -107,8 +104,6 @@ namespace Lidgren.Network
|
||||
bool ok = m_peer.SendMTUPacket(len, m_remoteEndPoint);
|
||||
if (ok == false)
|
||||
{
|
||||
//m_peer.LogDebug("Send MTU failed for size " + size);
|
||||
|
||||
// failure
|
||||
if (m_smallestFailedMTU == -1 || size < m_smallestFailedMTU)
|
||||
{
|
||||
@@ -149,9 +144,7 @@ namespace Lidgren.Network
|
||||
int len = om.Encode(m_peer.m_sendBuffer, 0, 0);
|
||||
bool connectionReset;
|
||||
m_peer.SendPacket(len, m_remoteEndPoint, 1, out connectionReset);
|
||||
|
||||
// m_peer.LogDebug("Received MTU expand request for " + size + " bytes");
|
||||
|
||||
|
||||
m_statistics.PacketSent(len, 1);
|
||||
}
|
||||
|
||||
@@ -162,11 +155,9 @@ namespace Lidgren.Network
|
||||
|
||||
if (size < m_currentMTU)
|
||||
{
|
||||
//m_peer.LogDebug("Received low MTU expand success (size " + size + "); current mtu is " + m_currentMTU);
|
||||
return;
|
||||
}
|
||||
|
||||
//m_peer.LogDebug("Expanding MTU to " + size);
|
||||
m_currentMTU = size;
|
||||
|
||||
ExpandMTU(now, true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
@@ -204,8 +204,6 @@ namespace Lidgren.Network
|
||||
NetTuple<NetMessageType, int> tuple;
|
||||
m_queuedOutgoingAcks.TryDequeue(out tuple);
|
||||
|
||||
//m_peer.LogVerbose("Sending ack for " + tuple.Item1 + "#" + tuple.Item2);
|
||||
|
||||
sendBuffer[m_sendBufferWritePtr++] = (byte)tuple.Item1;
|
||||
sendBuffer[m_sendBufferWritePtr++] = (byte)tuple.Item2;
|
||||
sendBuffer[m_sendBufferWritePtr++] = (byte)(tuple.Item2 >> 8);
|
||||
@@ -228,7 +226,6 @@ namespace Lidgren.Network
|
||||
NetTuple<NetMessageType, int> incAck;
|
||||
while (m_queuedIncomingAcks.TryDequeue(out incAck))
|
||||
{
|
||||
//m_peer.LogVerbose("Received ack for " + acktp + "#" + seqNr);
|
||||
NetSenderChannelBase chan = m_sendChannels[(int)incAck.Item1 - 1];
|
||||
if (chan == null)
|
||||
chan = CreateSenderChannel(incAck.Item1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
|
||||
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
|
||||
@@ -91,8 +91,6 @@ namespace Lidgren.Network
|
||||
/// </summary>
|
||||
public int ResentMessages { get { return m_resentMessagesDueToHole + m_resentMessagesDueToDelay; } }
|
||||
|
||||
// public double LastSendRespondedTo { get { return m_connection.m_lastSendRespondedTo; } }
|
||||
|
||||
#if USE_RELEASE_STATISTICS
|
||||
internal void PacketSent(int numBytes, int numMessages)
|
||||
{
|
||||
@@ -156,7 +154,6 @@ namespace Lidgren.Network
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder bdr = new StringBuilder();
|
||||
//bdr.AppendLine("Average roundtrip time: " + NetTime.ToReadable(m_connection.m_averageRoundtripTime));
|
||||
bdr.AppendLine("Sent " + m_sentBytes + " bytes in " + m_sentMessages + " messages in " + m_sentPackets + " packets");
|
||||
bdr.AppendLine("Received " + m_receivedBytes + " bytes in " + m_receivedMessages + " messages in " + m_receivedPackets + " packets");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -131,7 +131,6 @@ namespace Lidgren.Network
|
||||
Buffer.BlockCopy(im.m_data, ptr, info.Data, offset, im.LengthBytes - ptr);
|
||||
|
||||
int cnt = info.ReceivedChunks.Count();
|
||||
//LogVerbose("Found fragment #" + chunkNumber + " in group " + group + " offset " + offset + " of total bits " + totalBits + " (total chunks done " + cnt + ")");
|
||||
|
||||
LogVerbose("Received fragment " + chunkNumber + " of " + totalNumChunks + " (" + cnt + " chunks received)");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !__ANDROID__ && !IOS
|
||||
#if !__ANDROID__ && !IOS
|
||||
#define IS_MAC_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -252,9 +252,20 @@ namespace Lidgren.Network
|
||||
}
|
||||
if (m_messageReceivedEvent != null)
|
||||
{
|
||||
m_messageReceivedEvent.Set();
|
||||
m_messageReceivedEvent.Close();
|
||||
m_messageReceivedEvent = null;
|
||||
try
|
||||
{
|
||||
m_messageReceivedEvent.Set();
|
||||
m_messageReceivedEvent.Close();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
// For some reason, inside Godot this seems to throw ObjectDisposedExceptions on client shutdown.
|
||||
// If it's already disposed then I guess this is fine?
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_messageReceivedEvent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -370,9 +381,6 @@ namespace Lidgren.Network
|
||||
if (!m_socket.Poll(1000, SelectMode.SelectRead)) // wait up to 1 ms for data to arrive
|
||||
return;
|
||||
|
||||
//if (m_socket == null || m_socket.Available < 1)
|
||||
// return;
|
||||
|
||||
do
|
||||
{
|
||||
int bytesReceived = 0;
|
||||
@@ -398,8 +406,6 @@ namespace Lidgren.Network
|
||||
if (bytesReceived < NetConstants.HeaderByteSize)
|
||||
return;
|
||||
|
||||
//LogVerbose("Received " + bytesReceived + " bytes");
|
||||
|
||||
IPEndPoint ipsender = (IPEndPoint)m_senderRemote;
|
||||
|
||||
if (ipsender.Port == 1900)
|
||||
@@ -648,7 +654,6 @@ namespace Lidgren.Network
|
||||
|
||||
internal void AcceptConnection(NetConnection conn)
|
||||
{
|
||||
// LogDebug("Accepted connection " + conn);
|
||||
conn.InitExpandMTU(NetTime.Now);
|
||||
|
||||
if (m_handshakes.Remove(conn.m_remoteEndPoint) == false)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
|
||||
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
|
||||
@@ -63,7 +63,6 @@ namespace Lidgren.Network
|
||||
if (m == 0.0f && r == 0.0f)
|
||||
{
|
||||
// no latency simulation
|
||||
// LogVerbose("Sending packet " + numBytes + " bytes");
|
||||
bool wasSent = ActuallySendPacket(m_sendBuffer, numBytes, target, out connectionReset);
|
||||
// TODO: handle wasSent == false?
|
||||
return;
|
||||
@@ -87,8 +86,6 @@ namespace Lidgren.Network
|
||||
|
||||
m_delayedPackets.Add(p);
|
||||
}
|
||||
|
||||
// LogVerbose("Sending packet " + numBytes + " bytes - delayed " + NetTime.ToReadable(delay));
|
||||
}
|
||||
|
||||
private void SendDelayedPackets()
|
||||
@@ -142,8 +139,6 @@ namespace Lidgren.Network
|
||||
int bytesSent = m_socket.SendTo(data, 0, numBytes, SocketFlags.None, target);
|
||||
if (numBytes != bytesSent)
|
||||
LogWarning("Failed to send the full " + numBytes + "; only " + bytesSent + " bytes sent in packet!");
|
||||
|
||||
// LogDebug("Sent " + numBytes + " bytes");
|
||||
}
|
||||
catch (SocketException sx)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -80,8 +80,6 @@ namespace Lidgren.Network
|
||||
// mix some semi-random properties
|
||||
int seed = (int)Environment.TickCount;
|
||||
seed ^= forObject.GetHashCode();
|
||||
//seed ^= (int)(Stopwatch.GetTimestamp());
|
||||
//seed ^= (int)(Environment.WorkingSet); // will return 0 on mono
|
||||
|
||||
int extraSeed = System.Threading.Interlocked.Increment(ref s_extraSeed);
|
||||
|
||||
@@ -265,44 +263,6 @@ namespace Lidgren.Network
|
||||
this.x = x; this.y = y; this.z = z; this.w = w;
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// A version of NextBytes that uses a pointer to set 4 bytes of the byte buffer in one operation
|
||||
// /// thus providing a nice speedup. The loop is also partially unrolled to allow out-of-order-execution,
|
||||
// /// this results in about a x2 speedup on an AMD Athlon. Thus performance may vary wildly on different CPUs
|
||||
// /// depending on the number of execution units available.
|
||||
// ///
|
||||
// /// Another significant speedup is obtained by setting the 4 bytes by indexing pDWord (e.g. pDWord[i++]=w)
|
||||
// /// instead of adjusting it dereferencing it (e.g. *pDWord++=w).
|
||||
// ///
|
||||
// /// Note that this routine requires the unsafe compilation flag to be specified and so is commented out by default.
|
||||
// /// </summary>
|
||||
// /// <param name="buffer"></param>
|
||||
// public unsafe void NextBytesUnsafe(byte[] buffer)
|
||||
// {
|
||||
// if(buffer.Length % 8 != 0)
|
||||
// throw new ArgumentException("Buffer length must be divisible by 8", "buffer");
|
||||
//
|
||||
// uint x=this.x, y=this.y, z=this.z, w=this.w;
|
||||
//
|
||||
// fixed(byte* pByte0 = buffer)
|
||||
// {
|
||||
// uint* pDWord = (uint*)pByte0;
|
||||
// for(int i=0, len=buffer.Length>>2; i < len; i+=2)
|
||||
// {
|
||||
// uint t=(x^(x<<11));
|
||||
// x=y; y=z; z=w;
|
||||
// pDWord[i] = w = (w^(w>>19))^(t^(t>>8));
|
||||
//
|
||||
// t=(x^(x<<11));
|
||||
// x=y; y=z; z=w;
|
||||
// pDWord[i+1] = w = (w^(w>>19))^(t^(t>>8));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// this.x=x; this.y=y; this.z=z; this.w=w;
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods [Methods not present on System.Random]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -32,13 +32,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (relate == 0)
|
||||
{
|
||||
// Log("Received message #" + message.SequenceNumber + " right on time");
|
||||
|
||||
//
|
||||
// excellent, right on time
|
||||
//
|
||||
//m_peer.LogVerbose("Received RIGHT-ON-TIME " + message);
|
||||
|
||||
AdvanceWindow();
|
||||
m_peer.ReleaseMessage(message);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Lidgren.Network
|
||||
@@ -85,8 +85,7 @@ namespace Lidgren.Network
|
||||
startSlot = m_windowSize - 1;
|
||||
seqNr--;
|
||||
}
|
||||
|
||||
//m_connection.m_peer.LogVerbose("Resending due to delay #" + seqNr + " " + om.ToString());
|
||||
|
||||
m_connection.m_statistics.MessageResent(MessageResendReason.Delay);
|
||||
|
||||
m_connection.QueueSendMessage(om, seqNr);
|
||||
@@ -156,15 +155,10 @@ namespace Lidgren.Network
|
||||
int relate = NetUtility.RelativeSequenceNumber(seqNr, m_windowStart);
|
||||
|
||||
if (relate < 0)
|
||||
{
|
||||
//m_connection.m_peer.LogDebug("Received late/dupe ack for #" + seqNr);
|
||||
return; // late/duplicate ack
|
||||
}
|
||||
|
||||
if (relate == 0)
|
||||
{
|
||||
//m_connection.m_peer.LogDebug("Received right-on-time ack for #" + seqNr);
|
||||
|
||||
// ack arrived right on time
|
||||
NetException.Assert(seqNr == m_windowStart);
|
||||
|
||||
@@ -175,13 +169,11 @@ namespace Lidgren.Network
|
||||
// advance window if we already have early acks
|
||||
while (m_receivedAcks.Get(m_windowStart))
|
||||
{
|
||||
//m_connection.m_peer.LogDebug("Using early ack for #" + m_windowStart + "...");
|
||||
m_receivedAcks[m_windowStart] = false;
|
||||
DestoreMessage(m_windowStart % m_windowSize);
|
||||
|
||||
NetException.Assert(m_storedMessages[m_windowStart % m_windowSize].Message == null); // should already be destored
|
||||
m_windowStart = (m_windowStart + 1) % NetConstants.NumSequenceNumbers;
|
||||
//m_connection.m_peer.LogDebug("Advancing window to #" + m_windowStart);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -194,8 +186,6 @@ namespace Lidgren.Network
|
||||
// ... or the ack for that message was lost
|
||||
//
|
||||
|
||||
//m_connection.m_peer.LogDebug("Received early ack for #" + seqNr);
|
||||
|
||||
int sendRelate = NetUtility.RelativeSequenceNumber(seqNr, m_sendStart);
|
||||
if (sendRelate <= 0)
|
||||
{
|
||||
@@ -223,12 +213,8 @@ namespace Lidgren.Network
|
||||
rnr--;
|
||||
if (rnr < 0)
|
||||
rnr = NetConstants.NumSequenceNumbers - 1;
|
||||
|
||||
if (m_receivedAcks[rnr])
|
||||
{
|
||||
// m_connection.m_peer.LogDebug("Not resending #" + rnr + " (since we got ack)");
|
||||
}
|
||||
else
|
||||
|
||||
if (!m_receivedAcks[rnr])
|
||||
{
|
||||
int slot = rnr % m_windowSize;
|
||||
NetException.Assert(m_storedMessages[slot].Message != null);
|
||||
@@ -236,7 +222,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
// just sent once; resend immediately since we found gap in ack sequence
|
||||
NetOutgoingMessage rmsg = m_storedMessages[slot].Message;
|
||||
//m_connection.m_peer.LogVerbose("Resending #" + rnr + " (" + rmsg + ")");
|
||||
|
||||
if (now - m_storedMessages[slot].LastSent < (m_resendDelay * 0.35f))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -29,12 +29,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (relate == 0)
|
||||
{
|
||||
// Log("Received message #" + message.SequenceNumber + " right on time");
|
||||
|
||||
//
|
||||
// excellent, right on time
|
||||
//
|
||||
|
||||
AdvanceWindow();
|
||||
m_peer.ReleaseMessage(message);
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -30,13 +30,6 @@ namespace Lidgren.Network
|
||||
|
||||
if (relate == 0)
|
||||
{
|
||||
// Log("Received message #" + message.SequenceNumber + " right on time");
|
||||
|
||||
//
|
||||
// excellent, right on time
|
||||
//
|
||||
//m_peer.LogVerbose("Received RIGHT-ON-TIME " + message);
|
||||
|
||||
AdvanceWindow();
|
||||
m_peer.ReleaseMessage(message);
|
||||
|
||||
@@ -45,16 +38,6 @@ namespace Lidgren.Network
|
||||
|
||||
while (m_earlyReceived[nextSeqNr % m_windowSize])
|
||||
{
|
||||
//message = m_withheldMessages[nextSeqNr % m_windowSize];
|
||||
//NetException.Assert(message != null);
|
||||
|
||||
// remove it from withheld messages
|
||||
//m_withheldMessages[nextSeqNr % m_windowSize] = null;
|
||||
|
||||
//m_peer.LogVerbose("Releasing withheld message #" + message);
|
||||
|
||||
//m_peer.ReleaseMessage(message);
|
||||
|
||||
AdvanceWindow();
|
||||
nextSeqNr++;
|
||||
}
|
||||
@@ -78,8 +61,6 @@ namespace Lidgren.Network
|
||||
}
|
||||
|
||||
m_earlyReceived.Set(message.m_sequenceNumber % m_windowSize, true);
|
||||
//m_peer.LogVerbose("Received " + message + " WITHHOLDING, waiting for " + m_windowStart);
|
||||
//m_withheldMessages[message.m_sequenceNumber % m_windowSize] = message;
|
||||
|
||||
m_peer.ReleaseMessage(message);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define USE_SHA256
|
||||
#define USE_SHA256
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
@@ -75,8 +75,7 @@ namespace Lidgren.Network
|
||||
byte[] total = new byte[innerHash.Length + salt.Length];
|
||||
Buffer.BlockCopy(salt, 0, total, 0, salt.Length);
|
||||
Buffer.BlockCopy(innerHash, 0, total, salt.Length, innerHash.Length);
|
||||
|
||||
// x ie. H(salt || H(username || ":" || password))
|
||||
|
||||
return new NetBigInteger(NetUtility.ToHexString(sha.ComputeHash(total)), 16).ToByteArrayUnsigned();
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ namespace Lidgren.Network
|
||||
string one = NetUtility.ToHexString(clientPublicEphemeral);
|
||||
string two = NetUtility.ToHexString(serverPublicEphemeral);
|
||||
|
||||
int len = 66; // Math.Max(one.Length, two.Length);
|
||||
int len = 66;
|
||||
string ccstr = one.PadLeft(len, '0') + two.PadLeft(len, '0');
|
||||
|
||||
byte[] cc = NetUtility.ToByteArray(ccstr);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
@@ -40,9 +40,6 @@ namespace Lidgren.Network
|
||||
peer.Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
||||
peer.RawSend(arr, 0, arr.Length, new IPEndPoint(IPAddress.Broadcast, 1900));
|
||||
peer.Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, false);
|
||||
|
||||
// allow some extra time for router to respond
|
||||
// System.Threading.Thread.Sleep(50);
|
||||
}
|
||||
|
||||
internal void ExtractServiceUrl(string resp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Lidgren.Network
|
||||
@@ -94,15 +94,10 @@ namespace Lidgren.Network
|
||||
int relate = NetUtility.RelativeSequenceNumber(seqNr, m_windowStart);
|
||||
|
||||
if (relate < 0)
|
||||
{
|
||||
//m_connection.m_peer.LogDebug("Received late/dupe ack for #" + seqNr);
|
||||
return; // late/duplicate ack
|
||||
}
|
||||
|
||||
if (relate == 0)
|
||||
{
|
||||
//m_connection.m_peer.LogDebug("Received right-on-time ack for #" + seqNr);
|
||||
|
||||
// ack arrived right on time
|
||||
NetException.Assert(seqNr == m_windowStart);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
/* Copyright (c) 2010 Michael Lidgren
|
||||
|
||||
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
|
||||
@@ -107,7 +107,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
if (ex.SocketErrorCode == SocketError.HostNotFound)
|
||||
{
|
||||
//LogWrite(string.Format(CultureInfo.InvariantCulture, "Failed to resolve host '{0}'.", ipOrHost));
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
@@ -140,7 +139,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
if (ex.SocketErrorCode == SocketError.HostNotFound)
|
||||
{
|
||||
//LogWrite(string.Format(CultureInfo.InvariantCulture, "Failed to resolve host '{0}'.", ipOrHost));
|
||||
callback(null);
|
||||
}
|
||||
else
|
||||
@@ -189,7 +187,6 @@ namespace Lidgren.Network
|
||||
{
|
||||
if (ex.SocketErrorCode == SocketError.HostNotFound)
|
||||
{
|
||||
//LogWrite(string.Format(CultureInfo.InvariantCulture, "Failed to resolve host '{0}'.", ipOrHost));
|
||||
return null;
|
||||
}
|
||||
else
|
||||
@@ -266,7 +263,7 @@ namespace Lidgren.Network
|
||||
}
|
||||
return new string(c);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local broadcast address
|
||||
/// </summary>
|
||||
@@ -278,7 +275,7 @@ namespace Lidgren.Network
|
||||
if (wifi.IsWifiEnabled)
|
||||
{
|
||||
var dhcp = wifi.DhcpInfo;
|
||||
|
||||
|
||||
int broadcast = (dhcp.IpAddress & dhcp.Netmask) | ~dhcp.Netmask;
|
||||
byte[] quads = new byte[4];
|
||||
for (int k = 0; k < 4; k++)
|
||||
@@ -292,7 +289,7 @@ namespace Lidgren.Network
|
||||
{
|
||||
return IPAddress.Broadcast;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if IS_FULL_NET_AVAILABLE
|
||||
try
|
||||
{
|
||||
@@ -301,7 +298,7 @@ namespace Lidgren.Network
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
IPInterfaceProperties properties = ni.GetIPProperties();
|
||||
foreach (UnicastIPAddressInformation unicastAddress in properties.UnicastAddresses)
|
||||
{
|
||||
@@ -310,24 +307,24 @@ namespace Lidgren.Network
|
||||
var mask = unicastAddress.IPv4Mask;
|
||||
byte[] ipAdressBytes = unicastAddress.Address.GetAddressBytes();
|
||||
byte[] subnetMaskBytes = mask.GetAddressBytes();
|
||||
|
||||
|
||||
if (ipAdressBytes.Length != subnetMaskBytes.Length)
|
||||
throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
|
||||
|
||||
|
||||
byte[] broadcastAddress = new byte[ipAdressBytes.Length];
|
||||
for (int i = 0; i < broadcastAddress.Length; i++)
|
||||
{
|
||||
broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255));
|
||||
}
|
||||
return new IPAddress(broadcastAddress);
|
||||
return new IPAddress(broadcastAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch // Catch any errors
|
||||
catch // Catch any errors
|
||||
{
|
||||
return IPAddress.Broadcast;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return IPAddress.Broadcast;
|
||||
}
|
||||
|
||||
@@ -343,21 +340,21 @@ namespace Lidgren.Network
|
||||
Android.Net.Wifi.WifiManager wifi = (Android.Net.Wifi.WifiManager)Android.App.Application.Context.GetSystemService(Android.App.Activity.WifiService);
|
||||
if (!wifi.IsWifiEnabled) return null;
|
||||
var dhcp = wifi.DhcpInfo;
|
||||
|
||||
|
||||
int addr = dhcp.IpAddress;
|
||||
byte[] quads = new byte[4];
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
quads[k] = (byte) ((addr >> k * 8) & 0xFF);
|
||||
}
|
||||
}
|
||||
return new IPAddress(quads);
|
||||
}
|
||||
catch // Catch Access Denied errors
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#if IS_FULL_NET_AVAILABLE
|
||||
NetworkInterface ni = GetNetworkInterface();
|
||||
if (ni == null)
|
||||
@@ -486,12 +483,6 @@ namespace Lidgren.Network
|
||||
internal static int RelativeSequenceNumber(int nr, int expected)
|
||||
{
|
||||
return (nr - expected + NetConstants.NumSequenceNumbers + (NetConstants.NumSequenceNumbers / 2)) % NetConstants.NumSequenceNumbers - (NetConstants.NumSequenceNumbers / 2);
|
||||
|
||||
// old impl:
|
||||
//int retval = ((nr + NetConstants.NumSequenceNumbers) - expected) % NetConstants.NumSequenceNumbers;
|
||||
//if (retval > (NetConstants.NumSequenceNumbers / 2))
|
||||
// retval -= NetConstants.NumSequenceNumbers;
|
||||
//return retval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -586,4 +577,4 @@ namespace Lidgren.Network
|
||||
return bdr.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
MSBuild/SS14.DefineConstants.targets
Normal file
20
MSBuild/SS14.DefineConstants.targets
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<!-- Adds to the DefineConstants to provide things such as platform-specific defines. -->
|
||||
<Choose>
|
||||
<When Condition="'$(TargetOS)' == 'Windows'">
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(TargetOS)' == 'MacOS'" >
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);MACOS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);LINUX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
</Project>
|
||||
9
MSBuild/SS14.Engine.targets
Normal file
9
MSBuild/SS14.Engine.targets
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<Target Name="CopyResourcesFromShared">
|
||||
<ItemGroup>
|
||||
<_ResourceFiles Include="$(SolutionDir)bin\Shared\Resources\**\*.*" />
|
||||
</ItemGroup>
|
||||
<RemoveDir Directories="$(OutputPath)Resources" />
|
||||
<Copy SourceFiles="@(_ResourceFiles)" DestinationFolder="$(OutputPath)Resources\%(RecursiveDir)" />
|
||||
</Target>
|
||||
</Project>
|
||||
29
MSBuild/SS14.Properties.targets
Normal file
29
MSBuild/SS14.Properties.targets
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<!-- MSBuild hurts and I can't find a foolproof way to detect platform. -->
|
||||
<PropertyGroup>
|
||||
<OS Condition="'$(OS)' == ''">Windows_NT</OS>
|
||||
</PropertyGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(OS)' != 'Unix'">
|
||||
<PropertyGroup>
|
||||
<ActualOS>Windows</ActualOS>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<!-- Folders that *probably* only exist on MacOS and not Linux. -->
|
||||
<When Condition="Exists('/Volumes') And Exists('/System') And Exists('/Library')" >
|
||||
<PropertyGroup>
|
||||
<ActualOS>MacOS</ActualOS>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<ActualOS>Linux</ActualOS>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<PropertyGroup>
|
||||
<TargetOS Condition="'$(TargetOS)' == ''">$(ActualOS)</TargetOS>
|
||||
<Python>python3</Python>
|
||||
<Python Condition="'$(ActualOS)' == 'Windows'">py -3</Python>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
11
MSBuild/SS14.Sandbox.targets
Normal file
11
MSBuild/SS14.Sandbox.targets
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- Common target to copy content assemblies to the parent projects. -->
|
||||
<Target Name="CopyContentAssemblies">
|
||||
<Copy SourceFiles="@(ContentAssemblies)" DestinationFolder="$(ContentAssemblyTarget)" />
|
||||
</Target>
|
||||
<ItemDefinitionGroup>
|
||||
<ContentAssemblies>
|
||||
<Visible>False</Visible>
|
||||
</ContentAssemblies>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DirectedGraph GraphDirection="LeftToRight" Layout="Sugiyama" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
|
||||
<Nodes>
|
||||
<Node Id="Client" Category="Project" Label="Client" />
|
||||
</Nodes>
|
||||
<Links />
|
||||
<Categories>
|
||||
<Category Id="Project" />
|
||||
</Categories>
|
||||
<Properties>
|
||||
<Property Id="GraphDirection" DataType="Microsoft.VisualStudio.Progression.Layout.GraphDirection" />
|
||||
<Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
|
||||
<Property Id="Layout" DataType="System.String" />
|
||||
</Properties>
|
||||
<Styles>
|
||||
<Style TargetType="Node" GroupLabel="Project" ValueLabel="True">
|
||||
<Condition Expression="HasCategory('Project')" />
|
||||
<Setter Property="Background" Value="Blue" />
|
||||
</Style>
|
||||
</Styles>
|
||||
</DirectedGraph>
|
||||
41
RUN_THIS.py
Executable file
41
RUN_THIS.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Import future so people on py2 still get the clear error that they need to upgrade.
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
VERSION = sys.version_info
|
||||
NO_PROMPT = "--no-prompt" in sys.argv
|
||||
|
||||
sane_input = raw_input if VERSION.major < 3 else input
|
||||
|
||||
def main():
|
||||
if VERSION.major < 3 or (VERSION.major == 3 and VERSION.minor < 5):
|
||||
print("ERROR: You need at least Python 3.5 to build SS14.")
|
||||
# Need "press enter to exit" stuff because Windows just immediately closes conhost.
|
||||
if not NO_PROMPT:
|
||||
sane_input("Press enter to exit...")
|
||||
exit(1)
|
||||
|
||||
# Import git_helper by modifying the path.
|
||||
ss14_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(ss14_dir, "BuildChecker"))
|
||||
|
||||
try:
|
||||
import git_helper
|
||||
git_helper.main()
|
||||
|
||||
except Exception as e:
|
||||
print("ERROR:")
|
||||
traceback.print_exc()
|
||||
print("This was NOT intentional. If the error is not immediately obvious, ask on Discord or IRC for help.")
|
||||
if not NO_PROMPT:
|
||||
sane_input("Press enter to exit...")
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
if not NO_PROMPT:
|
||||
sane_input("Success! Press enter to exit...")
|
||||
3666
Resources/Maps/Demo/DemoGrid.yaml
Normal file
3666
Resources/Maps/Demo/DemoGrid.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Sprite>star1</Sprite>
|
||||
<EmitterPosition>
|
||||
<X>358</X>
|
||||
<Y>385</Y>
|
||||
</EmitterPosition>
|
||||
<EmissionOffset>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</EmissionOffset>
|
||||
<EmitRate>30</EmitRate>
|
||||
<MaximumParticleCount>200</MaximumParticleCount>
|
||||
<EmissionRadiusRange>
|
||||
<X>5</X>
|
||||
<Y>20</Y>
|
||||
</EmissionRadiusRange>
|
||||
<Velocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</Velocity>
|
||||
<VelocityVariance>0</VelocityVariance>
|
||||
<Acceleration>
|
||||
<X>0</X>
|
||||
<Y>1.5</Y>
|
||||
</Acceleration>
|
||||
<AccelerationVariance>0</AccelerationVariance>
|
||||
<RadialVelocity>10</RadialVelocity>
|
||||
<RadialVelocityVariance>0</RadialVelocityVariance>
|
||||
<RadialAcceleration>-1.25</RadialAcceleration>
|
||||
<RadialAccelerationVariance>0</RadialAccelerationVariance>
|
||||
<TangentialVelocity>0</TangentialVelocity>
|
||||
<TangentialVelocityVariance>0</TangentialVelocityVariance>
|
||||
<TangentialAcceleration>0</TangentialAcceleration>
|
||||
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
|
||||
<Lifetime>10</Lifetime>
|
||||
<LifetimeVariance>2</LifetimeVariance>
|
||||
<SpinVelocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</SpinVelocity>
|
||||
<SpinVelocityVariance>0</SpinVelocityVariance>
|
||||
<SizeRange>
|
||||
<X>0.1</X>
|
||||
<Y>0.05</Y>
|
||||
</SizeRange>
|
||||
<SizeVariance>0.05</SizeVariance>
|
||||
<ColorRange>
|
||||
<Start>
|
||||
<A>255</A>
|
||||
<R>113</R>
|
||||
<G>199</G>
|
||||
<B>255</B>
|
||||
</Start>
|
||||
<End>
|
||||
<A>80</A>
|
||||
<R>103</R>
|
||||
<G>180</G>
|
||||
<B>255</B>
|
||||
</End>
|
||||
</ColorRange>
|
||||
<ColorVariance>0</ColorVariance>
|
||||
</ParticleSettings>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Sprite>star1</Sprite>
|
||||
<EmitterPosition>
|
||||
<X>358</X>
|
||||
<Y>385</Y>
|
||||
</EmitterPosition>
|
||||
<EmissionOffset>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</EmissionOffset>
|
||||
<EmitRate>30</EmitRate>
|
||||
<MaximumParticleCount>200</MaximumParticleCount>
|
||||
<EmissionRadiusRange>
|
||||
<X>5</X>
|
||||
<Y>20</Y>
|
||||
</EmissionRadiusRange>
|
||||
<Velocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</Velocity>
|
||||
<VelocityVariance>0</VelocityVariance>
|
||||
<Acceleration>
|
||||
<X>0</X>
|
||||
<Y>1.5</Y>
|
||||
</Acceleration>
|
||||
<AccelerationVariance>0</AccelerationVariance>
|
||||
<RadialVelocity>10</RadialVelocity>
|
||||
<RadialVelocityVariance>0</RadialVelocityVariance>
|
||||
<RadialAcceleration>-1.25</RadialAcceleration>
|
||||
<RadialAccelerationVariance>0</RadialAccelerationVariance>
|
||||
<TangentialVelocity>0</TangentialVelocity>
|
||||
<TangentialVelocityVariance>0</TangentialVelocityVariance>
|
||||
<TangentialAcceleration>0</TangentialAcceleration>
|
||||
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
|
||||
<Lifetime>10</Lifetime>
|
||||
<LifetimeVariance>2</LifetimeVariance>
|
||||
<SpinVelocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</SpinVelocity>
|
||||
<SpinVelocityVariance>0</SpinVelocityVariance>
|
||||
<SizeRange>
|
||||
<X>0.1</X>
|
||||
<Y>0.05</Y>
|
||||
</SizeRange>
|
||||
<SizeVariance>0.05</SizeVariance>
|
||||
<ColorRange>
|
||||
<Start>
|
||||
<A>255</A>
|
||||
<R>228</R>
|
||||
<G>26</G>
|
||||
<B>199</B>
|
||||
</Start>
|
||||
<End>
|
||||
<A>30</A>
|
||||
<R>223</R>
|
||||
<G>31</G>
|
||||
<B>212</B>
|
||||
</End>
|
||||
</ColorRange>
|
||||
<ColorVariance>0</ColorVariance>
|
||||
</ParticleSettings>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Sprite>smoke</Sprite>
|
||||
<EmitterPosition>
|
||||
<X>358</X>
|
||||
<Y>385</Y>
|
||||
</EmitterPosition>
|
||||
<EmissionOffset>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</EmissionOffset>
|
||||
<EmitRate>11</EmitRate>
|
||||
<MaximumParticleCount>200</MaximumParticleCount>
|
||||
<EmissionRadiusRange>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</EmissionRadiusRange>
|
||||
<Velocity>
|
||||
<X>0</X>
|
||||
<Y>-0</Y>
|
||||
</Velocity>
|
||||
<VelocityVariance>0</VelocityVariance>
|
||||
<Acceleration>
|
||||
<X>0</X>
|
||||
<Y>-13</Y>
|
||||
</Acceleration>
|
||||
<AccelerationVariance>3</AccelerationVariance>
|
||||
<RadialVelocity>0</RadialVelocity>
|
||||
<RadialVelocityVariance>0</RadialVelocityVariance>
|
||||
<RadialAcceleration>0</RadialAcceleration>
|
||||
<RadialAccelerationVariance>0</RadialAccelerationVariance>
|
||||
<TangentialVelocity>0</TangentialVelocity>
|
||||
<TangentialVelocityVariance>0</TangentialVelocityVariance>
|
||||
<TangentialAcceleration>0</TangentialAcceleration>
|
||||
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
|
||||
<Lifetime>3</Lifetime>
|
||||
<LifetimeVariance>0</LifetimeVariance>
|
||||
<SpinVelocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</SpinVelocity>
|
||||
<SpinVelocityVariance>0.3</SpinVelocityVariance>
|
||||
<SizeRange>
|
||||
<X>0</X>
|
||||
<Y>1</Y>
|
||||
</SizeRange>
|
||||
<SizeVariance>0</SizeVariance>
|
||||
<ColorRange>
|
||||
<Start>
|
||||
<A>208</A>
|
||||
<R>128</R>
|
||||
<G>128</G>
|
||||
<B>128</B>
|
||||
</Start>
|
||||
<End>
|
||||
<A>0</A>
|
||||
<R>48</R>
|
||||
<G>48</G>
|
||||
<B>48</B>
|
||||
</End>
|
||||
</ColorRange>
|
||||
<ColorVariance>0</ColorVariance>
|
||||
</ParticleSettings>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Sprite>star1</Sprite>
|
||||
<EmitterPosition>
|
||||
<X>358</X>
|
||||
<Y>385</Y>
|
||||
</EmitterPosition>
|
||||
<EmissionOffset>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</EmissionOffset>
|
||||
<EmitRate>40</EmitRate>
|
||||
<MaximumParticleCount>200</MaximumParticleCount>
|
||||
<EmissionRadiusRange>
|
||||
<X>10</X>
|
||||
<Y>170</Y>
|
||||
</EmissionRadiusRange>
|
||||
<Velocity>
|
||||
<X>0</X>
|
||||
<Y>-20</Y>
|
||||
</Velocity>
|
||||
<VelocityVariance>0</VelocityVariance>
|
||||
<Acceleration>
|
||||
<X>0</X>
|
||||
<Y>-30</Y>
|
||||
</Acceleration>
|
||||
<AccelerationVariance>0</AccelerationVariance>
|
||||
<RadialVelocity>0</RadialVelocity>
|
||||
<RadialVelocityVariance>1</RadialVelocityVariance>
|
||||
<RadialAcceleration>10</RadialAcceleration>
|
||||
<RadialAccelerationVariance>0</RadialAccelerationVariance>
|
||||
<TangentialVelocity>0</TangentialVelocity>
|
||||
<TangentialVelocityVariance>1</TangentialVelocityVariance>
|
||||
<TangentialAcceleration>0</TangentialAcceleration>
|
||||
<TangentialAccelerationVariance>0.2</TangentialAccelerationVariance>
|
||||
<Lifetime>3</Lifetime>
|
||||
<LifetimeVariance>0</LifetimeVariance>
|
||||
<SpinVelocity>
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</SpinVelocity>
|
||||
<SpinVelocityVariance>2</SpinVelocityVariance>
|
||||
<SizeRange>
|
||||
<X>1</X>
|
||||
<Y>1</Y>
|
||||
</SizeRange>
|
||||
<SizeVariance>0</SizeVariance>
|
||||
<ColorRange>
|
||||
<Start>
|
||||
<A>255</A>
|
||||
<R>0</R>
|
||||
<G>0</G>
|
||||
<B>255</B>
|
||||
</Start>
|
||||
<End>
|
||||
<A>255</A>
|
||||
<R>0</R>
|
||||
<G>0</G>
|
||||
<B>0</B>
|
||||
</End>
|
||||
</ColorRange>
|
||||
<ColorVariance>0</ColorVariance>
|
||||
</ParticleSettings>
|
||||
31
Resources/Prototypes/Engine/Entities/Clothing.yml
Normal file
31
Resources/Prototypes/Engine/Entities/Clothing.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
- type: entity
|
||||
id: __engine_janitor_suit
|
||||
name: "[engine] Janitor Jumpsuit"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Items/janitorsuit.png
|
||||
|
||||
- type: Icon
|
||||
texture: Items/janitorsuit.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Physics
|
||||
mass: 5
|
||||
|
||||
- type: entity
|
||||
id: __engine_shoes
|
||||
name: "[engine] shoes"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Items/janitorsuit.png
|
||||
|
||||
- type: Icon
|
||||
texture: Items/shoes.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Physics
|
||||
mass: 5
|
||||
15
Resources/Prototypes/Engine/Entities/Containers.yml
Normal file
15
Resources/Prototypes/Engine/Entities/Containers.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
- type: entity
|
||||
id: __engine_toolbox
|
||||
name: "[engine] toolbox"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Items/toolbox_r.png
|
||||
|
||||
- type: Icon
|
||||
texture: Items/toolbox_r.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Physics
|
||||
mass: 5
|
||||
19
Resources/Prototypes/Engine/Entities/Doors.yml
Normal file
19
Resources/Prototypes/Engine/Entities/Doors.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
- type: entity
|
||||
id: __engine_door
|
||||
name: "[engine] Real Fake Door"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
drawdepth: Objects
|
||||
texture: Objects/door_ew.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/door_ew.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Collidable
|
||||
|
||||
placement:
|
||||
snap:
|
||||
- Wall
|
||||
15
Resources/Prototypes/Engine/Entities/JanitorItems.yml
Normal file
15
Resources/Prototypes/Engine/Entities/JanitorItems.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
- type: entity
|
||||
id: __engine_mop
|
||||
name: "[engine] mop"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Items/mop.png
|
||||
|
||||
- type: Icon
|
||||
texture: Items/mop.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Physics
|
||||
- type: Clickable
|
||||
23
Resources/Prototypes/Engine/Entities/Lights.yml
Normal file
23
Resources/Prototypes/Engine/Entities/Lights.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
- type: entity
|
||||
id: __engine_wall_light
|
||||
name: "[engine] Wall Light"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/wall_light.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/wall_light.png
|
||||
|
||||
- type: BoundingBox
|
||||
|
||||
- type: PointLight
|
||||
radius: 8
|
||||
energy: 1.2
|
||||
offset: "0, -16"
|
||||
color: "#DCDCC6"
|
||||
|
||||
placement:
|
||||
snap:
|
||||
- Wallmount
|
||||
26
Resources/Prototypes/Engine/Entities/Mobs.yml
Normal file
26
Resources/Prototypes/Engine/Entities/Mobs.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
- type: entity
|
||||
id: __engine_human
|
||||
name: "[engine] Urist McHuman"
|
||||
save: false
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
sprite: Mob/greyshirt.rsi
|
||||
state: greyshirt
|
||||
scale: 2, 2
|
||||
drawdepth: Mobs
|
||||
|
||||
- type: Icon
|
||||
sprite: Mob/greyshirt.rsi
|
||||
state: greyshirt
|
||||
|
||||
- type: BoundingBox
|
||||
aabb: "0.15,-0.45,1.05,0.45"
|
||||
|
||||
- type: Physics
|
||||
mass: 5
|
||||
|
||||
- type: Collidable
|
||||
DebugColor: "#0000FF"
|
||||
|
||||
18
Resources/Prototypes/Engine/Entities/Tables.yml
Normal file
18
Resources/Prototypes/Engine/Entities/Tables.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- type: entity
|
||||
id: __engine_worktop
|
||||
name: "[engine] worktop"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/worktop_single.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/worktop_single.png
|
||||
|
||||
- type: BoundingBox
|
||||
aabb: "-0.45,-1,0.95,1"
|
||||
DebugColor: "#0000FF"
|
||||
|
||||
- type: Collidable
|
||||
|
||||
60
Resources/Prototypes/Engine/Entities/Wallmounted.yml
Normal file
60
Resources/Prototypes/Engine/Entities/Wallmounted.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
- type: entity
|
||||
id: __engine_extinguisher
|
||||
name: "[engine] Extinguisher Cabinet"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/fire_extinguisher.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/fire_extinguisher.png
|
||||
|
||||
placement:
|
||||
mode: AlignWall
|
||||
range: 200
|
||||
nodes:
|
||||
- 18
|
||||
- 26
|
||||
- 32
|
||||
snap:
|
||||
- Wallmount
|
||||
|
||||
- type: entity
|
||||
id: __engine_fire_alarm
|
||||
name: "[engine] Fire Alarm"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/fire_alarm_off.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/fire_alarm_off.png
|
||||
|
||||
placement:
|
||||
mode: AlignWall
|
||||
range: 180
|
||||
nodes:
|
||||
- 5
|
||||
- 10
|
||||
- 15
|
||||
snap:
|
||||
- Wallmount
|
||||
|
||||
- type: entity
|
||||
id: __engine_med_cabinet
|
||||
name: "[engine] Medical Cabinet"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/med_cabinet.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/med_cabinet.png
|
||||
|
||||
placement:
|
||||
mode: AlignWall
|
||||
snap:
|
||||
- Wallmount
|
||||
22
Resources/Prototypes/Engine/Entities/Walls.yml
Normal file
22
Resources/Prototypes/Engine/Entities/Walls.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
- type: entity
|
||||
id: __engine_wall
|
||||
name: "[engine] Wall"
|
||||
components:
|
||||
- type: Transform
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
drawdepth: Walls
|
||||
texture: Tiles/wall_texture.png
|
||||
|
||||
- type: Icon
|
||||
texture: Tiles/wall_texture.png
|
||||
|
||||
- type: BoundingBox
|
||||
- type: Collidable
|
||||
- type: Occluder
|
||||
sizeX: 32
|
||||
sizeY: 32
|
||||
|
||||
placement:
|
||||
snap:
|
||||
- Wall
|
||||
7
Resources/Prototypes/Shaders/outline.yml
Normal file
7
Resources/Prototypes/Shaders/outline.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- type: shader
|
||||
id: selection_outline
|
||||
kind: source
|
||||
path: "/Shaders/outline.gdsl"
|
||||
params:
|
||||
outline_width: 1
|
||||
outline_color: "#FF000055"
|
||||
5
Resources/Prototypes/Shaders/stockshaders.yml
Normal file
5
Resources/Prototypes/Shaders/stockshaders.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
# Generic canvas shader without light shading.
|
||||
- type: shader
|
||||
id: unshaded
|
||||
kind: canvas
|
||||
light_mode: unshaded
|
||||
@@ -1,6 +0,0 @@
|
||||
#version 120
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0,0,0,1);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#version 120
|
||||
// Amount to blur.
|
||||
float blurAmount = 0.0135;
|
||||
|
||||
// Our texture sampler.
|
||||
uniform sampler2D sourceSampler;
|
||||
|
||||
|
||||
// Function to perform the sampling for the blur.
|
||||
vec4 psBlurSample(vec2 Tex , vec4 baseColor, float offX, float offY)
|
||||
{
|
||||
vec4 Color; // Output.
|
||||
float scaler = 0; // Scale of the sample.
|
||||
|
||||
// Calculate sample.
|
||||
scaler = (1 + (offY * offX));
|
||||
Tex.x = Tex.x + offX;
|
||||
Tex.y = Tex.y + offY;
|
||||
|
||||
Color = baseColor + texture2D(sourceSampler, Tex / scaler);
|
||||
return Color;
|
||||
}
|
||||
|
||||
|
||||
vec4 Blur()
|
||||
{
|
||||
vec4 Color = vec4(0); // Output.
|
||||
float Alpha = 0; // Alpha component.
|
||||
float blurValue = 0; // Blur value.
|
||||
|
||||
blurValue = blurAmount / 1000.0f;
|
||||
|
||||
if (blurAmount < 0)
|
||||
blurValue = 0;
|
||||
|
||||
if (blurAmount > 10)
|
||||
blurValue = 0.01;
|
||||
|
||||
|
||||
Color = texture2D(sourceSampler, gl_TexCoord[0].xy);
|
||||
|
||||
// Store the alpha for later, we don't want to blur that.
|
||||
Alpha = Color.a;
|
||||
|
||||
// Sample eight directions + the center.
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, -blurValue, -blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, 0, -blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, blurValue, -blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, -blurValue, blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, 0, blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, blurValue, blurValue);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, -blurValue, 0);
|
||||
Color = psBlurSample(gl_TexCoord[0].xy, Color, blurValue, 0);
|
||||
|
||||
// Calculate final color.
|
||||
Color.rgb = clamp((Color.rgb / 9) * vec3(.8,.8,.8),0,1);
|
||||
// Restore and combine the alpha.
|
||||
Color.a = Alpha * float(1);
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = Blur();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#version 120
|
||||
uniform sampler2D backgroundSampler;
|
||||
uniform sampler2D spriteSampler;
|
||||
|
||||
vec2 spriteDimensions;
|
||||
vec2 backbufferSize;
|
||||
|
||||
float cloakAmount = 0;
|
||||
|
||||
|
||||
|
||||
float refractionIndex = 1;
|
||||
|
||||
|
||||
|
||||
vec4 simplePS()
|
||||
{
|
||||
vec2 scaler = spriteDimensions/backbufferSize;
|
||||
vec2 backPos = vec2(0,0);
|
||||
vec4 spriteColor;
|
||||
vec4 newColor;
|
||||
|
||||
spriteColor = texture2D(spriteSampler, gl_TexCoord[0].xy);
|
||||
|
||||
if (spriteColor.a > 0)
|
||||
{
|
||||
backPos = (gl_TexCoord[0].xy * scaler);
|
||||
|
||||
|
||||
if ((spriteColor.r >= 0) && (spriteColor.r < 0.5))
|
||||
backPos.x += (spriteColor.r * cloakAmount) * (scaler.x / refractionIndex);
|
||||
else
|
||||
backPos.x -= (spriteColor.r * cloakAmount) * (scaler.x / refractionIndex);
|
||||
|
||||
if ((spriteColor.g >= 0.0) && (spriteColor.g < 0.5))
|
||||
backPos.y += (spriteColor.g * cloakAmount) * (scaler.y / refractionIndex);
|
||||
else
|
||||
backPos.y -= (spriteColor.g * cloakAmount) * (scaler.y / refractionIndex);
|
||||
|
||||
backPos.x += (spriteColor.b * cloakAmount) * (scaler.y / refractionIndex);
|
||||
backPos.y += (spriteColor.b * cloakAmount) * (scaler.y / refractionIndex);
|
||||
|
||||
newColor = texture2D(backgroundSampler, backPos);
|
||||
newColor = (newColor * (1 - (spriteColor.a - cloakAmount))) + (spriteColor * (spriteColor.a - cloakAmount));
|
||||
newColor.a = spriteColor.a;
|
||||
newColor *= vec4(.8,.8,.8,1);
|
||||
}
|
||||
|
||||
return newColor;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = simplePS();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#version 120
|
||||
uniform sampler2D sceneSampler;
|
||||
|
||||
|
||||
float duration;
|
||||
vec3 color_offset = vec3(0.2, 0.4, 0.3);
|
||||
int Iterations = 128;
|
||||
vec2 Pan = vec2(0.3776610, -0.3435075);
|
||||
float Zoom = 0.4;
|
||||
float Aspect = 1;
|
||||
vec2 JuliaSeed = vec2(-0.439, 0.576);
|
||||
vec3 ColorScale = vec3(6, 5, 4);
|
||||
|
||||
vec4 DeathShaderPS()
|
||||
{
|
||||
vec4 c = texture2D(sceneSampler, gl_TexCoord[0].xy);
|
||||
|
||||
c.b = c.g = 0;
|
||||
return c;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = DeathShaderPS();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 11
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
uniform vec2 weights_offsets15;
|
||||
uniform vec2 weights_offsets16;
|
||||
uniform vec2 weights_offsets17;
|
||||
uniform vec2 weights_offsets18;
|
||||
uniform vec2 weights_offsets19;
|
||||
uniform vec2 weights_offsets20;
|
||||
uniform vec2 weights_offsets21;
|
||||
uniform vec2 weights_offsets22;
|
||||
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurHorizontal()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14,
|
||||
weights_offsets15,
|
||||
weights_offsets16,
|
||||
weights_offsets17,
|
||||
weights_offsets18,
|
||||
weights_offsets19,
|
||||
weights_offsets20,
|
||||
weights_offsets21,
|
||||
weights_offsets22
|
||||
);
|
||||
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
{
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x + weights_offsets[i].y, gl_TexCoord[0].y))* weights_offsets[i].x;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurHorizontal();
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 11
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
uniform vec2 weights_offsets15;
|
||||
uniform vec2 weights_offsets16;
|
||||
uniform vec2 weights_offsets17;
|
||||
uniform vec2 weights_offsets18;
|
||||
uniform vec2 weights_offsets19;
|
||||
uniform vec2 weights_offsets20;
|
||||
uniform vec2 weights_offsets21;
|
||||
uniform vec2 weights_offsets22;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurVertical()
|
||||
{
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14,
|
||||
weights_offsets15,
|
||||
weights_offsets16,
|
||||
weights_offsets17,
|
||||
weights_offsets18,
|
||||
weights_offsets19,
|
||||
weights_offsets20,
|
||||
weights_offsets21,
|
||||
weights_offsets22
|
||||
);
|
||||
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
{
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y + weights_offsets[i].y)) * weights_offsets[i].x; // M A G I K
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurVertical();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 3
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurHorizontal()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x + weights_offsets[i].y, gl_TexCoord[0].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurHorizontal();
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 3
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurVertical()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y + weights_offsets[i].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurVertical();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#version 120
|
||||
attribute vec4 a_color;
|
||||
attribute vec3 a_position;
|
||||
attribute vec2 a_texCoord0;
|
||||
|
||||
varying vec2 TexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 5
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurHorizontal()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x + weights_offsets[i].y, gl_TexCoord[0].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurHorizontal();
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 5
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurVertical()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y + weights_offsets[i].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurVertical();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 7
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurHorizontal()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x + weights_offsets[i].y, gl_TexCoord[0].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurHorizontal();
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 7
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurVertical()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y + weights_offsets[i].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurVertical();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 9
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
uniform vec2 weights_offsets15;
|
||||
uniform vec2 weights_offsets16;
|
||||
uniform vec2 weights_offsets17;
|
||||
uniform vec2 weights_offsets18;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurHorizontal()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14,
|
||||
weights_offsets15,
|
||||
weights_offsets16,
|
||||
weights_offsets17,
|
||||
weights_offsets18
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x + weights_offsets[i].y, gl_TexCoord[0].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
|
||||
gl_FragColor = GaussianBlurHorizontal();
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 120
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#version 120
|
||||
#define RADIUS 9
|
||||
#define KERNEL_SIZE (RADIUS * 2 + 1)
|
||||
|
||||
uniform vec2 weights_offsets[KERNEL_SIZE];
|
||||
uniform vec2 weights_offsets0;
|
||||
uniform vec2 weights_offsets1;
|
||||
uniform vec2 weights_offsets2;
|
||||
uniform vec2 weights_offsets3;
|
||||
uniform vec2 weights_offsets4;
|
||||
uniform vec2 weights_offsets5;
|
||||
uniform vec2 weights_offsets6;
|
||||
uniform vec2 weights_offsets7;
|
||||
uniform vec2 weights_offsets8;
|
||||
uniform vec2 weights_offsets9;
|
||||
uniform vec2 weights_offsets10;
|
||||
uniform vec2 weights_offsets11;
|
||||
uniform vec2 weights_offsets12;
|
||||
uniform vec2 weights_offsets13;
|
||||
uniform vec2 weights_offsets14;
|
||||
uniform vec2 weights_offsets15;
|
||||
uniform vec2 weights_offsets16;
|
||||
uniform vec2 weights_offsets17;
|
||||
uniform vec2 weights_offsets18;
|
||||
|
||||
uniform sampler2D colorMapTexture;
|
||||
|
||||
vec4 GaussianBlurVertical()
|
||||
{
|
||||
vec4 color = vec4(0,0,0,0);
|
||||
|
||||
vec2 weights_offsets[KERNEL_SIZE] = vec2[KERNEL_SIZE]
|
||||
(
|
||||
weights_offsets0,
|
||||
weights_offsets1,
|
||||
weights_offsets2,
|
||||
weights_offsets3,
|
||||
weights_offsets4,
|
||||
weights_offsets5,
|
||||
weights_offsets6,
|
||||
weights_offsets7,
|
||||
weights_offsets8,
|
||||
weights_offsets9,
|
||||
weights_offsets10,
|
||||
weights_offsets11,
|
||||
weights_offsets12,
|
||||
weights_offsets13,
|
||||
weights_offsets14,
|
||||
weights_offsets15,
|
||||
weights_offsets16,
|
||||
weights_offsets17,
|
||||
weights_offsets18
|
||||
);
|
||||
|
||||
for (int i = 0; i < KERNEL_SIZE; ++i)
|
||||
color += texture2D(colorMapTexture, vec2(gl_TexCoord[0].x, gl_TexCoord[0].y + weights_offsets[i].y)) * weights_offsets[i].x;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = GaussianBlurVertical();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#version 120
|
||||
uniform sampler2D TextureUnit0;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(TextureUnit0,gl_TexCoord[0].xy);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
#version 120
|
||||
#define NUM_LIGHTS 6
|
||||
uniform vec4 LightPosData0;
|
||||
uniform vec4 LightPosData1;
|
||||
uniform vec4 LightPosData2;
|
||||
uniform vec4 LightPosData3;
|
||||
uniform vec4 LightPosData4;
|
||||
uniform vec4 LightPosData5;
|
||||
uniform vec4 LightPosData[NUM_LIGHTS];
|
||||
|
||||
uniform vec4 Colors[NUM_LIGHTS];
|
||||
uniform vec4 Colors0;
|
||||
uniform vec4 Colors1;
|
||||
uniform vec4 Colors2;
|
||||
uniform vec4 Colors3;
|
||||
uniform vec4 Colors4;
|
||||
uniform vec4 Colors5;
|
||||
|
||||
uniform sampler2D light0;
|
||||
uniform sampler2D light1;
|
||||
uniform sampler2D light2;
|
||||
uniform sampler2D light3;
|
||||
uniform sampler2D light4;
|
||||
uniform sampler2D light5;
|
||||
|
||||
uniform sampler2D sceneTexture;
|
||||
|
||||
vec4 PreLightBlendPS()
|
||||
{
|
||||
vec4 Colors[NUM_LIGHTS] = vec4[NUM_LIGHTS]
|
||||
(
|
||||
Colors0,
|
||||
Colors1,
|
||||
Colors2,
|
||||
Colors3,
|
||||
Colors4,
|
||||
Colors5
|
||||
);
|
||||
|
||||
vec4 LightPosData[NUM_LIGHTS] = vec4[NUM_LIGHTS]
|
||||
(
|
||||
LightPosData0,
|
||||
LightPosData1,
|
||||
LightPosData2,
|
||||
LightPosData3,
|
||||
LightPosData4,
|
||||
LightPosData5
|
||||
);
|
||||
|
||||
vec4 l[NUM_LIGHTS];
|
||||
vec2 ltc[NUM_LIGHTS];
|
||||
for(int i = 0;i<NUM_LIGHTS;i++)
|
||||
{
|
||||
ltc[i] = vec2((gl_TexCoord[0].x - LightPosData[i].x) * LightPosData[i].z, (gl_TexCoord[0].y - LightPosData[i].y) * LightPosData[i].w);
|
||||
}
|
||||
l[0] = texture2D(light0, ltc[0]);
|
||||
l[1] = texture2D(light1, ltc[1]);
|
||||
l[2] = texture2D(light2, ltc[2]);
|
||||
l[3] = texture2D(light3, ltc[3]);
|
||||
l[4] = texture2D(light4, ltc[4]);
|
||||
l[5] = texture2D(light5, ltc[5]);
|
||||
|
||||
l[0].rgb = l[0].rgb * Colors[0].rgb;
|
||||
l[1].rgb = l[1].rgb * Colors[1].rgb;
|
||||
l[2].rgb = l[2].rgb * Colors[2].rgb;
|
||||
l[3].rgb = l[3].rgb * Colors[3].rgb;
|
||||
l[4].rgb = l[4].rgb * Colors[4].rgb;
|
||||
l[5].rgb = l[5].rgb * Colors[5].rgb;
|
||||
|
||||
vec4 s = texture2D(sceneTexture, gl_TexCoord[0].xy); // sample existing lights
|
||||
|
||||
//Add the lights together
|
||||
float r = sqrt(pow(l[0].r, 2) + pow(l[1].r, 2) + pow(l[2].r, 2) + pow(l[3].r, 2) + pow(l[4].r, 2) + pow(l[5].r, 2) + pow(s.r, 2));
|
||||
float g = sqrt(pow(l[0].g, 2) + pow(l[1].g, 2) + pow(l[2].g, 2) + pow(l[3].g, 2) + pow(l[4].g, 2) + pow(l[5].g, 2) + pow(s.g, 2));
|
||||
float b = sqrt(pow(l[0].b, 2) + pow(l[1].b, 2) + pow(l[2].b, 2) + pow(l[3].b, 2) + pow(l[4].b, 2) + pow(l[5].b, 2) + pow(s.b, 2));
|
||||
vec4 c = vec4(r,g,b, 1);
|
||||
return c;
|
||||
//Return the light color
|
||||
return vec4(c.rgb,min(1, 1/max(c.r, max(c.g,c.b))));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = PreLightBlendPS();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#version 120
|
||||
uniform sampler2D TextureUnit0;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
gl_FragColor = texture2D(TextureUnit0,gl_TexCoord[0].xy) + vec4(.5,0,0,0);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 120
|
||||
void main()
|
||||
{
|
||||
// transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
// transform the texture coordinates
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
// forward the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user