Skip to content

Commit

Permalink
Revert the type offset look up code. (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
mburbea authored Dec 23, 2021
1 parent 5c0083d commit 6fea19c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions KoAR.Core/GameSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ true when Path.GetExtension(fileName) is "" => SaveType.Switch,
ReadOnlySpan<byte> data = Body;
_bagOffset = GetBagOffset(data);
_gameStateStartOffset = data.IndexOf(new byte[5] { 0xF7, 0x5D, 0x3C, 0x00, 0x0A });
var typeSectionOffset = data.IndexOf(new byte[8] { 1, 0, 0, 0, 0x23, 0xCC, 0x58, 0x00 });
var typeSectionOffset =
data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x06 }) is int ix and > -1
? ix
: data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x04 }) is int pix and > -1
? pix
: data.IndexOf(new byte[5] { 0x23, 0xCC, 0x58, 0x00, 0x03 });
_dataLengthOffsets = new[]{
_gameStateStartOffset + 5, // gameStateSize
data.IndexOf(new byte[5] { 0x0C, 0xAE, 0x32, 0x00, 0x00 }) + 5, // unknown length 1
typeSectionOffset + 9, // type section length
typeSectionOffset + 5, // type section length
};
_itemContainer = new(this, data.IndexOf(new byte[5] { 0xD3, 0x34, 0x43, 0x00, 0x00 }), 0x00_24_D5_68_00_00_00_0Bul);
_itemBuffsContainer = new(this, data.IndexOf(new byte[5] { 0xBB, 0xD5, 0x43, 0x00, 0x00 }), 0x00_28_60_84_00_00_00_0Bul);
Expand Down

0 comments on commit 6fea19c

Please sign in to comment.