diff --git a/.github/workflows/ci-otapi3.yml b/.github/workflows/ci-otapi3.yml
new file mode 100644
index 00000000..7e02f47d
--- /dev/null
+++ b/.github/workflows/ci-otapi3.yml
@@ -0,0 +1,39 @@
+name: CI(OTAPI3)
+
+on: [push]
+
+jobs:
+ test:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.100'
+
+ - name: MonoMod dev build
+ run: dotnet nuget add source https://pkgs.dev.azure.com/MonoMod/MonoMod/_packaging/DevBuilds%40Local/nuget/v3/index.json -n DevBuilds@Local
+
+ - name: Run tests
+ run: dotnet test
+
+ build:
+ runs-on: windows-latest
+ strategy:
+ matrix:
+ arch: ["win-x64", "osx-x64", "linux-x64", "linux-arm64", "linux-arm"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.100'
+
+ - name: MonoMod dev build
+ run: dotnet nuget add source https://pkgs.dev.azure.com/MonoMod/MonoMod/_packaging/DevBuilds%40Local/nuget/v3/index.json -n DevBuilds@Local
+
+ - name: Produce build
+ run: dotnet publish -r ${{ matrix.mode }} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained true
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 8f750f4c..a4795b3a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -9,9 +9,12 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
- "program": "${workspaceFolder}/TShockAPI/bin/Debug/net5.0/TerrariaServerAPI.dll",
+ "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.Run.dll",
+ "windows": {
+ "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.dll",
+ },
"args": [],
- "cwd": "${workspaceFolder}/TShockAPI/bin/Debug/net5.0/",
+ "cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/",
"console": "integratedTerminal",
"stopAtEntry": false
},
@@ -19,6 +22,65 @@
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
+ },
+ {
+ // this command assumes you have:
+ // raspberry pi 4 b with default user/pass, SSH enabled & connected to a reliable connection
+ // dotnet sdk 6.0.100 (needed for breakpoints to hit)
+ // windows with putty installed
+ // vsdbg
+ // follow this for other OS's: https://docs.microsoft.com/en-us/dotnet/iot/debugging?tabs=self-contained&pivots=vscode
+ // TODO: ability to chmod +x TShock.sh && chmod +x bin/TShock.Run
+ "name": ".NET Remote Launch - Self-contained",
+ "type": "coreclr",
+ "request": "launch",
+ "program": "/home/pi/dotnet/dotnet",
+ "args": [
+ "bin/TShock.Run.dll"
+ ],
+ "cwd": "/home/pi/tshockdev/publish",
+ "stopAtEntry": false,
+ "console": "integratedTerminal",
+ "pipeTransport": {
+ "pipeCwd": "${workspaceRoot}",
+ "pipeProgram": "C:\\Program Files\\PuTTY\\PLINK.EXE",
+ "pipeArgs": [
+ "-pw",
+ "raspberry",
+ "pi@raspberrypi"
+ ],
+ "debuggerPath": "/home/pi/vsdbg/vsdbg"
+ }
+ },
+ {
+ // this command assumes you have:
+ // raspberry pi 4 b with default user/pass, SSH enabled & connected to a reliable connection
+ // dotnet sdk 6.0.100 (needed for breakpoints to hit)
+ // windows with putty installed
+ // vsdbg
+ // follow this for other OS's: https://docs.microsoft.com/en-us/dotnet/iot/debugging?tabs=self-contained&pivots=vscode
+ // TODO: ability to chmod +x TShock.sh && chmod +x bin/TShock.Run
+ "name": ".NET Remote Publish & Launch - Self-contained",
+ "type": "coreclr",
+ "request": "launch",
+ "program": "/home/pi/dotnet/dotnet",
+ "args": [
+ "bin/TShock.Run.dll"
+ ],
+ "cwd": "/home/pi/tshockdev/publish",
+ "stopAtEntry": false,
+ "console": "integratedTerminal",
+ "preLaunchTask": "Remote Publish",
+ "pipeTransport": {
+ "pipeCwd": "${workspaceRoot}",
+ "pipeProgram": "C:\\Program Files\\PuTTY\\PLINK.EXE",
+ "pipeArgs": [
+ "-pw",
+ "raspberry",
+ "pi@raspberrypi"
+ ],
+ "debuggerPath": "/home/pi/vsdbg/vsdbg"
+ }
}
]
}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index b2d5b972..e8db5b18 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -12,6 +12,45 @@
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
+ },
+ {
+ "label": "Publish",
+ "options": {
+ "cwd": "TShockLauncher"
+ },
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "publish",
+ "-c",
+ "Debug",
+ "--self-contained",
+ "true",
+ "-r",
+ "linux-arm64",
+ "/nowarn:CS1591",
+ "/nowarn:CS1587"
+ ],
+ },
+ {
+ "label": "Remote Publish",
+ "options": {
+ "cwd": "TShockLauncher/bin/Debug/net6.0/linux-arm64"
+ },
+ "command": "C:\\Program Files\\PuTTY\\pscp.exe",
+ "type": "process",
+ "args": [
+ "-pw",
+ "raspberry",
+ "-sftp",
+ "-p",
+ "-r",
+ "publish",
+ "pi@raspberrypi:/home/pi/tshockdev"
+ ],
+ "dependsOn": [
+ "Publish"
+ ]
}
]
}
diff --git a/TShock.sln b/TShock.sln
index af1bc555..4e53bcfa 100644
--- a/TShock.sln
+++ b/TShock.sln
@@ -9,7 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TShockAPI", "TShockAPI\TSho
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerrariaServerAPI", "TerrariaServerAPI\TerrariaServerAPI\TerrariaServerAPI.csproj", "{6877506E-ADC6-4142-98A6-79E4FA02855A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockLauncher", "TShockLauncher\TShockLauncher.csproj", "{2A312452-A43F-43E3-8AEB-E22F9A35C210}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TShockLauncher", "TShockLauncher\TShockLauncher.csproj", "{2A312452-A43F-43E3-8AEB-E22F9A35C210}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TShockLauncher.Tests", "TShockLauncher.Tests\TShockLauncher.Tests.csproj", "{90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -71,6 +73,22 @@ Global
{2A312452-A43F-43E3-8AEB-E22F9A35C210}.Release|x64.Build.0 = Release|Any CPU
{2A312452-A43F-43E3-8AEB-E22F9A35C210}.Release|x86.ActiveCfg = Release|Any CPU
{2A312452-A43F-43E3-8AEB-E22F9A35C210}.Release|x86.Build.0 = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|x64.Build.0 = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Debug|x86.Build.0 = Debug|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|x64.ActiveCfg = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|x64.Build.0 = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|x86.ActiveCfg = Release|Any CPU
+ {90AB47F3-8220-48FC-BDAB-D6E97BFDA51B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/TShockLauncher.Tests/ServerInitTests.cs b/TShockLauncher.Tests/ServerInitTests.cs
new file mode 100644
index 00000000..c5e9813e
--- /dev/null
+++ b/TShockLauncher.Tests/ServerInitTests.cs
@@ -0,0 +1,31 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Diagnostics;
+using System.Threading;
+
+namespace TShockLauncher.Tests
+{
+ [TestClass]
+ public class ServerInitTests
+ {
+ [TestMethod]
+ public void EnsureBoots()
+ {
+ var are = new AutoResetEvent(false);
+ On.Terraria.Main.hook_DedServ cb = (On.Terraria.Main.orig_DedServ orig, Terraria.Main instance) =>
+ {
+ are.Set();
+ Debug.WriteLine("Server init process successful");
+ };
+ On.Terraria.Main.DedServ += cb;
+
+ new Thread(() => TerrariaApi.Server.Program.Main(new string[] { })).Start();
+
+ var hit = are.WaitOne(TimeSpan.FromSeconds(10));
+
+ On.Terraria.Main.DedServ -= cb;
+
+ Assert.AreEqual(true, hit);
+ }
+ }
+}
diff --git a/TShockLauncher.Tests/TShockLauncher.Tests.csproj b/TShockLauncher.Tests/TShockLauncher.Tests.csproj
new file mode 100644
index 00000000..9f321340
--- /dev/null
+++ b/TShockLauncher.Tests/TShockLauncher.Tests.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TShockLauncher/TShockLauncher.csproj b/TShockLauncher/TShockLauncher.csproj
index 9b3db346..26a462d3 100644
--- a/TShockLauncher/TShockLauncher.csproj
+++ b/TShockLauncher/TShockLauncher.csproj
@@ -5,18 +5,18 @@
net6.0
enable
enable
- TShock
- TShock.Run
+ TShock
+ TShock.Run
Always
+ embedded
+ true
-
-
-
- false
-
-
+
+
+
+
..\prebuilts\HttpServer.dll
@@ -28,23 +28,27 @@
-
-
-
-
-
-
-
-
-
-
+
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -83,9 +87,8 @@
-
-
+
-
+
diff --git a/TerrariaServerAPI b/TerrariaServerAPI
index a0b3dacf..a7949a2c 160000
--- a/TerrariaServerAPI
+++ b/TerrariaServerAPI
@@ -1 +1 @@
-Subproject commit a0b3dacfeea710cc62c8be43dc607678908f9fc8
+Subproject commit a7949a2cee98e43e321ed9981c92d08334156f79