示例#1
0
        public static bool SetActiveConfig(string File)
        {
            var cfg = "profiles/" + File;

            if (!System.IO.File.Exists(cfg))
            {
                return(false);
            }

            lock (ActiveConfig) {
                Data d = Data.Load(File);
                ActiveConfig = d;
            }

            // Make sure the ini file exists
            ReadConfiguration(File);

            ReloadActiveConfig();

            IniFile appcfg = new IniFile("config.ini");

            appcfg.AddSetting("Xbox", "KeyProfile", File);
            appcfg.SaveSettings();

            return(true);
        }
示例#2
0
        static void Main(string[] args)
        {
            // Check if we are debugging
            // if so then attach the console
            #if (DEBUG)
            int conPtr = AllocConsole();
            AttachConsole(conPtr);
            Logger.appendLogLine("State", "Console Attached!", Logger.Type.Info);
            #endif

            ReadConfiguration();
            ActiveConfig = Data.Load(ActiveConfigFile);
            ReloadActiveConfig();
            ReloadControlScheme();

            Thread tApplicationRun = new Thread(ApplicationRun);
            tApplicationRun.SetApartmentState(ApartmentState.STA);
            tApplicationRun.Start();

            while (MainForm == null)
            {
                Thread.Sleep(100);
            }

            Thread tPause = new Thread(Pause);
            tPause.SetApartmentState(ApartmentState.STA);
            tPause.IsBackground = true;
            tPause.Start();

            Thread tActivateKM = new Thread(() => { Activate.ActivateKeyboardAndMouse(); });
            tActivateKM.SetApartmentState(ApartmentState.STA);
            tActivateKM.IsBackground = true;
            tActivateKM.Start();
        }
示例#3
0
        public static bool SetActiveConfig(string file)
        {
            var profilePath = Path.Combine("profiles", file);

            if (!File.Exists(profilePath))
            {
                return(false);
            }

            lock (ActiveConfig) {
                Data d = Data.Load(file);
                ActiveConfig = d;
            }

            // Make sure the ini file exists
            ReadConfiguration(file);

            ReloadActiveConfig();

            IniFile appcfg = new IniFile("config.ini");

            appcfg.AddSetting("Xbox", "KeyProfile", file);
            appcfg.SaveSettings();

            return(true);
        }
示例#4
0
        private static void ApplicationRun()
        {
            Application.EnableVisualStyles();

            // Load configuration Files
            // My improvised Config file
            ActiveConfig = Data.Load(ActiveConfigFile);
            ReloadControlScheme();
            DoneLoadingCfg = true;

            // Start our lowlevel keyboard hook
            if (IntPtr.Size == 8)
            {
                Hooks.LowLevelKeyboardHook._hookID =
                    Hooks.LowLevelKeyboardHook.SetHook(Hooks.LowLevelKeyboardHook._proc);

                if (Hooks.LowLevelKeyboardHook._hookID == IntPtr.Zero)
                {
                    MessageBox.Show("Failed to find the Xbox Application to disable Escape.");
                }
            }
            else
            {
                MessageBox.Show("In 32bit mode you cannot disable the Escape key!", "Notice about 32bit", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }

            Application.Run(mainform);
        }
示例#5
0
        static void Main(string[] args)
        {
            // Check if we are debugging
            // if so then attach the console
            #if (DEBUG)
            int conPtr = AllocConsole();
            AttachConsole(conPtr);
            Logger.appendLogLine("State", "Console Attached!", Logger.Type.Info);
            #endif

            ReadConfiguration();
            ActiveConfig = Data.Load(ActiveConfigFile);
            ReloadActiveConfig();
            ReloadControlScheme();

            TranslateKeyboard.LoadKeymap();

            Thread tApplicationRun = new Thread(ApplicationRun);
            tApplicationRun.SetApartmentState(ApartmentState.STA);
            tApplicationRun.Start();

            //XboxKeyboardMouse.Hooks.HIDHook.getInfo();

            //XboxKeyboardMouse.Hooks.InterceptKeys.init();


            while (MainForm == null)
            {
                Thread.Sleep(100);
            }

            MainForm.FormClosing += (sender, e) => { Activate.ShutDown(); };

            Thread tPause = new Thread(Pause);
            tPause.SetApartmentState(ApartmentState.STA);
            tPause.IsBackground = true;
            tPause.Start();

            Thread tActivateKM = new Thread(() => { Activate.ActivateKeyboardAndMouse(); });
            tActivateKM.SetApartmentState(ApartmentState.STA);
            tActivateKM.IsBackground = true;
            tActivateKM.Start();
        }