Skip to content

Commit 1ede406

Browse files
committed
[MISC]: Fixed FueledItems read & published 0.1.5
1 parent c655b2a commit 1ede406

File tree

9 files changed

+39
-49
lines changed

9 files changed

+39
-49
lines changed

.github/workflows/dotnet.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
PROJECT_FILE_PATH: ./SatisfactorySaveNet.Abstracts/SatisfactorySaveNet.Abstracts.csproj
3636
PACKAGE_NAME: SatisfactorySaveNet
37-
VERSION_STATIC: 0.1.4
37+
VERSION_STATIC: 0.1.5
3838
TAG_COMMIT: false
3939
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
4040
NUGET_SOURCE: https://api.nuget.org
@@ -45,7 +45,7 @@ jobs:
4545
with:
4646
PROJECT_FILE_PATH: ./SatisfactorySaveNet/SatisfactorySaveNet.csproj
4747
PACKAGE_NAME: SatisfactorySaveNet
48-
VERSION_STATIC: 0.1.4
48+
VERSION_STATIC: 0.1.5
4949
TAG_COMMIT: false
5050
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
5151
NUGET_SOURCE: https://api.nuget.org

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<IsPackable>false</IsPackable>
1212
<IsPublishable>false</IsPublishable>
1313

14-
<VersionPrefix>0.1.4</VersionPrefix>
14+
<VersionPrefix>0.1.5</VersionPrefix>
1515
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
1616
<Version Condition=" '$(VersionSuffix)' == '' ">$(VersionPrefix)</Version>
1717

Directory.Packages.props

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
6+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
77
<PackageVersion Include="CommunityToolkit.HighPerformance" Version="8.2.2" />
88
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
99
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
10-
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
11-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
10+
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
11+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
1212
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
1313
<PackageVersion Include="NSubstitute" Version="5.1.0" />
14-
<PackageVersion Include="NUnit" Version="4.1.0" />
15-
<PackageVersion Include="NUnit.Analyzers" Version="4.1.0" />
16-
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
14+
<PackageVersion Include="NUnit" Version="4.2.1" />
15+
<PackageVersion Include="NUnit.Analyzers" Version="4.3.0" />
16+
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
1717
</ItemGroup>
1818
</Project>

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SatisfactorySaveNet
22
I'm very happy to announce the first stable release of this component (v0.1.0).
3-
**EDIT:** Still consider using versions starting from v0.1.4 due to some bugfixes.
43
By this I consider this software as **stable** and **correct**!
54
You can integrate it using [nuget.org](https://www.nuget.org/packages/SatisfactorySaveNet/).
65

@@ -10,7 +9,7 @@ This component currently allows reading all contained data of the *.sav file typ
109

1110
It is planned to add writing capabilities if this project finds interested users.
1211

13-
Further, (external and promising looking) documentation of the save game format is available [here](https://github.com/moritz-h/satisfactory-3d-map/blob/master/docs/SATISFACTORY_SAVE.md). **Link fixed now sorry**
12+
Further, (external and promising looking) documentation of the save game format is available [here](docs/SATISFACTORY_SAVE.md).
1413

1514
## How to use
1615
```CSharp
@@ -39,4 +38,4 @@ ISaveFileSerializer Instance = new SaveFileSerializer(HeaderSerializer.Instance,
3938
> You should have received a copy of the GNU General Public License
4039
> along with this program. If not, see <https://www.gnu.org/licenses/>.
4140
42-
The source code of SatisfactorySaveNet itself is licensed under the GNU GPLv3.
41+
The source code of SatisfactorySaveNet itself is licensed under the GNU GPLv3.

SatisfactorySaveNet.Abstracts/Model/Typed/InventoryItem.cs

-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ public class InventoryItem : TypedData
99
public string ItemType { get; set; } = string.Empty;
1010
public required ObjectReference? ObjectReference { get; set; }
1111
public Property? ExtraProperty { get; set; }
12-
public string? LevelName { get; set; }
1312
}

SatisfactorySaveNet.Tests/SatisfactorySaveNet.Tests.csproj

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FluentAssertions"/>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
11-
<PackageReference Include="NSubstitute"/>
12-
<PackageReference Include="NUnit"/>
13-
<PackageReference Include="NUnit3TestAdapter"/>
9+
<PackageReference Include="FluentAssertions" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
11+
<PackageReference Include="Newtonsoft.Json" />
12+
<PackageReference Include="NSubstitute" />
13+
<PackageReference Include="NUnit" />
14+
<PackageReference Include="NUnit3TestAdapter" />
1415
<PackageReference Include="NUnit.Analyzers">
1516
<PrivateAssets>all</PrivateAssets>
1617
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

SatisfactorySaveNet/ExtraDataSerializer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ private ConveyorData DeserializeConveyor(BinaryReader reader, Header header)
266266
if (header.SaveVersion < 44)
267267
objectReference = _objectReferenceSerializer.Deserialize(reader);
268268
else
269-
levelName = _stringSerializer.Deserialize(reader);
269+
levelName = _stringSerializer.Deserialize(reader); //ToDo: This might be an int state like in TypedDataSerializer.DeserializeInventoryItem()
270270

271271
var position = _vectorSerializer.DeserializeVec4B(reader);
272272

SatisfactorySaveNet/TypedDataSerializer.cs

+20-29
Original file line numberDiff line numberDiff line change
@@ -439,45 +439,37 @@ private TypedData DeserializeInventoryStack(BinaryReader reader, Header header)
439439

440440
private InventoryItem DeserializeInventoryItem(BinaryReader reader, Header header, bool isArrayProperty)
441441
{
442-
var padding = reader.ReadInt32();
442+
var padding1 = reader.ReadInt32();
443443
var itemType = _stringSerializer.Deserialize(reader);
444444
ObjectReference? objectReference = null;
445-
string? levelName = null;
445+
var hasState = false;
446446

447447
if (header.SaveVersion < 44)
448448
objectReference = _objectReferenceSerializer.Deserialize(reader);
449449
else
450-
levelName = _stringSerializer.Deserialize(reader);
450+
hasState = reader.ReadInt32() != 0;
451451

452452
Property? property = null;
453453

454-
if (header.SaveVersion >= 44 && FuelContainingItems.Contains(itemType))
454+
if (header.SaveVersion >= 44 && FuelContainingItems.Contains(itemType) && hasState)
455455
{
456-
var hex = _hexSerializer.Deserialize(reader, 3);
457-
var hasFuel = hex.Equals("\0\0\0", StringComparison.Ordinal);
456+
var padding2 = reader.ReadInt32();
457+
var scriptName = _stringSerializer.Deserialize(reader);
458+
var unknown = reader.ReadInt32();
459+
var properties = _propertySerializer.DeserializeProperties(reader, header).ToArray();
458460

459-
if (hasFuel)
460-
{
461-
var scriptName = _stringSerializer.Deserialize(reader);
462-
var unknown = reader.ReadInt32();
463-
var properties = _propertySerializer.DeserializeProperties(reader, header).ToArray();
464-
465-
if (!isArrayProperty)
466-
property = _propertySerializer.DeserializeProperty(reader, header);
467-
468-
return new FueledInventoryItem
469-
{
470-
ItemType = itemType,
471-
ObjectReference = objectReference,
472-
ExtraProperty = property,
473-
LevelName = levelName,
474-
Properties = properties,
475-
ScriptName = scriptName,
476-
Unknown1 = unknown
477-
};
478-
}
461+
if (!isArrayProperty)
462+
property = _propertySerializer.DeserializeProperty(reader, header);
479463

480-
reader.BaseStream.Seek(-3, SeekOrigin.Current);
464+
return new FueledInventoryItem
465+
{
466+
ItemType = itemType,
467+
ObjectReference = objectReference,
468+
ExtraProperty = property,
469+
Properties = properties,
470+
ScriptName = scriptName,
471+
Unknown1 = unknown
472+
};
481473
}
482474

483475
if (!isArrayProperty)
@@ -487,8 +479,7 @@ private InventoryItem DeserializeInventoryItem(BinaryReader reader, Header heade
487479
{
488480
ItemType = itemType,
489481
ObjectReference = objectReference,
490-
ExtraProperty = property,
491-
LevelName = levelName
482+
ExtraProperty = property
492483
};
493484
}
494485

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.204",
3+
"version": "8.0.401",
44
"rollForward": "feature"
55
}
66
}

0 commit comments

Comments
 (0)