diff --git a/Net/Database.cs b/Net/Database.cs index 55cb07e2..af92b1a0 100644 --- a/Net/Database.cs +++ b/Net/Database.cs @@ -52,13 +52,13 @@ namespace Net titleDb.MaxVersion = title.version; int maxVersionShort = title.version >> 16; - for(int i = 0; i <= maxVersionShort; i++) + for (int i = 0; i <= maxVersionShort; i++) { var version = i << 16; if (!titleDb.Versions.TryGetValue(version, out TitleVersion versionDb)) { - versionDb = new TitleVersion {Version = version}; + versionDb = new TitleVersion { Version = version }; titleDb.Versions.Add(version, versionDb); } } @@ -70,6 +70,7 @@ namespace Net { public long Id { get; set; } public long UpdateId { get; set; } + public List AocIds { get; set; } = new List(); public int MaxVersion { get; set; } public Dictionary Versions { get; set; } = new Dictionary(); diff --git a/Net/NetContext.cs b/Net/NetContext.cs index 91e2d572..1b8ebb6e 100644 --- a/Net/NetContext.cs +++ b/Net/NetContext.cs @@ -106,6 +106,8 @@ namespace Net if (controlEntry == null) return null; var controlNca = GetNcaFile(titleId, version, controlEntry.NcaId.ToHexString()); + if (controlNca == null) return null; + var nca = new Nca(ToolCtx.Keyset, controlNca, true); var romfs = new Romfs(nca.OpenSection(0, false)); var controlNacp = romfs.GetFile("/control.nacp"); diff --git a/Net/Program.cs b/Net/Program.cs index 4ba46e6e..4c5d9742 100644 --- a/Net/Program.cs +++ b/Net/Program.cs @@ -80,26 +80,23 @@ namespace Net var control = net.GetControl((ulong)titleId, version.Version); version.Control = control; if (control == null) version.Exists = false; + + Cnmt meta = net.GetCnmt((ulong)titleId, version.Version); + version.ContentMetadata = meta; + if (meta == null) version.Exists = false; + logger?.LogMessage($"{titleId}v{version.Version}"); //Thread.Sleep(300); } catch (Exception ex) { - Console.WriteLine($"Failed getting {titleId}v{version.Version}\n{ex.Message}"); + logger?.LogMessage($"Failed getting {titleId}v{version.Version}\n{ex.Message}"); } } - // net.Save(); + // net.Save(); } net.Save(); - return; - - var titles = GetTitleIds("titles.txt"); - - foreach (var title in titles) - { - var control = net.GetControl(title, 0); - } } private static void OpenKeyset(Context ctx)