Skip to content

Commit

Permalink
Update for 4.30
Browse files Browse the repository at this point in the history
  • Loading branch information
cengelha committed Jun 24, 2023
1 parent e7d7fa3 commit 62f9768
Show file tree
Hide file tree
Showing 10 changed files with 485 additions and 18 deletions.
7 changes: 0 additions & 7 deletions .github/changelogs/0.5.2.md

This file was deleted.

4 changes: 4 additions & 0 deletions .github/changelogs/0.5.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Small update to catch up with the latest version of No Man's Sky.

### Added
* Support for game versions up to **Singularity 4.30**
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ All notable changes to this project will be documented in this file. It uses the
### Fixed
### Security

## 0.5.3 (2023-06-24)

### Added
* Support for game versions up to **Singularity 4.30**

## 0.5.2 (2023-03-19)

### Added
Expand Down
4 changes: 4 additions & 0 deletions libNOM.io/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ internal set

public bool IsFractal => IsVersion(VersionEnum.Fractal); // { get; }

public bool IsInterceptor => IsVersion(VersionEnum.Interceptor); // { get; }

public bool IsSingularity => IsVersion(VersionEnum.Singularity); // { get; }

public string SaveName // { get; set; }
{
get => _jsonObject is not null ? _jsonObject.GetValue<string?>("6f=.Pk4", "PlayerStateData.SaveName") ?? string.Empty : string.Empty;
Expand Down
1 change: 1 addition & 0 deletions libNOM.io/Enums/SeasonEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public enum SeasonEnum
LeviathanRedux = 15,
PolestarRedux = 16,
Utopia = 17,
Singularity = 18,
Future,
}
3 changes: 3 additions & 0 deletions libNOM.io/Enums/VersionEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ public enum VersionEnum
[Description(nameof(Waypoint))]
WaypointWithSuperchargedSlots = 405,
Fractal = 410,
Interceptor = 420,
Mac = 425,
Singularity = 430,
}
38 changes: 30 additions & 8 deletions libNOM.io/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,15 +1490,26 @@ protected VersionEnum GetVersionEnum(Container container, JObject jsonObject)
209 = 5141/4117
*/

if (container.BaseVersion >= 4143) // 4.10
if (container.BaseVersion >= 4144) // 4.20, 4.25, 4.30
{
return VersionEnum.Fractal;
// Only used in actual Expedition saves.
//var greyIfCantStart = jsonObject.SelectTokens(usesMapping ? "PlayerStateData.SeasonData.Stages[*].Milestones[*].GreyIfCantStart" : "6f=.Rol.3Mw[*].kr6[*].:?x");
//if (greyIfCantStart.Any())
// return VersionEnum.Singularity;

// This is actually VersionEnum.Mac but it made most of the preperation for Singularity Expedition and therefore we already use this here.
var seasonStartMusicOverride = jsonObject.SelectToken(Settings.Mapping ? "PlayerStateData.SeasonData.SeasonStartMusicOverride" : "6f=.Rol.XEk");
if (seasonStartMusicOverride is not null)
return VersionEnum.Singularity;

return VersionEnum.Interceptor;
}

if (container.BaseVersion >= 4143) // 4.10
return VersionEnum.Fractal;

if (container.BaseVersion >= 4142) // 4.05
{
return VersionEnum.WaypointWithSuperchargedSlots;
}

if (container.BaseVersion >= 4141) // 4.04
return VersionEnum.WaypointWithAgileStat;
Expand Down Expand Up @@ -1602,15 +1613,26 @@ protected VersionEnum GetVersionEnum(Container container, JObject jsonObject)
/// <inheritdoc cref="GetVersionEnum(Container, JObject)"/>
protected static VersionEnum GetVersionEnum(Container container, string json)
{
if (container.BaseVersion >= 4143) // 4.10
if (container.BaseVersion >= 4144) // 4.20, 4.25, 4.30
{
return VersionEnum.Fractal;
// Only used in actual Expedition saves.
//var greyIfCantStart = json.Contains("\":?x\":"); // GreyIfCantStart
//if (greyIfCantStart)
// return VersionEnum.Singularity;

// This is actually VersionEnum.Mac but it made most of the preperation for Singularity Expedition and therefore we already use this here.
var seasonStartMusicOverride = json.Contains("\"XEk\":"); // SeasonStartMusicOverride
if (seasonStartMusicOverride)
return VersionEnum.Singularity;

return VersionEnum.Interceptor;
}

if (container.BaseVersion >= 4143) // 4.10
return VersionEnum.Fractal;

if (container.BaseVersion >= 4142) // 4.05
{
return VersionEnum.WaypointWithSuperchargedSlots;
}

if (container.BaseVersion >= 4141) // 4.04
return VersionEnum.WaypointWithAgileStat;
Expand Down
3 changes: 3 additions & 0 deletions libNOM.io/PlatformSteam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ internal record class PlatformDirectoryDataSteam : PlatformDirectoryData
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) // SteamDeck
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "Steam", "steamapps", "compatdata", "275850", "pfx", "drive_c", "users", "steamuser", "Application Data", "HelloGames", "NMS");
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) // macOS
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "HelloGames", "NMS");
return string.Empty; // same as if not defined at all
}))();

Expand Down
10 changes: 7 additions & 3 deletions libNOM.io/libNOM.io.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<LangVersion>10.0</LangVersion>
<Deterministic>True</Deterministic>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<!-- Package -->
<PropertyGroup>
<Version>0.5.2</Version>
<Authors>zencq</Authors>
<Version>0.5.3</Version>
<Authors>cengelha</Authors>
<Description>Provides reading and writing save files from the game No Man's Sky for all possible platforms as well as related actions.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/zencq/libNOM.io</RepositoryUrl>
Expand All @@ -30,6 +32,8 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<PackageTags>NoMansSky;NMS;libNOM</PackageTags>
<Copyright>Copyright (c) Christian Engelhardt 2021</Copyright>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<!-- https://github.com/clairernovotny/DeterministicBuilds -->
Expand All @@ -41,7 +45,7 @@
<ItemGroup>
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.5" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="libNOM.map" Version="0.9.0" />
<PackageReference Include="libNOM.map" Version="0.9.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading

0 comments on commit 62f9768

Please sign in to comment.