Check if Zstd is installed

This commit is contained in:
Wrexbe (Josh)
2023-08-19 18:32:17 -07:00
parent dab7a9112f
commit eb2dd3230e
3 changed files with 26 additions and 0 deletions

View File

@@ -110,6 +110,13 @@ namespace Robust.Client
{
DebugTools.AssertNotNull(_resourceManifest);
if (!ZStd.IsSupported())
{
_logger.Fatal("A required dll was not found. You need to install {DllName}.", "ZStd");
return false;
}
_clyde.InitializePostWindowing();
_clydeAudio.InitializePostWindowing();
_clyde.SetWindowTitle(

View File

@@ -265,6 +265,12 @@ namespace Robust.Server
return true;
}
if (!ZStd.IsSupported())
{
_logger.Fatal("A required dll was not found. You need to install {DllName}.", "ZStd");
return true;
}
// Has to be done early because this guy's in charge of the main thread Synchronization Context.
_taskManager.Initialize();

View File

@@ -19,6 +19,19 @@ public static class ZStd
return (int)ZSTD_COMPRESSBOUND((nuint)length);
}
public static bool IsSupported()
{
try
{
Marshal.PrelinkAll(typeof(Zstd));
return true;
}
catch (DllNotFoundException)
{
return false;
}
}
public static unsafe int Compress(
Span<byte> into,
ReadOnlySpan<byte> data,