Skip to content

Commit 820e2f2

Browse files
authored
Merge pull request #1941 from dartasen/version/1.7.1.0
2 parents 0b06511 + 156ba80 commit 820e2f2

File tree

6 files changed

+136
-7
lines changed

6 files changed

+136
-7
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project InitialTargets="PrepareForModding">
22
<!-- Set default properties for all projects (can be overridden per project) -->
33
<PropertyGroup>
4-
<Version>1.7.0.0</Version>
4+
<Version>1.7.1.0</Version>
55
<LangVersion>10</LangVersion>
66
<NitroxProject>false</NitroxProject>
77
<TestLibrary>false</TestLibrary>

NitroxLauncher/LauncherLogic.cs

+46-4
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,54 @@ await Task.Factory.StartNew(async () =>
8888
[Conditional("RELEASE")]
8989
public async void ConfigureFirewall()
9090
{
91-
Task task = Task.Run(() => WindowsHelper.CheckFirewallRules());
92-
await task;
91+
Log.Info($"Using {Environment.OSVersion}");
9392

94-
if (task.Exception != null)
93+
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
9594
{
96-
MessageBox.Show($"An error occurred configuring the firewall: {task.Exception}");
95+
return;
96+
}
97+
98+
/**
99+
This feature won't work in older windows version and will crash the launcher instantly
100+
101+
Windows Vista : 6.0
102+
Windows 7 : 6.1
103+
Windows 8 : 6.2, Windows 8.1 : 6.3
104+
Windows 10/11 : 10.0
105+
**/
106+
if (Environment.OSVersion.Version.Major <= 6)
107+
{
108+
return;
109+
}
110+
111+
CancellationTokenSource cancellationTokenSource = new();
112+
Task task = Task.Run(() => WindowsHelper.CheckFirewallRules(), cancellationTokenSource.Token);
113+
114+
try
115+
{
116+
cancellationTokenSource.CancelAfter(millisecondsDelay: 10000);
117+
118+
await task.ConfigureAwait(false);
119+
120+
if (task.Exception != null)
121+
{
122+
throw task.Exception;
123+
}
124+
}
125+
catch (OperationCanceledException ex)
126+
{
127+
Log.Error(ex, "Firewall configuration took way too long");
128+
LauncherNotifier.Error("Unable to configure firewall rules");
129+
}
130+
catch (AggregateException ex)
131+
{
132+
ex.Flatten().InnerExceptions.ForEach(exception => Log.Error(exception));
133+
LauncherNotifier.Error("Unable to configure firewall rules");
134+
}
135+
catch (Exception ex)
136+
{
137+
Log.Error(ex, "Fatal error while configuring firewall");
138+
LauncherNotifier.Error("Fatal error while configuring firewall");
97139
}
98140
}
99141

NitroxLauncher/Pages/LaunchGamePage.xaml.cs

+47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.ComponentModel;
33
using System.Windows;
4+
using System.Windows.Controls;
5+
using System.Windows.Media;
46
using NitroxLauncher.Models;
57
using NitroxModel;
68
using NitroxModel.Discovery;
@@ -32,9 +34,12 @@ public LaunchGamePage()
3234

3335
private async void SinglePlayerButton_Click(object sender, RoutedEventArgs e)
3436
{
37+
LauncherNotifier.Info("Launching singleplayer Subnautica ...");
38+
3539
try
3640
{
3741
await LauncherLogic.Instance.StartSingleplayerAsync();
42+
3843
}
3944
catch (Exception ex)
4045
{
@@ -44,6 +49,48 @@ private async void SinglePlayerButton_Click(object sender, RoutedEventArgs e)
4449

4550
private async void MultiplayerButton_Click(object sender, RoutedEventArgs e)
4651
{
52+
if (sender is not Button button)
53+
{
54+
return;
55+
}
56+
57+
switch (GamePlatform)
58+
{
59+
case Platform.MICROSOFT:
60+
button.Background = new SolidColorBrush(Colors.Red);
61+
MessageBox.Show("Sorry, due to technical problems Nitrox isn't yet compatible with Subnautica on Microsoft Store\n\nWe're doing our best to give you the opportunity to be able to play again soon.", "Error while starting in multiplayer mode", MessageBoxButton.OK, MessageBoxImage.Error);
62+
return;
63+
64+
case Platform.STEAM:
65+
66+
if (!NitroxUser.IsNewestSubnautica.GetValueOrDefault(false))
67+
{
68+
break;
69+
}
70+
71+
button.Background = new SolidColorBrush(Colors.Red);
72+
MessageBox.Show(
73+
"Due to Subnautica's recent update \"Living Large\", Nitrox is currently not compatible.\nHowever you can still use older version of Subnautica in order to play Nitrox. You can do so by following these steps.\n\nENSURE NITROX AND SUBNAUTICA ARE CLOSED BEFORE PROCEEDING!\n\nChanging Subnautica to Legacy Build on STEAM:\n\n1. Right click Subnautica in Steam\n2. Click Properties\n3. Click Betas\n4. Select Legacy - Public legacy builds\n5. Close it out and let Steam download and install the Legacy version of Subnautica\n6. Run Subnautica through Steam (It will say \"Subnautica [legacy]\" in your library if you did it right)\n7. Launch Subnautica through Nitrox to play.",
74+
"Nitrox requires your attention",
75+
MessageBoxButton.OK,
76+
MessageBoxImage.Information
77+
);
78+
return;
79+
80+
case Platform.EPIC:
81+
82+
if (!NitroxUser.IsNewestSubnautica.GetValueOrDefault(false))
83+
{
84+
break;
85+
}
86+
87+
button.Background = new SolidColorBrush(Colors.Red);
88+
MessageBox.Show("Due to Subnautica's recent update \"Living Large\", Epic Games is currently not compatible with Nitrox.\n\nWe are working on an update we do not have an estimate as to when it is done.", "Error while starting in multiplayer mode", MessageBoxButton.OK, MessageBoxImage.Error);
89+
return;
90+
}
91+
92+
LauncherNotifier.Info("Launching Subnautica ...");
93+
4794
try
4895
{
4996
await LauncherLogic.Instance.StartMultiplayerAsync();

NitroxModel/Helper/NitroxUser.cs

+27
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public static string GamePath
7878
string path = GameInstallationFinder.Instance.FindGame(errors);
7979
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path))
8080
{
81+
GamePlatform = GamePlatforms.GetPlatformByGameDir(path);
8182
return gamePath = path;
8283
}
8384

@@ -100,5 +101,31 @@ public static string GamePath
100101
GamePlatform = GamePlatforms.GetPlatformByGameDir(gamePath);
101102
}
102103
}
104+
105+
public static bool? IsNewestSubnautica
106+
{
107+
get
108+
{
109+
if (string.IsNullOrWhiteSpace(GamePath))
110+
{
111+
return null;
112+
}
113+
114+
string streamingAssetsFolder = Path.Combine(GamePath, "Subnautica_Data", "StreamingAssets");
115+
string aaFolder = Path.Combine(streamingAssetsFolder, "aa");
116+
117+
if (!Directory.Exists(streamingAssetsFolder)) {
118+
// Probably authorization exception
119+
return null;
120+
}
121+
122+
if (File.Exists(Path.Combine(aaFolder, "catalog.json")) && File.Exists(Path.Combine(aaFolder, "settings.json")))
123+
{
124+
return true;
125+
}
126+
127+
return false;
128+
}
129+
}
103130
}
104131
}

NitroxServer-Subnautica/Program.cs

+13
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ private static async Task StartServer(string[] args)
8282
});
8383
}
8484

85+
if (NitroxUser.IsNewestSubnautica.GetValueOrDefault(false))
86+
{
87+
Log.Error("Due to Subnautica's recent update \"Living Large\", Nitrox is currently not compatible. However you can still use older version of Subnautica in order to play Nitrox. You can do so by following these steps");
88+
89+
if (NitroxUser.GamePlatform?.Platform == Platform.STEAM)
90+
{
91+
Log.Warn("ENSURE NITROX AND SUBNAUTICA ARE CLOSED BEFORE PROCEEDING!");
92+
Log.Warn("Changing Subnautica to Legacy Build on STEAM:\n1. Right click Subnautica in Steam\n2. Click Properties\n3. Click Betas\n4. Select Legacy - Public legacy builds\n5. Close it out and let Steam download and install the Legacy version of Subnautica\n6. Run Subnautica through Steam (It will say \"Subnautica [legacy]\" in your library if you did it right)\n7. Launch Subnautica through Nitrox to play.");
93+
}
94+
95+
throw new Exception("Unable to start server, Nitrox isn't compatible with this Subnautica version");
96+
}
97+
8598
NitroxServiceLocator.InitializeDependencyContainer(new SubnauticaServerAutoFacRegistrar());
8699
NitroxServiceLocator.BeginNewLifetimeScope();
87100

NitroxServer/Server.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public Server(WorldPersistence worldPersistence, World world, ServerConfig serve
5454

5555
public string GetSaveSummary(Perms viewerPerms = Perms.CONSOLE)
5656
{
57-
// TODO: Extend summary with more useful save file data
58-
// Note for later additions: order these lines by their length
5957
StringBuilder builder = new("\n");
58+
6059
if (viewerPerms is Perms.CONSOLE)
6160
{
6261
builder.AppendLine($" - Save location: {Path.GetFullPath(serverConfig.SaveName)}");
6362
}
63+
6464
builder.AppendLine($" - Aurora's state: {world.EventTriggerer.GetAuroraStateSummary()}");
6565
builder.AppendLine($" - Current time: day {world.EventTriggerer.Day} ({Math.Floor(world.EventTriggerer.ElapsedSeconds)}s)");
6666
builder.AppendLine($" - Scheduled goals stored: {world.GameData.StoryGoals.ScheduledGoals.Count}");

0 commit comments

Comments
 (0)