mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Avoid opening KIP files twice
This commit is contained in:
parent
c73493b505
commit
7050b9a681
1 changed files with 5 additions and 8 deletions
|
@ -17,8 +17,7 @@ namespace LibHac
|
||||||
|
|
||||||
public Kip(IStorage storage)
|
public Kip(IStorage storage)
|
||||||
{
|
{
|
||||||
Storage = storage;
|
Header = new KipHeader(storage);
|
||||||
Header = new KipHeader(Storage);
|
|
||||||
|
|
||||||
Size = HeaderSize;
|
Size = HeaderSize;
|
||||||
|
|
||||||
|
@ -28,6 +27,8 @@ namespace LibHac
|
||||||
SectionOffsets[index] = Size;
|
SectionOffsets[index] = Size;
|
||||||
Size += sectionSize;
|
Size += sectionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Storage = storage.Slice(0, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IStorage OpenSection(int index)
|
public IStorage OpenSection(int index)
|
||||||
|
@ -194,12 +195,8 @@ namespace LibHac
|
||||||
|
|
||||||
for (int i = 0; i < KipCount; i++)
|
for (int i = 0; i < KipCount; i++)
|
||||||
{
|
{
|
||||||
// How to get the KIP's size the lazy way
|
Kips[i] = new Kip(Storage.Slice(offset));
|
||||||
var kip = new Kip(Storage.Slice(offset));
|
offset += Kips[i].Size;
|
||||||
|
|
||||||
Kips[i] = new Kip(Storage.Slice(offset, kip.Size));
|
|
||||||
|
|
||||||
offset += kip.Size;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue