hack around steamworks being an override load so skipping game context unmanaged resolver

This commit is contained in:
zznty
2025-05-11 02:27:31 +07:00
parent 1274e7abcf
commit 88739f7cad

View File

@@ -1,5 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using CringeBootstrap.Abstractions;
using CringeLauncher.Utils;
using CringePlugins.Loader;
@@ -7,7 +9,6 @@ using CringePlugins.Render;
using CringePlugins.Splash;
using HarmonyLib;
using NLog;
using ParallelTasks;
using Sandbox;
using Sandbox.Engine.Networking;
using Sandbox.Engine.Platform.VideoMode;
@@ -70,6 +71,10 @@ public class Launcher : ICorePlugin
CheckUpdates(args).GetAwaiter().GetResult();
#endif
// hook up steam as we ship it inside base context as an override
if (AssemblyLoadContext.GetLoadContext(typeof(Launcher).Assembly) is ICoreLoadContext coreLoadContext)
NativeLibrary.SetDllImportResolver(typeof(Steamworks.Constants).Assembly, (name, _, _) => coreLoadContext.ResolveUnmanagedDll(name));
_harmony.PatchAll(typeof(Launcher).Assembly);
var splash = new Splash();