public GameRunning(GameProfile gameProfile, bool isTest, ParrotData parrotData, string testMenuString, bool testMenuIsExe = false, string testMenuExe = "", bool runEmuOnly = false) { InitializeComponent(); _runEmuOnly = runEmuOnly; _gameLocation = gameProfile.GamePath; InputCode.ButtonMode = gameProfile.EmulationProfile; _isTest = isTest; _gameProfile = gameProfile; _serialPortHandler = new SerialPortHandler(); _parrotData = parrotData; _testMenuString = testMenuString; _testMenuIsExe = testMenuIsExe; _testMenuExe = testMenuExe; if (parrotData?.GunSensitivityPlayer1 > 10) { _player1GunMultiplier = 10; } if (parrotData?.GunSensitivityPlayer1 < 0) { _player1GunMultiplier = 0; } if (parrotData?.GunSensitivityPlayer2 > 10) { _player2GunMultiplier = 10; } if (parrotData?.GunSensitivityPlayer2 < 0) { _player2GunMultiplier = 0; } }
/// <summary> /// Loads the settings data file. /// </summary> private void LoadParrotData() { try { if (!File.Exists("ParrotData.xml")) { MessageBox.Show("Seems this is first time you are running me, please set emulation settings.", "Hello World", MessageBoxButton.OK, MessageBoxImage.Information); _parrotData = new ParrotData(); Lazydata.ParrotData = _parrotData; JoystickHelper.Serialize(_parrotData); return; } _parrotData = JoystickHelper.DeSerialize(); if (_parrotData == null) { _parrotData = new ParrotData(); Lazydata.ParrotData = _parrotData; JoystickHelper.Serialize(_parrotData); } } catch (Exception e) { MessageBox.Show( $"Exception happened during loading ParrotData.xml! Generate new one by saving!{Environment.NewLine}{Environment.NewLine}{e}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void LoadStuff(ParrotData parrotData) { _parrotData = parrotData; BtnRefreshHaptic(null, null); if (_parrotData.SineBase != 0) { TxtSine.Text = _parrotData.SineBase.ToString(); } if (_parrotData.FrictionBase != 0) { TxtFriction.Text = _parrotData.FrictionBase.ToString(); } if (_parrotData.ConstantBase != 0) { TxtConstant.Text = _parrotData.ConstantBase.ToString(); } if (_parrotData.SpringBase != 0) { TxtSpring.Text = _parrotData.SpringBase.ToString(); } ChkUseFfb.IsChecked = _parrotData.UseHaptic; ChkThrustmasterFix.IsChecked = _parrotData.HapticThrustmasterFix; ChkUseSto0ZCheckBox.IsChecked = _parrotData.UseSto0ZDrivingHack; sTo0zZonePercent.Value = _parrotData.StoozPercent; ChkUseMouse.IsChecked = _parrotData.UseMouse; CmbJoystickInterface.SelectedIndex = _parrotData.XInputMode ? 1 : 0; ChkFullAxisGas.IsChecked = _parrotData.FullAxisGas; ChkFullAxisBrake.IsChecked = _parrotData.FullAxisBrake; ChkReverseAxisGas.IsChecked = _parrotData.ReverseAxisGas; ChkReverseAxisBrake.IsChecked = _parrotData.ReverseAxisBrake; GunSensitivityPlayer1.Value = _parrotData.GunSensitivityPlayer1; GunSensitivityPlayer2.Value = _parrotData.GunSensitivityPlayer2; }
private void BtnSaveSettings(object sender, RoutedEventArgs e) { try { if (_parrotData == null) { _parrotData = new ParrotData(); Lazydata.ParrotData = _parrotData; } _parrotData.UseSto0ZDrivingHack = ChkUseSto0ZCheckBox.IsChecked != null && ChkUseSto0ZCheckBox.IsChecked.Value; _parrotData.StoozPercent = (int)sTo0zZonePercent.Value; if (ChkFullAxisGas.IsChecked.HasValue) { _parrotData.FullAxisGas = ChkFullAxisGas.IsChecked.Value; } if (ChkReverseAxisGas.IsChecked.HasValue) { _parrotData.ReverseAxisGas = ChkReverseAxisGas.IsChecked.Value; } if (ChkFullAxisBrake.IsChecked.HasValue) { _parrotData.FullAxisBrake = ChkFullAxisBrake.IsChecked.Value; } if (ChkReverseAxisBrake.IsChecked.HasValue) { _parrotData.ReverseAxisBrake = ChkReverseAxisBrake.IsChecked.Value; } if (GunSensitivityPlayer1.Value != null) { _parrotData.GunSensitivityPlayer1 = (int)GunSensitivityPlayer1.Value; } if (GunSensitivityPlayer2.Value != null) { _parrotData.GunSensitivityPlayer2 = (int)GunSensitivityPlayer2.Value; } _parrotData.SaveLastPlayed = ChkSaveLastPlayed.IsChecked.Value; _parrotData.UseDiscordRPC = ChkUseDiscordRPC.IsChecked.Value; _parrotData.CheckForUpdates = ChkCheckForUpdates.IsChecked.Value; _parrotData.SilentMode = ChkSilentMode.IsChecked.Value; JoystickHelper.Serialize(_parrotData); DiscordRPC.Shutdown(); string[] psargs = Environment.GetCommandLineArgs(); System.Diagnostics.Process.Start(Application.ResourceAssembly.Location, psargs[0]); Application.Current.Shutdown(); } catch (Exception exception) { MessageBox.Show($"Exception happened during ParrotData.xml saving!{Environment.NewLine}{Environment.NewLine}{exception}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public GameRunning(GameProfile gameProfile, bool isTest, ParrotData parrotData, string testMenuString, bool testMenuIsExe = false, string testMenuExe = "", bool runEmuOnly = false, bool profileLaunch = false, Library library = null) { InitializeComponent(); if (profileLaunch == false && !runEmuOnly) { Application.Current.Windows.OfType <MainWindow>().Single().menuButton.IsEnabled = false; } textBoxConsole.Text = ""; _runEmuOnly = runEmuOnly; _gameLocation = gameProfile.GamePath; InputCode.ButtonMode = gameProfile.EmulationProfile; _isTest = isTest; _gameProfile = gameProfile; _serialPortHandler = new SerialPortHandler(); _parrotData = parrotData; _testMenuString = testMenuString; _testMenuIsExe = testMenuIsExe; _testMenuExe = testMenuExe; _cmdLaunch = profileLaunch; if (parrotData?.GunSensitivityPlayer1 > 10) { _player1GunMultiplier = 10; } if (parrotData?.GunSensitivityPlayer1 < 0) { _player1GunMultiplier = 0; } if (parrotData?.GunSensitivityPlayer2 > 10) { _player2GunMultiplier = 10; } if (parrotData?.GunSensitivityPlayer2 < 0) { _player2GunMultiplier = 0; } if (runEmuOnly) { buttonForceQuit.Visibility = Visibility.Collapsed; } gameName.Text = _gameProfile.GameName; _library = library; }
public void LoadStuff(ParrotData parrotData) { _parrotData = parrotData; ChkUseSto0ZCheckBox.IsChecked = _parrotData.UseSto0ZDrivingHack; sTo0zZonePercent.Value = _parrotData.StoozPercent; ChkSaveLastPlayed.IsChecked = _parrotData.SaveLastPlayed; ChkUseDiscordRPC.IsChecked = _parrotData.UseDiscordRPC; ChkCheckForUpdates.IsChecked = _parrotData.CheckForUpdates; ChkSilentMode.IsChecked = _parrotData.SilentMode; ChkFullAxisGas.IsChecked = _parrotData.FullAxisGas; ChkFullAxisBrake.IsChecked = _parrotData.FullAxisBrake; ChkReverseAxisGas.IsChecked = _parrotData.ReverseAxisGas; ChkReverseAxisBrake.IsChecked = _parrotData.ReverseAxisBrake; GunSensitivityPlayer1.Value = _parrotData.GunSensitivityPlayer1; GunSensitivityPlayer2.Value = _parrotData.GunSensitivityPlayer2; }
public void LoadNewSettings(GameProfile gameProfile, ComboBoxItem comboItem, ParrotData parrotData) { _gameProfile = gameProfile; _comboItem = comboItem; _isXinput = parrotData.XInputMode; // Hack foreach (var t in gameProfile.JoystickButtons) { t.BindName = _isXinput ? t.BindNameXi : t.BindNameDi; } JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons; if (_joystickControlXInput == null) { _joystickControlXInput = new JoystickControlXInput(); } if (_joystickControlDirectInput == null) { _joystickControlDirectInput = new JoystickControlDirectInput(); } }
public void LoadNewSettings(GameProfile gameProfile, ListBoxItem comboItem, ParrotData parrotData) { _gameProfile = gameProfile; _comboItem = comboItem; _isXinput = gameProfile.ConfigValues.Any(x => x.FieldName == "XInput" && x.FieldValue == "1"); // Hack foreach (var t in gameProfile.JoystickButtons) { t.BindName = _isXinput ? t.BindNameXi : t.BindNameDi; } JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons; if (_joystickControlXInput == null) { _joystickControlXInput = new JoystickControlXInput(); } if (_joystickControlDirectInput == null) { _joystickControlDirectInput = new JoystickControlDirectInput(); } }
private void BtnSaveSettings(object sender, RoutedEventArgs e) { try { if (_parrotData == null) { _parrotData = new ParrotData(); Lazydata.ParrotData = _parrotData; } if (ChkThrustmasterFix.IsChecked.HasValue) { _parrotData.HapticThrustmasterFix = ChkThrustmasterFix.IsChecked.Value; } _parrotData.ConstantBase = Convert.ToInt16(TxtConstant.Text); _parrotData.SineBase = Convert.ToInt16(TxtSine.Text); _parrotData.FrictionBase = Convert.ToInt16(TxtFriction.Text); _parrotData.SpringBase = Convert.ToInt16(TxtSpring.Text); if (ChkUseFfb.IsChecked.HasValue) { _parrotData.UseHaptic = ChkUseFfb.IsChecked.Value; } _parrotData.HapticDevice = (string)((ComboBoxItem)HapticComboBox.SelectedItem).Tag; _parrotData.UseSto0ZDrivingHack = ChkUseSto0ZCheckBox.IsChecked != null && ChkUseSto0ZCheckBox.IsChecked.Value; _parrotData.StoozPercent = (int)sTo0zZonePercent.Value; _parrotData.UseMouse = ChkUseMouse.IsChecked != null && ChkUseMouse.IsChecked.Value; _parrotData.XInputMode = _xinputMode; if (ChkFullAxisGas.IsChecked.HasValue) { _parrotData.FullAxisGas = ChkFullAxisGas.IsChecked.Value; } if (ChkReverseAxisGas.IsChecked.HasValue) { _parrotData.ReverseAxisGas = ChkReverseAxisGas.IsChecked.Value; } if (ChkFullAxisBrake.IsChecked.HasValue) { _parrotData.FullAxisBrake = ChkFullAxisBrake.IsChecked.Value; } if (ChkReverseAxisBrake.IsChecked.HasValue) { _parrotData.ReverseAxisBrake = ChkReverseAxisBrake.IsChecked.Value; } if (GunSensitivityPlayer1.Value != null) { _parrotData.GunSensitivityPlayer1 = (int)GunSensitivityPlayer1.Value; } if (GunSensitivityPlayer2.Value != null) { _parrotData.GunSensitivityPlayer2 = (int)GunSensitivityPlayer2.Value; } _parrotData.SaveLastPlayed = ChkSaveLastPlayed.IsChecked.Value; _parrotData.UseDiscordRPC = ChkUseDiscordRPC.IsChecked.Value; JoystickHelper.Serialize(_parrotData); MessageBox.Show("Generation of ParrotData.xml was succesful, please restart me!", "Save Complete", MessageBoxButton.OK, MessageBoxImage.Information); MainWindow.SafeExit(); } catch (Exception exception) { MessageBox.Show($"Exception happened during ParrotData.xml saving!{Environment.NewLine}{Environment.NewLine}{exception}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static void UseForceFeedback(ParrotData _parrotData, ref bool endCheckBox) { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; var f = new ForceFeedbackJesus.ForceFeedbackJesus(); var initResult = f.InitializeHaptic(_parrotData.HapticThrustmasterFix, _parrotData.HapticDevice, _parrotData.ConstantBase, _parrotData.SineBase, _parrotData.FrictionBase, _parrotData.SpringBase, 0); if (initResult != string.Empty) { MessageBox.Show(initResult, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } f.TriggerSpringEffect(4); if (InputCode.ButtonMode == EmulationProfile.NamcoWmmt5) { while (!endCheckBox) { //var val1 = BitConverter.ToSingle(BitConverter.GetBytes(JvsHelper.StateView.ReadUInt32(8)), 0) * // 10f; var val2 = BitConverter.ToSingle(BitConverter.GetBytes(JvsHelper.StateView.ReadUInt32(12)), 0) * 10f; var val3 = BitConverter.ToSingle(BitConverter.GetBytes(JvsHelper.StateView.ReadUInt32(16)), 0) * 10f; //if(_parrotData.HapticThrustmasterFix) // f.TriggerSpringEffectInfinite(6); f.TriggerFrictionEffectInfinite(val3); //f.TriggerSpringEffectInfinite(val1); f.TriggerSpringEffectInfinite(val2); float my4ByteFloat = BitConverter.ToSingle(BitConverter.GetBytes(JvsHelper.StateView.ReadUInt32(20)), 0); if (my4ByteFloat < 0) { // negative value f.TriggerRightRollEffect(-my4ByteFloat * 10f); } else if (my4ByteFloat > 0) { // positive value f.TriggerLeftRollEffect(my4ByteFloat * 10f); } Thread.Sleep(10); } } if (InputCode.ButtonMode == EmulationProfile.WackyRaces || InputCode.ButtonMode == EmulationProfile.ChaseHq2) { while (!endCheckBox) { byte value = JvsHelper.StateView.ReadByte(8); if (_lastValue != value) { ffbEffectSender(f, value); _lastValue = value; } Thread.Sleep(10); } } if (InputCode.ButtonMode == EmulationProfile.SegaInitialD) { while (!endCheckBox) { Int32 value = JvsHelper.StateView.ReadInt32(8); if (_lastValueInt32 != value) { ffbEffectSender(f, value); _lastValueInt32 = value; } Thread.Sleep(10); } } if (InputCode.ButtonMode == EmulationProfile.Outrun2SPX) { f.TriggerSpringEffectInfinite(8); f.TriggerFrictionEffectInfinite(8); while (!endCheckBox) { int value = JvsHelper.StateView.ReadInt32(8); if (value > 0x100) { ffbEffectSender(f, (byte)(value - 0x100)); JvsHelper.StateView.Write(8, value - 0x100); } Thread.Sleep(10); } } if (InputCode.ButtonMode == EmulationProfile.EuropaRSegaRally3 || InputCode.ButtonMode == EmulationProfile.EuropaRFordRacing) { while (!endCheckBox) { byte value = JvsHelper.StateView.ReadByte(8); if (_lastValue != value) { ffbEffectSender(f, value); _lastValue = value; } Thread.Sleep(10); } } if (InputCode.ButtonMode == EmulationProfile.SegaRacingClassic) { while (!endCheckBox) { byte value = JvsHelper.StateView.ReadByte(9); if (_lastValue != value) { ffbEffectSender(f, value); _lastValue = value; } Thread.Sleep(10); } } f.Uninitialize(); }