Mod config migration from plugin hub
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (NuGet) (push) Successful in 50s
Build / Build Nuget package (SharedCringe) (push) Successful in 58s
Build / Build Nuget package (CringePlugins) (push) Successful in 1m11s
Build / Build Launcher (push) Successful in 1m42s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 3m5s

Update ui when migrating pluginhub config
Added mod loader as a default plugin
Temp fix for pbs
This commit is contained in:
2025-05-13 04:04:22 -04:00
parent 3295afc447
commit 78880d2a78
4 changed files with 138 additions and 24 deletions

View File

@@ -12,7 +12,7 @@ using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class ModAssemblyLoadContextPatches
public static class ModAssemblyLoadContextPatches //todo: use ModScriptCompilerPatch
{
private static ModAssemblyLoadContext? _currentSessionContext;
private static readonly MyConcurrentHashSet<string> AssemblyNames = [];
@@ -30,7 +30,7 @@ public static class ModAssemblyLoadContextPatches
.InsertAndAdvance(new(OpCodes.Ldarg_0), CodeInstruction.LoadField(original.DeclaringType, "target"))
.SetInstruction(CodeInstruction.CallClosure((byte[] assembly, byte[] symbols, MyApiTarget target) =>
{
if (target is not MyApiTarget.Mod) return Assembly.Load(assembly, symbols);
//if (target is not MyApiTarget.Mod) return Assembly.Load(assembly, symbols);
ArgumentNullException.ThrowIfNull(_currentSessionContext, "No session context");
return _currentSessionContext.LoadFromStream(new MemoryStream(assembly), new MemoryStream(symbols));
}))
@@ -39,7 +39,7 @@ public static class ModAssemblyLoadContextPatches
.InsertAndAdvance(new(OpCodes.Ldarg_0), CodeInstruction.LoadField(original.DeclaringType, "target"))
.SetInstruction(CodeInstruction.CallClosure((byte[] assembly, MyApiTarget target) =>
{
if (target is not MyApiTarget.Mod) return Assembly.Load(assembly);
//if (target is not MyApiTarget.Mod) return Assembly.Load(assembly);
ArgumentNullException.ThrowIfNull(_currentSessionContext, "No session context");
return _currentSessionContext.LoadFromStream(new MemoryStream(assembly));
}))