Esempio n. 1
0
        static DebuggerDllExports()
        {
            if (Environment.GetEnvironmentVariable("ldbWaitForDebugger") == "yes")
            {
                while (!Debugger.IsAttached)
                {
                    Thread.Sleep(1);
                }

                GlobalState.IsInVisualStudio = true;
            }

            if (!Application.ExecutablePath.ToLower().Contains(GlobalState.SettlersExe))
            {
                MessageBox.Show("This DLL only works with " + GlobalState.SettlersExe);
                Environment.Exit(0);
            }

            GlobalState.SettlersThread       = Thread.CurrentThread;
            GlobalState.SettlersWindowHandle = Process.GetCurrentProcess().MainWindowHandle;
            //WindowStyle settlersWndStyle = (WindowStyle)WinAPI.GetWindowLong(GlobalState.SettlersWindowHandle, WinAPI.GWL_STYLE);
            //settlersWndStyle |= WindowStyle.WS_MINIMIZEBOX | WindowStyle.WS_SIZEBOX | WindowStyle.WS_MAXIMIZEBOX;
            //WinAPI.SetWindowLong(GlobalState.SettlersWindowHandle, WinAPI.GWL_STYLE, (uint)settlersWndStyle);

            //TickHook.InstallHook();
            GameLoopHook.InstallHook();
            ErrorHook.InstallHook();
            Thread uiThread = new Thread(new ThreadStart(DbgThread.RunMessageLoop));

            uiThread.SetApartmentState(ApartmentState.STA);
            uiThread.Start();
            GlobalState.UIThread = uiThread;
        }
Esempio n. 2
0
 public DebugEngine(LuaState ls)
 {
     this.ls          = ls;
     this.debugHook   = new LuaDebugHook(this.DebugHook);
     this.logCallback = new LuaCFunc(this.LogCallback);
     RegisterLogFunction();
     ErrorHook.SetErrorHandler(ls.L, new ErrorHook.LuaErrorCaught(this.ErrorCaughtHook));
     this.fireStateChangedEvent = new Action(FireStateChangedEvent);
     SetHook();
 }
Esempio n. 3
0
 public static void RemoveLuaState(UIntPtr L)
 {
     lock (GlobalState.GuiUpdateLock)
     {
         LuaState ls = GlobalState.L2State[L];
         ls.RemovedByGame();
         GlobalState.L2State.Remove(L);
         GlobalState.LuaStates.Remove(ls);
         ErrorHook.RemoveErrorHandler(L); // todo: refactor into luastate?
         GlobalState.UpdateStatesView = true;
     }
 }