mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Adjust PFS0 printing
This commit is contained in:
parent
58226afd7b
commit
67ad322310
3 changed files with 21 additions and 21 deletions
|
@ -189,11 +189,9 @@ namespace LibHac
|
|||
headerDec.Read(headerBytes, 0, headerBytes.Length);
|
||||
}
|
||||
|
||||
using (var reader = new BinaryReader(new MemoryStream(headerBytes)))
|
||||
{
|
||||
Header = new NcaHeader(reader);
|
||||
}
|
||||
|
||||
var reader = new BinaryReader(new MemoryStream(headerBytes));
|
||||
|
||||
Header = new NcaHeader(reader);
|
||||
}
|
||||
|
||||
private void DecryptKeyArea(Keyset keyset)
|
||||
|
@ -261,15 +259,13 @@ namespace LibHac
|
|||
long offset = sect.Header.Bktr.SubsectionHeader.Offset;
|
||||
using (var streamDec = new RandomAccessSectorStream(new Aes128CtrStream(GetStream(), DecryptedKeys[2], sect.Offset, sect.Size, sect.Offset, sect.Header.Ctr)))
|
||||
{
|
||||
using (var reader = new BinaryReader(streamDec))
|
||||
{
|
||||
streamDec.Position = offset + 8;
|
||||
var size = reader.ReadInt64();
|
||||
var reader = new BinaryReader(streamDec);
|
||||
streamDec.Position = offset + 8;
|
||||
long size = reader.ReadInt64();
|
||||
|
||||
if (size != offset)
|
||||
{
|
||||
sect.SuperblockHashValidity = Validity.Invalid;
|
||||
}
|
||||
if (size != offset)
|
||||
{
|
||||
sect.SuperblockHashValidity = Validity.Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +308,7 @@ namespace LibHac
|
|||
stream.Position = offset;
|
||||
stream.Read(hashTable, 0, hashTable.Length);
|
||||
|
||||
sect.SuperblockHashValidity = Crypto.CheckMemoryHashTable(hashTable,expected,0, hashTable.Length);
|
||||
sect.SuperblockHashValidity = Crypto.CheckMemoryHashTable(hashTable, expected, 0, hashTable.Length);
|
||||
if (sect.Type == SectionType.Romfs) sect.Romfs.IvfcLevels[0].HashValidity = sect.SuperblockHashValidity;
|
||||
}
|
||||
|
||||
|
@ -371,7 +367,6 @@ namespace LibHac
|
|||
section.Position = dataOffset;
|
||||
logger?.SetTotal(blockCount);
|
||||
|
||||
|
||||
for (long i = 0; i < blockCount; i++)
|
||||
{
|
||||
var remaining = (dataLen - i * blockSize);
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace hactoolnet
|
|||
|
||||
if (ctx.Options.ExefsOutDir != null || ctx.Options.ExefsOut != null)
|
||||
{
|
||||
NcaSection section = nca.Sections.FirstOrDefault(x => x.IsExefs);
|
||||
NcaSection section = nca.Sections.FirstOrDefault(x => x?.IsExefs == true);
|
||||
|
||||
if (section == null)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using LibHac;
|
||||
|
@ -25,7 +24,8 @@ namespace hactoolnet
|
|||
|
||||
private static string Print(this Pfs pfs)
|
||||
{
|
||||
const int colLen = 65;
|
||||
const int colLen = 36;
|
||||
const int fileNameLen = 39;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine();
|
||||
|
@ -35,10 +35,15 @@ namespace hactoolnet
|
|||
PrintItem(sb, colLen, "Magic:", pfs.Header.Magic);
|
||||
PrintItem(sb, colLen, "Number of files:", pfs.Header.NumFiles);
|
||||
|
||||
sb.AppendLine("Files:");
|
||||
foreach (PfsFileEntry file in pfs.Files.OrderBy(x => x.Offset))
|
||||
for (int i = 0; i < pfs.Files.Length; i++)
|
||||
{
|
||||
PrintItem(sb, colLen, $"{file.Name}", $"{file.Offset:x12}-{file.Offset + file.Size:x12}");
|
||||
PfsFileEntry file = pfs.Files[i];
|
||||
|
||||
string label = i == 0 ? "Files:" : "";
|
||||
string offsets = $"{file.Offset:x12}-{file.Offset + file.Size:x12}{file.HashValidity.GetValidityString()}";
|
||||
string data = $"pfs0:/{file.Name}".PadRight(fileNameLen) + offsets;
|
||||
|
||||
PrintItem(sb, colLen, label, data);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
|
Loading…
Reference in a new issue