forked from DodoCooker/ArkSavegameToolkit
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented basic support for V11 file format. (#5)
* Implemented basic support for V11 file format. * Determined that one of the "unknown" fields for this new data is actually a string, not an int - to define it a cryo creature is neutered. * Alex informed me these should be read as longs and not int. * Re-factored reading of cryo storage into ArkCryoStore object. * Generic fix to ignore unknown bytes before hibernation entries. Identified from official saves which use command line switches: -newsaveformat -usestore * + Only read data in ArkCryoStore if it's of type "Dino". + Reduced check on byte size for CustomItemDatas and only read in first 10 bytes to include offset to cryo store data.
- Loading branch information
1 parent
3f60040
commit 612cf06
Showing
2 changed files
with
253 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace SavegameToolkit | ||
{ | ||
internal class ArkCryoStore : GameObjectContainerMixin | ||
{ | ||
private long propertiesOffset = 0; | ||
|
||
public ArkCryoStore(ArkArchive archive) | ||
{ | ||
ReadBinary(archive); | ||
} | ||
|
||
public void ReadBinary(ArkArchive archive) | ||
{ | ||
var objectType = archive.ReadString(); //type? | ||
if (objectType.Equals("dino", StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
var stringPropertyCount = archive.ReadInt(); | ||
while(stringPropertyCount-- > 0) | ||
{ | ||
archive.ReadString(); | ||
} | ||
|
||
var floatPropertyCount = archive.ReadInt(); | ||
while(floatPropertyCount-- > 0) | ||
{ | ||
archive.ReadFloat(); | ||
} | ||
|
||
var colorNameCount = archive.ReadInt(); //color name count | ||
while (colorNameCount-- > 0) | ||
{ | ||
var colorName = archive.ReadString(); | ||
} | ||
|
||
|
||
var cryoStoreUnknown1 = archive.ReadLong(); | ||
|
||
//store properties offset | ||
propertiesOffset = archive.Position; | ||
|
||
//load GameObjects | ||
Objects.Clear(); | ||
|
||
bool useNameTable = archive.UseNameTable; | ||
archive.UseNameTable = false; | ||
|
||
var objectCount = archive.ReadInt(); | ||
while (objectCount-- > 0) | ||
{ | ||
Objects.Add(new GameObject(archive)); | ||
} | ||
|
||
archive.UseNameTable = useNameTable; | ||
} | ||
|
||
|
||
} | ||
|
||
public void LoadProperties(ArkArchive archive) | ||
{ | ||
bool useNameTable = archive.UseNameTable; | ||
archive.UseNameTable = false; | ||
|
||
var pos = archive.Position; | ||
|
||
for(int i=0; i < Objects.Count;i++) | ||
{ | ||
Objects[i].LoadProperties(archive, new GameObject(), (int)propertiesOffset); | ||
} | ||
|
||
archive.Position = pos; | ||
archive.UseNameTable = useNameTable; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters