Skip to content

Commit 6fea19c

Browse files
authored
Revert the type offset look up code. (#131)
1 parent 5c0083d commit 6fea19c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

KoAR.Core/GameSave.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ true when Path.GetExtension(fileName) is "" => SaveType.Switch,
7171
ReadOnlySpan<byte> data = Body;
7272
_bagOffset = GetBagOffset(data);
7373
_gameStateStartOffset = data.IndexOf(new byte[5] { 0xF7, 0x5D, 0x3C, 0x00, 0x0A });
74-
var typeSectionOffset = data.IndexOf(new byte[8] { 1, 0, 0, 0, 0x23, 0xCC, 0x58, 0x00 });
74+
var typeSectionOffset =
75+
data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x06 }) is int ix and > -1
76+
? ix
77+
: data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x04 }) is int pix and > -1
78+
? pix
79+
: data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x03 });
7580
_dataLengthOffsets = new[]{
7681
_gameStateStartOffset + 5, // gameStateSize
7782
data.IndexOf(new byte[5] { 0x0C, 0xAE, 0x32, 0x00, 0x00 }) + 5, // unknown length 1
78-
typeSectionOffset + 9, // type section length
83+
typeSectionOffset + 5, // type section length
7984
};
8085
_itemContainer = new(this, data.IndexOf(new byte[5] { 0xD3, 0x34, 0x43, 0x00, 0x00 }), 0x00_24_D5_68_00_00_00_0Bul);
8186
_itemBuffsContainer = new(this, data.IndexOf(new byte[5] { 0xBB, 0xD5, 0x43, 0x00, 0x00 }), 0x00_28_60_84_00_00_00_0Bul);

0 commit comments

Comments
 (0)