diff --git a/src/LibHac/IO/AesXtsFile.cs b/src/LibHac/IO/AesXtsFile.cs
index f054193c..bc42f831 100644
--- a/src/LibHac/IO/AesXtsFile.cs
+++ b/src/LibHac/IO/AesXtsFile.cs
@@ -72,6 +72,8 @@ namespace LibHac.IO
public override void SetSize(long size)
{
+ Header.SetSize(size, VerificationKey);
+
throw new NotImplementedException();
}
}
diff --git a/src/LibHac/IO/AesXtsFileHeader.cs b/src/LibHac/IO/AesXtsFileHeader.cs
index 3d72827b..58d8f8d9 100644
--- a/src/LibHac/IO/AesXtsFileHeader.cs
+++ b/src/LibHac/IO/AesXtsFileHeader.cs
@@ -13,7 +13,7 @@ namespace LibHac.IO
public uint Magic { get; }
public byte[] EncryptedKey1 { get; } = new byte[0x10];
public byte[] EncryptedKey2 { get; } = new byte[0x10];
- public long Size { get; }
+ public long Size { get; private set; }
public byte[] DecryptedKey1 { get; } = new byte[0x10];
public byte[] DecryptedKey2 { get; } = new byte[0x10];
@@ -63,6 +63,12 @@ namespace LibHac.IO
return Util.ArraysEqual(hmac, Signature);
}
+ public void SetSize(long size, byte[] verificationKey)
+ {
+ Size = size;
+ Signature = CalculateHmac(verificationKey);
+ }
+
private void DecryptKeys()
{
Crypto.DecryptEcb(Kek1, EncryptedKey1, DecryptedKey1, 0x10);
diff --git a/src/LibHac/IO/FileSystemExtensions.cs b/src/LibHac/IO/FileSystemExtensions.cs
index 1c509f45..553b8667 100644
--- a/src/LibHac/IO/FileSystemExtensions.cs
+++ b/src/LibHac/IO/FileSystemExtensions.cs
@@ -35,7 +35,7 @@ namespace LibHac.IO
destFs.CreateFile(subDstPath, entry.Size, options);
using (IFile srcFile = sourceFs.OpenFile(subSrcPath, OpenMode.Read))
- using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write))
+ using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write | OpenMode.Append))
{
logger?.LogMessage(subSrcPath);
srcFile.CopyTo(dstFile, logger);
diff --git a/src/LibHac/IO/LocalFileSystem.cs b/src/LibHac/IO/LocalFileSystem.cs
index 0eabad86..c665698e 100644
--- a/src/LibHac/IO/LocalFileSystem.cs
+++ b/src/LibHac/IO/LocalFileSystem.cs
@@ -6,9 +6,19 @@ namespace LibHac.IO
{
private string BasePath { get; }
+ ///
+ /// Opens a directory on local storage as an .
+ /// The directory will be created if it does not exist.
+ ///
+ /// The path that will be the root of the .
public LocalFileSystem(string basePath)
{
BasePath = Path.GetFullPath(basePath);
+
+ if (!Directory.Exists(BasePath))
+ {
+ Directory.CreateDirectory(BasePath);
+ }
}
internal string ResolveLocalPath(string path)
diff --git a/src/LibHac/NcaStructs.cs b/src/LibHac/NcaStructs.cs
index 7f059f76..07563588 100644
--- a/src/LibHac/NcaStructs.cs
+++ b/src/LibHac/NcaStructs.cs
@@ -268,13 +268,13 @@ namespace LibHac
Control,
Manual,
Data,
- AocData
+ PublicData
}
public enum DistributionType
{
Download,
- Gamecard
+ GameCard
}
public enum NcaEncryptionType