public static void SetEngineMethodsAsMono( IntPtr passControllerMethods, IntPtr passManagedInitializeMethod, IntPtr passManagedCallbackMethod) { Debug.Print("Setting engine methods at Controller::SetEngineMethodsAsMono"); Debug.Print("Beginning..."); Controller.RuntimeLibrary = TaleWorlds.Library.Runtime.Mono; Controller._passControllerMethods = Marshal.GetDelegateForFunctionPointer(passControllerMethods, typeof(OneMethodPasserDelegate)); Controller._passManagedInitializeMethodPointer = passManagedInitializeMethod; Controller._passManagedCallbackMethodPointer = passManagedCallbackMethod; Debug.Print("Starting controller..."); Controller.Start(); Debug.Print("Setting engine methods at Controller::SetEngineMethodsAsMono - Done"); }
public static void SetEngineMethodsAsDotNet( Delegate passControllerMethods, Delegate passManagedInitializeMethod, Delegate passManagedCallbackMethod) { Debug.Print("Setting engine methods at Controller::SetEngineMethodsAsDotNet"); if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework")) { Controller.RuntimeLibrary = TaleWorlds.Library.Runtime.DotNet; } else if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Core")) { Controller.RuntimeLibrary = TaleWorlds.Library.Runtime.DotNetCore; } Controller._passControllerMethods = passControllerMethods; Controller._passManagedInitializeMethod = passManagedInitializeMethod; Controller._passManagedCallbackMethod = passManagedCallbackMethod; Controller.Start(); }