예제 #1
0
파일: Program.cs 프로젝트: 0xdhac/MK2360
        private static void OnApplicationExit(object sender, EventArgs e)
        {
            if (XMode.IsActive())
            {
                XMode.Stop(true);
            }

            XMode.BlockInput(false);
        }
예제 #2
0
파일: Form1.cs 프로젝트: 0xdhac/MK2360
 private void ControllerModeButton_Click(object sender, EventArgs e)
 {
     if (XMode.IsActive())
     {
         XMode.Stop(true);
     }
     else
     {
         XMode.Start();
     }
 }
예제 #3
0
파일: Macros.cs 프로젝트: 0xdhac/MK2360
        private Input.InputAction KeyPressed(Input i)
        {
            if (!XMode.IsActive())
            {
                return(Input.InputAction.Continue);
            }

            if (!i.IsChanged.Contains(true))
            {
                return(Input.InputAction.Block);
            }

            foreach (KeyFunction kf in m_Keys)
            {
                foreach (Input.InputState inp in i.m_InputState)
                {
                    if (kf.m_Key == i && inp == kf.m_State)
                    {
                        if (kf.m_Func != null)
                        {
                            Task.Run(() =>
                            {
                                var func = m_Lua[kf.m_Func] as LuaFunction;
                                if (func != null)
                                {
                                    func.Call(i.Code.ToString());
                                }
                            });
                        }

                        return(Input.InputAction.Block);
                    }
                }
            }

            return(Input.InputAction.Continue);
        }
예제 #4
0
파일: Form1.cs 프로젝트: 0xdhac/MK2360
        private void Intercept()
        {
            IntPtr context = Interception.interception_create_context();

            Interception.Stroke stroke = new Interception.Stroke();
            int device;

            // Check for keyboard changes
            Interception.InterceptionPredicate interception_is_keyboard = Interception.interception_is_keyboard;
            Interception.interception_set_filter(
                context,
                interception_is_keyboard,
                ((ushort)Interception.FilterKeyState.KeyDown |
                 (ushort)Interception.FilterKeyState.KeyUp));

            // Check for mouse changes
            Interception.InterceptionPredicate interception_is_mouse = Interception.interception_is_mouse;
            Interception.interception_set_filter(
                context,
                interception_is_mouse,
                (ushort)Interception.FilterMouseState.All);

            while (Interception.interception_receive(context, device = Interception.interception_wait(context), ref stroke, 1) > 0)
            {
                byte[] strokeBytes = Interception.getBytes(stroke);
                if (Interception.interception_is_keyboard(device) != 0)
                {
                    Interception.KeyStroke kstroke = stroke;

                    if (kstroke.code == (ushort)Input.DIK.LWin || kstroke.code == (ushort)Input.DIK.RWin)
                    {
                        Interception.interception_send(context, device, strokeBytes, 1);
                        continue;
                    }

                    Input i = new Input(kstroke);

                    if (i.m_InputType == Input.InputType.Keyboard && Config.m_Config.m_KillSwitch == (Input.DIK)i.Code[0] && i.m_InputState[0] == Input.InputState.Down)
                    {
                        if (XMode.IsActive())
                        {
                            XMode.Stop(false);
                        }
                        else
                        {
                            XMode.Start();
                        }

                        continue;
                    }

                    Input.InputAction act = i.CallKeyListeners();

                    if ((act & Input.InputAction.Block) == 0)
                    {
                        Interception.interception_send(context, device, strokeBytes, 1);
                    }
                }
                else if (Interception.interception_is_mouse(device) != 0)
                {
                    Interception.MouseStroke kstroke = stroke;
                    Input i = new Input(kstroke);

                    Input.InputAction act = i.CallKeyListeners();

                    if ((act & Input.InputAction.Block) == 0)
                    {
                        Interception.interception_send(context, device, strokeBytes, 1);
                    }
                }
            }

            Interception.interception_destroy_context(context);
        }
예제 #5
0
파일: Macros.cs 프로젝트: 0xdhac/MK2360
 public static void StopXMode()
 {
     XMode.Stop(true);
 }