From b83fb6c7fc83899b1b4760783d06d6ec0d6d9d14 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 9 May 2019 19:10:23 -0500 Subject: [PATCH] Add SaveFsList expansion --- src/LibHac/IO/Save/SaveFsList.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/LibHac/IO/Save/SaveFsList.cs b/src/LibHac/IO/Save/SaveFsList.cs index 6b203842..5b03d352 100644 --- a/src/LibHac/IO/Save/SaveFsList.cs +++ b/src/LibHac/IO/Save/SaveFsList.cs @@ -9,6 +9,8 @@ namespace LibHac.IO.Save { private const int FreeListHeadIndex = 0; private const int UsedListHeadIndex = 1; + private const int CapacityIncrement = 0x4000; + public int MaxNameLength { get; } = 0x40; private IStorage Storage { get; } @@ -96,7 +98,11 @@ namespace LibHac.IO.Save if (capacity == 0 || length >= capacity) { - throw new NotImplementedException(); + long currentSize = Storage.GetSize(); + Storage.SetSize(currentSize + CapacityIncrement); + + long newSize = Storage.GetSize(); + SetListCapacity((int)(newSize / _sizeOfEntry)); } SetListLength(length + 1); @@ -266,7 +272,6 @@ namespace LibHac.IO.Save return MemoryMarshal.Read(buf); } - // ReSharper disable once UnusedMember.Local private void SetListCapacity(int capacity) { Span buf = stackalloc byte[sizeof(int)];