Пример #1
0
        static void Main(string[] args)
        {
            emClient = new ViGEmClient();             // Manages emulated XInput

            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Get local BT host MAC
                if (nic.NetworkInterfaceType != NetworkInterfaceType.FastEthernetFx && nic.NetworkInterfaceType != NetworkInterfaceType.Wireless80211)
                {
                    if (nic.Name.Split()[0] == "Bluetooth")
                    {
                        btMAC = nic.GetPhysicalAddress();
                    }
                }
            }

            JoyconManager mgr = new JoyconManager();

            mgr.Awake();
            mgr.Start();

            server = new UdpServer(mgr.j);

            server.Start(IPAddress.Parse(ConfigurationSettings.AppSettings["IP"]), Int32.Parse(ConfigurationSettings.AppSettings["Port"]));
            HighResTimer timer = new HighResTimer(pollsPerSecond, new HighResTimer.ActionDelegate(mgr.Update));

            timer.Start();

            Console.Write("Press enter to quit.");
            Console.ReadLine();

            server.Stop();
            timer.Stop();
            mgr.OnApplicationQuit();
        }
Пример #2
0
        static void Main(string[] args)
        {
            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Get local BT host MAC
                if (nic.NetworkInterfaceType != NetworkInterfaceType.FastEthernetFx && nic.NetworkInterfaceType != NetworkInterfaceType.Wireless80211)
                {
                    if (nic.Name.Split()[0] == "Bluetooth")
                    {
                        btMAC = nic.GetPhysicalAddress();
                    }
                }
            }

            JoyconManager mgr = new JoyconManager();

            mgr.Awake();
            mgr.Start();

            server = new UdpServer(mgr.j);

            //updateThread = new Thread(new ThreadStart(mgr.Update));
            //updateThread.Start();

            server.Start(26760);
            HighResTimer timer = new HighResTimer(pollsPerSecond, new HighResTimer.ActionDelegate(mgr.Update));

            timer.Start();

            Console.Write("Press enter to quit.");
            Console.ReadLine();

            server.Stop();
            timer.Stop();
            mgr.OnApplicationQuit();
        }
Пример #3
0
        public static void Start()
        {
            pid = Process.GetCurrentProcess().Id.ToString();             // get current process id for HidCerberus.Srv

            if (useHIDG)
            {
                try {
                    var HidCerberusService = new ServiceController("HidCerberus Service");
                    if (HidCerberusService.Status == ServiceControllerStatus.Stopped)
                    {
                        form.console.Text += "HidGuardian was stopped. Starting...\r\n";

                        try {
                            HidCerberusService.Start();
                        } catch (Exception e) {
                            form.console.Text += "Unable to start HidGuardian - everything should work fine without it, but if you need it, run the app again as an admin.\r\n";
                            useHIDG            = false;
                        }
                    }
                } catch (Exception e) {
                    form.console.Text += "Unable to start HidGuardian - everything should work fine without it, but if you need it, install it properly as admin.\r\n";
                    useHIDG            = false;
                }

                HttpWebResponse response;
                if (Boolean.Parse(ConfigurationManager.AppSettings["PurgeWhitelist"]))
                {
                    try {
                        response = (HttpWebResponse)WebRequest.Create(@"http://*****:*****@"http://localhost:26762/api/v1/hidguardian/whitelist/add/" + pid).GetResponse();                     // add BetterJoyForCemu to allowed processes
                } catch (Exception e) {
                    form.console.Text += "Unable to add program to whitelist.\r\n";
                    useHIDG            = false;
                }
            }
            else
            {
                form.console.Text += "HidGuardian is disabled.\r\n";
            }

            emClient = new ViGEmClient();             // Manages emulated XInput

            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Get local BT host MAC
                if (nic.NetworkInterfaceType != NetworkInterfaceType.FastEthernetFx && nic.NetworkInterfaceType != NetworkInterfaceType.Wireless80211)
                {
                    if (nic.Name.Split()[0] == "Bluetooth")
                    {
                        btMAC = nic.GetPhysicalAddress();
                    }
                }
            }

            mgr      = new JoyconManager();
            mgr.form = form;
            mgr.Awake();
            mgr.CheckForNewControllers();
            mgr.Start();

            server      = new UdpServer(mgr.j);
            server.form = form;

            server.Start(IPAddress.Parse(ConfigurationManager.AppSettings["IP"]), Int32.Parse(ConfigurationManager.AppSettings["Port"]));
            timer = new HighResTimer(pollsPerSecond, new HighResTimer.ActionDelegate(mgr.Update));
            timer.Start();

            form.console.Text += "All systems go\r\n";
        }
Пример #4
0
        public static void Start()
        {
            pid = Process.GetCurrentProcess().Id.ToString();             // get current process id for HidCerberus.Srv

            if (useHIDG)
            {
                form.console.AppendText("HidGuardian is enabled.\r\n");
                try {
                    var HidCerberusService = new ServiceController("HidCerberus Service");
                    if (HidCerberusService.Status == ServiceControllerStatus.Stopped)
                    {
                        form.console.AppendText("HidGuardian was stopped. Starting...\r\n");

                        try {
                            HidCerberusService.Start();
                        } catch (Exception e) {
                            form.console.AppendText("Unable to start HidGuardian - everything should work fine without it, but if you need it, run the app again as an admin.\r\n");
                            useHIDG = false;
                        }
                    }
                } catch (Exception e) {
                    form.console.AppendText("Unable to start HidGuardian - everything should work fine without it, but if you need it, install it properly as admin.\r\n");
                    useHIDG = false;
                }

                HttpWebResponse response;
                if (Boolean.Parse(ConfigurationManager.AppSettings["PurgeWhitelist"]))
                {
                    try {
                        response = (HttpWebResponse)WebRequest.Create(@"http://*****:*****@"http://localhost:26762/api/v1/hidguardian/whitelist/add/" + pid).GetResponse();                     // add BetterJoyForCemu to allowed processes
                } catch (Exception e) {
                    form.console.AppendText("Unable to add program to whitelist.\r\n");
                    useHIDG = false;
                }
            }

            if (Boolean.Parse(ConfigurationManager.AppSettings["ShowAsXInput"]) || Boolean.Parse(ConfigurationManager.AppSettings["ShowAsDS4"]))
            {
                try {
                    emClient = new ViGEmClient();                     // Manages emulated XInput
                } catch (Nefarius.ViGEm.Client.Exceptions.VigemBusNotFoundException) {
                    form.console.AppendText("Could not start VigemBus. Make sure drivers are installed correctly.\r\n");
                }
            }

            foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                // Get local BT host MAC
                if (nic.NetworkInterfaceType != NetworkInterfaceType.FastEthernetFx && nic.NetworkInterfaceType != NetworkInterfaceType.Wireless80211)
                {
                    if (nic.Name.Split()[0] == "Bluetooth")
                    {
                        btMAC = nic.GetPhysicalAddress();
                    }
                }
            }

            mgr      = new JoyconManager();
            mgr.form = form;
            mgr.Awake();
            mgr.CheckForNewControllers();
            mgr.Start();

            server      = new UdpServer(mgr.j);
            server.form = form;

            server.Start(IPAddress.Parse(ConfigurationManager.AppSettings["IP"]), Int32.Parse(ConfigurationManager.AppSettings["Port"]));
            timer = new HighResTimer(pollsPerSecond, new HighResTimer.ActionDelegate(mgr.Update));
            timer.Start();

            // Capture keyboard + mouse events for binding's sake
            keyboard           = WindowsInput.Capture.Global.KeyboardAsync();
            keyboard.KeyEvent += Keyboard_KeyEvent;
            mouse              = WindowsInput.Capture.Global.MouseAsync();
            mouse.MouseEvent  += Mouse_MouseEvent;

            form.console.AppendText("All systems go\r\n");
        }