Files
RobustToolbox/Robust.Client/Utility/ClientDllMap.cs
T
Pieter-Jan BriersandGitHub 5268a4a3f0 Move SDL3 binding to NuGet package (#6184)
I'm worried about the IDE performance overhead of the 20k lines of LibraryImport it generates into Robust.Client.

Also, this allows me to trim the binding, which saves a tiny amount of space from publishes. Always nice to have.
2025-09-04 18:44:49 +02:00

43 lines
1.0 KiB
C#

#if !WINDOWS
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using OpenTK.Audio.OpenAL;
using SDL3;
namespace Robust.Client.Utility
{
internal static class ClientDllMap
{
[ModuleInitializer]
internal static void Initialize()
{
NativeLibrary.SetDllImportResolver(typeof(ClientDllMap).Assembly, (name, assembly, path) =>
{
if (name == "swnfd.dll")
{
#if LINUX || FREEBSD
return NativeLibrary.Load("libswnfd.so", assembly, path);
#elif MACOS
return NativeLibrary.Load("libswnfd.dylib", assembly, path);
#endif
}
if (name == "libEGL.dll")
{
#if LINUX || FREEBSD
return NativeLibrary.Load("libEGL.so", assembly, path);
#endif
}
return IntPtr.Zero;
});
#if MACOS
OpenALLibraryNameContainer.OverridePath = "libopenal.1.dylib";
#endif
}
}
}
#endif