Example #1
0
        public MainWindow()
        {
#if DEBUG
            if (!File.Exists("idzconfig.bin"))
            {
                MainWindow_new mwNew = new MainWindow_new();
                mwNew.ShowDialog();
                gameConfig = mwNew.newConfig;
                if (!gameConfig.XOrDInput)
                {
                    ControllerSettings cs = new ControllerSettings(gameConfig, gameConfig.XOrDInput);
                    cs.ShowDialog();
                }
            }
#endif
            AutoUpdater.Start("https://raw.githubusercontent.com/nzgamer41/ZeroLauncher/master/Autoupdate.xml");
            try
            {
                InitializeComponent();
                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (nic.Supports(NetworkInterfaceComponent.IPv4) == false)
                    {
                        continue;
                    }
                    foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)
                    {
                        if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            networkAdapters.Add(nic);
                            comboBoxNetAdapter.Items.Add(nic.Name + " " + ip.Address.ToString());
                        }
                    }
                }

                if (File.Exists("idzconfig.bin"))
                {
                    gameConfig = ReadFromBinaryFile <IDZConfig>("idzconfig.bin");
                    updateUI();
                }
                else
                {
                    comboBoxNetAdapter.SelectedIndex = 0;
                    updateUI();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Example #2
0
        //private static Thread _inputListener;
        public ControllerSettings(IDZConfig gameProfile, bool isXinput)
        {
            InitializeComponent();
            _gameProfile = gameProfile;
            _isXinput    = isXinput;
            if (_isXinput)
            {
                MessageBox.Show("Whoops, somehow you've ended up here with XInput selected. Gonna close this now. XINPUT MAPPING COMING SOME TIME IN 2021!");
                this.Close();
            }

            if (_joystick != null)
            {
                _joystick.Dispose();
            }
            dInput = new DirectInput();
            var joystickGuid = Guid.Empty;

            foreach (var device in dInput.GetDevices(DeviceType.Joystick, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.Driving, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.Gamepad, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.FirstPerson, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            if (joystickGuid == Guid.Empty)
            {
                MessageBox.Show("No DirectInput joystick connected");
                return;
            }

            _joystick = new Joystick(dInput, joystickGuid);
            _joystick.Properties.BufferSize = 512;
            _joystick.Acquire();
        }
Example #3
0
        //private static Thread _inputListener;
        public ControllerSettings(IDZConfig gameProfile, bool isXinput)
        {
            InitializeComponent();
            _gameProfile = gameProfile;
            _isXinput    = isXinput;
            if (_joystick != null)
            {
                _joystick.Dispose();
            }
            dInput = new DirectInput();
            var joystickGuid = Guid.Empty;

            foreach (var device in dInput.GetDevices(DeviceType.Joystick, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.Driving, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.Gamepad, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            foreach (var device in dInput.GetDevices(DeviceType.FirstPerson, DeviceEnumerationFlags.AttachedOnly))
            {
                joystickGuid = device.InstanceGuid;
                break;
            }
            if (joystickGuid == Guid.Empty)
            {
                MessageBox.Show("No DirectInput joystick connected");
                return;
            }

            _joystick = new Joystick(dInput, joystickGuid);
            _joystick.Properties.BufferSize = 512;
            _joystick.Acquire();
        }
Example #4
0
        public MainWindow()
        {
#if DEBUG
            MainWindow_new mwNew = new MainWindow_new();
            mwNew.ShowDialog();
#endif
            AutoUpdater.Start("https://raw.githubusercontent.com/nzgamer41/ZeroLauncher/master/Autoupdate.xml");
            try
            {
                InitializeComponent();
                foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (nic.Supports(NetworkInterfaceComponent.IPv4) == false)
                    {
                        continue;
                    }
                    foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)
                    {
                        if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            networkAdapters.Add(nic);
                            comboBoxNetAdapter.Items.Add(nic.Name + " " + ip.Address.ToString());
                        }
                    }
                }

                if (File.Exists("idzconfig.bin"))
                {
                    gameConfig = ReadFromBinaryFile <IDZConfig>("idzconfig.bin");
                    int selAdapter = networkAdapters.FindIndex(x => x.Name == gameConfig.selectedNic);
                    comboBoxNetAdapter.SelectedIndex = selAdapter;
                    if (gameConfig.JapOrExp)
                    {
                        buttonJap.IsChecked = false;
                        buttonExp.IsChecked = true;
                    }
                    else if (gameConfig.JapOrExp == false)
                    {
                        buttonExp.IsChecked = false;
                        buttonJap.IsChecked = true;
                    }

                    textBoxGameAMFS.Text = gameConfig.AMFSDir;

                    checkBoxIdeal.IsChecked    = gameConfig.IdealLan;
                    checkBoxDistServ.IsChecked = gameConfig.DistServer;
                    if (gameConfig.restriction != 0)
                    {
                        restrictUpDown.Value = gameConfig.restriction;
                    }
                    else
                    {
                        restrictUpDown.Value = 97;
                    }
                    // When I implement a online AIME server this will be togglable
                    //checkBoxAime.IsChecked = gameConfig.ImitateMe;
                    string reg = "Japan";
                    if (gameConfig.JapOrExp)
                    {
                        reg = "Export";
                    }
                    string reg2 = "DInput";
                    if (gameConfig.XOrDInput)
                    {
                        reg2 = "XInput";
                    }
                }
                else
                {
                    comboBoxNetAdapter.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }