mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 14:52:35 +02:00
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.
43 lines
1.0 KiB
C#
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
|