Skip to content

Commit

Permalink
v2.2.0 (#80)
Browse files Browse the repository at this point in the history
* FalconBMS official color applied

* VR option added

* support BMS4.38 Internal test version

* set assembly info as a BMS Launcher (not alternative)

* installer info update

* removed un-needed updater attempt

* fix 4.38 to show 4.38 number

* show VR toggle for 4.37

* added VR starter

* 4.36I uses 4.37 override

* added WINWING Orion

* Check if installed files really exists. In case of removing BMS files but not registry.

* try-catch open sub key

* Made a shortcut to Updater

* no need bit-swarm

* no need update xml

* Update label lights blue

* Reg key check fixed

* log fix

* disable this routine for the time being

* Fix not launching who don't have VR.

* Don't clear category dropdown after assigning control (#79)

* bms-logcat.exe crash fix

* fix VR setting not saved

* remove callsign window for now,

* g_nVRHMD

Co-authored-by: Daniel Tian <[email protected]>
  • Loading branch information
chihirobelmo and danieltian authored Dec 30, 2022
1 parent 426526b commit 73aafff
Show file tree
Hide file tree
Showing 37 changed files with 3,946 additions and 693 deletions.

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions Falcon BMS Alternative Launcher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Falcon BMS Alternative Laun
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Falcon BMS Alternative Launcher Setup", "Falcon BMS Alternative Launcher Setup\Falcon BMS Alternative Launcher Setup.vdproj", "{476CFD8D-0EBB-4CAC-A053-77480B27ABDC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update Information Generator", "Update Information Generator\Update Information Generator.csproj", "{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -41,18 +39,6 @@ Global
{476CFD8D-0EBB-4CAC-A053-77480B27ABDC}.Release|x64.Build.0 = Release
{476CFD8D-0EBB-4CAC-A053-77480B27ABDC}.Release|x86.ActiveCfg = Release
{476CFD8D-0EBB-4CAC-A053-77480B27ABDC}.Release|x86.Build.0 = Release
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|x64.ActiveCfg = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|x64.Build.0 = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|x86.ActiveCfg = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Debug|x86.Build.0 = Debug|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|Any CPU.Build.0 = Release|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|x64.ActiveCfg = Release|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|x64.Build.0 = Release|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|x86.ActiveCfg = Release|Any CPU
{3A6F35D5-0FE8-4AC4-890E-0A0624A8A5BF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions Falcon BMS Alternative Launcher/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
<setting name="BMS_Version" serializeAs="String">
<value>Falcon4.0</value>
</setting>
<setting name="Misc_VR" serializeAs="String">
<value>False</value>
</setting>
</FalconBMS.Launcher.Properties.Settings>
<FalconBMS_Alternative_Launcher_Cs.Properties.Settings>
<setting name="Platform" serializeAs="String">
Expand Down
2 changes: 2 additions & 0 deletions Falcon BMS Alternative Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private static void App_DispatcherUnhandledException(object sender, DispatcherUn

MessageBox.Show("An unknown error has occured. Contact support if this problem persists.", "Error",
MessageBoxButton.OK, MessageBoxImage.Error);
Diagnostics.Log(e.Exception);
Diagnostics.WriteLogFile();

e.Handled = true;
}
Expand Down
2 changes: 2 additions & 0 deletions Falcon BMS Alternative Launcher/AppProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public AppProperties(MainWindow mainWindow)
mainWindow.Misc_SmartScalingOverride.IsChecked = Properties.Settings.Default.Misc_SmartScalingOverride;
mainWindow.Misc_NaturalHeadMovement.IsChecked = Properties.Settings.Default.Misc_NaturalHeadMovement;
mainWindow.Misc_PilotModel.IsChecked = Properties.Settings.Default.Misc_PilotModel;
mainWindow.Misc_VR.IsChecked = Properties.Settings.Default.Misc_VR;

// Button Status Default
mainWindow.Select_DX_Release.IsChecked = true;
Expand Down Expand Up @@ -57,6 +58,7 @@ public void SaveUISetup()
Properties.Settings.Default.Misc_SmartScalingOverride = (bool)mainWindow.Misc_SmartScalingOverride.IsChecked;
Properties.Settings.Default.Misc_NaturalHeadMovement = (bool)mainWindow.Misc_NaturalHeadMovement.IsChecked;
Properties.Settings.Default.Misc_PilotModel = (bool)mainWindow.Misc_PilotModel.IsChecked;
Properties.Settings.Default.Misc_VR = (bool)mainWindow.Misc_VR.IsChecked;
Properties.Settings.Default.Save();
}

Expand Down
158 changes: 99 additions & 59 deletions Falcon BMS Alternative Launcher/AppRegInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class AppRegInfo

public string[] availableBMSVersions =
{
"Falcon BMS 4.38 (Internal)",
"Falcon BMS 4.37 (Internal)",
"Falcon BMS 4.37",
"Falcon BMS 4.36 (Internal)",
Expand All @@ -74,12 +75,18 @@ public AppRegInfo(MainWindow mainWindow)
{
if (Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Benchmark Sims\\" + version, false) == null)
continue;
mainWindow.ListBox_BMS.Items.Add(version);

if (BMSExists(version))
mainWindow.ListBox_BMS.Items.Add(version);
else
continue;

if (flg)
{
selectedVersion = version;
flg = false;
}

if (version == Properties.Settings.Default.BMS_Version)
{
selectedVersion = version;
Expand All @@ -90,12 +97,98 @@ public AppRegInfo(MainWindow mainWindow)
Init(mainWindow, selectedVersion);
}

public bool BMSExists(string version)
{
string regName64 = "SOFTWARE\\Wow6432Node\\Benchmark Sims\\" + version;
string regName32 = "SOFTWARE\\Benchmark Sims\\" + version;

try
{
RegistryKey regkey64 = Registry.LocalMachine.OpenSubKey(regName64, true);
regName = regName64;
regkey = regkey64;
}
catch (Exception ex1)
{
Diagnostics.Log(regName64);
Diagnostics.Log(ex1);
}

if (regkey == null)
{
try
{
RegistryKey regkey32 = Registry.LocalMachine.OpenSubKey(regName32, true);

if (regkey == null)
{
Diagnostics.Log("No BMS registries found.");
return false;
}

platform = Platform.OS_32bit;
mainWindow.Misc_Platform.IsChecked = false;
mainWindow.Misc_Platform.IsEnabled = false;

regName = regName32;
regkey = regkey32;
}
catch (Exception ex2)
{
Diagnostics.Log(regName32);
Diagnostics.Log(ex2);
return false;
}

if (regkey == null)
{
Diagnostics.Log("No BMS registries found.");
return false;
}
}

byte[] bs;

if (regkey.GetValue("PilotName") == null)
{
bs = Encoding.ASCII.GetBytes("Joe Pilot\0\0\0\0\0\0\0\0\0\0\0");
regkey.SetValue("PilotName", bs);
}
if (regkey.GetValue("PilotCallsign") == null)
{
bs = Encoding.ASCII.GetBytes("Viper\0\0\0\0\0\0\0");
regkey.SetValue("PilotCallsign", bs);
}
if (regkey.GetValue("curTheater") == null)
{
regkey.SetValue("curTheater", "Korea KTO");
}

installDir = (string)regkey.GetValue("baseDir");
currentTheater = (string)regkey.GetValue("curTheater");

pilotCallsign = ReadPilotCallsign((byte[])regkey.GetValue("PilotCallsign"));

if (platform == Platform.OS_64bit)
exeDir = installDir + "\\bin\\x64\\Falcon BMS.exe";
if (platform == Platform.OS_32bit)
exeDir = installDir + "\\bin\\x86\\Falcon BMS.exe";

return File.Exists(exeDir);
}

public void Init(MainWindow mainWindow, string version)
{
this.mainWindow = mainWindow;

switch (version)
{
case "Falcon BMS 4.38 (Internal)":
bms_Version = BMS_Version.BMS438I;
keyFileName = "BMS - Full.key";
overRideSetting = new OverrideSettingFor438(this.mainWindow, this);
starter = new Starter438Internal(this, this.mainWindow);
break;
case "Falcon BMS 4.37 (Internal)":
bms_Version = BMS_Version.BMS437I;
keyFileName = "BMS - Full.key";
Expand All @@ -105,7 +198,7 @@ public void Init(MainWindow mainWindow, string version)
case "Falcon BMS 4.36 (Internal)":
bms_Version = BMS_Version.BMS436I;
keyFileName = "BMS - Full.key";
overRideSetting = new OverrideSettingFor436(this.mainWindow, this);
overRideSetting = new OverrideSettingFor437(this.mainWindow, this);
starter = new Starter436Internal(this, this.mainWindow);
break;
case "Falcon BMS 4.37":
Expand Down Expand Up @@ -157,62 +250,7 @@ public void Init(MainWindow mainWindow, string version)
break;
}

string regName64 = "SOFTWARE\\Wow6432Node\\Benchmark Sims\\" + version;
string regName32 = "SOFTWARE\\Benchmark Sims\\" + version;

RegistryKey regkey64 = Registry.LocalMachine.OpenSubKey(regName64, true);
RegistryKey regkey32 = Registry.LocalMachine.OpenSubKey(regName32, true);

// Read Registry
if (regkey64 == null)
{
if (regkey32 == null)
{
Properties.Settings.Default.BMS_Version = "Falcon4.0";
MessageBox.Show("Could not find FalconBMS Installed.");
mainWindow.Close();
return;
}

platform = Platform.OS_32bit;
mainWindow.Misc_Platform.IsChecked = false;
mainWindow.Misc_Platform.IsEnabled = false;

regName = regName32;
regkey = regkey32;
}
else
{
regName = regName64;
regkey = regkey64;
}

byte[] bs;

if (regkey.GetValue("PilotName") == null)
{
bs = Encoding.ASCII.GetBytes("Joe Pilot\0\0\0\0\0\0\0\0\0\0\0");
regkey.SetValue("PilotName", bs);
}
if (regkey.GetValue("PilotCallsign") == null)
{
bs = Encoding.ASCII.GetBytes("Viper\0\0\0\0\0\0\0");
regkey.SetValue("PilotCallsign", bs);
}
if (regkey.GetValue("curTheater") == null)
{
regkey.SetValue("curTheater", "Korea KTO");
}

installDir = (string)regkey.GetValue("baseDir");
currentTheater = (string)regkey.GetValue("curTheater");

pilotCallsign = ReadPilotCallsign((byte[])regkey.GetValue("PilotCallsign"));

if (platform == Platform.OS_64bit)
exeDir = installDir + "\\bin\\x64\\Falcon BMS.exe";
if (platform == Platform.OS_32bit)
exeDir = installDir + "\\bin\\x86\\Falcon BMS.exe";
BMSExists(version);

updateVersion = CheckUpdateVersion();

Expand Down Expand Up @@ -374,6 +412,8 @@ public enum BMS_Version
BMS436I,
BMS436,
BMS437I,
BMS437
BMS437,
BMS438I,
BMS438
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
<Compile Include="Input\DxAssgn.cs" />
<Compile Include="Input\InGameAxAssgn.cs" />
<Compile Include="Input\KeyFile.cs" />
<Compile Include="Override\OverrideSettingFor438.cs" />
<Compile Include="Starter\Starter436I.cs" />
<Compile Include="Starter\Starter438I.cs" />
<Compile Include="Starter\Starter437I.cs" />
<Compile Include="Starter\Starter437.cs" />
<Compile Include="Starter\Starter436.cs" />
Expand All @@ -141,6 +143,7 @@
<Compile Include="Override\OverrideSettingFor435.cs" />
<Compile Include="Override\OverrideSettingFor436.cs" />
<Compile Include="Override\OverrideSettingFor437.cs" />
<Compile Include="SteamVR.cs" />
<Compile Include="Torrent.cs" />
<Compile Include="Update\Update.cs" />
<Compile Include="Windows\CallsignWindow.xaml.cs">
Expand Down Expand Up @@ -343,6 +346,12 @@
<ItemGroup>
<Resource Include="AutoUpdate.xml" />
</ItemGroup>
<ItemGroup>
<Resource Include="Stock\Setup.v100.WINWING Orion Throttle Base II TGRIP-F16 {Stock}.xml" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\UPD.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterResolveReferences">
<ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions Falcon BMS Alternative Launcher/Override/OverrideSettingFor437.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,53 @@ public class OverrideSettingFor437 : OverrideSettingFor436
public OverrideSettingFor437(MainWindow mainWindow, AppRegInfo appReg) : base(mainWindow, appReg)
{
}

protected override void SaveConfigfile(Hashtable inGameAxis, DeviceControl deviceControl)
{
string filename = appReg.GetInstallDir() + "/User/Config/falcon bms.cfg";
string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/falcon bms.cfg";
if (!File.Exists(fbackupname) & File.Exists(filename))
File.Copy(filename, fbackupname, true);

if (File.Exists(filename))
File.SetAttributes(filename, File.GetAttributes(filename) & ~FileAttributes.ReadOnly);

StreamReader cReader = new StreamReader
(filename, Encoding.Default);
string stResult = "";
while (cReader.Peek() >= 0)
{
string stBuffer = cReader.ReadLine();
if (stBuffer.Contains("// SETUP OVERRIDE"))
continue;
stResult += stBuffer + "\r\n";
}
cReader.Close();

StreamWriter cfg = new StreamWriter
(filename, false, Encoding.GetEncoding("shift_jis"));
cfg.Write(stResult);
cfg.Write("set g_nButtonsPerDevice " + CommonConstants.DX128
+ " // SETUP OVERRIDE\r\n");
cfg.Write("set g_nHotasPinkyShiftMagnitude " + deviceControl.joyAssign.Length * CommonConstants.DX128
+ " // SETUP OVERRIDE\r\n");
cfg.Write("set g_bHotasDgftSelfCancel " + Convert.ToInt32(mainWindow.Misc_OverrideSelfCancel.IsChecked)
+ " // SETUP OVERRIDE\r\n");
cfg.Write("set g_b3DClickableCursorAnchored " + Convert.ToInt32(mainWindow.Misc_MouseCursorAnchor.IsChecked)
+ " // SETUP OVERRIDE\r\n");
cfg.Write("set g_nVRHMD " + Convert.ToInt32(mainWindow.Misc_VR.IsChecked)
+ " // SETUP OVERRIDE\r\n");
if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == ((InGameAxAssgn)inGameAxis["Throttle"]).GetDeviceNumber())
{
cfg.Close();
return;
}
cfg.Write("set g_nNumOfPOVs 2 // SETUP OVERRIDE\r\n");
cfg.Write("set g_nPOV1DeviceID " + (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() + 2) + " // SETUP OVERRIDE\r\n");
cfg.Write("set g_nPOV1ID 0 // SETUP OVERRIDE\r\n");
cfg.Write("set g_nPOV2DeviceID " + (((InGameAxAssgn)inGameAxis["Throttle"]).GetDeviceNumber() + 2) + " // SETUP OVERRIDE\r\n");
cfg.Write("set g_nPOV2ID 0 // SETUP OVERRIDE\r\n");
cfg.Close();
}
}
}
18 changes: 18 additions & 0 deletions Falcon BMS Alternative Launcher/Override/OverrideSettingFor438.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Xml.Serialization;

using FalconBMS.Launcher.Input;
using FalconBMS.Launcher.Windows;

namespace FalconBMS.Launcher.Override
{
public class OverrideSettingFor438 : OverrideSettingFor437
{
public OverrideSettingFor438(MainWindow mainWindow, AppRegInfo appReg) : base(mainWindow, appReg)
{
}
}
}
2 changes: 2 additions & 0 deletions Falcon BMS Alternative Launcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc

MessageBox.Show("An unknown error has occured. Contact support if this problem persists.", "Error",
MessageBoxButton.OK, MessageBoxImage.Error);
Diagnostics.Log(e.ExceptionObject.ToString());
Diagnostics.WriteLogFile();

//e.Handled = true;
}
Expand Down
Loading

0 comments on commit 73aafff

Please sign in to comment.