Skip to content

Commit e146021

Browse files
committed
Fixed using Showcase Camera resetting DynamicLOD / Fixed Issues DynamicLOD taking a long Time to close after the Sim was closed
1 parent 7ed89f2 commit e146021

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

DynamicLOD-latest.zip

92 Bytes
Binary file not shown.

DynamicLOD/DynamicLOD.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Description>Another Adapative LOD Implementation based on muumimorko
1313
Work</Description>
1414
<Copyright>Copyright © 2024</Copyright>
15-
<Version>0.3.4</Version>
15+
<Version>0.3.5</Version>
1616
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
1717
<WindowsSdkPackageVersion>10.0.17763.41</WindowsSdkPackageVersion>
1818
</PropertyGroup>
@@ -38,7 +38,7 @@ Work</Description>
3838
</ItemGroup>
3939

4040
<ItemGroup>
41-
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.1" />
41+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
4242
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.1.3" />
4343
<PackageReference Include="Serilog" Version="4.0.1" />
4444
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />

DynamicLOD/IPCManager.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ namespace DynamicLOD
77
public static class IPCManager
88
{
99
public static readonly int waitDuration = 30000;
10+
public static bool simWasStarted = false;
1011

1112
public static MobiSimConnect SimConnect { get; set; } = null;
1213

1314
public static bool WaitForSimulator(ServiceModel model)
1415
{
1516
bool simRunning = IsSimRunning();
16-
if (!simRunning && model.WaitForConnect)
17+
if (!simRunning && !simWasStarted && model.WaitForConnect)
1718
{
1819
do
1920
{
@@ -45,7 +46,10 @@ public static bool IsProcessRunning(string name)
4546

4647
public static bool IsSimRunning()
4748
{
48-
return IsProcessRunning("FlightSimulator");
49+
bool result = IsProcessRunning("FlightSimulator");
50+
if (result)
51+
simWasStarted = true;
52+
return result;
4953
}
5054

5155
public static bool WaitForConnection(ServiceModel model)
@@ -58,7 +62,7 @@ public static bool WaitForConnection(ServiceModel model)
5862
SimConnect = new MobiSimConnect();
5963
bool mobiRequested = SimConnect.Connect();
6064

61-
if (!SimConnect.IsConnected)
65+
if (!SimConnect.IsConnected && IsSimRunning())
6266
{
6367
do
6468
{
@@ -69,7 +73,7 @@ public static bool WaitForConnection(ServiceModel model)
6973
}
7074
while (!SimConnect.IsConnected && IsSimRunning() && !model.CancellationRequested);
7175

72-
return SimConnect.IsConnected;
76+
return SimConnect.IsConnected && IsSimRunning();
7377
}
7478
else
7579
{
@@ -92,7 +96,7 @@ public static bool WaitForSessionReady(ServiceModel model)
9296
isReady = IsCamReady();
9397
}
9498

95-
if (!isReady)
99+
if (!isReady || !IsSimRunning())
96100
{
97101
Logger.Log(LogLevel.Error, "IPCManager:WaitForSessionReady", $"SimConnect or Simulator not available - aborting");
98102
return false;
@@ -103,10 +107,7 @@ public static bool WaitForSessionReady(ServiceModel model)
103107

104108
public static bool IsCamReady()
105109
{
106-
float value = SimConnect.ReadSimVar("CAMERA STATE", "Enum");
107-
bool parkState = SimConnect.ReadSimVar("PLANE IN PARKING STATE", "Bool") == 1;
108-
109-
return value >= 2 && value <= 5 && !parkState;
110+
return SimConnect.ReadSimVar("CAMERA STATE", "Enum") < 11;
110111
}
111112

112113
public static void CloseSafe()

Installer/Installer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<UpdateRequired>false</UpdateRequired>
2727
<MapFileExtensions>true</MapFileExtensions>
2828
<ApplicationRevision>0</ApplicationRevision>
29-
<ApplicationVersion>0.3.4.0</ApplicationVersion>
29+
<ApplicationVersion>0.3.5.0</ApplicationVersion>
3030
<UseApplicationTrust>false</UseApplicationTrust>
3131
<PublishWizardCompleted>true</PublishWizardCompleted>
3232
<BootstrapperEnabled>true</BootstrapperEnabled>

Installer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
5050
// indem Sie "*" wie unten gezeigt eingeben:
5151
// [assembly: AssemblyVersion("1.0.*")]
52-
[assembly: AssemblyVersion("0.3.4.0")]
53-
[assembly: AssemblyFileVersion("0.3.4.0")]
52+
[assembly: AssemblyVersion("0.3.5.0")]
53+
[assembly: AssemblyFileVersion("0.3.5.0")]

0 commit comments

Comments
 (0)