feature: first
All checks were successful
Build / Compute Version (push) Successful in 4s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m47s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m31s
Build / Build Nuget package (NuGet) (push) Successful in 6m2s
Build / Build Nuget package (SharedCringe) (push) Successful in 7m25s
Build / Build Launcher (push) Successful in 9m11s

This commit is contained in:
zznty
2022-10-28 01:58:54 +07:00
commit aa979e9519
81 changed files with 6162 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>preview</LangVersion>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>
<Publicize Include="VRage:VRage.Plugins.MyPlugins.LoadPlugins" />
<Publicize Include="SpaceEngineers.Game:SpaceEngineers.Game.SpaceEngineersGame.OnRenderInitialized" />
<Publicize Include="Sandbox.Game:Sandbox.Engine.Platform.Game.set_DrawThread" />
<Publicize Include="Sandbox.Game:Sandbox.MySandboxGame.form" />
<Publicize Include="Sandbox.Game:Sandbox.MySandboxGame.RenderThread_SizeChanged" />
<Publicize Include="VRage.Render11;VRage.Platform.Windows;VRage.Scripting" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dnlib" Version="4.4.0" />
<PackageReference Include="Krafs.Publicizer" Version="2.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.Private.ServiceModel" Version="4.10.3" />
<PackageReference Include="Torch.SixLabors.ImageSharp" Version="1.0.0-beta6" />
<PackageReference Include="Velopack" Version="0.0.630-g9c52e40" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="Lib.Harmony.Thin" Version="2.3.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.*" ExcludeAssets="runtime" />
<PackageReference Include="Steamworks.NET" Version="20.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CringeBootstrap.Abstractions\CringeBootstrap.Abstractions.csproj" />
<ProjectReference Include="..\CringePlugins\CringePlugins.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="NativeMethods.txt" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,93 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using CringePlugins.Abstractions;
using CringePlugins.Render;
using ImGuiNET;
using SharpDX.Direct3D11;
using static ImGuiNET.ImGui;
namespace CringeLauncher;
internal class ImGuiHandler : IDisposable
{
private readonly DeviceContext _deviceContext;
private static nint _wndproc;
public static ImGuiHandler? Instance;
public static RenderTargetView? Rtv;
private readonly IRootRenderComponent _renderHandler;
public ImGuiHandler(nint windowHandle, Device1 device, DeviceContext deviceContext)
{
_deviceContext = deviceContext;
_renderHandler = new RenderHandler();
CreateContext();
var io = GetIO();
io.ConfigWindowsMoveFromTitleBarOnly = true;
io.ConfigFlags |= ImGuiConfigFlags.DockingEnable | ImGuiConfigFlags.ViewportsEnable;
ImGui_ImplWin32_Init(windowHandle);
ImGui_ImplDX11_Init(device.NativePointer, deviceContext.NativePointer);
}
public void HookWindow(HWND windowHandle)
{
_wndproc = PInvoke.GetWindowLongPtr(windowHandle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
unsafe
{
delegate* unmanaged[Stdcall]<HWND, int, nint, nint, int> wndProcHook = &WndProcHook;
PInvoke.SetWindowLongPtr(windowHandle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC, (nint)wndProcHook);
}
}
public void DoRender()
{
if (Rtv is null)
throw new InvalidOperationException("Rtv is null");
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
NewFrame();
_renderHandler.OnFrame();
Render();
_deviceContext.ClearState();
_deviceContext.OutputMerger.SetRenderTargets(Rtv);
ImGui_ImplDX11_RenderDrawData(GetDrawData());
UpdatePlatformWindows();
RenderPlatformWindowsDefault();
}
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
private static int WndProcHook(HWND hWnd, int msg, nint wParam, nint lParam)
{
var hookResult = ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
return hookResult == 0 ? CallWindowProc(_wndproc, hWnd, msg, wParam, lParam) : hookResult;
}
[DllImport("USER32.dll", ExactSpelling = true, EntryPoint = "CallWindowProcW")]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
private static extern int CallWindowProc(nint lpPrevWndFunc, HWND hWnd, int msg, nint wParam, nint lParam);
public void Dispose()
{
_deviceContext.Dispose();
_renderHandler.Dispose();
}
}

240
CringeLauncher/Launcher.cs Normal file
View File

@@ -0,0 +1,240 @@
using System.Reflection;
using CringeBootstrap.Abstractions;
using CringeLauncher.Utils;
using CringePlugins.Loader;
using CringePlugins.Splash;
using HarmonyLib;
using NLog;
using Sandbox;
using Sandbox.Engine.Networking;
using Sandbox.Engine.Platform.VideoMode;
using Sandbox.Engine.Utils;
using Sandbox.Game;
using SpaceEngineers.Game;
using SpaceEngineers.Game.Achievements;
using SpaceEngineers.Game.GUI;
using Velopack;
using VRage;
using VRage.Audio;
using VRage.FileSystem;
using VRage.Game;
using VRage.Game.Localization;
using VRage.GameServices;
using VRage.Mod.Io;
using VRage.Platform.Windows;
using VRage.Steam;
using VRage.UserInterface;
using VRageRender;
using VRageRender.ExternalApp;
namespace CringeLauncher;
public class Launcher : ICorePlugin
{
private const uint AppId = 244850U;
private SpaceEngineersGame? _game;
private readonly Harmony _harmony = new("CringeBootstrap");
private PluginsLifetime? _lifetime;
private MyGameRenderComponent? _renderComponent;
public void Initialize(string[] args)
{
LogManager.Setup()
.SetupExtensions(s =>
{
s.RegisterLayoutRenderer("cringe-exception", e =>
{
if (e.Exception is null) return string.Empty;
e.Exception.FormatStackTrace();
return e.Exception.ToString();
});
});
LogManager.ReconfigExistingLoggers();
//environment variable for viktor's plugins
Environment.SetEnvironmentVariable("SE_PLUGIN_DISABLE_METHOD_VERIFICATION", "True");
_harmony.PatchAll(typeof(Launcher).Assembly);
#if !DEBUG
CheckUpdates().GetAwaiter().GetResult();
#endif
var splash = new Splash();
splash.DefineStage(_lifetime = new PluginsLifetime());
InitTexts();
SpaceEngineersGame.SetupBasicGameInfo();
MyFinalBuildConstants.APP_VERSION = MyPerGameSettings.BasicGameInfo.GameVersion.GetValueOrDefault();
MyShaderCompiler.Init(MyShaderCompiler.TargetPlatform.PC, false);
MyVRageWindows.Init(MyPerGameSettings.BasicGameInfo.ApplicationName, MySandboxGame.Log,
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
MyPerGameSettings.BasicGameInfo.ApplicationName),
false, false);
MyPlatformGameSettings.SAVE_TO_CLOUD_OPTION_AVAILABLE = true;
MyXAudio2.DEVICE_DETAILS_SUPPORTED = false;
if (MyVRage.Platform.System.SimulationQuality == SimulationQuality.Normal)
{
MyPlatformGameSettings.SIMPLIFIED_SIMULATION_OVERRIDE = false;
}
MyFileSystem.ExePath = Path.GetDirectoryName(args.ElementAtOrDefault(0) ?? Assembly.GetExecutingAssembly().Location)!;
MyFileSystem.RootPath = new DirectoryInfo(MyFileSystem.ExePath).Parent!.FullName;
MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName,
MyVRage.Platform.System.GetRootPath(), MyVRage.Platform.System.GetAppDataPath(),true, 3, () =>
{
MyFakes.VOICE_CHAT_MIC_SENSITIVITY = MySandboxGame.Config.MicSensitivity;
MyPlatformGameSettings.VOICE_CHAT_AUTOMATIC_ACTIVATION = MySandboxGame.Config.AutomaticVoiceChatActivation;
});
MyVRage.Platform.Init();
SpaceEngineersGame.SetupPerGameSettings();
ConfigureSettings();
InitThreadPool();
MyVRage.Platform.System.OnThreadpoolInitialized();
InitRender();
_renderComponent = new();
_renderComponent.Start(new(), InitEarlyWindow, MyVideoSettingsManager.Initialize(), MyPerGameSettings.MaxFrameRate);
_renderComponent.RenderThread.BeforeDraw += MyFpsManager.Update;
_renderComponent.RenderThread.SizeChanged += RenderThreadOnSizeChanged;
splash.ExecuteLoadingStages();
InitUgc();
MyFileSystem.InitUserSpecific(MyGameService.UserId.ToString());
_game = new(args)
{
GameRenderComponent = _renderComponent,
DrawThread = _renderComponent.RenderThread.SystemThread,
form = MyVRage.Platform.Windows.Window
};
_renderComponent.RenderThread.SizeChanged += _game.RenderThread_SizeChanged;
_renderComponent.RenderThread.UpdateSize();
}
private void RenderThreadOnSizeChanged(int width, int height, MyViewport viewport)
{
if (_renderComponent is not null)
_renderComponent.RenderThread.SizeChanged -= RenderThreadOnSizeChanged;
MyVRage.Platform.Windows.Window.ShowAndFocus();
}
public void Run() => _game?.Run();
private static IVRageWindow InitEarlyWindow()
{
MyVRage.Platform.Windows.CreateWindow("Cringe Launcher", MyPerGameSettings.GameIcon, null);
MyVRage.Platform.Windows.Window.OnExit += MySandboxGame.ExitThreadSafe;
return MyVRage.Platform.Windows.Window;
}
private async Task CheckUpdates()
{
var mgr = new UpdateManager("https://dl.zznty.ru/CringeLauncher/");
// check for new version
var newVersion = await mgr.CheckForUpdatesAsync();
if (newVersion == null)
return; // no update available
// download new version
await mgr.DownloadUpdatesAsync(newVersion);
// install new version and restart app
mgr.ApplyUpdatesAndRestart(newVersion);
}
#region Keen shit
private static void InitThreadPool()
{
ParallelTasks.Parallel.Scheduler = new ThreadPoolScheduler();
}
private static void ConfigureSettings()
{
MyPlatformGameSettings.ENABLE_LOGOS = false;
}
private static void InitTexts()
{
var textsPath = Path.Combine(MyFileSystem.RootPath, @"Content\Data\Localization\CoreTexts");
var hashSet = new HashSet<MyLanguagesEnum>();
MyTexts.LoadSupportedLanguages(textsPath, hashSet);
if (!MyTexts.Languages.TryGetValue(MyLanguage.Instance.GetOsLanguageCurrentOfficial(), out var description) &&
!MyTexts.Languages.TryGetValue(MyLanguagesEnum.English, out description))
return;
MyTexts.LoadTexts(textsPath, description.CultureName, description.SubcultureName);
}
public static void InitUgc()
{
var steamGameService = MySteamGameService.Create(false, AppId);
MyServiceManager.Instance.AddService(steamGameService);
var aggregator = new MyServerDiscoveryAggregator();
MySteamGameService.InitNetworking(false, steamGameService, MyPerGameSettings.GameName, aggregator);
// MyEOSService.InitNetworking(false, false, MyPerGameSettings.GameName, steamGameService, "xyza7891964JhtVD93nm3nZp8t1MbnhC",
// "AKGM16qoFtct0IIIA8RCqEIYG4d4gXPPDNpzGuvlhLA", "24b1cd652a18461fa9b3d533ac8d6b5b",
// "1958fe26c66d4151a327ec162e4d49c8", "07c169b3b641401496d352cad1c905d6",
// "https://retail.epicgames.com/", MyEOSService.CreatePlatform(),
// MyPlatformGameSettings.VERBOSE_NETWORK_LOGGING, ArraySegment<string>.Empty, aggregator,
// MyMultiplayer.Channels);
// EOS networking is disabled due to memory leak, waiting for update with EOSSDK >= 1.15.4
MyServiceManager.Instance.AddService<IMyServerDiscovery>(aggregator);
MyServiceManager.Instance.AddService(MySteamGameService.CreateMicrophone());
MyGameService.WorkshopService.AddAggregate(MySteamUgcService.Create(AppId, steamGameService));
var modUgc = MyModIoService.Create(MyServiceManager.Instance.GetService<IMyGameService>(), "spaceengineers",
"264",
"1fb4489996a5e8ffc6ec1135f9985b5b", "331", "f2b64abe55452252b030c48adc0c1f0e",
MyPlatformGameSettings.UGC_TEST_ENVIRONMENT, false, MyPlatformGameSettings.MODIO_PLATFORM,
MyPlatformGameSettings.MODIO_PORTAL);
modUgc.IsConsentGiven = MySandboxGame.Config.ModIoConsent;
MyGameService.WorkshopService.AddAggregate(modUgc);
MySpaceEngineersAchievements.Initialize();
}
private static void InitRender()
{
var renderQualityHint = MyVRage.Platform.Render.GetRenderQualityHint();
var preset = MyGuiScreenOptionsGraphics.GetPreset(renderQualityHint);
MyRenderProxy.Settings.User = MyVideoSettingsManager
.GetGraphicsSettingsFromConfig(ref preset, renderQualityHint > MyRenderPresetEnum.CUSTOM)
.PerformanceSettings.RenderSettings;
MyRenderProxy.Settings.EnableAnsel = MyPlatformGameSettings.ENABLE_ANSEL;
MyRenderProxy.Settings.EnableAnselWithSprites = MyPlatformGameSettings.ENABLE_ANSEL_WITH_SPRITES;
var graphicsRenderer = MySandboxGame.Config.GraphicsRenderer;
MySandboxGame.Config.GraphicsRenderer = graphicsRenderer;
_ = new MyEngine();
MyRenderProxy.Initialize(new MyDX11Render(MyRenderProxy.Settings));
}
#endregion
public void Dispose()
{
_game?.Dispose();
MyGameService.ShutDown();
MyInitializer.InvokeAfterRun();
MyVRage.Done();
}
}

View File

@@ -0,0 +1,7 @@
using CringeBootstrap.Abstractions;
using SharedCringe.Loader;
namespace CringeLauncher.Loader;
public class ModAssemblyLoadContext(ICoreLoadContext parentContext)
: DerivedAssemblyLoadContext(parentContext, "World Mods Context");

View File

@@ -0,0 +1,2 @@
GetWindowLongPtr
SetWindowLongPtr

View File

@@ -0,0 +1,19 @@
using HarmonyLib;
using Sandbox.Game.World;
namespace CringeLauncher.Patches;
[HarmonyPatch(typeof(MyScriptManager), nameof(MyScriptManager.Init))]
public static class DarkTardMissingNamespacePatch
{
private static void Prefix(Dictionary<string, string> ___m_compatibilityChanges)
{
___m_compatibilityChanges["using System.Runtime.Remoting.Metadata.W3cXsd2001;"] = "";
___m_compatibilityChanges["using System.IO.Ports;"] = "";
___m_compatibilityChanges["using System.Runtime.Remoting;"] = "";
___m_compatibilityChanges["using System.Runtime.Remoting.Messaging;"] = "";
___m_compatibilityChanges["using System.Numerics;"] = "";
___m_compatibilityChanges["using System.Runtime.Remoting.Lifetime;"] = "";
___m_compatibilityChanges["using System.Net.Configuration;"] = "";
}
}

View File

@@ -0,0 +1,30 @@
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
namespace CringeLauncher.Patches;
// eos is disabled
// [HarmonyPatch]
public class EosInitPatch
{
private static MethodInfo TargetMethod() =>
AccessTools.Method(Type.GetType("VRage.EOS.MyEOSNetworking, VRage.EOS", true), "Init");
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var ins = instructions.ToList();
var stIndex = ins.FindIndex(b => b.opcode == OpCodes.Stloc_1);
ins.InsertRange(stIndex, new []
{
new CodeInstruction(OpCodes.Dup),
new(OpCodes.Ldc_I4_2), // PlatformFlags.DisableOverlay
new(OpCodes.Conv_I8),
CodeInstruction.Call("Epic.OnlineServices.Platform.Options:set_Flags"),
});
return ins;
}
}

View File

@@ -0,0 +1,122 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.Loader;
using System.Xml.Serialization;
using CringeBootstrap.Abstractions;
using CringePlugins.Utils;
using HarmonyLib;
using Sandbox.Game.World;
using VRage;
using VRage.FileSystem;
using VRage.Game;
using VRage.Game.Common;
using VRage.Game.Components;
using VRage.Game.Definitions;
using VRage.Game.Entity.UseObject;
using VRage.ObjectBuilders;
using VRage.ObjectBuilders.Private;
using VRage.Plugins;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class IntrospectionPatches
{
[HarmonyPrefix, HarmonyPatch(typeof(Assembly), nameof(Assembly.GetTypes))]
private static bool GetTypesPrefix(Assembly __instance, ref Type[] __result)
{
if (AssemblyLoadContext.GetLoadContext(__instance) is ICoreLoadContext || __instance.FullName?.StartsWith("System.") == true)
return true;
Debug.WriteLine($"Blocking GetTypes for {__instance.FullName}");
__result = [];
return false;
}
[HarmonyPrefix, HarmonyPatch(typeof(AccessTools), nameof(AccessTools.GetTypesFromAssembly))]
private static bool GetTypesHarmonyPrefix(Assembly assembly, ref Type[] __result)
{
if (AssemblyLoadContext.GetLoadContext(assembly) is ICoreLoadContext)
return true;
__result = IntrospectionContext.Global.CollectAttributedTypes<HarmonyAttribute>(assembly.GetMainModule())
.ToArray();
return false;
}
[HarmonyPrefix, HarmonyPatch(typeof(MySession), "PrepareBaseSession", typeof(MyObjectBuilder_Checkpoint), typeof(MyObjectBuilder_Sector))]
private static void PrepareSessionPrefix()
{
// i hate keen for that in MyUseObjectFactory..cctor
// MyUseObjectFactory.RegisterAssemblyTypes(Assembly.LoadFrom(Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll")));
MyUseObjectFactory.RegisterAssemblyTypes(MyPlugins.SandboxGameAssembly);
}
[HarmonyPrefix, HarmonyPatch(typeof(MyPlugins), nameof(MyPlugins.LoadPlugins))]
private static bool LoadPluginsPrefix(List<Assembly> assemblies, List<IPlugin> ___m_plugins, List<IHandleInputPlugin> ___m_handleInputPlugins)
{
foreach (var type in assemblies.SelectMany(b => IntrospectionContext.Global.CollectDerivedTypes<IPlugin>(b.GetMainModule())))
{
var instance = Activator.CreateInstance(type);
if (instance is IPlugin plugin)
___m_plugins.Add(plugin);
if (instance is IHandleInputPlugin handleInputPlugin)
___m_handleInputPlugins.Add(handleInputPlugin);
}
return false;
}
[HarmonyPrefix, HarmonyPatch(typeof(MyXmlSerializerManager), "TryLoadSerializerFrom")]
private static bool LoadSerializerPrefix(string assemblyName, string typeName, ref XmlSerializer? __result)
{
if (AssemblyLoadContext.GetLoadContext(typeof(IntrospectionPatches).Assembly) is not ICoreLoadContext context)
return false;
var assembly = context.ResolveFromAssemblyName(new(assemblyName));
if (assembly?.GetType($"Microsoft.Xml.Serialization.GeneratedAssembly.{typeName}Serializer") is not { } type)
return false;
__result = Activator.CreateInstance(type) as XmlSerializer;
return false;
}
[HarmonyPrefix, HarmonyPatch(typeof(MyXmlSerializerManager), nameof(MyXmlSerializerManager.RegisterFromAssembly))]
private static bool XmlManagerRegisterPrefix(Assembly assembly) => AssemblyLoadContext.GetLoadContext(assembly) is ICoreLoadContext;
[HarmonyPatch]
private static class GameAssembliesPatch
{
private static IEnumerable<MethodInfo> TargetMethods()
{
return AccessTools.GetDeclaredMethods(typeof(MyPlugins))
.Where(b => b.Name.StartsWith("Register") &&
b.GetParameters() is [var param] && param.ParameterType == typeof(string));
}
private static bool Prefix([HarmonyArgument(0)] string file)
{
var name = AssemblyName.GetAssemblyName(Path.Join(MyFileSystem.ExePath, file));
ref var staticAssembly = ref AccessTools.StaticFieldRefAccess<Assembly>(typeof(MyPlugins), name.Name switch
{
"Sandbox.Common" => "m_sandboxAssembly",
"Sandbox.Game" => "m_sandboxGameAssembly",
"SpaceEngineers.Game" => "m_gamePluginAssembly",
"SpaceEngineers.ObjectBuilders" => "m_gameObjBuildersPlugin",
_ => throw new ArgumentOutOfRangeException(null, $"Unknown assembly name: {name}")
});
staticAssembly = AssemblyLoadContext.GetLoadContext(typeof(GameAssembliesPatch).Assembly)!
.LoadFromAssemblyName(name);
return false;
}
}
}

View File

@@ -0,0 +1,70 @@
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Loader;
using CringeBootstrap.Abstractions;
using CringeLauncher.Loader;
using HarmonyLib;
using Sandbox.Game.World;
using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class ModAssemblyLoadContextPatches
{
private static ModAssemblyLoadContext? _currentSessionContext;
[HarmonyPatch(typeof(MyScriptCompiler), nameof(MyScriptCompiler.Compile), MethodType.Async)]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> CompilerTranspiler(IEnumerable<CodeInstruction> instructions, MethodBase original)
{
var matcher = new CodeMatcher(instructions);
var load1Method = AccessTools.DeclaredMethod(typeof(Assembly), nameof(Assembly.Load), [typeof(byte[]), typeof(byte[])]);
var load2Method = AccessTools.DeclaredMethod(typeof(Assembly), nameof(Assembly.Load), [typeof(byte[])]);
matcher.SearchForward(i => i.Calls(load1Method))
.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);
ArgumentNullException.ThrowIfNull(_currentSessionContext, "No session context");
return _currentSessionContext.LoadFromStream(new MemoryStream(assembly), new MemoryStream(symbols));
}));
matcher.SearchForward(i => i.Calls(load2Method))
.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);
ArgumentNullException.ThrowIfNull(_currentSessionContext, "No session context");
return _currentSessionContext.LoadFromStream(new MemoryStream(assembly));
}));
return matcher.Instructions();
}
[HarmonyPatch(typeof(MySession), nameof(MySession.Load))]
[HarmonyPatch(typeof(MySession), "LoadMultiplayer")]
[HarmonyPrefix]
private static void LoadPrefix()
{
if (_currentSessionContext is not null)
throw new InvalidOperationException("Previous session context was not disposed");
if (AssemblyLoadContext.GetLoadContext(typeof(MySession).Assembly) is not ICoreLoadContext coreContext)
throw new NotSupportedException("Mod loading is not supported in this context");
_currentSessionContext = new ModAssemblyLoadContext(coreContext);
}
[HarmonyPatch(typeof(MySession), nameof(MySession.Unload))]
[HarmonyPostfix]
private static void UnloadPostfix()
{
if (_currentSessionContext is null) return;
_currentSessionContext.Unload();
_currentSessionContext = null;
}
}

View File

@@ -0,0 +1,309 @@
namespace CringeLauncher.Patches;
#if false
[HarmonyPatch]
public static class ModScriptCompilerPatch
{
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
private static AssemblyLoadContext _modContext = new(null, true);
private static readonly HashSet<string> LoadedModAssemblyNames = new();
private static readonly ConditionalWeakTable<MyProgrammableBlock, AssemblyLoadContext> LoadContexts = new();
private static readonly FieldInfo InstanceField = AccessTools.Field(typeof(MyProgrammableBlock), "m_instance");
private static readonly FieldInfo AssemblyField = AccessTools.Field(typeof(MyProgrammableBlock), "m_assembly");
private static readonly FieldInfo CompilerErrorsField = AccessTools.Field(typeof(MyProgrammableBlock), "m_compilerErrors");
static ModScriptCompilerPatch()
{
MySession.OnUnloaded += OnUnloaded;
ModWhitelistAnalyzer =
AccessTools.FieldRefAccess<MyScriptCompiler, DiagnosticAnalyzer>(
MyScriptCompiler.Static, "m_modApiWhitelistDiagnosticAnalyzer");
ScriptWhitelistAnalyzer =
AccessTools.FieldRefAccess<MyScriptCompiler, DiagnosticAnalyzer>(
MyScriptCompiler.Static, "m_ingameWhitelistDiagnosticAnalyzer");
MetadataReferences =
AccessTools.FieldRefAccess<MyScriptCompiler, List<MetadataReference>>(
MyScriptCompiler.Static, "m_metadataReferences");
InjectMod = AccessTools.MethodDelegate<Func<CSharpCompilation, SyntaxTree, int, SyntaxTree>>(
AccessTools.Method(typeof(MyScriptCompiler), "InjectMod"), MyScriptCompiler.Static);
InjectInstructionCounter = AccessTools.MethodDelegate<Func<CSharpCompilation, SyntaxTree, SyntaxTree>>(
AccessTools.Method(typeof(MyScriptCompiler), "InjectInstructionCounter"), MyScriptCompiler.Static);
EmitDiagnostics = AccessTools.MethodDelegate<Func<CompilationWithAnalyzers, EmitResult, List<Message>, bool, Task<bool>>>(
AccessTools.Method(typeof(MyScriptCompiler), "EmitDiagnostics"), MyScriptCompiler.Static);
MakeAssemblyName =
AccessTools.MethodDelegate<Func<string, string>>(AccessTools.Method(typeof(MyScriptCompiler),
"MakeAssemblyName"));
CreateInstanceMethod = AccessTools.Method(typeof(MyProgrammableBlock), "CreateInstance");
SetDetailedInfoMethod = AccessTools.Method(typeof(MyProgrammableBlock), "SetDetailedInfo");
}
private static void OnUnloaded()
{
LoadedModAssemblyNames.Clear();
if (!_modContext.Assemblies.Any())
return;
_modContext.Unload();
_modContext = new(null, true);
}
[HarmonyPatch(typeof(MyProgrammableBlock), "Compile")]
[HarmonyPrefix]
private static bool CompilePrefix(MyProgrammableBlock __instance, string program, string storage, bool instantiate,
ref MyProgrammableBlock.ScriptTerminationReason ___m_terminationReason,
MyIngameScriptComponent ___ScriptComponent)
{
if (!MySession.Static.EnableIngameScripts || __instance.CubeGrid is {IsPreview: true} or {CreatePhysics: false})
return false;
___m_terminationReason = MyProgrammableBlock.ScriptTerminationReason.None;
CompileAsync(__instance, program, storage, instantiate, ___ScriptComponent);
return false;
}
[HarmonyPatch(typeof(MyGuiScreenEditor), "CheckCodeButtonClicked")]
[HarmonyPrefix]
private static bool GuiCompilePrefix(List<string> ___m_compilerErrors, MyGuiScreenEditor __instance)
{
___m_compilerErrors.Clear();
var progress = new MyGuiScreenProgress(MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_CheckingCode));
MyScreenManager.AddScreen(progress);
if (__instance.Description.Text.Length > 0)
CompileAsync(__instance, ___m_compilerErrors, __instance.Description.Text.ToString(), progress).Wait();
return false;
}
[HarmonyPatch(typeof(MyScriptCompiler), nameof(MyScriptCompiler.Compile))]
[HarmonyPrefix]
private static bool Prefix(ref Task<Assembly?> __result, MyApiTarget target, string assemblyName, IEnumerable<Script> scripts,
List<Message> messages, string friendlyName, bool enableDebugInformation = false)
{
__result = CompileAsync(_modContext, target, assemblyName, scripts, messages, friendlyName,
enableDebugInformation);
return false;
}
private static async Task CompileAsync(MyGuiScreenEditor editor, List<string> errors, string program, MyGuiScreenProgress progress)
{
var context = new AssemblyLoadContext(null, true);
var messages = new List<Message>();
var script = MyVRage.Platform.Scripting.GetIngameScript(program, "Program", nameof(MyGridProgram));
await CompileAsync(context, MyApiTarget.Ingame, "check", new[] { script }, messages,
"PB Code Editor");
errors.AddRange(messages.OrderBy(b => b.IsError ? 0 : 1).Select(b => b.Text));
context.Unload();
progress.CloseScreen();
if (errors.Count > 0)
{
var sb = new StringBuilder(errors.Sum(b => b.Length + Environment.NewLine.Length));
foreach (var error in errors)
{
sb.AppendLine(error);
}
MyScreenManager.AddScreen(new MyGuiScreenEditorError(sb.ToString()));
return;
}
var messageBox = MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info, MyMessageBoxButtonsType.OK,
MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_CompilationOk),
MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeEditor_Title));
MyGuiSandbox.AddScreen(messageBox);
}
private static async void CompileAsync(MyProgrammableBlock block,
string program,
string storage,
bool instantiate, MyIngameScriptComponent scriptComponent)
{
scriptComponent.NextUpdate = UpdateType.None;
scriptComponent.NeedsUpdate = MyEntityUpdateEnum.NONE;
SetDetailedInfoMethod.Invoke(block, new object?[] { "Compiling..." });
try
{
if (LoadContexts.TryGetValue(block, out var context))
{
AccessTools.FieldRefAccess<MyProgrammableBlock, IMyGridProgram?>(block, InstanceField) = null;
AccessTools.FieldRefAccess<MyProgrammableBlock, Assembly?>(block, AssemblyField) = null;
context.Unload();
}
LoadContexts.AddOrUpdate(block, context = new(null, true));
var messages = new List<Message>();
var assembly = await CompileAsync(context, MyApiTarget.Ingame,
$"pb_{block.EntityId}_{Random.Shared.NextInt64()}",
new[]
{
MyVRage.Platform.Scripting.GetIngameScript(
program, "Program", nameof(MyGridProgram))
}, messages, $"PB: {block.DisplayName} ({block.EntityId})");
AccessTools.FieldRefAccess<MyProgrammableBlock, Assembly?>(block, AssemblyField) = assembly;
var errors = AccessTools.FieldRefAccess<MyProgrammableBlock, List<string>>(block, CompilerErrorsField);
errors.Clear();
errors.AddRange(messages.Select(b => b.Text));
if (instantiate)
MySandboxGame.Static.Invoke(
() => CreateInstanceMethod.Invoke(block, new object?[] { assembly, errors, storage }),
nameof(CompileAsync));
}
catch (Exception e)
{
SetDetailedInfoMethod.Invoke(block, new object?[] { e.ToString() });
Log.Error(e);
}
}
private static async Task<Assembly?> CompileAsync(AssemblyLoadContext context, MyApiTarget target,
string assemblyName, IEnumerable<Script> scripts,
List<Message> messages, string? friendlyName,
bool enableDebugInformation = false)
{
friendlyName ??= "<No Name>";
var assemblyFileName = MakeAssemblyName(assemblyName);
Func<CSharpCompilation, SyntaxTree, SyntaxTree>? syntaxTreeInjector;
DiagnosticAnalyzer? whitelistAnalyzer;
switch (target)
{
case MyApiTarget.None:
whitelistAnalyzer = null;
syntaxTreeInjector = null;
break;
case MyApiTarget.Mod:
{
var modId = MyModWatchdog.AllocateModId(friendlyName);
whitelistAnalyzer = ModWhitelistAnalyzer;
syntaxTreeInjector = (c, st) => InjectMod(c, st, modId);
//skip if name exists already
if (!LoadedModAssemblyNames.Add(assemblyFileName))
{
Console.WriteLine($"{assemblyFileName} is already loaded, skipping");
return null;
}
break;
}
case MyApiTarget.Ingame:
syntaxTreeInjector = InjectInstructionCounter;
whitelistAnalyzer = ScriptWhitelistAnalyzer;
break;
default:
throw new ArgumentOutOfRangeException(nameof(target), target, "Invalid compilation target");
}
var compilation = CreateCompilation(assemblyFileName, scripts);
var compilationWithoutInjection = compilation;
var injectionFailed = false;
if (syntaxTreeInjector != null)
{
SyntaxTree[]? newSyntaxTrees = null;
try
{
var syntaxTrees = compilation.SyntaxTrees;
if (syntaxTrees.Length == 1)
{
newSyntaxTrees = new[] { syntaxTreeInjector(compilation, syntaxTrees[0]) };
}
else
{
var compilation1 = compilation;
newSyntaxTrees = await Task
.WhenAll(syntaxTrees.Select(
x => Task.Run(() => syntaxTreeInjector(compilation1, x)))).ConfigureAwait(false);
}
}
catch (Exception e)
{
Log.Warn(e);
injectionFailed = true;
}
if (newSyntaxTrees is not null)
compilation = compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(newSyntaxTrees);
}
CompilationWithAnalyzers? analyticCompilation = null;
if (whitelistAnalyzer != null)
{
analyticCompilation = compilation.WithAnalyzers(ImmutableArray.Create(whitelistAnalyzer));
compilation = (CSharpCompilation)analyticCompilation.Compilation;
}
using var assemblyStream = new MemoryStream();
var emitResult = compilation.Emit(assemblyStream);
var success = emitResult.Success;
var myBlacklistSyntaxVisitor = new MyBlacklistSyntaxVisitor();
foreach (var syntaxTree in compilation.SyntaxTrees)
{
myBlacklistSyntaxVisitor.SetSemanticModel(compilation.GetSemanticModel(syntaxTree, false));
myBlacklistSyntaxVisitor.Visit(await syntaxTree.GetRootAsync());
}
if (myBlacklistSyntaxVisitor.HasAnyResult())
{
myBlacklistSyntaxVisitor.GetResultMessages(messages);
}
else
{
success = await EmitDiagnostics(analyticCompilation, emitResult, messages, success).ConfigureAwait(false);
assemblyStream.Seek(0, SeekOrigin.Begin);
if (injectionFailed) return null;
if (success)
return context.LoadFromStream(assemblyStream);
await EmitDiagnostics(analyticCompilation, compilationWithoutInjection.Emit(assemblyStream), messages,
false).ConfigureAwait(false);
}
return null;
}
private static readonly CSharpCompilationOptions CompilationOptions =
new(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release, platform: Platform.X64);
private static readonly CSharpParseOptions ParseOptions = new(LanguageVersion.CSharp11, DocumentationMode.None);
private static readonly DiagnosticAnalyzer ModWhitelistAnalyzer;
private static readonly DiagnosticAnalyzer ScriptWhitelistAnalyzer;
private static readonly List<MetadataReference> MetadataReferences;
private static readonly Func<CSharpCompilation, SyntaxTree, int, SyntaxTree> InjectMod;
private static readonly Func<CSharpCompilation, SyntaxTree, SyntaxTree> InjectInstructionCounter;
private static readonly Func<CompilationWithAnalyzers, EmitResult, List<Message>, bool, Task<bool>> EmitDiagnostics;
private static readonly Func<string, string> MakeAssemblyName;
private static readonly MethodInfo CreateInstanceMethod;
private static readonly MethodInfo SetDetailedInfoMethod;
private static CSharpCompilation CreateCompilation(string assemblyFile, IEnumerable<Script>? scripts)
{
if (scripts == null)
return CSharpCompilation.Create(assemblyFile, null, MetadataReferences,
CompilationOptions);
var parseOptions = ParseOptions.WithPreprocessorSymbols(MyScriptCompiler.Static.ConditionalCompilationSymbols);
var enumerable = scripts.Select(s => CSharpSyntaxTree.ParseText(s.Code, parseOptions, s.Name, Encoding.UTF8));
return CSharpCompilation.Create(assemblyFile, enumerable, MetadataReferences, CompilationOptions);
}
}
#endif

View File

@@ -0,0 +1,22 @@
using Windows.Win32.Foundation;
using HarmonyLib;
using SharpDX.DXGI;
using VRage.Platform.Windows.Forms;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public class RenderHookPatch
{
[HarmonyPrefix, HarmonyPatch(typeof(SwapChain), nameof(SwapChain.Present))]
private static void PresentPrefix()
{
ImGuiHandler.Instance?.DoRender();
}
[HarmonyPostfix, HarmonyPatch(typeof(MyGameForm), "OnLoad")]
private static void LoadPostfix(MyGameForm __instance)
{
ImGuiHandler.Instance?.HookWindow((HWND)__instance.Handle);
}
}

View File

@@ -0,0 +1,10 @@
using HarmonyLib;
using SpaceEngineers.Game;
namespace CringeLauncher.Patches;
[HarmonyPatch(typeof(SpaceEngineersGame), "InitializeRender")]
public static class RenderInitPatch
{
private static bool Prefix() => false;
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Concurrent;
using System.Collections.Immutable;
using System.Reflection;
using HarmonyLib;
using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class ScriptCompilerInitializationPatch
{
private static MethodInfo TargetMethod()
{
return AccessTools.Method(Type.GetType("VRage.Scripting.MyVRageScriptingInternal, VRage.Scripting", true),
"Initialize");
}
private static bool Prefix(Thread updateThread, Type[] referencedTypes, string[] symbols)
{
MyModWatchdog.Init(updateThread);
MyScriptCompiler.Static.AddImplicitIngameNamespacesFromTypes(referencedTypes);
MyScriptCompiler.Static.AddConditionalCompilationSymbols(symbols);
using var batch = MyScriptCompiler.Static.Whitelist.OpenBatch();
batch.AllowTypes(MyWhitelistTarget.ModApi, typeof(ConcurrentQueue<>));
batch.AllowNamespaceOfTypes(MyWhitelistTarget.Both, typeof(ImmutableArray));
return false;
}
}

View File

@@ -0,0 +1,85 @@
using HarmonyLib;
using SharpDX.Direct3D11;
using SharpDX.DXGI;
using VRage.Platform.Windows.Render;
using VRage.Render11.Resources;
using VRageRender;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class SwapChainPatch
{
internal static nint WindowHandle;
[HarmonyPrefix, HarmonyPatch(typeof(MyPlatformRender), nameof(MyPlatformRender.CreateSwapChain))]
private static bool SwapChainPrefix(nint windowHandle)
{
WindowHandle = windowHandle;
MyPlatformRender.DisposeSwapChain();
MyPlatformRender.Log.WriteLine("CreateDeviceInternal create swapchain");
if (MyPlatformRender.m_swapchain != null)
return false;
var chainDescription = new SwapChainDescription
{
BufferCount = 2,
Flags = SwapChainFlags.AllowModeSwitch,
IsWindowed = true,
ModeDescription = MyPlatformRender.GetCurrentModeDescriptor(MyPlatformRender.m_settings) with
{
Format = Format.R8G8B8A8_UNorm
},
SampleDescription = {
Count = 1,
Quality = 0
},
OutputHandle = windowHandle,
Usage = Usage.ShaderInput | Usage.RenderTargetOutput,
SwapEffect = SwapEffect.Discard
};
var factory = MyPlatformRender.GetFactory();
try
{
MyPlatformRender.m_swapchain = new SwapChain(factory, MyPlatformRender.DeviceInstance, chainDescription);
}
catch (Exception)
{
MyPlatformRender.Log.WriteLine("SwapChain factory = " + factory);
MyPlatformRender.Log.WriteLine("SwapChain Device = " + MyPlatformRender.DeviceInstance);
MyPlatformRender.PrintSwapChainDescriptionToLog(chainDescription);
throw;
}
factory.MakeWindowAssociation(windowHandle, WindowAssociationFlags.IgnoreAll);
return false;
}
[HarmonyPostfix, HarmonyPatch(typeof(MyRender11), nameof(MyRender11.CreateDeviceInternal))]
private static void CreateDevicePostfix()
{
ImGuiHandler.Instance ??= new ImGuiHandler(WindowHandle, MyRender11.DeviceInstance, MyRender11.RC.DeviceContext);
}
[HarmonyPrefix, HarmonyPatch(typeof(MyBackbuffer), MethodType.Constructor, typeof(SharpDX.Direct3D11.Resource))]
private static bool SwapChainBBPrefix(MyBackbuffer __instance, SharpDX.Direct3D11.Resource swapChainBB)
{
__instance.m_resource = swapChainBB;
__instance.m_rtv = new RenderTargetView(MyRender11.DeviceInstance, swapChainBB, new()
{
Format = Format.R8G8B8A8_UNorm_SRgb,
Dimension = RenderTargetViewDimension.Texture2D,
});
__instance.m_srv = new ShaderResourceView(MyRender11.DeviceInstance, swapChainBB);
ImGuiHandler.Rtv = new RenderTargetView(MyRender11.DeviceInstance, swapChainBB, new()
{
Format = Format.R8G8B8A8_UNorm,
Dimension = RenderTargetViewDimension.Texture2D,
});
return false;
}
}

View File

@@ -0,0 +1,14 @@
using HarmonyLib;
using VRage.Network;
namespace CringeLauncher.Patches;
[HarmonyPatch(typeof(MyTypeTable), "IsSerializableClass")]
public static class TypeTableRegisterPatch
{
private static void Postfix(Type type, ref bool __result)
{
if (type == typeof(Delegate) || type == typeof(MulticastDelegate))
__result = true;
}
}

View File

@@ -0,0 +1,20 @@
using System.Reflection;
using HarmonyLib;
using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class WhitelistAllowPatch
{
private static MethodInfo TargetMethod()
{
return AccessTools.Method(AccessTools.Inner(typeof(MyScriptWhitelist), "MyWhitelistBatch"), "AllowMembers");
}
private static void Prefix(ref MemberInfo[] members)
{
if (members.Any(b => b is null))
members = members.Where(b => b is { }).ToArray();
}
}

View File

@@ -0,0 +1,46 @@
using System.Collections.Concurrent;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Text.RegularExpressions;
using HarmonyLib;
using VRage.FileSystem;
using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch(typeof(MyScriptWhitelist), MethodType.Constructor, typeof(MyScriptCompiler))]
public static class WhitelistPatch
{
private static void Prefix(MyScriptCompiler scriptCompiler)
{
var baseDir = new FileInfo(typeof(Type).Assembly.Location).DirectoryName!;
scriptCompiler.AddReferencedAssemblies(
typeof(Type).Assembly.Location,
typeof(LinkedList<>).Assembly.Location,
typeof(Regex).Assembly.Location,
typeof(Enumerable).Assembly.Location,
typeof(ConcurrentBag<>).Assembly.Location,
typeof(ImmutableArray).Assembly.Location,
typeof(PropertyChangedEventArgs).Assembly.Location,
typeof(TypeConverter).Assembly.Location,
typeof(System.Diagnostics.TraceSource).Assembly.Location,
typeof(System.Security.Policy.Evidence).Assembly.Location,
Path.Combine(baseDir, "System.Xml.ReaderWriter.dll"),
Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.dll"),
Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"),
Path.Combine(baseDir, "netstandard.dll"),
Path.Combine(baseDir, "System.Runtime.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"),
Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Library.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Math.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Game.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Render.dll"),
Path.Combine(MyFileSystem.ExePath, "VRage.Input.dll"),
Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.ObjectBuilders.dll"),
Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.Game.dll"));
}
}

View File

@@ -0,0 +1,37 @@
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using VRage.Scripting;
namespace CringeLauncher.Patches;
[HarmonyPatch]
public static class WhitelistRegistrationPatch
{
private static IEnumerable<MethodInfo> TargetMethods()
{
yield return AccessTools.Method(typeof(MyScriptWhitelist), "Register",
new[] { typeof(MyWhitelistTarget), typeof(INamespaceSymbol), typeof(Type) });
yield return AccessTools.Method(typeof(MyScriptWhitelist), "Register",
new[] { typeof(MyWhitelistTarget), typeof(ITypeSymbol), typeof(Type) });
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var ins = instructions.ToList();
var throwIns = ins.FindAll(b => b.opcode == OpCodes.Throw).Select(b => ins.IndexOf(b));
foreach (var index in throwIns)
{
var i = index;
do
{
ins[i] = new(OpCodes.Nop);
} while (ins[--i].opcode.FlowControl != FlowControl.Cond_Branch);
ins[index] = new(OpCodes.Ret);
}
return ins;
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection.Emit;
using System.Xml;
using HarmonyLib;
using VRage;
namespace CringeLauncher.Patches;
[HarmonyPatch(typeof(CustomRootWriter), "Init")]
public class XmlRootWriterPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var ins = instructions.ToList();
var index = ins.FindIndex(b =>
b.opcode == OpCodes.Ldstr && b.operand is "xsi:type");
ins[index].operand = "xsi";
ins.InsertRange(index + 1, new[]
{
new CodeInstruction(OpCodes.Ldstr, "type"),
new CodeInstruction(OpCodes.Ldstr, "http://www.w3.org/2001/XMLSchema-instance")
});
var instruction = ins[ins.FindIndex(b => b.opcode == OpCodes.Callvirt)];
instruction.operand = AccessTools.Method(typeof(XmlWriter), "WriteAttributeString", new[]
{
typeof(string),
typeof(string),
typeof(string),
typeof(string)
});
return ins;
}
}

View File

@@ -0,0 +1,108 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Runtime.Loader;
using System.Text;
using HarmonyLib;
namespace CringeLauncher.Utils;
public static class ExceptionFormatter
{
private static readonly AccessTools.FieldRef<Exception, string> StackTraceField = AccessTools.FieldRefAccess<Exception, string>("_remoteStackTraceString");
public static void FormatStackTrace(this Exception exception)
{
var stackTrace = new StackTrace(exception, true);
var sb = new StringBuilder();
var i = 0;
while (stackTrace.GetFrame(i++) is { } frame)
{
var method = frame.GetMethod();
if (method is null)
continue;
sb.Append("at ");
if (method.DeclaringType is { } declaringType &&
AssemblyLoadContext.GetLoadContext(declaringType.Assembly) is { } assemblyLoadContext)
sb.Append(assemblyLoadContext).Append("//");
if (method.IsStatic)
sb.Append("static ");
if (method is MethodInfo methodInfo)
sb.Append(methodInfo.ReturnType, false);
else
sb.Append("new");
sb.Append(' ');
if (method.DeclaringType is null)
sb.Append("<null>");
else
sb.Append(method.DeclaringType, true);
if (method is MethodInfo)
{
sb.Append('.');
sb.Append(method.Name);
}
if (method.ContainsGenericParameters)
sb.Append(method.GetGenericArguments(), false);
sb.Append('(');
var parameters = method.GetParameters();
for (var j = 0; j < parameters.Length; j++)
{
sb.Append(parameters[j].ParameterType, false);
if (!string.IsNullOrEmpty(parameters[j].Name))
sb.Append(' ').Append(parameters[j].Name);
if (j < parameters.Length - 1)
sb.Append(", ");
}
sb.Append(')');
if (frame.GetFileName() is { } fileName)
{
sb.Append(" in ").Append(fileName).Append('(').Append(frame.GetFileLineNumber()).Append(':').Append(frame.GetFileColumnNumber()).Append(')');
}
sb.AppendLine();
}
ref var stackTraceString = ref StackTraceField(exception);
stackTraceString = sb.ToString();
}
private static StringBuilder Append(this StringBuilder sb, Type type, bool fullName = false)
{
if (fullName && !string.IsNullOrEmpty(type.Namespace))
sb.Append(type.Namespace).Append('.');
sb.Append(type.Name);
if (type.ContainsGenericParameters)
sb.Append(type.GetGenericArguments(), fullName);
return sb;
}
private static StringBuilder Append(this StringBuilder sb, Type[] genericArguments, bool fullName)
{
sb.Append('<');
for (var i = 0; i < genericArguments.Length; i++)
{
sb.Append(genericArguments[i], fullName);
if (i < genericArguments.Length - 1)
sb.Append(", ");
}
sb.Append('>');
return sb;
}
}

View File

@@ -0,0 +1,19 @@
using System.Reflection;
using HarmonyLib;
namespace CringeLauncher.Utils;
public static class MethodTools
{
public static MethodInfo AsyncMethodBody(MethodInfo method)
{
var (_, operand) = PatchProcessor.ReadMethodBody(method).First();
if (operand is not LocalVariableInfo localVar)
throw new InvalidOperationException($"Method {method.FullDescription()} does not contain a valid async state machine");
return AccessTools.Method(localVar.LocalType, "MoveNext") ??
throw new InvalidOperationException(
$"Async State machine of method {method.FullDescription()} does not contain a valid MoveNext method");
}
}

View File

@@ -0,0 +1,85 @@
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using Havok;
using ParallelTasks;
using CringeTask = ParallelTasks.Task;
namespace CringeLauncher.Utils;
public class ThreadPoolScheduler : IWorkScheduler
{
public void Schedule(CringeTask item)
{
ThreadPool.UnsafeQueueUserWorkItem(new ThreadPoolWorkItemTask(item), false);
}
public bool WaitForTasksToFinish(TimeSpan waitTimeout) => true;
public void ScheduleOnEachWorker(Action action)
{
}
public int ReadAndClearExecutionTime() => 0;
public void SuspendThreads(TimeSpan waitTimeout)
{
}
public void ResumeThreads()
{
}
public int ThreadCount { get; } = ThreadPool.ThreadCount;
}
[HarmonyPatch]
internal class KeenThreadingPatch
{
private static MethodBase TargetMethod()
{
var type = Type.GetType(
"VRage.Render11.Resources.Textures.MyTextureStreamingManager+MyStreamedTextureBase, VRage.Render11");
return AccessTools.FirstConstructor(type, _ => true);
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
var property = AccessTools.Property(typeof(Environment), nameof(Environment.ProcessorCount));
return instructions.Manipulator(i => i.Calls(property.GetMethod),
i =>
{
i.opcode = OpCodes.Ldc_I4;
i.operand = 1024;
});
}
}
[HarmonyPatch]
internal class ThreadPoolWorkItemTask(CringeTask task) : IThreadPoolWorkItem
{
public void Execute()
{
if (HkBaseSystem.IsInitialized && !HkBaseSystem.IsThreadInitialized)
HkBaseSystem.InitThread(Thread.CurrentThread.Name);
task.Execute();
}
private static MethodBase TargetMethod()
{
var type = Type.GetType("System.Threading.PortableThreadPool+WorkerThread, System.Private.CoreLib", true);
return AccessTools.DeclaredMethod(type, "WorkerThreadStart");
}
private static void Postfix()
{
if (!HkBaseSystem.IsInitialized || !HkBaseSystem.IsThreadInitialized) return;
HkBaseSystem.QuitThread();
Debug.WriteLine($"Hk Shutdown for {Thread.CurrentThread.Name}");
}
}

View File

@@ -0,0 +1,472 @@
{
"version": 1,
"dependencies": {
"net8.0-windows10.0.19041": {
"dnlib": {
"type": "Direct",
"requested": "[4.4.0, )",
"resolved": "4.4.0",
"contentHash": "cKHI720q+zfEEvzklWVGt6B0TH3AibAyJbpUJl4U6KvTP13tycfnqJpkGHRZ/oQ45BTIoIxIwltHIJVDN+iCqQ=="
},
"Krafs.Publicizer": {
"type": "Direct",
"requested": "[2.2.1, )",
"resolved": "2.2.1",
"contentHash": "QGI4nMGQbKsuFUUboixVHu4mv3lHB5RejIa7toIlzTmwLkuCYYEpUBJjmy3OpXYyj5dVSZAXVbr4oeMSloE67Q=="
},
"Lib.Harmony.Thin": {
"type": "Direct",
"requested": "[2.3.3, )",
"resolved": "2.3.3",
"contentHash": "jsaFv7XnWJnyfyvFbkgIkZtV6tWMteNUcDK3idq+3LwPqpTFNxsOv2eKmj4qqP8QR8UynG1Y9AUaC/+dVruMHg==",
"dependencies": {
"MonoMod.Core": "1.1.0",
"System.Text.Json": "8.0.1"
}
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Direct",
"requested": "[4.11.0, )",
"resolved": "4.11.0",
"contentHash": "6XYi2EusI8JT4y2l/F3VVVS+ISoIX9nqHsZRaG6W5aFeJ5BEuBosHfT/ABb73FN0RZ1Z3cj2j7cL28SToJPXOw==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
"Microsoft.CodeAnalysis.Common": "[4.11.0]",
"System.Collections.Immutable": "8.0.0",
"System.Reflection.Metadata": "8.0.0"
}
},
"Microsoft.Windows.CsWin32": {
"type": "Direct",
"requested": "[0.3.106, )",
"resolved": "0.3.106",
"contentHash": "Mx5fK7uN6fwLR4wUghs6//HonAnwPBNmC2oonyJVhCUlHS/r6SUS3NkBc3+gaQiv+0/9bqdj1oSCKQFkNI+21Q==",
"dependencies": {
"Microsoft.Windows.SDK.Win32Docs": "0.1.42-alpha",
"Microsoft.Windows.SDK.Win32Metadata": "60.0.34-preview",
"Microsoft.Windows.WDK.Win32Metadata": "0.11.4-experimental"
}
},
"NLog": {
"type": "Direct",
"requested": "[5.3.4, )",
"resolved": "5.3.4",
"contentHash": "gLy7+O1hEYJXIlcTr1/VWjGXrZTQFZzYNO18IWasD64pNwz0BreV+nHLxWKXWZzERRzoKnsk2XYtwLkTVk7J1A=="
},
"SpaceEngineersDedicated.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.*, )",
"resolved": "1.205.26",
"contentHash": "kQSFCLgi0nFUhLvXlp9D2w4cTnXtEIctWtNlK+Vw4FAofws60rwR6Kil9YBNlaDyoo19dcyNt3bs4G9VculcIA==",
"dependencies": {
"SharpDX": "4.2.0-keen-cringe",
"protobuf-net": "1.0.0"
}
},
"Steamworks.NET": {
"type": "Direct",
"requested": "[20.1.0, )",
"resolved": "20.1.0",
"contentHash": "+GntwnyJ5tCNvUIaQxv2+ehDvZJzGUqlSB5xRBk1hTj1qqBJ6s4vK/OfGD/jae7aTmXiGSm8wpJORosNtQevJQ=="
},
"System.Diagnostics.PerformanceCounter": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "lX6DXxtJqVGWw7N/QmVoiCyVQ+Q/Xp+jVXPr3gLK1jJExSn1qmAjJQeb8gnOYeeBTG3E3PmG1nu92eYj/TEjpg==",
"dependencies": {
"System.Configuration.ConfigurationManager": "8.0.0"
}
},
"System.Management": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "jrK22i5LRzxZCfGb+tGmke2VH7oE0DvcDlJ1HAKYU8cPmD8XnpUT0bYn2Gy98GEhGjtfbR/sxKTVb+dE770pfA==",
"dependencies": {
"System.CodeDom": "8.0.0"
}
},
"System.Private.ServiceModel": {
"type": "Direct",
"requested": "[4.10.3, )",
"resolved": "4.10.3",
"contentHash": "BcUV7OERlLqGxDXZuIyIMMmk1PbqBblLRbAoigmzIUx/M8A+8epvyPyXRpbgoucKH7QmfYdQIev04Phx2Co08A==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.Extensions.ObjectPool": "5.0.10",
"System.Numerics.Vectors": "4.5.0",
"System.Reflection.DispatchProxy": "4.7.1",
"System.Security.Cryptography.Xml": "6.0.1",
"System.Security.Principal.Windows": "5.0.0"
}
},
"Torch.SixLabors.ImageSharp": {
"type": "Direct",
"requested": "[1.0.0-beta6, )",
"resolved": "1.0.0-beta6",
"contentHash": "WJ7ocT79HgmuKi0+ltpvXTiMI80UcI3DeS8XSfYwJtTB1tcQws6zLPGuUwra6qe6qRrFfpABeDP3xvHV1rJgfg==",
"dependencies": {
"SixLabors.Core": "1.0.0-beta0007",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Velopack": {
"type": "Direct",
"requested": "[0.0.630-g9c52e40, )",
"resolved": "0.0.630-g9c52e40",
"contentHash": "4xNKtV+vyZPdlaQMNeen7p3WqGoq7CkVVkneywod1kTM3zKphQQwxo6KESGxsolwImXM8cZk4E1Zu64SYbaJhQ==",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"NuGet.Versioning": "6.10.1"
}
},
"Basic.Reference.Assemblies.Net80": {
"type": "Transitive",
"resolved": "1.7.9",
"contentHash": "1wbS9ZJLFVrKD2jqv27gekIrpjpLffR9sitLQh5drWoG9KbyR/CgrAhw5I0c8Eq3zFMOToCmrpZi3VpRoInCgg==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "4.11.0"
}
},
"Basic.Reference.Assemblies.Net80Windows": {
"type": "Transitive",
"resolved": "1.7.9",
"contentHash": "98GFm8MC+pv37rTHaxBm5KFucqdJj0jK0XRHSGt2sXK9HNqtGImIFCFahxjUzskQjiUkPAzVhTou2OYZOuhhEg==",
"dependencies": {
"Microsoft.CodeAnalysis.Common": "4.11.0"
}
},
"ImGui.NET.DirectX": {
"type": "Transitive",
"resolved": "1.91.0.1",
"contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==",
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.5.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ=="
},
"Microsoft.CodeAnalysis.Analyzers": {
"type": "Transitive",
"resolved": "3.3.4",
"contentHash": "AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g=="
},
"Microsoft.CodeAnalysis.Common": {
"type": "Transitive",
"resolved": "4.11.0",
"contentHash": "djf8ujmqYImFgB04UGtcsEhHrzVqzHowS+EEl/Yunc5LdrYrZhGBWUTXoCF0NzYXJxtfuD+UVQarWpvrNc94Qg==",
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "3.3.4",
"System.Collections.Immutable": "8.0.0",
"System.Reflection.Metadata": "8.0.0"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg=="
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "Transitive",
"resolved": "5.0.10",
"contentHash": "pp9tbGqIhdEXL6Q1yJl+zevAJSq4BsxqhS1GXzBvEsEz9DDNu9GLNzgUy2xyFc4YjB4m4Ff2YEWTnvQvVYdkvQ=="
},
"Microsoft.Windows.SDK.Win32Docs": {
"type": "Transitive",
"resolved": "0.1.42-alpha",
"contentHash": "Z/9po23gUA9aoukirh2ItMU2ZS9++Js9Gdds9fu5yuMojDrmArvY2y+tq9985tR3cxFxpZO1O35Wjfo0khj5HA=="
},
"Microsoft.Windows.SDK.Win32Metadata": {
"type": "Transitive",
"resolved": "60.0.34-preview",
"contentHash": "TA3DUNi4CTeo+ItTXBnGZFt2159XOGSl0UOlG5vjDj4WHqZjhwYyyUnzOtrbCERiSaP2Hzg7otJNWwOSZgutyA=="
},
"Microsoft.Windows.WDK.Win32Metadata": {
"type": "Transitive",
"resolved": "0.11.4-experimental",
"contentHash": "bf5MCmUyZf0gBlYQjx9UpRAZWBkRndyt9XicR+UNLvAUAFTZQbu6YaX/sNKZlR98Grn0gydfh/yT4I3vc0AIQA==",
"dependencies": {
"Microsoft.Windows.SDK.Win32Metadata": "60.0.34-preview"
}
},
"Mono.Cecil": {
"type": "Transitive",
"resolved": "0.11.5",
"contentHash": "fxfX+0JGTZ8YQeu1MYjbBiK2CYTSzDyEeIixt+yqKKTn7FW8rv7JMY70qevup4ZJfD7Kk/VG/jDzQQTpfch87g=="
},
"MonoMod.Backports": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "GUAjCrCZEddqHKHFA7Lh61PgTzoKY7gfBShFe0hQe0p8iynHhBK3TWGyRi+QIw/PGfaRPwx6c33CPGFURBVM6g==",
"dependencies": {
"MonoMod.ILHelpers": "1.0.1"
}
},
"MonoMod.Core": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "Ks8RntZGVcktr2QF/AovTEbuOkrgXz6omjrvT5LRveOIQJuy+IFuEQPBVWu+cSKVIoZD5XkpRFvlVrItgPIrXw==",
"dependencies": {
"Mono.Cecil": "0.11.5",
"MonoMod.Backports": "1.1.0",
"MonoMod.ILHelpers": "1.0.1",
"MonoMod.Utils": "25.0.4"
}
},
"MonoMod.ILHelpers": {
"type": "Transitive",
"resolved": "1.0.1",
"contentHash": "6djj/Hz+/eTomo1H/sJEJNxBz2ZdhXjvH0MOmyU2xRtbjaIfBQuyVV0zNUbJhMY/8qoWrz7WXfskfFhdaY0afA=="
},
"MonoMod.Utils": {
"type": "Transitive",
"resolved": "25.0.4",
"contentHash": "cB94MaZtFD9u4clYEFTwM4jGXnJnzXsxYF3yBpMZKHhXOas66tMF2frbdYte023i0MH4C5iRJbDjxHmA4x5VgA==",
"dependencies": {
"Mono.Cecil": "0.11.5",
"MonoMod.Backports": "1.1.0",
"MonoMod.ILHelpers": "1.0.1"
}
},
"NuGet.Frameworks": {
"type": "Transitive",
"resolved": "6.11.1",
"contentHash": "plTZ3ariSWQVsFn2mk83SsdmSg1VpgIMTSZpP/eSE/NNQF02p+M9ItxAYeUZBMX+cQ2nFkSwxQRJ0/fkaV9Hbg=="
},
"NuGet.Versioning": {
"type": "Transitive",
"resolved": "6.11.1",
"contentHash": "YNn3BB71F+guJW42TbAhGcMh3gpyqFMZcPVD9pm5vcvGivTALtRely/VCPWQQ6JQ5PfwIrjPaJMO7VnqyeK3rg=="
},
"protobuf-net": {
"type": "Transitive",
"resolved": "1.0.0",
"contentHash": "kTGOK0E87473sOImOjgZOnz3kTC2aMLffoRWQLYNuBLJnwNNmjanF9IkevZ9Q7yYLeABQfcF3BpeepuMntMVNw=="
},
"SharpDX": {
"type": "Transitive",
"resolved": "4.2.0-keen-cringe",
"contentHash": "LaJN3h1Gi1FWVdef2I5WtOH9gwzKCBniH0CragarbkN2QheYY6Lqm+91PcOfp1w/4wdVb+k8Kjv3sO393Tphtw=="
},
"SixLabors.Core": {
"type": "Transitive",
"resolved": "1.0.0-beta0007",
"contentHash": "s9aPl6yxwcvoKRD0u0zjkCISZCCifbUi9/XVFjdvlx5Pt7vRYmGV0anq1EEftUjIEHbEu5aNBipbUSBIV2CE7w==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.CodeDom": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "WTlRjL6KWIMr/pAaq3rYqh0TJlzpouaQ/W1eelssHgtlwHAH25jXTkUphTYx9HaIIf7XA6qs/0+YhtLEQRkJ+Q=="
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "JlYi9XVvIREURRUlGMr1F6vOFLk7YSY4p1vHo4kX3tQ0AGrjqlRWHDi66ImHhy6qwXBG3BJ6Y1QlYQ+Qz6Xgww==",
"dependencies": {
"System.Diagnostics.EventLog": "8.0.0",
"System.Security.Cryptography.ProtectedData": "8.0.0"
}
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "fdYxcRjQqTTacKId/2IECojlDSFvp7LP5N78+0z/xH7v/Tuw5ZAxu23Y6PTCRinqyu2ePx+Gn1098NC6jM6d+A=="
},
"System.Formats.Asn1": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "T6fD00dQ3NTbPDy31m4eQUwKW84s03z0N2C8HpOklyeaDgaJPa/TexP4/SkORMSOwc7WhKifnA6Ya33AkzmafA=="
},
"System.Numerics.Vectors": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ=="
},
"System.Reflection.DispatchProxy": {
"type": "Transitive",
"resolved": "4.7.1",
"contentHash": "C1sMLwIG6ILQ2bmOT4gh62V6oJlyF4BlHcVMrOoor49p0Ji2tA8QAoqyMcIhAdH6OHKJ8m7BU+r4LK2CUEOKqw=="
},
"System.Reflection.Metadata": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
"dependencies": {
"System.Collections.Immutable": "8.0.0"
}
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Security.AccessControl": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ=="
},
"System.Security.Cryptography.Pkcs": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "ynmbW2GjIGg9K1wXmVIRs4IlyDolf0JXNpzFQ8JCVgwM+myUC2JeUggl2PwQig2PNVMegKmN1aAx7WPQ8tI3vA==",
"dependencies": {
"System.Formats.Asn1": "6.0.0"
}
},
"System.Security.Cryptography.ProtectedData": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
},
"System.Security.Cryptography.Xml": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "5e5bI28T0x73AwTsbuFP4qSRzthmU2C0Gqgg3AZ3KTxmSyA+Uhk31puA3srdaeWaacVnHhLdJywCzqOiEpbO/w==",
"dependencies": {
"System.Security.AccessControl": "6.0.0",
"System.Security.Cryptography.Pkcs": "6.0.1"
}
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "8.0.1",
"contentHash": "7AWk2za1hSEJBppe/Lg+uDcam2TrDqwIKa9XcPssSwyjC2xa39EKEGul3CO5RWNF+hMuZG4zlBDrvhBdDTg4lg==",
"dependencies": {
"System.Text.Encodings.Web": "8.0.0"
}
},
"cringebootstrap.abstractions": {
"type": "Project"
},
"cringeplugins": {
"type": "Project",
"dependencies": {
"Basic.Reference.Assemblies.Net80": "[1.7.9, )",
"Basic.Reference.Assemblies.Net80Windows": "[1.7.9, )",
"ImGui.NET.DirectX": "[1.91.0.1, )",
"NLog": "[5.3.4, )",
"NuGet": "[1.0.0, )",
"SharedCringe": "[1.0.0, )",
"SpaceEngineersDedicated.ReferenceAssemblies": "[1.*, )",
"dnlib": "[4.4.0, )"
}
},
"nuget": {
"type": "Project",
"dependencies": {
"NuGet.Frameworks": "[6.11.1, )",
"NuGet.Versioning": "[6.11.1, )"
}
},
"sharedcringe": {
"type": "Project",
"dependencies": {
"CringeBootstrap.Abstractions": "[1.0.0, )",
"NLog": "[5.3.4, )",
"SpaceEngineersDedicated.ReferenceAssemblies": "[1.*, )"
}
}
},
"net8.0-windows10.0.19041/win-x64": {
"Steamworks.NET": {
"type": "Direct",
"requested": "[20.1.0, )",
"resolved": "20.1.0",
"contentHash": "+GntwnyJ5tCNvUIaQxv2+ehDvZJzGUqlSB5xRBk1hTj1qqBJ6s4vK/OfGD/jae7aTmXiGSm8wpJORosNtQevJQ=="
},
"System.Diagnostics.PerformanceCounter": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "lX6DXxtJqVGWw7N/QmVoiCyVQ+Q/Xp+jVXPr3gLK1jJExSn1qmAjJQeb8gnOYeeBTG3E3PmG1nu92eYj/TEjpg==",
"dependencies": {
"System.Configuration.ConfigurationManager": "8.0.0"
}
},
"System.Management": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "jrK22i5LRzxZCfGb+tGmke2VH7oE0DvcDlJ1HAKYU8cPmD8XnpUT0bYn2Gy98GEhGjtfbR/sxKTVb+dE770pfA==",
"dependencies": {
"System.CodeDom": "8.0.0"
}
},
"ImGui.NET.DirectX": {
"type": "Transitive",
"resolved": "1.91.0.1",
"contentHash": "PpW1gQ9g97h6Hm/h/tkSBOmsBYgGwN8wKNmlJomcQFD/zRY1HPkJZz18XRSfRLHPmH2eeh4hhhZv1KHug7dF9g==",
"dependencies": {
"System.Buffers": "4.5.1",
"System.Numerics.Vectors": "4.5.0",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "fdYxcRjQqTTacKId/2IECojlDSFvp7LP5N78+0z/xH7v/Tuw5ZAxu23Y6PTCRinqyu2ePx+Gn1098NC6jM6d+A=="
},
"System.Security.AccessControl": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ=="
},
"System.Security.Cryptography.Pkcs": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "ynmbW2GjIGg9K1wXmVIRs4IlyDolf0JXNpzFQ8JCVgwM+myUC2JeUggl2PwQig2PNVMegKmN1aAx7WPQ8tI3vA==",
"dependencies": {
"System.Formats.Asn1": "6.0.0"
}
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
},
"System.Text.Encodings.Web": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
}
}
}
}