diff --git a/src/LibHac/Kip.cs b/src/LibHac/Kip.cs index 8a4145d1..9a328608 100644 --- a/src/LibHac/Kip.cs +++ b/src/LibHac/Kip.cs @@ -17,8 +17,7 @@ namespace LibHac public Kip(IStorage storage) { - Storage = storage; - Header = new KipHeader(Storage); + Header = new KipHeader(storage); Size = HeaderSize; @@ -28,6 +27,8 @@ namespace LibHac SectionOffsets[index] = Size; Size += sectionSize; } + + Storage = storage.Slice(0, Size); } public IStorage OpenSection(int index) @@ -194,12 +195,8 @@ namespace LibHac for (int i = 0; i < KipCount; i++) { - // How to get the KIP's size the lazy way - var kip = new Kip(Storage.Slice(offset)); - - Kips[i] = new Kip(Storage.Slice(offset, kip.Size)); - - offset += kip.Size; + Kips[i] = new Kip(Storage.Slice(offset)); + offset += Kips[i].Size; } } }