Skip to content

Commit

Permalink
Il2Cpp: Fix OnInstallUnityTlsInterface not being static
Browse files Browse the repository at this point in the history
This causes crashes in some games (likely because of mono generating thisptr arg which could break the stack order on x86)
  • Loading branch information
ghorsington committed Jan 22, 2022
1 parent 3f172db commit 7669b6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BepInEx.IL2CPP/IL2CPPChainloader.cs
Expand Up @@ -94,7 +94,7 @@ public override void Initialize(string gameExePath = null)
PreloaderLogger.Log.Log(LogLevel.Debug, "Runtime invoke patched");
}

private void OnInstallUnityTlsInterface(IntPtr unityTlsInterfaceStruct)
private static void OnInstallUnityTlsInterface(IntPtr unityTlsInterfaceStruct)
{
Logger.Log(LogLevel.Debug, $"Captured UnityTls interface at {unityTlsInterfaceStruct.ToInt64():x8}");
Il2CppTlsAdapter.Options.UnityTlsInterface = unityTlsInterfaceStruct;
Expand Down Expand Up @@ -157,7 +157,7 @@ public override BasePlugin LoadPlugin(PluginInfo pluginInfo, Assembly pluginAsse
{
var type = pluginAssembly.GetType(pluginInfo.TypeName);

var pluginInstance = (BasePlugin) Activator.CreateInstance(type);
var pluginInstance = (BasePlugin)Activator.CreateInstance(type);

pluginInstance.Load();

Expand Down

0 comments on commit 7669b6d

Please sign in to comment.