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);
|
headerDec.Read(headerBytes, 0, headerBytes.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = new BinaryReader(new MemoryStream(headerBytes)))
|
var reader = new BinaryReader(new MemoryStream(headerBytes));
|
||||||
{
|
|
||||||
Header = new NcaHeader(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Header = new NcaHeader(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DecryptKeyArea(Keyset keyset)
|
private void DecryptKeyArea(Keyset keyset)
|
||||||
|
@ -261,15 +259,13 @@ namespace LibHac
|
||||||
long offset = sect.Header.Bktr.SubsectionHeader.Offset;
|
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 streamDec = new RandomAccessSectorStream(new Aes128CtrStream(GetStream(), DecryptedKeys[2], sect.Offset, sect.Size, sect.Offset, sect.Header.Ctr)))
|
||||||
{
|
{
|
||||||
using (var reader = new BinaryReader(streamDec))
|
var reader = new BinaryReader(streamDec);
|
||||||
{
|
streamDec.Position = offset + 8;
|
||||||
streamDec.Position = offset + 8;
|
long size = reader.ReadInt64();
|
||||||
var size = reader.ReadInt64();
|
|
||||||
|
|
||||||
if (size != offset)
|
if (size != offset)
|
||||||
{
|
{
|
||||||
sect.SuperblockHashValidity = Validity.Invalid;
|
sect.SuperblockHashValidity = Validity.Invalid;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +308,7 @@ namespace LibHac
|
||||||
stream.Position = offset;
|
stream.Position = offset;
|
||||||
stream.Read(hashTable, 0, hashTable.Length);
|
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;
|
if (sect.Type == SectionType.Romfs) sect.Romfs.IvfcLevels[0].HashValidity = sect.SuperblockHashValidity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +367,6 @@ namespace LibHac
|
||||||
section.Position = dataOffset;
|
section.Position = dataOffset;
|
||||||
logger?.SetTotal(blockCount);
|
logger?.SetTotal(blockCount);
|
||||||
|
|
||||||
|
|
||||||
for (long i = 0; i < blockCount; i++)
|
for (long i = 0; i < blockCount; i++)
|
||||||
{
|
{
|
||||||
var remaining = (dataLen - i * blockSize);
|
var remaining = (dataLen - i * blockSize);
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace hactoolnet
|
||||||
|
|
||||||
if (ctx.Options.ExefsOutDir != null || ctx.Options.ExefsOut != null)
|
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)
|
if (section == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using LibHac;
|
using LibHac;
|
||||||
|
@ -25,7 +24,8 @@ namespace hactoolnet
|
||||||
|
|
||||||
private static string Print(this Pfs pfs)
|
private static string Print(this Pfs pfs)
|
||||||
{
|
{
|
||||||
const int colLen = 65;
|
const int colLen = 36;
|
||||||
|
const int fileNameLen = 39;
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
@ -35,10 +35,15 @@ namespace hactoolnet
|
||||||
PrintItem(sb, colLen, "Magic:", pfs.Header.Magic);
|
PrintItem(sb, colLen, "Magic:", pfs.Header.Magic);
|
||||||
PrintItem(sb, colLen, "Number of files:", pfs.Header.NumFiles);
|
PrintItem(sb, colLen, "Number of files:", pfs.Header.NumFiles);
|
||||||
|
|
||||||
sb.AppendLine("Files:");
|
for (int i = 0; i < pfs.Files.Length; i++)
|
||||||
foreach (PfsFileEntry file in pfs.Files.OrderBy(x => x.Offset))
|
|
||||||
{
|
{
|
||||||
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();
|
return sb.ToString();
|
||||||
|
|
Loading…
Reference in a new issue