Skip to content

Commit e8713f1

Browse files
authored
Merge pull request #477 from js6pak/wine-warning
Warn about outdated wine
2 parents 8b32f63 + a77efac commit e8713f1

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Runtimes/Unity/BepInEx.Unity.IL2CPP/Il2CppInteropManager.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,12 @@ private static List<AssemblyDefinition> RunCpp2Il()
285285

286286
private static void RunIl2CppInteropGenerator(List<AssemblyDefinition> sourceAssemblies)
287287
{
288-
// Wine doesn't seem to support parallelism properly
289-
var canRunParallel = !PlatformHelper.Is(Platform.Wine);
290-
291288
var opts = new GeneratorOptions
292289
{
293290
GameAssemblyPath = GameAssemblyPath,
294291
Source = sourceAssemblies,
295292
OutputDir = IL2CPPInteropAssemblyPath,
296293
UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null,
297-
Parallel = canRunParallel,
298294
ObfuscatedNamesRegex = !string.IsNullOrEmpty(ConfigUnhollowerDeobfuscationRegex.Value)
299295
? new Regex(ConfigUnhollowerDeobfuscationRegex.Value)
300296
: null,

Runtimes/Unity/BepInEx.Unity.IL2CPP/Preloader.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using BepInEx.Preloader.Core.Patching;
99
using BepInEx.Preloader.RuntimeFixes;
1010
using BepInEx.Unity.Common;
11+
using MonoMod.Utils;
1112

1213
namespace BepInEx.Unity.IL2CPP;
1314

@@ -51,6 +52,15 @@ public static void Run()
5152
Logger.Log(LogLevel.Debug, $"Interop assembly directory: {Il2CppInteropManager.IL2CPPInteropAssemblyPath}");
5253
Logger.Log(LogLevel.Debug, $"BepInEx root path: {Paths.BepInExRootPath}");
5354

55+
if (PlatformHelper.Is(Platform.Wine) && !Environment.Is64BitProcess)
56+
{
57+
if (!NativeLibrary.TryGetExport(NativeLibrary.Load("ntdll"), "RtlRestoreContext", out var _))
58+
{
59+
Logger.Log(LogLevel.Warning,
60+
"Your wine version doesn't support CoreCLR properly, expect crashes! Upgrade to wine 7.16 or higher.");
61+
}
62+
}
63+
5464
NativeLibrary.SetDllImportResolver(typeof(Il2CppInterop.Runtime.IL2CPP).Assembly, DllImportResolver);
5565

5666
Il2CppInteropManager.Initialize();

0 commit comments

Comments
 (0)