diff --git a/FalconBMS Alternative Launcher Cs/AppRegInfo.cs b/FalconBMS Alternative Launcher Cs/AppRegInfo.cs
index 14d26d6..ed92ee9 100644
--- a/FalconBMS Alternative Launcher Cs/AppRegInfo.cs
+++ b/FalconBMS Alternative Launcher Cs/AppRegInfo.cs
@@ -168,6 +168,25 @@ public AppRegInfo(MainWindow mainWindow)
return;
}
+ byte[] bs;
+ if (regkey.GetValue("PilotName") == null)
+ {
+ this.regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regName, true);
+ bs = new byte[] { 0x4a, 0x6f, 0x65, 0x20, 0x50, 0x69, 0x6c, 0x6f, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ regkey.SetValue("PilotName", bs);
+ }
+ if (regkey.GetValue("PilotCallsign") == null)
+ {
+ this.regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regName, true);
+ bs = new byte[] { 0x56, 0x69, 0x70, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ regkey.SetValue("PilotCallsign", bs);
+ }
+ if (regkey.GetValue("curTheater") == null)
+ {
+ this.regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regName, true);
+ regkey.SetValue("curTheater", "Korea KTO");
+ }
+
this.installDir = (string)regkey.GetValue("baseDir");
this.currentTheater = (string)regkey.GetValue("curTheater");
this.pilotCallsign = (Encoding.UTF8.GetString((byte[])regkey.GetValue("PilotCallsign"))).Replace("\0", "");
diff --git a/FalconBMS Alternative Launcher Cs/DeviceControl.cs b/FalconBMS Alternative Launcher Cs/DeviceControl.cs
index c703817..24e00a8 100644
--- a/FalconBMS Alternative Launcher Cs/DeviceControl.cs
+++ b/FalconBMS Alternative Launcher Cs/DeviceControl.cs
@@ -36,6 +36,7 @@ public DeviceControl(AppRegInfo appReg)
System.Xml.Serialization.XmlSerializer serializer;
System.IO.StreamReader sr;
string fileName = "";
+ string stockFileName = "";
int i = 0;
foreach (DeviceInstance dev in devList)
@@ -58,6 +59,20 @@ public DeviceControl(AppRegInfo appReg)
joyAssign[i] = (JoyAssgn)serializer.Deserialize(sr);
sr.Close();
}
+ else
+ {
+ stockFileName = appReg.GetInstallDir() + "/User/Config/Setup.v100." + joyAssign[i].GetProductName().Replace("/", "-")
+ + " {Stock}.xml";
+ if (File.Exists(stockFileName))
+ {
+ File.Copy(stockFileName, fileName);
+
+ serializer = new System.Xml.Serialization.XmlSerializer(typeof(JoyAssgn));
+ sr = new System.IO.StreamReader(fileName, new System.Text.UTF8Encoding(false));
+ joyAssign[i] = (JoyAssgn)serializer.Deserialize(sr);
+ sr.Close();
+ }
+ }
joyAssign[i].SetDeviceInstance(dev);
i += 1;
}
diff --git a/FalconBMS Alternative Launcher Cs/JoyAssgn.cs b/FalconBMS Alternative Launcher Cs/JoyAssgn.cs
index e34893d..e0e7416 100644
--- a/FalconBMS Alternative Launcher Cs/JoyAssgn.cs
+++ b/FalconBMS Alternative Launcher Cs/JoyAssgn.cs
@@ -451,6 +451,28 @@ public string GetKeyLineDX(int joynum, int numOfDevices)
{
if (this.dx[i].assign[ii].GetCallback() == "SimDoNothing")
continue;
+ if (this.dx[i].assign[ii].GetCallback() == "SimHotasPinkyShift")
+ {
+ if (ii != 0)
+ continue;
+ assign += this.dx[i].assign[ii].GetCallback();
+ assign += " " + (joynum * 32 + i).ToString();
+ assign += " " + ((int)Invoke.Default).ToString();
+ assign += " " + "-2";
+ assign += " " + "0";
+ assign += " " + "0x0";
+ assign += " " + this.dx[i].assign[ii].GetSoundID();
+ assign += "\n";
+ assign += this.dx[i].assign[ii].GetCallback();
+ assign += " " + (numOfDevices * 32 + joynum * 32 + i).ToString();
+ assign += " " + ((int)Invoke.Default).ToString();
+ assign += " " + "-2";
+ assign += " " + "0";
+ assign += " " + "0x0";
+ assign += " " + this.dx[i].assign[ii].GetSoundID();
+ assign += "\n";
+ continue;
+ }
assign += this.dx[i].assign[ii].GetCallback();
if (ii == 0 | ii == 2)
assign += " " + (joynum * 32 + i).ToString();
diff --git a/FalconBMS Alternative Launcher Cs/MainWindow.xaml.cs b/FalconBMS Alternative Launcher Cs/MainWindow.xaml.cs
index 8e28f7b..132bc08 100644
--- a/FalconBMS Alternative Launcher Cs/MainWindow.xaml.cs
+++ b/FalconBMS Alternative Launcher Cs/MainWindow.xaml.cs
@@ -53,44 +53,75 @@ public MainWindow()
///
private void Window_Loaded(object sender, RoutedEventArgs e)
{
- // load command line.
- string[] args = Environment.GetCommandLineArgs();
- var option = new Dictionary();
- for (int index = 1; index < args.Length; index += 2)
+ try
{
- option.Add(args[index], args[index + 1]);
- }
- if (option.ContainsKey("/yame") == true)
- if (option["/yame"] == "true")
- FLG_YAME64 = true;
- if (FLG_YAME64)
- {
- LargeTab.SelectedIndex = 1;
- Tab_Launcher.Visibility = Visibility.Collapsed;
- Tab_VisualAcuity.Visibility = Visibility.Collapsed;
- Misc_SmartScalingOverride.IsChecked = false;
+ // load command line.
+ string[] args = Environment.GetCommandLineArgs();
+ var option = new Dictionary();
+ for (int index = 1; index < args.Length; index += 2)
+ {
+ option.Add(args[index], args[index + 1]);
+ }
+ if (option.ContainsKey("/yame") == true)
+ if (option["/yame"] == "true")
+ FLG_YAME64 = true;
+ if (option.ContainsKey("/visibility") == true)
+ {
+ if (option["/visibility"] == "true")
+ {
+ Tab_VisualAcuity.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ Tab_VisualAcuity.Visibility = Visibility.Collapsed;
+ Misc_SmartScalingOverride.IsChecked = false;
+ }
+ }
+ else
+ {
+ Tab_VisualAcuity.Visibility = Visibility.Collapsed;
+ Misc_SmartScalingOverride.IsChecked = false;
+ }
+
+ if (FLG_YAME64)
+ {
+ LargeTab.SelectedIndex = 1;
+ Tab_Launcher.Visibility = Visibility.Collapsed;
+
+ this.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
+ BackGroundBox1.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
+ BackGroundBox2.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
+ BackGroundImage.Opacity = 0;
+
+ Button_Apply_YAME64.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ Button_Apply_YAME64.Visibility = Visibility.Hidden;
+ }
- this.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
- BackGroundBox1.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
- BackGroundBox2.Background = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
- BackGroundImage.Opacity = 0;
+ // Load UI Properties(Like Button Status).
+ this.appProperties = new AppProperties(this);
- Button_Apply_YAME64.Visibility = Visibility.Visible;
+ // Read Registry
+ this.appReg = new AppRegInfo(this);
}
- else
+ catch (System.IO.FileNotFoundException ex)
{
- Button_Apply_YAME64.Visibility = Visibility.Hidden;
+ System.Console.WriteLine(ex.Message);
+
+ System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\FBMSAltLauncherErrorLog.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
+
+ MessageBox.Show("Error Log Saved To C:\\FBMSAltLauncherErrorLog.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ this.Close();
}
try
{
- // Load UI Properties(Like Button Status).
- this.appProperties = new AppProperties(this);
-
- // Read Registry
- this.appReg = new AppRegInfo(this);
-
// Read Theater List
TheaterList theaterlist = new TheaterList(appReg, this.Dropdown_TheaterList);
@@ -134,6 +165,8 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
sw.Write(ex.Message);
sw.Close();
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
this.Close();
}
}
@@ -145,9 +178,24 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
///
private void Window_Closed(object sender, EventArgs e)
{
- // Save UI Properties(Like Button Status).
- this.appProperties.SaveUISetup();
- this.appReg.getOverrideWriter().Execute(inGameAxis, deviceControl, keyFile, visualAcuity);
+ try
+ {
+ // Save UI Properties(Like Button Status).
+ this.appProperties.SaveUISetup();
+ this.appReg.getOverrideWriter().Execute(inGameAxis, deviceControl, keyFile, visualAcuity);
+ }
+ catch (System.IO.FileNotFoundException ex)
+ {
+ System.Console.WriteLine(ex.Message);
+
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
+
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ this.Close();
+ }
}
///
@@ -223,73 +271,89 @@ private void OpenDocs_Click(object sender, RoutedEventArgs e)
///
private void Launch_Click(object sender, RoutedEventArgs e)
{
- System.Diagnostics.Process process;
- switch (((System.Windows.Controls.Button)sender).Name)
+ try
{
- case "Launch_BMS":
- string strCmdText = "";
- if (CMD_ACMI.IsChecked == false)
- strCmdText += "-acmi ";
- if (CMD_WINDOW.IsChecked == false)
- strCmdText += "-window ";
- if (CMD_NOMOVIE.IsChecked == false)
- strCmdText += "-nomovie ";
- if (CMD_EF.IsChecked == false)
- strCmdText += "-ef ";
- if (CMD_MONO.IsChecked == false)
- strCmdText += "-mono ";
- strCmdText += "-bw " + appProperties.bandWidthDefault;
-
- // OVERRIDE SETTINGS.
- if (this.ApplicationOverride.IsChecked == true)
- {
- string textMessage = "You are going to launch BMS without any setup override from AxisAssign and KeyMapping section. Will you continue?";
- if (MessageBox.Show(textMessage, "WARNING", MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.Cancel)
+
+ System.Diagnostics.Process process;
+ switch (((System.Windows.Controls.Button)sender).Name)
+ {
+ case "Launch_BMS":
+ string strCmdText = "";
+ if (CMD_ACMI.IsChecked == false)
+ strCmdText += "-acmi ";
+ if (CMD_WINDOW.IsChecked == false)
+ strCmdText += "-window ";
+ if (CMD_NOMOVIE.IsChecked == false)
+ strCmdText += "-nomovie ";
+ if (CMD_EF.IsChecked == false)
+ strCmdText += "-ef ";
+ if (CMD_MONO.IsChecked == false)
+ strCmdText += "-mono ";
+ strCmdText += "-bw " + appProperties.bandWidthDefault;
+
+ // OVERRIDE SETTINGS.
+ if (this.ApplicationOverride.IsChecked == true)
+ {
+ string textMessage = "You are going to launch BMS without any setup override from AxisAssign and KeyMapping section. Will you continue?";
+ if (MessageBox.Show(textMessage, "WARNING", MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.Cancel)
+ return;
+ }
+ else
+ {
+ appReg.getOverrideWriter().Execute(inGameAxis, deviceControl, keyFile, visualAcuity);
+ }
+
+ String appPlatform = appReg.GetInstallDir() + "/Bin/x86/Falcon BMS.exe";
+ if (this.Misc_Platform.IsChecked == true)
+ appPlatform = appReg.GetInstallDir() + "/Bin/x64/Falcon BMS.exe";
+ if (File.Exists(appPlatform) == false)
+ {
+ this.Misc_Platform.IsChecked = false;
+ appPlatform = appReg.GetInstallDir() + "/Bin/x86/Falcon BMS.exe";
return;
- }
- else
- {
- appReg.getOverrideWriter().Execute(inGameAxis, deviceControl, keyFile, visualAcuity);
- }
+ }
+ process = System.Diagnostics.Process.Start(appPlatform, strCmdText);
+ this.WindowState = WindowState.Minimized;
+ process.Exited += new EventHandler(window_Normal);
+ process.EnableRaisingEvents = true;
+ this.WindowState = WindowState.Minimized;
+ break;
+ case "Launch_CFG":
+ process = System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Config.exe");
+ process.Exited += new EventHandler(window_Normal);
+ process.EnableRaisingEvents = true;
+ this.WindowState = WindowState.Minimized;
+ break;
+ case "Launch_DISX":
+ System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/Display Extraction.exe");
+ break;
+ case "Launch_IVCC":
+ System.IO.Directory.SetCurrentDirectory(appReg.GetInstallDir() + "/Bin/x86/IVC/");
+ System.Diagnostics.Process.Start("IVC Client.exe");
+ break;
+ case "Launch_IVCS":
+ System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/IVC/IVC Server.exe");
+ break;
+ case "Launch_AVC":
+ System.IO.Directory.SetCurrentDirectory(appReg.GetInstallDir() + "/Bin/x86/");
+ System.Diagnostics.Process.Start("Avionics Configurator.exe");
+ break;
+ case "Launch_EDIT":
+ System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/Editor.exe");
+ break;
+ }
+ }
+ catch (System.IO.FileNotFoundException ex)
+ {
+ System.Console.WriteLine(ex.Message);
- String appPlatform = appReg.GetInstallDir() + "/Bin/x86/Falcon BMS.exe";
- if (this.Misc_Platform.IsChecked == true)
- appPlatform = appReg.GetInstallDir() + "/Bin/x64/Falcon BMS.exe";
- if (File.Exists(appPlatform) == false)
- {
- this.Misc_Platform.IsChecked = false;
- appPlatform = appReg.GetInstallDir() + "/Bin/x86/Falcon BMS.exe";
- return;
- }
- process = System.Diagnostics.Process.Start(appPlatform, strCmdText);
- this.WindowState = WindowState.Minimized;
- process.Exited += new EventHandler(window_Normal);
- process.EnableRaisingEvents = true;
- this.WindowState = WindowState.Minimized;
- break;
- case "Launch_CFG":
- process = System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Config.exe");
- process.Exited += new EventHandler(window_Normal);
- process.EnableRaisingEvents = true;
- this.WindowState = WindowState.Minimized;
- break;
- case "Launch_DISX":
- System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/Display Extraction.exe");
- break;
- case "Launch_IVCC":
- System.IO.Directory.SetCurrentDirectory(appReg.GetInstallDir() + "/Bin/x86/IVC/");
- System.Diagnostics.Process.Start("IVC Client.exe");
- break;
- case "Launch_IVCS":
- System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/IVC/IVC Server.exe");
- break;
- case "Launch_AVC":
- System.IO.Directory.SetCurrentDirectory(appReg.GetInstallDir() + "/Bin/x86/");
- System.Diagnostics.Process.Start("Avionics Configurator.exe");
- break;
- case "Launch_EDIT":
- System.Diagnostics.Process.Start(appReg.GetInstallDir() + "/Bin/x86/Editor.exe");
- break;
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
+
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ this.Close();
}
}
@@ -310,204 +374,220 @@ private void window_Normal(object sender, System.EventArgs e)
///
private void Launch_Third(object sender, RoutedEventArgs e)
{
- string target = "";
- string downloadlink = "";
- string installexe = "";
-
- switch (((System.Windows.Controls.Button)sender).Name)
+ try
{
- case "Launch_WDP":
- target = @"C:\Weapon Delivery Planner\WeaponDeliveryPlanner.exe";
- if (File.Exists(target) == true)
- {
- System.Diagnostics.Process.Start(target);
- break;
- }
- target = "\\WeaponDeliveryPlanner.exe";
- downloadlink = "http://www.weapondeliveryplanner.nl/";
- installexe = Properties.Settings.Default.Third_WDP + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_WDP = fbd.SelectedPath;
- else
- {
- System.Diagnostics.Process.Start(downloadlink);
- return;
- }
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_MC":
- target = "\\Mission Commander.exe";
- downloadlink = "http://www.weapondeliveryplanner.nl/";
- installexe = Properties.Settings.Default.Third_MC + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+ string target = "";
+ string downloadlink = "";
+ string installexe = "";
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_MC = fbd.SelectedPath;
- else
+ switch (((System.Windows.Controls.Button)sender).Name)
+ {
+ case "Launch_WDP":
+ target = @"C:\Weapon Delivery Planner\WeaponDeliveryPlanner.exe";
+ if (File.Exists(target) == true)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Diagnostics.Process.Start(target);
+ break;
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_WC":
- target = "\\Weather Commander.exe";
- downloadlink = "http://www.weapondeliveryplanner.nl/";
- installexe = Properties.Settings.Default.Third_WC + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_WC = fbd.SelectedPath;
- else
+ target = "\\WeaponDeliveryPlanner.exe";
+ downloadlink = "http://www.weapondeliveryplanner.nl/";
+ installexe = Properties.Settings.Default.Third_WDP + target;
+ if (File.Exists(installexe) == false)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_WDP = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_F4WX":
- target = "\\F4Wx.exe";
- downloadlink = "https://www.bmsforum.org/forum/showthread.php?29203";
- installexe = Properties.Settings.Default.Third_F4WX + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_F4WX = fbd.SelectedPath;
- else
+ System.Diagnostics.Process.Start(installexe);
+ break;
+ case "Launch_MC":
+ target = "\\Mission Commander.exe";
+ downloadlink = "http://www.weapondeliveryplanner.nl/";
+ installexe = Properties.Settings.Default.Third_MC + target;
+ if (File.Exists(installexe) == false)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_MC = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_F4AWACS":
- target = "\\F4AWACS.exe";
- downloadlink = "http://sakgiok.gr/";
- installexe = Properties.Settings.Default.Third_F4AWACS + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_F4AWACS = fbd.SelectedPath;
- else
+ System.Diagnostics.Process.Start(installexe);
+ break;
+ case "Launch_WC":
+ target = "\\Weather Commander.exe";
+ downloadlink = "http://www.weapondeliveryplanner.nl/";
+ installexe = Properties.Settings.Default.Third_WC + target;
+ if (File.Exists(installexe) == false)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_WC = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_TIR":
- target = @"C:\Program Files (x86)\NaturalPoint\TrackIR5\TrackIR5.exe";
- if (File.Exists(target) == true)
- {
- System.Diagnostics.Process.Start(target);
+ System.Diagnostics.Process.Start(installexe);
break;
- }
- target = "\\TrackIR5.exe";
- downloadlink = "https://www.naturalpoint.com/trackir/";
- installexe = Properties.Settings.Default.Third_TIR + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_TIR = fbd.SelectedPath;
- else
+ case "Launch_F4WX":
+ target = "\\F4Wx.exe";
+ downloadlink = "https://www.bmsforum.org/forum/showthread.php?29203";
+ installexe = Properties.Settings.Default.Third_F4WX + target;
+ if (File.Exists(installexe) == false)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_F4WX = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
- case "Launch_VA":
- target = @"C:\Program Files (x86)\VoiceAttack\VoiceAttack.exe";
- if (File.Exists(target) == true)
- {
- System.Diagnostics.Process.Start(target);
+ System.Diagnostics.Process.Start(installexe);
break;
- }
- target = @"C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\VoiceAttack.exe";
- if (File.Exists(target) == true)
- {
- System.Diagnostics.Process.Start(target);
+ case "Launch_F4AWACS":
+ target = "\\F4AWACS.exe";
+ downloadlink = "http://sakgiok.gr/";
+ installexe = Properties.Settings.Default.Third_F4AWACS + target;
+ if (File.Exists(installexe) == false)
+ {
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_F4AWACS = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
+ }
+ System.Diagnostics.Process.Start(installexe);
break;
- }
- target = "\\VoiceAttack.exe";
- downloadlink = "https://voiceattack.com/";
- installexe = Properties.Settings.Default.Third_VA + target;
- if (File.Exists(installexe) == false)
- {
- System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
-
- fbd.Description = "Select Install Directory";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- fbd.ShowNewFolderButton = false;
- System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
-
- installexe = fbd.SelectedPath + target;
- if (File.Exists(installexe))
- Properties.Settings.Default.Third_VA = fbd.SelectedPath;
- else
+ case "Launch_TIR":
+ target = @"C:\Program Files (x86)\NaturalPoint\TrackIR5\TrackIR5.exe";
+ if (File.Exists(target) == true)
{
- System.Diagnostics.Process.Start(downloadlink);
- return;
+ System.Diagnostics.Process.Start(target);
+ break;
}
- }
- System.Diagnostics.Process.Start(installexe);
- break;
+ target = "\\TrackIR5.exe";
+ downloadlink = "https://www.naturalpoint.com/trackir/";
+ installexe = Properties.Settings.Default.Third_TIR + target;
+ if (File.Exists(installexe) == false)
+ {
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_TIR = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
+ }
+ System.Diagnostics.Process.Start(installexe);
+ break;
+ case "Launch_VA":
+ target = @"C:\Program Files (x86)\VoiceAttack\VoiceAttack.exe";
+ if (File.Exists(target) == true)
+ {
+ System.Diagnostics.Process.Start(target);
+ break;
+ }
+ target = @"C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\VoiceAttack.exe";
+ if (File.Exists(target) == true)
+ {
+ System.Diagnostics.Process.Start(target);
+ break;
+ }
+ target = "\\VoiceAttack.exe";
+ downloadlink = "https://voiceattack.com/";
+ installexe = Properties.Settings.Default.Third_VA + target;
+ if (File.Exists(installexe) == false)
+ {
+ System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
+
+ fbd.Description = "Select Install Directory";
+ fbd.RootFolder = Environment.SpecialFolder.MyComputer;
+ fbd.ShowNewFolderButton = false;
+ System.Windows.Forms.DialogResult dirResult = fbd.ShowDialog();
+
+ installexe = fbd.SelectedPath + target;
+ if (File.Exists(installexe))
+ Properties.Settings.Default.Third_VA = fbd.SelectedPath;
+ else
+ {
+ System.Diagnostics.Process.Start(downloadlink);
+ return;
+ }
+ }
+ System.Diagnostics.Process.Start(installexe);
+ break;
+ }
+ }
+ catch (System.IO.FileNotFoundException ex)
+ {
+ System.Console.WriteLine(ex.Message);
+
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
+
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ this.Close();
}
}
diff --git a/FalconBMS Alternative Launcher Cs/MainWindowAxisAssign.cs b/FalconBMS Alternative Launcher Cs/MainWindowAxisAssign.cs
index eaa4e18..0dab84c 100644
--- a/FalconBMS Alternative Launcher Cs/MainWindowAxisAssign.cs
+++ b/FalconBMS Alternative Launcher Cs/MainWindowAxisAssign.cs
@@ -91,145 +91,160 @@ public partial class MainWindow
///
public void AxisMovingTimer_Tick(object sender, EventArgs e)
{
- if (inGameAxis.Count == 0)
- return;
- invertNum = 0;
- foreach (AxisName nme in axisNameList)
+ try
{
- if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber() == -1)
- continue;
- tblabel = this.FindName("Label_" + nme.ToString()) as Label;
- tbprogressbar = this.FindName("Axis_" + nme.ToString()) as ProgressBar;
-
- switch (nme)
+ if (inGameAxis.Count == 0)
+ return;
+ invertNum = 0;
+ foreach (AxisName nme in axisNameList)
{
- case AxisName.Throttle:
- case AxisName.Throttle_Right:
- case AxisName.Toe_Brake:
- case AxisName.Toe_Brake_Right:
- case AxisName.Intercom:
- case AxisName.COMM_Channel_1:
- case AxisName.COMM_Channel_2:
- case AxisName.MSL_Volume:
- case AxisName.Threat_Volume:
- case AxisName.AI_vs_IVC:
- if (!((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert())
- invertNum = -1;
- else
- invertNum = 1;
- break;
- default:
- if (!((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert())
- invertNum = 1;
- else
- invertNum = -1;
- break;
- }
- if (invertNum == 1)
- {
- tbprogressbar.Minimum = 0;
- tbprogressbar.Maximum = MAXIN;
- }
- else
- {
- tbprogressbar.Minimum = -MAXIN;
- tbprogressbar.Maximum = 0;
- }
+ if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber() == -1)
+ continue;
+ tblabel = this.FindName("Label_" + nme.ToString()) as Label;
+ tbprogressbar = this.FindName("Axis_" + nme.ToString()) as ProgressBar;
- if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber() == -2)
- {
- tbprogressbar.Value = (MAXIN / 2 + (wheelValue * 1024 / 120)) * invertNum;
- tblabel.Content = "MOUSE : WH";
- continue;
- }
+ switch (nme)
+ {
+ case AxisName.Throttle:
+ case AxisName.Throttle_Right:
+ case AxisName.Toe_Brake:
+ case AxisName.Toe_Brake_Right:
+ case AxisName.Intercom:
+ case AxisName.COMM_Channel_1:
+ case AxisName.COMM_Channel_2:
+ case AxisName.MSL_Volume:
+ case AxisName.Threat_Volume:
+ case AxisName.AI_vs_IVC:
+ if (!((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert())
+ invertNum = -1;
+ else
+ invertNum = 1;
+ break;
+ default:
+ if (!((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert())
+ invertNum = 1;
+ else
+ invertNum = -1;
+ break;
+ }
+ if (invertNum == 1)
+ {
+ tbprogressbar.Minimum = 0;
+ tbprogressbar.Maximum = MAXIN;
+ }
+ else
+ {
+ tbprogressbar.Minimum = -MAXIN;
+ tbprogressbar.Maximum = 0;
+ }
- int output = ApplyDeadZone
- (
- deviceControl.JoyAxisState(((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber(), ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetPhysicalNumber()),
- ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeadzone(),
- ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetSaturation()
- );
- tbprogressbar.Value = output * invertNum;
+ if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber() == -2)
+ {
+ tbprogressbar.Value = (MAXIN / 2 + (wheelValue * 1024 / 120)) * invertNum;
+ tblabel.Content = "MOUSE : WH";
+ continue;
+ }
- string joyActualName = deviceControl.joyStick[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].DeviceInformation.InstanceName;
- string joyName = "JOY " + ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber();
+ int output = ApplyDeadZone
+ (
+ deviceControl.JoyAxisState(((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber(), ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetPhysicalNumber()),
+ ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeadzone(),
+ ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetSaturation()
+ );
+ tbprogressbar.Value = output * invertNum;
- if (joyActualName.Contains("Thrustmaster HOTAS Cougar"))
- joyName = "HOTAS";
- if (joyActualName.Contains("Thrustmaster Combined - HOTAS Warthog"))
- joyName = "TMWHC";
- if (joyActualName.Contains("Joystick - HOTAS Warthog"))
- joyName = "TMWHJ";
- if (joyActualName.Contains("Throttle - HOTAS Warthog"))
- joyName = "TMWHT";
- if (joyActualName.ToLower().Contains("t.16000m"))
- joyName = "T16KM";
- if (joyActualName.ToLower().Contains("t.flight hotas x"))
- joyName = "TMTHX";
- if (joyActualName.ToLower().Contains("t - rudder"))
- joyName = "TTFRP";
- if (joyActualName.ToLower().Contains("fssb"))
- joyName = "FSSBR";
- if (joyActualName.ToLower().Contains("tusba"))
- joyName = "TUSBA";
- if (joyActualName.ToLower().Contains("rusba"))
- joyName = "RUSBA";
- if (joyActualName.ToLower().Contains("fusba"))
- joyName = "FUSBA";
- if (joyActualName.ToLower().Contains("crosswind"))
- joyName = "MFGCW";
- if (joyActualName.ToLower().Contains("g940"))
- joyName = "LG940";
- if (joyActualName.ToLower().Contains("x36"))
- joyName = "STX36";
- if (joyActualName.ToLower().Contains("x45"))
- joyName = "STX45";
- if (joyActualName.ToLower().Contains("x52"))
- joyName = "STX52";
- if (joyActualName.ToLower().Contains("x52 pro"))
- joyName = "SX52P";
- if (joyActualName.ToLower().Contains("x55"))
- joyName = "STX55";
- if (joyActualName.ToLower().Contains("x56"))
- joyName = "STX56";
- if (joyActualName.ToLower().Contains("x65"))
- joyName = "SX65F";
- if (joyActualName.ToLower().Contains("ch fighter"))
- joyName = "CHPFS";
- if (joyActualName.ToLower().Contains("ch combat"))
- joyName = "CHPCS";
- if (joyActualName.ToLower().Contains("ch ") && joyActualName.ToLower().Contains("throttle"))
- joyName = "CHPPT";
- if (joyActualName.ToLower().Contains("ch ") && joyActualName.ToLower().Contains("pedals"))
- joyName = "CHPPP";
+ string joyActualName = deviceControl.joyStick[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].DeviceInformation.InstanceName;
+ string joyName = "JOY " + ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber();
- int axisNumber = ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetPhysicalNumber();
- tblabel.Content = joyName + " : " + ((AxisNumName)axisNumber).ToString().Replace('_', ' ');
- tblabel.Content = ((string)tblabel.Content).Replace("Axis ", " ");
- tblabel.Content = ((string)tblabel.Content).Replace("Rotation ", "R");
- tblabel.Content = ((string)tblabel.Content).Replace("Slider 0", "S1");
- tblabel.Content = ((string)tblabel.Content).Replace("Slider 1", "S2");
+ if (joyActualName.Contains("Thrustmaster HOTAS Cougar"))
+ joyName = "HOTAS";
+ if (joyActualName.Contains("Thrustmaster Combined - HOTAS Warthog"))
+ joyName = "TMWHC";
+ if (joyActualName.Contains("Joystick - HOTAS Warthog"))
+ joyName = "TMWHJ";
+ if (joyActualName.Contains("Throttle - HOTAS Warthog"))
+ joyName = "TMWHT";
+ if (joyActualName.ToLower().Contains("t.16000m"))
+ joyName = "T16KM";
+ if (joyActualName.ToLower().Contains("t.flight hotas x"))
+ joyName = "TMTHX";
+ if (joyActualName.ToLower().Contains("t - rudder"))
+ joyName = "TTFRP";
+ if (joyActualName.ToLower().Contains("fssb"))
+ joyName = "FSSBR";
+ if (joyActualName.ToLower().Contains("tusba"))
+ joyName = "TUSBA";
+ if (joyActualName.ToLower().Contains("rusba"))
+ joyName = "RUSBA";
+ if (joyActualName.ToLower().Contains("fusba"))
+ joyName = "FUSBA";
+ if (joyActualName.ToLower().Contains("crosswind"))
+ joyName = "MFGCW";
+ if (joyActualName.ToLower().Contains("g940"))
+ joyName = "LG940";
+ if (joyActualName.ToLower().Contains("x36"))
+ joyName = "STX36";
+ if (joyActualName.ToLower().Contains("x45"))
+ joyName = "STX45";
+ if (joyActualName.ToLower().Contains("x52"))
+ joyName = "STX52";
+ if (joyActualName.ToLower().Contains("x52 pro"))
+ joyName = "SX52P";
+ if (joyActualName.ToLower().Contains("x55"))
+ joyName = "STX55";
+ if (joyActualName.ToLower().Contains("x56"))
+ joyName = "STX56";
+ if (joyActualName.ToLower().Contains("x65"))
+ joyName = "SX65F";
+ if (joyActualName.ToLower().Contains("ch fighter"))
+ joyName = "CHPFS";
+ if (joyActualName.ToLower().Contains("ch combat"))
+ joyName = "CHPCS";
+ if (joyActualName.ToLower().Contains("ch ") && joyActualName.ToLower().Contains("throttle"))
+ joyName = "CHPPT";
+ if (joyActualName.ToLower().Contains("ch ") && joyActualName.ToLower().Contains("pedals"))
+ joyName = "CHPPP";
- if (nme != AxisName.Throttle & nme != AxisName.Throttle_Right)
- continue;
+ int axisNumber = ((InGameAxAssgn)inGameAxis[nme.ToString()]).GetPhysicalNumber();
+ tblabel.Content = joyName + " : " + ((AxisNumName)axisNumber).ToString().Replace('_', ' ');
+ tblabel.Content = ((string)tblabel.Content).Replace("Axis ", " ");
+ tblabel.Content = ((string)tblabel.Content).Replace("Rotation ", "R");
+ tblabel.Content = ((string)tblabel.Content).Replace("Slider 0", "S1");
+ tblabel.Content = ((string)tblabel.Content).Replace("Slider 1", "S2");
- tblabelab = this.FindName("AB_" + nme.ToString()) as Label;
- tblabelab.Visibility = Visibility.Hidden;
+ if (nme != AxisName.Throttle & nme != AxisName.Throttle_Right)
+ continue;
- tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 0x38, 0x78, 0xA8));
- if (MAXIN + tbprogressbar.Value < deviceControl.throttlePos.GetIDLE())
- {
- tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 240, 0, 0));
- tblabelab.Visibility = Visibility.Visible;
- tblabelab.Content = "IDLE CUTOFF";
- }
- if (MAXIN + tbprogressbar.Value > deviceControl.throttlePos.GetAB())
- {
- tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 0, 240, 0));
- tblabelab.Visibility = Visibility.Visible;
- tblabelab.Content = "AB";
+ tblabelab = this.FindName("AB_" + nme.ToString()) as Label;
+ tblabelab.Visibility = Visibility.Hidden;
+
+ tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 0x38, 0x78, 0xA8));
+ if (MAXIN + tbprogressbar.Value < deviceControl.throttlePos.GetIDLE())
+ {
+ tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 240, 0, 0));
+ tblabelab.Visibility = Visibility.Visible;
+ tblabelab.Content = "IDLE CUTOFF";
+ }
+ if (MAXIN + tbprogressbar.Value > deviceControl.throttlePos.GetAB())
+ {
+ tbprogressbar.Foreground = new SolidColorBrush(Color.FromArgb(0x80, 0, 240, 0));
+ tblabelab.Visibility = Visibility.Visible;
+ tblabelab.Content = "AB";
+ }
}
}
+ catch (System.IO.FileNotFoundException ex)
+ {
+ System.Console.WriteLine(ex.Message);
+
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
+
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ this.Close();
+ }
}
///
diff --git a/FalconBMS Alternative Launcher Cs/MainWindowKeyMapping.cs b/FalconBMS Alternative Launcher Cs/MainWindowKeyMapping.cs
index a230ce3..dcb3a7e 100644
--- a/FalconBMS Alternative Launcher Cs/MainWindowKeyMapping.cs
+++ b/FalconBMS Alternative Launcher Cs/MainWindowKeyMapping.cs
@@ -188,76 +188,100 @@ private void KeyMappingGrid_MouseRightButtonDown(object sender, MouseButtonEvent
///
public void KeyMappingTimer_Tick(object sender, EventArgs e)
{
- directInputDevice.GetCurrentKeyboardState();
- for (int i = 1; i < 238; i++)
- if (directInputDevice.KeyboardState[(Microsoft.DirectX.DirectInput.Key)i])
- KeyMappingGrid_KeyDown();
-
- int Rows = KeyMappingGrid.SelectedIndex;
- if (Rows == -1 | statusSearch == Search.Search)
+ try
{
- JumptoAssignedKey();
- return;
- }
- if (KeyMappingGrid.CurrentColumn == null)
- return;
- if (keyFile.keyAssign[Rows].GetVisibility() != "White")
- return;
+ directInputDevice.GetCurrentKeyboardState();
+ for (int i = 1; i < 238; i++)
+ if (directInputDevice.KeyboardState[(Microsoft.DirectX.DirectInput.Key)i])
+ KeyMappingGrid_KeyDown();
- switch (statusAssign)
- {
- case Status.GetNeutralPos:
- for (int i = 0; i < deviceControl.devList.Count; i++)
- neutralButtons[i] = new NeutralButtons(deviceControl.joyStick[i]);
- statusAssign = Status.WaitingforInput;
- break;
- case Status.WaitingforInput:
- for (int i = 0; i < deviceControl.devList.Count; i++)
- {
- buttons = deviceControl.joyStick[i].CurrentJoystickState.GetButtons();
- for (int ii = 0; ii < 32; ii++)
- {
- if (buttons[ii] == neutralButtons[i].buttons[ii])
- continue;
- statusAssign = Status.GetNeutralPos;
- if (buttons[ii] == 0)
- continue;
-
- Pinky pinkyStatus = Pinky.UnShift;
- Behaviour behaviourStatus = Behaviour.Press;
- if (Select_PinkyShift.IsChecked == false)
- pinkyStatus = Pinky.Shift;
- if (Select_DX_Release.IsChecked == false)
- behaviourStatus = Behaviour.Release;
+ int Rows = KeyMappingGrid.SelectedIndex;
+ if (Rows == -1 | statusSearch == Search.Search)
+ {
+ JumptoAssignedKey();
+ return;
+ }
+ if (KeyMappingGrid.CurrentColumn == null)
+ return;
+ if (keyFile.keyAssign[Rows].GetVisibility() != "White")
+ return;
- // Construct DX button instance.
- deviceControl.joyAssign[i].dx[ii].Assign(keyFile.keyAssign[Rows].GetCallback(), pinkyStatus, behaviourStatus, invokeStatus, 0);
- KeyMappingGrid.Items.Refresh();
- KeyMappingGrid.UnselectAllCells();
- }
- povs = deviceControl.joyStick[i].CurrentJoystickState.GetPointOfView();
- for (int ii = 0; ii < 4; ii++)
+ switch (statusAssign)
+ {
+ case Status.GetNeutralPos:
+ for (int i = 0; i < deviceControl.devList.Count; i++)
+ neutralButtons[i] = new NeutralButtons(deviceControl.joyStick[i]);
+ statusAssign = Status.WaitingforInput;
+ break;
+ case Status.WaitingforInput:
+ for (int i = 0; i < deviceControl.devList.Count; i++)
{
- if (povs[ii] == neutralButtons[i].povs[ii])
- continue;
- statusAssign = Status.GetNeutralPos;
- if (povs[ii] == -1)
- continue;
+ buttons = deviceControl.joyStick[i].CurrentJoystickState.GetButtons();
+ for (int ii = 0; ii < 32; ii++)
+ {
+ if (buttons[ii] == neutralButtons[i].buttons[ii])
+ continue;
+ statusAssign = Status.GetNeutralPos;
+ if (buttons[ii] == 0)
+ continue;
+
+ Pinky pinkyStatus = Pinky.UnShift;
+ Behaviour behaviourStatus = Behaviour.Press;
+ if (Select_PinkyShift.IsChecked == false)
+ pinkyStatus = Pinky.Shift;
+ if (Select_DX_Release.IsChecked == false)
+ behaviourStatus = Behaviour.Release;
+
+ // Construct DX button instance.
+ if (keyFile.keyAssign[Rows].GetCallback() == "SimHotasPinkyShift")
+ {
+ deviceControl.joyAssign[i].dx[ii].Assign(keyFile.keyAssign[Rows].GetCallback(), Pinky.UnShift, Behaviour.Press, Invoke.Default, 0);
+ deviceControl.joyAssign[i].dx[ii].Assign(keyFile.keyAssign[Rows].GetCallback(), Pinky.Shift, Behaviour.Press, Invoke.Default, 0);
+ }
+ else
+ {
+ deviceControl.joyAssign[i].dx[ii].Assign(keyFile.keyAssign[Rows].GetCallback(), pinkyStatus, behaviourStatus, invokeStatus, 0);
+ }
+
+ KeyMappingGrid.Items.Refresh();
+ KeyMappingGrid.UnselectAllCells();
+ }
+ povs = deviceControl.joyStick[i].CurrentJoystickState.GetPointOfView();
+ for (int ii = 0; ii < 4; ii++)
+ {
+ if (povs[ii] == neutralButtons[i].povs[ii])
+ continue;
+ statusAssign = Status.GetNeutralPos;
+ if (povs[ii] == -1)
+ continue;
+
+ Pinky pinkyStatus = Pinky.UnShift;
+ if (Select_PinkyShift.IsChecked == false)
+ pinkyStatus = Pinky.Shift;
+
+ // Construct POV button instance.
+ deviceControl.joyAssign[i].pov[ii].Assign(povs[ii], keyFile.keyAssign[Rows].GetCallback(), pinkyStatus, 0);
+
+ KeyMappingGrid.Items.Refresh();
+ KeyMappingGrid.UnselectAllCells();
+ }
+ }
+ break;
+ }
+ }
+ catch (System.IO.FileNotFoundException ex)
+ {
+ System.Console.WriteLine(ex.Message);
- Pinky pinkyStatus = Pinky.UnShift;
- if (Select_PinkyShift.IsChecked == false)
- pinkyStatus = Pinky.Shift;
+ System.IO.StreamWriter sw = new System.IO.StreamWriter(appReg.GetInstallDir() + "\\Error.txt", false, System.Text.Encoding.GetEncoding("shift_jis"));
+ sw.Write(ex.Message);
+ sw.Close();
- // Construct POV button instance.
- deviceControl.joyAssign[i].pov[ii].Assign(povs[ii], keyFile.keyAssign[Rows].GetCallback(), pinkyStatus, 0);
+ MessageBox.Show("Error Log Saved To " + appReg.GetInstallDir() + "\\Error.txt", "WARNING", MessageBoxButton.OK, MessageBoxImage.Information);
- KeyMappingGrid.Items.Refresh();
- KeyMappingGrid.UnselectAllCells();
- }
- }
- break;
+ this.Close();
}
}
diff --git a/FalconBMS Alternative Launcher Cs/OverrideSetting.cs b/FalconBMS Alternative Launcher Cs/OverrideSetting.cs
index 7b5c7b7..65fc862 100644
--- a/FalconBMS Alternative Launcher Cs/OverrideSetting.cs
+++ b/FalconBMS Alternative Launcher Cs/OverrideSetting.cs
@@ -38,9 +38,6 @@ public OverrideSetting(MainWindow mainWindow, AppRegInfo appReg)
{
this.mainWindow = mainWindow;
this.appReg = appReg;
-
- if (!System.IO.Directory.Exists(appReg.GetInstallDir() + "/User/Config/Backup/"))
- System.IO.Directory.CreateDirectory(appReg.GetInstallDir() + "/User/Config/Backup/");
}
///
@@ -52,6 +49,9 @@ public OverrideSetting(MainWindow mainWindow, AppRegInfo appReg)
///
public void Execute(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile, VisualAcuity visualAcuity)
{
+ if (!System.IO.Directory.Exists(appReg.GetInstallDir() + "/User/Config/Backup/"))
+ System.IO.Directory.CreateDirectory(appReg.GetInstallDir() + "/User/Config/Backup/");
+
SaveAxisMapping(inGameAxis, deviceControl);
SaveJoystickCal(inGameAxis, deviceControl);
SaveDeviceSorting(deviceControl);
@@ -112,6 +112,8 @@ protected void SaveConfigfile(DeviceControl deviceControl, VisualAcuity visualAc
if (!System.IO.File.Exists(fbackupname))
System.IO.File.Copy(filename, fbackupname, true);
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.StreamReader cReader = new System.IO.StreamReader
(filename, System.Text.Encoding.Default);
string stResult = "";
@@ -156,6 +158,9 @@ protected void SaveDeviceSorting(DeviceControl deviceControl)
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/DeviceSorting.txt";
if ((!System.IO.File.Exists(fbackupname)) & (System.IO.File.Exists(filename)))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.StreamWriter ds = new System.IO.StreamWriter
(filename, false, System.Text.Encoding.GetEncoding("shift_jis"));
ds.Write(deviceSort);
@@ -171,6 +176,9 @@ protected void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl,
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/" + appReg.getKeyFileName();
if (!System.IO.File.Exists(fbackupname))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.StreamWriter sw = new System.IO.StreamWriter
(filename, false, System.Text.Encoding.GetEncoding("utf-8"));
for (int i = 0; i < keyFile.keyAssign.Length; i++)
@@ -201,6 +209,9 @@ protected void SaveAxisMapping(Hashtable inGameAxis, DeviceControl deviceControl
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/axismapping.dat";
if ((!System.IO.File.Exists(fbackupname)) & (System.IO.File.Exists(filename)))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.FileStream fs = new System.IO.FileStream
(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
@@ -314,6 +325,9 @@ protected void SaveJoystickCal(Hashtable inGameAxis, DeviceControl deviceControl
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/joystick.cal";
if ((!System.IO.File.Exists(fbackupname)) & (System.IO.File.Exists(filename)))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.FileStream fs = new System.IO.FileStream
(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
@@ -490,6 +504,9 @@ protected override void SavePop()
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/" + appReg.GetPilotCallsign().ToString() + ".pop";
if (!System.IO.File.Exists(fbackupname))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.FileStream fs = new System.IO.FileStream
(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
byte[] bs = new byte[fs.Length];
@@ -653,6 +670,9 @@ protected override void SavePop()
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/" + appReg.GetPilotCallsign().ToString() + ".pop";
if (!System.IO.File.Exists(fbackupname))
System.IO.File.Copy(filename, fbackupname, true);
+
+ System.IO.File.SetAttributes(filename, System.IO.File.GetAttributes(filename) & (~System.IO.FileAttributes.ReadOnly));
+
System.IO.FileStream fs = new System.IO.FileStream
(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
byte[] bs = new byte[fs.Length];