public static void Initialise() { Binding.engineDll = "FC3.dll"; Binding.gameDll = "FC3.dll"; Binding.managedDll = "FC3Editor.Core.dll"; Binding.LoadIGEDll = null; Binding.UnloadIGEDll = null; if (EngineUtils.HasArgument("-dx11")) { Binding.engineDll = Binding.engineDll.Replace(".dll", "_d3d11.dll"); Binding.gameDll = Binding.gameDll.Replace(".dll", "_d3d11.dll"); } IntPtr hModule = Binding.LoadLibrary(Binding.engineDll); if (hModule == IntPtr.Zero) throw new Exception("Not Loaded"); Binding.InitDuniaEngine = (Binding._InitDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "InitDuniaEngine"), typeof(Binding._InitDuniaEngine)); Binding.TickDuniaEngine = (Binding._TickDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "TickDuniaEngine"), typeof(Binding._TickDuniaEngine)); Binding.RunDuniaEngine = (Binding._RunDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "RunDuniaEngine"), typeof(Binding._RunDuniaEngine)); Binding.CloseDuniaEngine = (Binding._CloseDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "CloseDuniaEngine"), typeof(Binding._CloseDuniaEngine)); Binding.LocalizeText = (Binding._LocalizeText)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "LocalizeText"), typeof(Binding._LocalizeText)); }
//public delegate bool DisableThreadLibraryCallsDelegate(IntPtr hModule); //public static bool DisableThreadLibraryCalls(IntPtr handle) //{ // return true; //} public static void Initialise() { Binding.engineDll = "FC3.dll"; Binding.gameDll = "FC3.dll"; Binding.managedDll = "FC3Editor.Core.dll"; Binding.LoadIGEDll = null; Binding.UnloadIGEDll = null; if (EngineUtils.HasArgument("-dx11")) { Binding.engineDll = Binding.engineDll.Replace(".dll", "_d3d11.dll"); Binding.gameDll = Binding.gameDll.Replace(".dll", "_d3d11.dll"); } //object o = null; //var hModule = LocalHook.GetProcAddress( Binding.gameDll, "DllEntryPoint"); //IntPtr ptr = new IntPtr(0); IntPtr hModule = Binding.LoadLibrary(Binding.engineDll); //IntPtr module = Binding.GetModuleHandle(Binding.engineDll); //var result = EasyHook.LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "DisableThreadLibraryCalls"), new DisableThreadLibraryCallsDelegate(DisableThreadLibraryCalls), o); // LoadLibraryEx( //var hook = new IntPtr( // 0x10DF2F04 + // Marshal.ReadInt32(hModule)); //var original = (DllMain)Marshal.GetDelegateForFunctionPointer(hook, typeof(DllMain)); //var __dllmain = int.Parse("10DF2F04", System.Globalization.NumberStyles.HexNumber); // IntPtr hook = new IntPtr(__dllmain + (int)hModule); //var result = EasyHook.LocalHook.Create(hook, new DllMain(_dllBypass), o); //result.ThreadACL.SetExclusiveACL(new Int32[0]); if (hModule == IntPtr.Zero) throw new Exception("Not Loaded"); Binding.InitDuniaEngine = (Binding._InitDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "InitDuniaEngine"), typeof(Binding._InitDuniaEngine)); Binding.TickDuniaEngine = (Binding._TickDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "TickDuniaEngine"), typeof(Binding._TickDuniaEngine)); Binding.RunDuniaEngine = (Binding._RunDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "RunDuniaEngine"), typeof(Binding._RunDuniaEngine)); Binding.CloseDuniaEngine = (Binding._CloseDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "CloseDuniaEngine"), typeof(Binding._CloseDuniaEngine)); Binding.LocalizeText = (Binding._LocalizeText)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "LocalizeText"), typeof(Binding._LocalizeText)); }
static Binding() { Binding.engineDll = "FC3.dll"; Binding.gameDll = "FC3.dll"; Binding.managedDll = "FC3Editor.Core.dll"; Binding.LoadIGEDll = null; Binding.UnloadIGEDll = null; if (Program.HasArgument("-dx11")) { Binding.engineDll = Binding.engineDll.Replace(".dll", "_d3d11.dll"); Binding.gameDll = Binding.gameDll.Replace(".dll", "_d3d11.dll"); } IntPtr hModule = Binding.LoadLibrary(Binding.engineDll); Binding.InitDuniaEngine = (Binding._InitDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "InitDuniaEngine"), typeof(Binding._InitDuniaEngine)); Binding.TickDuniaEngine = (Binding._TickDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "TickDuniaEngine"), typeof(Binding._TickDuniaEngine)); Binding.RunDuniaEngine = (Binding._RunDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "RunDuniaEngine"), typeof(Binding._RunDuniaEngine)); Binding.CloseDuniaEngine = (Binding._CloseDuniaEngine)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "CloseDuniaEngine"), typeof(Binding._CloseDuniaEngine)); Binding.LocalizeText = (Binding._LocalizeText)Marshal.GetDelegateForFunctionPointer(Binding.GetProcAddress(hModule, "LocalizeText"), typeof(Binding._LocalizeText)); }