ResourceTree: Are we fast yet?

This commit is contained in:
Exter-N 2023-11-14 20:38:21 +01:00
parent b2bf6eb0f7
commit 60551c8739
5 changed files with 33 additions and 25 deletions

View file

@ -168,11 +168,19 @@ public unsafe class ImcFile : MetaBaseFile
if (file == null)
throw new Exception();
fixed (byte* ptr = file.Data)
return GetEntry(file.Data, slot, variantIdx, out exists);
}
public static ImcEntry GetEntry(ReadOnlySpan<byte> imcFileData, EquipSlot slot, Variant variantIdx, out bool exists)
{
fixed (byte* ptr = imcFileData)
{
var entry = VariantPtr(ptr, PartIndex(slot), variantIdx);
if (entry == null)
{
exists = false;
return new ImcEntry();
}
exists = true;
return *entry;