Skip to content

Commit

Permalink
.NET 8 :soda: (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
PJB3005 authored Dec 13, 2023
1 parent e9cc769 commit 2dd097f
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Launcher.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
2. Download .NET runtime script.
3. Local dev SS14.Loader launching code.
-->
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Version>0.24.0</Version>
</PropertyGroup>
</Project>
6 changes: 0 additions & 6 deletions SS14.Launcher/Api/AuthApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,4 @@ public AuthApiException(string message) : base(message)
public AuthApiException(string message, Exception inner) : base(message, inner)
{
}

protected AuthApiException(
SerializationInfo info,
StreamingContext context) : base(info, context)
{
}
}
2 changes: 1 addition & 1 deletion SS14.Launcher/Models/Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ private static async Task<ProcessStartInfo> GetLoaderStartInfo()
basePath = Path.GetFullPath(Path.Combine(
LauncherPaths.DirLauncherInstall,
"..", "..", "..", "..",
"SS14.Loader", "bin", "Debug", "net7.0"));
"SS14.Loader", "bin", "Debug", "net8.0"));
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
Expand Down
54 changes: 26 additions & 28 deletions SS14.Launcher/Utility/ZStd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ public ZStdException(string message, Exception inner) : base(message, inner)
{
}

protected ZStdException(
SerializationInfo info,
StreamingContext context) : base(info, context)
{
}

public static unsafe ZStdException FromCode(nuint code)
{
return new ZStdException(Marshal.PtrToStringUTF8((IntPtr)ZSTD_getErrorName(code))!);
Expand Down Expand Up @@ -291,30 +285,34 @@ public override async ValueTask<int> ReadAsync(
return 0;
}

unsafe
var ret = DecompressChunk(this, buffer.Span);
if (ret > 0)
return (int)ret;

} while (true);

static unsafe nuint DecompressChunk(ZStdDecompressStream stream, Span<byte> buffer)
{
fixed (byte* inputPtr = stream._buffer)
fixed (byte* outputPtr = buffer)
{
fixed (byte* inputPtr = _buffer)
fixed (byte* outputPtr = buffer.Span)
{
ZSTD_outBuffer outputBuf = default;
outputBuf.dst = outputPtr;
outputBuf.pos = 0;
outputBuf.size = (nuint)buffer.Length;
ZSTD_inBuffer inputBuf = default;
inputBuf.src = inputPtr;
inputBuf.pos = (nuint)_bufferPos;
inputBuf.size = (nuint)_bufferSize;

var ret = ZSTD_decompressStream(_ctx, &outputBuf, &inputBuf);

_bufferPos = (int)inputBuf.pos;
ZStdException.ThrowIfError(ret);

if (outputBuf.pos > 0)
return (int)outputBuf.pos;
}
ZSTD_outBuffer outputBuf = default;
outputBuf.dst = outputPtr;
outputBuf.pos = 0;
outputBuf.size = (nuint)buffer.Length;
ZSTD_inBuffer inputBuf = default;
inputBuf.src = inputPtr;
inputBuf.pos = (nuint)stream._bufferPos;
inputBuf.size = (nuint)stream._bufferSize;

var ret = ZSTD_decompressStream(stream._ctx, &outputBuf, &inputBuf);

stream._bufferPos = (int)inputBuf.pos;
ZStdException.ThrowIfError(ret);

return outputBuf.pos;
}
} while (true);
}
}

public override long Seek(long offset, SeekOrigin origin)
Expand Down
8 changes: 4 additions & 4 deletions download_net_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
PLATFORM_LINUX = "linux"
PLATFORM_MACOS = "mac"

DOTNET_RUNTIME_VERSION = "7.0.3"
DOTNET_RUNTIME_VERSION = "8.0.0"

DOTNET_RUNTIME_DOWNLOADS = {
PLATFORM_LINUX: "https://download.visualstudio.microsoft.com/download/pr/2431d5ac-f5db-4bb1-bcf0-4a2d9725d4e4/1b0747add72af919754509f83ad08660/dotnet-runtime-7.0.3-linux-x64.tar.gz",
PLATFORM_WINDOWS: "https://download.visualstudio.microsoft.com/download/pr/e30129ab-4e46-42af-90a9-a5b597b06746/3e9993907f00eaba9da4a8d9ed168657/dotnet-runtime-7.0.3-win-x64.zip",
PLATFORM_MACOS: "https://download.visualstudio.microsoft.com/download/pr/c8f49e77-4d55-4a33-aa87-ddc034be61a2/77a50b1726446bee5a3a4dc6573568e2/dotnet-runtime-7.0.3-osx-x64.tar.gz"
PLATFORM_LINUX: "https://download.visualstudio.microsoft.com/download/pr/fc4b4447-45f2-4fd2-899a-77eb1aed7792/6fd52c0c61f064ddc7fe7684e841f491/dotnet-runtime-8.0.0-linux-x64.tar.gz",
PLATFORM_WINDOWS: "https://download.visualstudio.microsoft.com/download/pr/924f2e25-ba50-4b90-a35c-6ef73d1149a3/b9a57fa45dad7cca93a0aa937a8ba03d/dotnet-runtime-8.0.0-win-x64.zip",
PLATFORM_MACOS: "https://download.visualstudio.microsoft.com/download/pr/65e0ad28-b73d-46ab-b3ae-2d2ae4460b78/50ee103e816a255f9a5331bc2975a6ef/dotnet-runtime-8.0.0-osx-x64.tar.gz"
}

p = os.path.join
Expand Down
4 changes: 2 additions & 2 deletions publish_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mkdir -p bin/publish/Linux/bin/loader
mkdir -p bin/publish/Linux/dotnet

cp PublishFiles/SS14.Launcher PublishFiles/SS14.desktop bin/publish/Linux/
cp SS14.Launcher/bin/Release/net7.0/linux-x64/publish/* bin/publish/Linux/bin/
cp SS14.Loader/bin/Release/net7.0/linux-x64/publish/* bin/publish/Linux/bin/loader
cp SS14.Launcher/bin/Release/net8.0/linux-x64/publish/* bin/publish/Linux/bin/
cp SS14.Loader/bin/Release/net8.0/linux-x64/publish/* bin/publish/Linux/bin/loader
cp -r Dependencies/dotnet/linux/* bin/publish/Linux/dotnet/

cd bin/publish/Linux
Expand Down
4 changes: 2 additions & 2 deletions publish_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ mkdir -p "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin
mkdir -p "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin/loader/Space Station 14.app/Contents/Resources/bin/"

cp -r Dependencies/dotnet/mac/* "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/dotnet/"
cp -r SS14.Launcher/bin/Release/net7.0/osx-x64/publish/* "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin/"
cp -r SS14.Loader/bin/Release/net7.0/osx-x64/publish/* "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin/loader/Space Station 14.app/Contents/Resources/bin/"
cp -r SS14.Launcher/bin/Release/net8.0/osx-x64/publish/* "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin/"
cp -r SS14.Loader/bin/Release/net8.0/osx-x64/publish/* "bin/publish/macOS/Space Station 14 Launcher.app/Contents/Resources/bin/loader/Space Station 14.app/Contents/Resources/bin/"
pushd bin/publish/macOS
zip -r ../../../SS14.Launcher_macOS.zip *
popd
8 changes: 4 additions & 4 deletions publish_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ dotnet publish SS14.Launcher/SS14.Launcher.csproj /p:FullRelease=True -c Release
dotnet publish SS14.Loader/SS14.Loader.csproj -c Release --no-self-contained -r win-x64 /nologo
dotnet publish SS14.Launcher.Bootstrap/SS14.Launcher.Bootstrap.csproj -c Release /nologo

./exe_set_subsystem.py "SS14.Launcher/bin/Release/net7.0/win-x64/publish/SS14.Launcher.exe" 2
./exe_set_subsystem.py "SS14.Loader/bin/Release/net7.0/win-x64/publish/SS14.Loader.exe" 2
./exe_set_subsystem.py "SS14.Launcher/bin/Release/net8.0/win-x64/publish/SS14.Launcher.exe" 2
./exe_set_subsystem.py "SS14.Loader/bin/Release/net8.0/win-x64/publish/SS14.Loader.exe" 2

# Create intermediate directories.
mkdir -p bin/publish/Windows/bin
Expand All @@ -23,8 +23,8 @@ mkdir -p bin/publish/Windows/dotnet
cp -r Dependencies/dotnet/windows/* bin/publish/Windows/dotnet
cp "SS14.Launcher.Bootstrap/bin/Release/net45/publish/Space Station 14 Launcher.exe" bin/publish/Windows
cp "SS14.Launcher.Bootstrap/console.bat" bin/publish/Windows
cp SS14.Launcher/bin/Release/net7.0/win-x64/publish/* bin/publish/Windows/bin
cp SS14.Loader/bin/Release/net7.0/win-x64/publish/* bin/publish/Windows/bin/loader
cp SS14.Launcher/bin/Release/net8.0/win-x64/publish/* bin/publish/Windows/bin
cp SS14.Loader/bin/Release/net8.0/win-x64/publish/* bin/publish/Windows/bin/loader

pushd bin/publish/Windows
zip -r ../../../SS14.Launcher_Windows.zip *
Expand Down

0 comments on commit 2dd097f

Please sign in to comment.