Skip to content

Commit

Permalink
fix: possible wrong metadata size when transfering
Browse files Browse the repository at this point in the history
  • Loading branch information
cengelha committed Jul 26, 2024
1 parent 2fea567 commit 850c0c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ All notable changes to this project will be documented in this file. It uses the
[Keep a Changelog](http://keepachangelog.com/en/1.0.0/) principles and [Semantic Versioning](https://semver.org/)
since 1.0.0.

## Unreleased
## Unreleased (0.10.1)

### Known Issues
### Added
* Support for changed save format on Microsoft platform in Worlds 5.01.1
### Changed
* Make `Common.DeepCopy()` public
### Deprecated
### Removed
### Fixed
* Wrong metadata size when transferring save to container with other size
### Security

## 0.10.0 (2024-07-22)
Expand Down
14 changes: 6 additions & 8 deletions libNOM.io/Platform_Write.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,12 @@ protected ReadOnlySpan<byte> PrepareMeta(Container container, ReadOnlySpan<byte>

protected byte[] CreateMetaBuffer(Container container)
{
var capacity = (int)(container.Extra.MetaLength);
if (capacity == 0)
capacity = container.GameVersion switch {
>= GameVersionEnum.Worlds => META_LENGTH_TOTAL_WORLDS,
>= GameVersionEnum.Waypoint => META_LENGTH_TOTAL_WAYPOINT,
_ => META_LENGTH_TOTAL_VANILLA,
};

var capacity = container.GameVersion switch
{
>= GameVersionEnum.Worlds => META_LENGTH_TOTAL_WORLDS,
>= GameVersionEnum.Waypoint => META_LENGTH_TOTAL_WAYPOINT,
_ => META_LENGTH_TOTAL_VANILLA,
};
return new byte[capacity];
}

Expand Down
2 changes: 1 addition & 1 deletion libNOM.io/libNOM.io.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<!-- Package -->
<PropertyGroup Label="General">
<Version>0.10.1-beta.3</Version>
<Version>0.10.1-beta.4</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>
<Copyright>Copyright (c) Christian Engelhardt 2021</Copyright>
Expand Down
2 changes: 1 addition & 1 deletion libNOM.test/Steam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void T102_Read_76561198042453834_0x7D3_Worlds()
{
// Arrange
var expectAccountData = true;
var path = GetCombinedPath("Steam", "st_76561198042453834_Worlds");
var path = GetCombinedPath("Steam", "st_76561198042453834_0x7D3_Worlds");
var results = new ReadResults[]
{
new(0, "Slot1Auto", true, true, false, true, true, true, false, false, SaveContextQueryEnum.Main, nameof(PresetGameModeEnum.Normal), DifficultyPresetTypeEnum.Custom, SeasonEnum.None, 4153, 4665, GameVersionEnum.Worlds, "Iteration 1", "An Bord von Die „Batannam“-Sphäre", 1287227),
Expand Down

0 comments on commit 850c0c9

Please sign in to comment.