From 88739f7cadc7f7d42ff3120294543ce1badfb84b Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Sun, 11 May 2025 02:27:31 +0700 Subject: [PATCH] hack around steamworks being an override load so skipping game context unmanaged resolver --- CringeLauncher/Launcher.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CringeLauncher/Launcher.cs b/CringeLauncher/Launcher.cs index cea3dbc..340cb8f 100644 --- a/CringeLauncher/Launcher.cs +++ b/CringeLauncher/Launcher.cs @@ -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();