Warn about outdated wine

This commit is contained in:
js6pak committed 2022-08-29 00:55:10 +02:00
1 parent 78b5b58884
commit a77efac44b
2 files changed
+10 -4

No files matched your search

@@ -285,16 +285,12 @@ internal static class Il2CppInteropManager
private static void RunIl2CppInteropGenerator(List<AssemblyDefinition> sourceAssemblies)
{
// Wine doesn't seem to support parallelism properly
var canRunParallel = !PlatformHelper.Is(Platform.Wine);
var opts = new GeneratorOptions
{
GameAssemblyPath = GameAssemblyPath,
Source = sourceAssemblies,
OutputDir = IL2CPPInteropAssemblyPath,
UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null,
Parallel = canRunParallel,
ObfuscatedNamesRegex = !string.IsNullOrEmpty(ConfigUnhollowerDeobfuscationRegex.Value)
? new Regex(ConfigUnhollowerDeobfuscationRegex.Value)
: null,
@@ -8,6 +8,7 @@ using BepInEx.Preloader.Core.Logging;
using BepInEx.Preloader.Core.Patching;
using BepInEx.Preloader.RuntimeFixes;
using BepInEx.Unity.Common;
using MonoMod.Utils;
namespace BepInEx.Unity.IL2CPP;
@@ -51,6 +52,15 @@ public static class Preloader
Logger.Log(LogLevel.Debug, $"Interop assembly directory: {Il2CppInteropManager.IL2CPPInteropAssemblyPath}");
Logger.Log(LogLevel.Debug, $"BepInEx root path: {Paths.BepInExRootPath}");
if (PlatformHelper.Is(Platform.Wine) && !Environment.Is64BitProcess)
{
if (!NativeLibrary.TryGetExport(NativeLibrary.Load("ntdll"), "RtlRestoreContext", out var _))
{
Logger.Log(LogLevel.Warning,
"Your wine version doesn't support CoreCLR properly, expect crashes! Upgrade to wine 7.16 or higher.");
}
}
NativeLibrary.SetDllImportResolver(typeof(Il2CppInterop.Runtime.IL2CPP).Assembly, DllImportResolver);
Il2CppInteropManager.Initialize();