LibHac/libhac/Nacp.cs

62 lines
2.1 KiB
C#
Raw Normal View History

using System.IO;
2018-06-30 21:15:55 +02:00
namespace libhac
{
public class Nacp
{
public NacpLang[] Languages { get; } = new NacpLang[0x10];
public string Version { get; }
2018-07-02 20:16:38 +02:00
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 BcatSaveDataSize { get; }
public long TotalSaveDataSize { get; }
public long UserTotalSaveDataSize { get; }
public long DeviceTotalSaveDataSize { get; }
2018-06-30 21:15:55 +02:00
public Nacp(BinaryReader reader)
{
var start = reader.BaseStream.Position;
for (int i = 0; i < 16; i++)
{
Languages[i] = new NacpLang(reader);
}
reader.BaseStream.Position = start + 0x3060;
Version = reader.ReadUtf8Z();
2018-07-02 20:16:38 +02:00
reader.BaseStream.Position = start + 0x3070;
AddOnContentBaseId = reader.ReadUInt64();
SaveDataOwnerId = reader.ReadUInt64();
UserAccountSaveDataSize = reader.ReadInt64();
UserAccountSaveDataJournalSize = reader.ReadInt64();
DeviceSaveDataSize = reader.ReadInt64();
DeviceSaveDataJournalSize = reader.ReadInt64();
BcatSaveDataSize = reader.ReadInt64();
UserTotalSaveDataSize = UserAccountSaveDataSize + UserAccountSaveDataJournalSize;
DeviceTotalSaveDataSize = DeviceSaveDataSize + DeviceSaveDataJournalSize;
TotalSaveDataSize = UserTotalSaveDataSize + DeviceTotalSaveDataSize;
2018-06-30 21:15:55 +02:00
}
}
public class NacpLang
{
public string Title { get; }
public string Developer { get; }
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;
}
}
}