mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Rebase on master
This commit is contained in:
parent
e581964a84
commit
20a4473abf
7 changed files with 13 additions and 172 deletions
|
@ -1,7 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace libhac
|
namespace LibHac
|
||||||
{
|
{
|
||||||
public class Nacp
|
public class Nacp
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,10 @@ namespace libhac
|
||||||
SeedForPseudoDeviceId = reader.ReadUInt64();
|
SeedForPseudoDeviceId = reader.ReadUInt64();
|
||||||
BcatPassphrase = reader.ReadUtf8Z(65);
|
BcatPassphrase = reader.ReadUtf8Z(65);
|
||||||
|
|
||||||
reader.BaseStream.Position = start + 0x3148;
|
reader.BaseStream.Position = start + 0x3141;
|
||||||
|
Reserved01 = reader.ReadByte();
|
||||||
|
Reserved02 = reader.ReadBytes(6);
|
||||||
|
|
||||||
UserAccountSaveDataSizeMax = reader.ReadInt64();
|
UserAccountSaveDataSizeMax = reader.ReadInt64();
|
||||||
UserAccountSaveDataJournalSizeMax = reader.ReadInt64();
|
UserAccountSaveDataJournalSizeMax = reader.ReadInt64();
|
||||||
DeviceSaveDataSizeMax = reader.ReadInt64();
|
DeviceSaveDataSizeMax = reader.ReadInt64();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using libhac;
|
using LibHac;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Net
|
namespace Net
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFrameworks>netcoreapp2.1;net45</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using libhac;
|
using LibHac;
|
||||||
|
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
|
@ -63,10 +63,10 @@ namespace Net
|
||||||
|
|
||||||
var nca = new Nca(ToolCtx.Keyset, stream, true);
|
var nca = new Nca(ToolCtx.Keyset, stream, true);
|
||||||
Stream sect = nca.OpenSection(0, false);
|
Stream sect = nca.OpenSection(0, false);
|
||||||
var pfs0 = new Pfs0(sect);
|
var pfs0 = new Pfs(sect);
|
||||||
var file = pfs0.GetFile(0);
|
var file = pfs0.OpenFile(pfs0.Files[0]);
|
||||||
|
|
||||||
var cnmt = new Cnmt(new MemoryStream(file));
|
var cnmt = new Cnmt(file);
|
||||||
return cnmt;
|
return cnmt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using libhac;
|
using LibHac;
|
||||||
|
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libhac;
|
using LibHac;
|
||||||
|
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
|
|
162
libhac/Nacp.cs
162
libhac/Nacp.cs
|
@ -1,162 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace libhac
|
|
||||||
{
|
|
||||||
public class Nacp
|
|
||||||
{
|
|
||||||
public NacpLang[] Languages { get; } = new NacpLang[0x10];
|
|
||||||
public string Isbn { get; }
|
|
||||||
public byte StartupUserAccount { get; }
|
|
||||||
public byte TouchScreenUsageMode { get; }
|
|
||||||
public byte AocRegistrationType { get; }
|
|
||||||
public int AttributeFlag { get; }
|
|
||||||
public uint SupportedLanguageFlag { get; }
|
|
||||||
public uint ParentalControlFlag { get; }
|
|
||||||
public byte Screenshot { get; }
|
|
||||||
public byte VideoCapture { get; }
|
|
||||||
public byte DataLossConfirmation { get; }
|
|
||||||
public byte PlayLogPolicy { get; }
|
|
||||||
public ulong PresenceGroupId { get; }
|
|
||||||
public sbyte[] RatingAge { get; } = new sbyte[32];
|
|
||||||
public string DisplayVersion { get; }
|
|
||||||
public ulong AddOnContentBaseId { get; }
|
|
||||||
public ulong SaveDataOwnerId { get; }
|
|
||||||
public long UserAccountSaveDataSize { get; }
|
|
||||||
public long UserAccountSaveDataJournalSize { get; }
|
|
||||||
public long DeviceSaveDataSize { get; }
|
|
||||||
public long DeviceSaveDataJournalSize { get; }
|
|
||||||
public long BcatDeliveryCacheStorageSize { get; }
|
|
||||||
public string ApplicationErrorCodeCategory { get; }
|
|
||||||
public ulong[] LocalCommunicationId { get; } = new ulong[8];
|
|
||||||
public byte LogoType { get; }
|
|
||||||
public byte LogoHandling { get; }
|
|
||||||
public byte RuntimeAddOnContentInstall { get; }
|
|
||||||
public byte[] Reserved00 { get; }
|
|
||||||
public byte CrashReport { get; }
|
|
||||||
public byte Hdcp { get; }
|
|
||||||
public ulong SeedForPseudoDeviceId { get; }
|
|
||||||
public string BcatPassphrase { get; }
|
|
||||||
public byte Reserved01 { get; }
|
|
||||||
public byte[] Reserved02 { get; }
|
|
||||||
public long UserAccountSaveDataSizeMax { get; }
|
|
||||||
public long UserAccountSaveDataJournalSizeMax { get; }
|
|
||||||
public long DeviceSaveDataSizeMax { get; }
|
|
||||||
public long DeviceSaveDataJournalSizeMax { get; }
|
|
||||||
public long TemporaryStorageSize { get; }
|
|
||||||
public long CacheStorageSize { get; }
|
|
||||||
public long CacheStorageJournalSize { get; }
|
|
||||||
public long CacheStorageDataAndJournalSizeMax { get; }
|
|
||||||
public short CacheStorageIndex { get; }
|
|
||||||
public byte[] Reserved03 { get; }
|
|
||||||
public List<ulong> PlayLogQueryableApplicationId { get; } = new List<ulong>();
|
|
||||||
public byte PlayLogQueryCapability { get; }
|
|
||||||
public byte RepairFlag { get; }
|
|
||||||
public byte ProgramIndex { get; }
|
|
||||||
|
|
||||||
|
|
||||||
public long TotalSaveDataSize { get; }
|
|
||||||
public long UserTotalSaveDataSize { get; }
|
|
||||||
public long DeviceTotalSaveDataSize { get; }
|
|
||||||
|
|
||||||
public Nacp() { }
|
|
||||||
|
|
||||||
public Nacp(BinaryReader reader)
|
|
||||||
{
|
|
||||||
var start = reader.BaseStream.Position;
|
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
Languages[i] = new NacpLang(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
Isbn = reader.ReadUtf8Z(37);
|
|
||||||
reader.BaseStream.Position = start + 0x3025;
|
|
||||||
StartupUserAccount = reader.ReadByte();
|
|
||||||
TouchScreenUsageMode = reader.ReadByte();
|
|
||||||
AocRegistrationType = reader.ReadByte();
|
|
||||||
AttributeFlag = reader.ReadInt32();
|
|
||||||
SupportedLanguageFlag = reader.ReadUInt32();
|
|
||||||
ParentalControlFlag = reader.ReadUInt32();
|
|
||||||
Screenshot = reader.ReadByte();
|
|
||||||
VideoCapture = reader.ReadByte();
|
|
||||||
DataLossConfirmation = reader.ReadByte();
|
|
||||||
PlayLogPolicy = reader.ReadByte();
|
|
||||||
PresenceGroupId = reader.ReadUInt64();
|
|
||||||
|
|
||||||
for (int i = 0; i < RatingAge.Length; i++)
|
|
||||||
{
|
|
||||||
RatingAge[i] = reader.ReadSByte();
|
|
||||||
}
|
|
||||||
|
|
||||||
DisplayVersion = reader.ReadUtf8Z(16);
|
|
||||||
reader.BaseStream.Position = start + 0x3070;
|
|
||||||
AddOnContentBaseId = reader.ReadUInt64();
|
|
||||||
SaveDataOwnerId = reader.ReadUInt64();
|
|
||||||
UserAccountSaveDataSize = reader.ReadInt64();
|
|
||||||
UserAccountSaveDataJournalSize = reader.ReadInt64();
|
|
||||||
DeviceSaveDataSize = reader.ReadInt64();
|
|
||||||
DeviceSaveDataJournalSize = reader.ReadInt64();
|
|
||||||
BcatDeliveryCacheStorageSize = reader.ReadInt64();
|
|
||||||
ApplicationErrorCodeCategory = reader.ReadUtf8Z(8);
|
|
||||||
reader.BaseStream.Position = start + 0x30B0;
|
|
||||||
|
|
||||||
for (int i = 0; i < LocalCommunicationId.Length; i++)
|
|
||||||
{
|
|
||||||
LocalCommunicationId[i] = reader.ReadUInt64();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogoType = reader.ReadByte();
|
|
||||||
LogoHandling = reader.ReadByte();
|
|
||||||
RuntimeAddOnContentInstall = reader.ReadByte();
|
|
||||||
Reserved00 = reader.ReadBytes(3);
|
|
||||||
CrashReport = reader.ReadByte();
|
|
||||||
Hdcp = reader.ReadByte();
|
|
||||||
SeedForPseudoDeviceId = reader.ReadUInt64();
|
|
||||||
BcatPassphrase = reader.ReadUtf8Z(65);
|
|
||||||
|
|
||||||
reader.BaseStream.Position = start + 0x3148;
|
|
||||||
UserAccountSaveDataSizeMax = reader.ReadInt64();
|
|
||||||
UserAccountSaveDataJournalSizeMax = reader.ReadInt64();
|
|
||||||
DeviceSaveDataSizeMax = reader.ReadInt64();
|
|
||||||
DeviceSaveDataJournalSizeMax = reader.ReadInt64();
|
|
||||||
TemporaryStorageSize = reader.ReadInt64();
|
|
||||||
CacheStorageSize = reader.ReadInt64();
|
|
||||||
CacheStorageJournalSize = reader.ReadInt64();
|
|
||||||
CacheStorageDataAndJournalSizeMax = reader.ReadInt64();
|
|
||||||
CacheStorageIndex = reader.ReadInt16();
|
|
||||||
Reserved03 = reader.ReadBytes(6);
|
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
var value = reader.ReadUInt64();
|
|
||||||
if (value != 0) PlayLogQueryableApplicationId.Add(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayLogQueryCapability = reader.ReadByte();
|
|
||||||
RepairFlag = reader.ReadByte();
|
|
||||||
ProgramIndex = reader.ReadByte();
|
|
||||||
|
|
||||||
UserTotalSaveDataSize = UserAccountSaveDataSize + UserAccountSaveDataJournalSize;
|
|
||||||
DeviceTotalSaveDataSize = DeviceSaveDataSize + DeviceSaveDataJournalSize;
|
|
||||||
TotalSaveDataSize = UserTotalSaveDataSize + DeviceTotalSaveDataSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NacpLang
|
|
||||||
{
|
|
||||||
public string Title { get; }
|
|
||||||
public string Developer { get; }
|
|
||||||
|
|
||||||
public NacpLang() { }
|
|
||||||
|
|
||||||
public NacpLang(BinaryReader reader)
|
|
||||||
{
|
|
||||||
var start = reader.BaseStream.Position;
|
|
||||||
Title = reader.ReadUtf8Z();
|
|
||||||
reader.BaseStream.Position = start + 0x200;
|
|
||||||
Developer = reader.ReadUtf8Z();
|
|
||||||
reader.BaseStream.Position = start + 0x300;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue