Skip to content

Commit fc2231e

Browse files
VELD-DevCoding-Hen
authored andcommitted
Fixed GameInstallationFinder for Below Zero
1 parent 4fc20b6 commit fc2231e

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

Nitrox.BuildTool/Program.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Diagnostics;
33
using System.IO;
44
using System.Reflection;
@@ -22,7 +22,11 @@ public static class Program
2222

2323
public static string GeneratedOutputDir => Path.Combine(ProcessDir, "generated_files");
2424

25+
#if BELOWZERO
26+
private const int LEGACY_BRANCH_SUBNAUTICA_VERSION = 49370;
27+
#elif SUBNAUTICA
2528
private const int LEGACY_BRANCH_SUBNAUTICA_VERSION = 68598;
29+
#endif
2630

2731
public static async Task Main(string[] args)
2832
{
@@ -58,7 +62,11 @@ private static void LogError(string message)
5862

5963
private static void AbortIfInvalidGameVersion(GameInstallData game)
6064
{
65+
#if BELOWZERO
66+
string gameVersionFile = Path.Combine(game.InstallDir, "SubnauticaZero_Data", "StreamingAssets", "SNUnmanagedData", "plastic_status.ignore");
67+
#elif SUBNAUTICA
6168
string gameVersionFile = Path.Combine(game.InstallDir, "Subnautica_Data", "StreamingAssets", "SNUnmanagedData", "plastic_status.ignore");
69+
#endif
6270
if (!File.Exists(gameVersionFile))
6371
{
6472
return;

NitroxModel/Discovery/GameInstallationFinder.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ public static bool IsSubnauticaDirectory(string directory)
5454
#if SUBNAUTICA
5555
return Directory.EnumerateFiles(directory, "*.exe")
5656
.Any(file => Path.GetFileName(file)?.Equals("subnautica.exe", StringComparison.OrdinalIgnoreCase) ?? false);
57-
#endif
58-
#if BELOWZERO
57+
#elif BELOWZERO
5958
return Directory.EnumerateFiles(directory, "*.exe")
60-
.Any(file => Path.GetFileName(file)?.Equals("subnauticazero.exe", StringComparison.OrdinalIgnoreCase) ?? false);
59+
.Any(file => Path.GetFileName(file)?.Equals("subnauticazero.exe", StringComparison.OrdinalIgnoreCase) ?? false);
6160
#endif
6261
}
6362
}

NitroxModel/Discovery/InstallationFinders/SteamGameRegistryFinder.cs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Runtime.InteropServices;
@@ -36,6 +36,7 @@ public string FindGame(IList<string> errors = null)
3636
return null;
3737
}
3838
string appsPath = Path.Combine(steamPath, "steamapps");
39+
#if SUBNAUTICA
3940
if (File.Exists(Path.Combine(appsPath, $"appmanifest_{GameInfo.Subnautica.SteamAppId}.acf")))
4041
{
4142
return Path.Combine(appsPath, "common", GameInfo.Subnautica.Name);
@@ -49,6 +50,21 @@ public string FindGame(IList<string> errors = null)
4950
{
5051
return path;
5152
}
53+
#elif BELOWZERO
54+
if(File.Exists(Path.Combine(appsPath, $"appmanifest_{GameInfo.SubnauticaBelowZero.SteamAppId}.acf")))
55+
{
56+
return Path.Combine(appsPath, "common", GameInfo.SubnauticaBelowZero.Name);
57+
}
58+
string path = SearchAllInstallations(Path.Combine(appsPath, "libraryfolders.vdf"), GameInfo.SubnauticaBelowZero.SteamAppId, GameInfo.SubnauticaBelowZero.Name);
59+
if(string.IsNullOrEmpty(path))
60+
{
61+
errors?.Add($"It appears you don't have {GameInfo.SubnauticaBelowZero.Name} installed anywhere. The game files are needed to run the server");
62+
}
63+
else
64+
{
65+
return path;
66+
}
67+
#endif
5268

5369
return null;
5470
}

0 commit comments

Comments
 (0)