Skip to content

Commit

Permalink
Early support for loading V7 savegames
Browse files Browse the repository at this point in the history
  • Loading branch information
Qowyn committed Jun 22, 2017
1 parent c4b5c25 commit 91c9d6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>qowyn.ark</groupId>
<artifactId>ark-savegame-toolkit</artifactId>
<version>0.7.2</version>
<version>0.7.3</version>
<packaging>jar</packaging>

<name>ARK Savegame Toolkit</name>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/qowyn/ark/ArkSavegame.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class ArkSavegame implements GameObjectContainer {

protected short saveVersion;

protected int binaryDataOffset;

protected int nameTableOffset;

protected int propertiesBlockOffset;
Expand Down Expand Up @@ -137,7 +139,7 @@ public boolean hasUnknownData() {
public void readBinary(ArkArchive archive, ReadingOptions options) {
readBinaryHeader(archive);

if (saveVersion == 6) {
if (saveVersion > 5) {
// Name table is located after the objects block, but will be needed to read the objects block
readBinaryNameTable(archive);
}
Expand All @@ -163,6 +165,15 @@ protected void readBinaryHeader(ArkArchive archive) {
nameTableOffset = archive.getInt();
propertiesBlockOffset = archive.getInt();
gameTime = archive.getFloat();
} else if (saveVersion == 7) {
binaryDataOffset = archive.getInt();
int shouldBeZero = archive.getInt();
if (shouldBeZero != 0) {
throw new UnsupportedOperationException("The stuff at this position should be zero: " + Integer.toHexString(archive.position() - 4));
}
nameTableOffset = archive.getInt();
propertiesBlockOffset = archive.getInt();
gameTime = archive.getFloat();
} else {
throw new UnsupportedOperationException("Found unknown Version " + saveVersion);
}
Expand Down

0 comments on commit 91c9d6b

Please sign in to comment.