ApplicationLibrary.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. using LibHac;
  2. using LibHac.Common;
  3. using LibHac.Fs;
  4. using LibHac.Fs.Fsa;
  5. using LibHac.FsSystem;
  6. using LibHac.FsSystem.NcaUtils;
  7. using LibHac.Ns;
  8. using Ryujinx.Common.Configuration;
  9. using Ryujinx.Common.Logging;
  10. using Ryujinx.Configuration.System;
  11. using Ryujinx.HLE.FileSystem;
  12. using Ryujinx.HLE.HOS;
  13. using Ryujinx.HLE.Loaders.Npdm;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.IO;
  17. using System.Reflection;
  18. using System.Text;
  19. using System.Text.Json;
  20. using JsonHelper = Ryujinx.Common.Utilities.JsonHelper;
  21. using Path = System.IO.Path;
  22. namespace Ryujinx.Ui.App
  23. {
  24. public class ApplicationLibrary
  25. {
  26. public event EventHandler<ApplicationAddedEventArgs> ApplicationAdded;
  27. public event EventHandler<ApplicationCountUpdatedEventArgs> ApplicationCountUpdated;
  28. private readonly byte[] _nspIcon;
  29. private readonly byte[] _xciIcon;
  30. private readonly byte[] _ncaIcon;
  31. private readonly byte[] _nroIcon;
  32. private readonly byte[] _nsoIcon;
  33. private VirtualFileSystem _virtualFileSystem;
  34. private Language _desiredTitleLanguage;
  35. public ApplicationLibrary(VirtualFileSystem virtualFileSystem)
  36. {
  37. _virtualFileSystem = virtualFileSystem;
  38. _nspIcon = GetResourceBytes("Ryujinx.Ui.Resources.Icon_NSP.png");
  39. _xciIcon = GetResourceBytes("Ryujinx.Ui.Resources.Icon_XCI.png");
  40. _ncaIcon = GetResourceBytes("Ryujinx.Ui.Resources.Icon_NCA.png");
  41. _nroIcon = GetResourceBytes("Ryujinx.Ui.Resources.Icon_NRO.png");
  42. _nsoIcon = GetResourceBytes("Ryujinx.Ui.Resources.Icon_NSO.png");
  43. }
  44. private byte[] GetResourceBytes(string resourceName)
  45. {
  46. Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
  47. byte[] resourceByteArray = new byte[resourceStream.Length];
  48. resourceStream.Read(resourceByteArray);
  49. return resourceByteArray;
  50. }
  51. public IEnumerable<string> GetFilesInDirectory(string directory)
  52. {
  53. Stack<string> stack = new Stack<string>();
  54. stack.Push(directory);
  55. while (stack.Count > 0)
  56. {
  57. string dir = stack.Pop();
  58. string[] content = Array.Empty<string>();
  59. try
  60. {
  61. content = Directory.GetFiles(dir, "*");
  62. }
  63. catch (UnauthorizedAccessException)
  64. {
  65. Logger.Warning?.Print(LogClass.Application, $"Failed to get access to directory: \"{dir}\"");
  66. }
  67. if (content.Length > 0)
  68. {
  69. foreach (string file in content)
  70. {
  71. yield return file;
  72. }
  73. }
  74. try
  75. {
  76. content = Directory.GetDirectories(dir);
  77. }
  78. catch (UnauthorizedAccessException)
  79. {
  80. Logger.Warning?.Print(LogClass.Application, $"Failed to get access to directory: \"{dir}\"");
  81. }
  82. if (content.Length > 0)
  83. {
  84. foreach (string subdir in content)
  85. {
  86. stack.Push(subdir);
  87. }
  88. }
  89. }
  90. }
  91. public void ReadControlData(IFileSystem controlFs, Span<byte> outProperty)
  92. {
  93. using var controlFile = new UniqueRef<IFile>();
  94. controlFs.OpenFile(ref controlFile.Ref(), "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure();
  95. controlFile.Get.Read(out _, 0, outProperty, ReadOption.None).ThrowIfFailure();
  96. }
  97. public void LoadApplications(List<string> appDirs, Language desiredTitleLanguage)
  98. {
  99. int numApplicationsFound = 0;
  100. int numApplicationsLoaded = 0;
  101. _desiredTitleLanguage = desiredTitleLanguage;
  102. // Builds the applications list with paths to found applications
  103. List<string> applications = new List<string>();
  104. foreach (string appDir in appDirs)
  105. {
  106. if (!Directory.Exists(appDir))
  107. {
  108. Logger.Warning?.Print(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{appDir}\"");
  109. continue;
  110. }
  111. foreach (string app in GetFilesInDirectory(appDir))
  112. {
  113. if ((Path.GetExtension(app).ToLower() == ".nsp") ||
  114. (Path.GetExtension(app).ToLower() == ".pfs0") ||
  115. (Path.GetExtension(app).ToLower() == ".xci") ||
  116. (Path.GetExtension(app).ToLower() == ".nca") ||
  117. (Path.GetExtension(app).ToLower() == ".nro") ||
  118. (Path.GetExtension(app).ToLower() == ".nso"))
  119. {
  120. applications.Add(app);
  121. numApplicationsFound++;
  122. }
  123. }
  124. }
  125. // Loops through applications list, creating a struct and then firing an event containing the struct for each application
  126. foreach (string applicationPath in applications)
  127. {
  128. double fileSize = new FileInfo(applicationPath).Length * 0.000000000931;
  129. string titleName = "Unknown";
  130. string titleId = "0000000000000000";
  131. string developer = "Unknown";
  132. string version = "0";
  133. byte[] applicationIcon = null;
  134. BlitStruct<ApplicationControlProperty> controlHolder = new BlitStruct<ApplicationControlProperty>(1);
  135. try
  136. {
  137. using (FileStream file = new FileStream(applicationPath, FileMode.Open, FileAccess.Read))
  138. {
  139. if ((Path.GetExtension(applicationPath).ToLower() == ".nsp") ||
  140. (Path.GetExtension(applicationPath).ToLower() == ".pfs0") ||
  141. (Path.GetExtension(applicationPath).ToLower() == ".xci"))
  142. {
  143. try
  144. {
  145. PartitionFileSystem pfs;
  146. bool isExeFs = false;
  147. if (Path.GetExtension(applicationPath).ToLower() == ".xci")
  148. {
  149. Xci xci = new Xci(_virtualFileSystem.KeySet, file.AsStorage());
  150. pfs = xci.OpenPartition(XciPartitionType.Secure);
  151. }
  152. else
  153. {
  154. pfs = new PartitionFileSystem(file.AsStorage());
  155. // If the NSP doesn't have a main NCA, decrement the number of applications found and then continue to the next application.
  156. bool hasMainNca = false;
  157. foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*"))
  158. {
  159. if (Path.GetExtension(fileEntry.FullPath).ToLower() == ".nca")
  160. {
  161. using var ncaFile = new UniqueRef<IFile>();
  162. pfs.OpenFile(ref ncaFile.Ref(), fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
  163. Nca nca = new Nca(_virtualFileSystem.KeySet, ncaFile.Get.AsStorage());
  164. int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
  165. // Some main NCAs don't have a data partition, so check if the partition exists before opening it
  166. if (nca.Header.ContentType == NcaContentType.Program && !(nca.SectionExists(NcaSectionType.Data) && nca.Header.GetFsHeader(dataIndex).IsPatchSection()))
  167. {
  168. hasMainNca = true;
  169. break;
  170. }
  171. }
  172. else if (Path.GetFileNameWithoutExtension(fileEntry.FullPath) == "main")
  173. {
  174. isExeFs = true;
  175. }
  176. }
  177. if (!hasMainNca && !isExeFs)
  178. {
  179. numApplicationsFound--;
  180. continue;
  181. }
  182. }
  183. if (isExeFs)
  184. {
  185. applicationIcon = _nspIcon;
  186. using var npdmFile = new UniqueRef<IFile>();
  187. Result result = pfs.OpenFile(ref npdmFile.Ref(), "/main.npdm".ToU8Span(), OpenMode.Read);
  188. if (ResultFs.PathNotFound.Includes(result))
  189. {
  190. Npdm npdm = new Npdm(npdmFile.Get.AsStream());
  191. titleName = npdm.TitleName;
  192. titleId = npdm.Aci0.TitleId.ToString("x16");
  193. }
  194. }
  195. else
  196. {
  197. // Store the ControlFS in variable called controlFs
  198. GetControlFsAndTitleId(pfs, out IFileSystem controlFs, out titleId);
  199. ReadControlData(controlFs, controlHolder.ByteSpan);
  200. // Get the title name, title ID, developer name and version number from the NACP
  201. version = IsUpdateApplied(titleId, out string updateVersion) ? updateVersion : controlHolder.Value.DisplayVersion.ToString();
  202. GetNameIdDeveloper(ref controlHolder.Value, out titleName, out _, out developer);
  203. // Read the icon from the ControlFS and store it as a byte array
  204. try
  205. {
  206. using var icon = new UniqueRef<IFile>();
  207. controlFs.OpenFile(ref icon.Ref(), $"/icon_{_desiredTitleLanguage}.dat".ToU8Span(), OpenMode.Read).ThrowIfFailure();
  208. using (MemoryStream stream = new MemoryStream())
  209. {
  210. icon.Get.AsStream().CopyTo(stream);
  211. applicationIcon = stream.ToArray();
  212. }
  213. }
  214. catch (HorizonResultException)
  215. {
  216. foreach (DirectoryEntryEx entry in controlFs.EnumerateEntries("/", "*"))
  217. {
  218. if (entry.Name == "control.nacp")
  219. {
  220. continue;
  221. }
  222. using var icon = new UniqueRef<IFile>();
  223. controlFs.OpenFile(ref icon.Ref(), entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
  224. using (MemoryStream stream = new MemoryStream())
  225. {
  226. icon.Get.AsStream().CopyTo(stream);
  227. applicationIcon = stream.ToArray();
  228. }
  229. if (applicationIcon != null)
  230. {
  231. break;
  232. }
  233. }
  234. if (applicationIcon == null)
  235. {
  236. applicationIcon = Path.GetExtension(applicationPath).ToLower() == ".xci" ? _xciIcon : _nspIcon;
  237. }
  238. }
  239. }
  240. }
  241. catch (MissingKeyException exception)
  242. {
  243. applicationIcon = Path.GetExtension(applicationPath).ToLower() == ".xci" ? _xciIcon : _nspIcon;
  244. Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}");
  245. }
  246. catch (InvalidDataException)
  247. {
  248. applicationIcon = Path.GetExtension(applicationPath).ToLower() == ".xci" ? _xciIcon : _nspIcon;
  249. Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {applicationPath}");
  250. }
  251. catch (Exception exception)
  252. {
  253. Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. File: '{applicationPath}' Error: {exception}");
  254. numApplicationsFound--;
  255. continue;
  256. }
  257. }
  258. else if (Path.GetExtension(applicationPath).ToLower() == ".nro")
  259. {
  260. BinaryReader reader = new BinaryReader(file);
  261. byte[] Read(long position, int size)
  262. {
  263. file.Seek(position, SeekOrigin.Begin);
  264. return reader.ReadBytes(size);
  265. }
  266. try
  267. {
  268. file.Seek(24, SeekOrigin.Begin);
  269. int assetOffset = reader.ReadInt32();
  270. if (Encoding.ASCII.GetString(Read(assetOffset, 4)) == "ASET")
  271. {
  272. byte[] iconSectionInfo = Read(assetOffset + 8, 0x10);
  273. long iconOffset = BitConverter.ToInt64(iconSectionInfo, 0);
  274. long iconSize = BitConverter.ToInt64(iconSectionInfo, 8);
  275. ulong nacpOffset = reader.ReadUInt64();
  276. ulong nacpSize = reader.ReadUInt64();
  277. // Reads and stores game icon as byte array
  278. applicationIcon = Read(assetOffset + iconOffset, (int) iconSize);
  279. // Read the NACP data
  280. Read(assetOffset + (int)nacpOffset, (int)nacpSize).AsSpan().CopyTo(controlHolder.ByteSpan);
  281. // Get the title name, title ID, developer name and version number from the NACP
  282. version = controlHolder.Value.DisplayVersion.ToString();
  283. GetNameIdDeveloper(ref controlHolder.Value, out titleName, out titleId, out developer);
  284. }
  285. else
  286. {
  287. applicationIcon = _nroIcon;
  288. titleName = Path.GetFileNameWithoutExtension(applicationPath);
  289. }
  290. }
  291. catch
  292. {
  293. Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
  294. numApplicationsFound--;
  295. continue;
  296. }
  297. }
  298. else if (Path.GetExtension(applicationPath).ToLower() == ".nca")
  299. {
  300. try
  301. {
  302. Nca nca = new Nca(_virtualFileSystem.KeySet, new FileStream(applicationPath, FileMode.Open, FileAccess.Read).AsStorage());
  303. int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
  304. if (nca.Header.ContentType != NcaContentType.Program || (nca.SectionExists(NcaSectionType.Data) && nca.Header.GetFsHeader(dataIndex).IsPatchSection()))
  305. {
  306. numApplicationsFound--;
  307. continue;
  308. }
  309. }
  310. catch (InvalidDataException)
  311. {
  312. Logger.Warning?.Print(LogClass.Application, $"The NCA header content type check has failed. This is usually because the header key is incorrect or missing. Errored File: {applicationPath}");
  313. }
  314. catch
  315. {
  316. Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. Errored File: {applicationPath}");
  317. numApplicationsFound--;
  318. continue;
  319. }
  320. applicationIcon = _ncaIcon;
  321. titleName = Path.GetFileNameWithoutExtension(applicationPath);
  322. }
  323. // If its an NSO we just set defaults
  324. else if (Path.GetExtension(applicationPath).ToLower() == ".nso")
  325. {
  326. applicationIcon = _nsoIcon;
  327. titleName = Path.GetFileNameWithoutExtension(applicationPath);
  328. }
  329. }
  330. }
  331. catch (IOException exception)
  332. {
  333. Logger.Warning?.Print(LogClass.Application, exception.Message);
  334. numApplicationsFound--;
  335. continue;
  336. }
  337. ApplicationMetadata appMetadata = LoadAndSaveMetaData(titleId);
  338. if (appMetadata.LastPlayed != "Never" && !DateTime.TryParse(appMetadata.LastPlayed, out _))
  339. {
  340. Logger.Warning?.Print(LogClass.Application, $"Last played datetime \"{appMetadata.LastPlayed}\" is invalid for current system culture, skipping (did current culture change?)");
  341. appMetadata.LastPlayed = "Never";
  342. }
  343. ApplicationData data = new ApplicationData
  344. {
  345. Favorite = appMetadata.Favorite,
  346. Icon = applicationIcon,
  347. TitleName = titleName,
  348. TitleId = titleId,
  349. Developer = developer,
  350. Version = version,
  351. TimePlayed = ConvertSecondsToReadableString(appMetadata.TimePlayed),
  352. LastPlayed = appMetadata.LastPlayed,
  353. FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0, 1),
  354. FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + "MB" : fileSize.ToString("0.##") + "GB",
  355. Path = applicationPath,
  356. ControlHolder = controlHolder
  357. };
  358. numApplicationsLoaded++;
  359. OnApplicationAdded(new ApplicationAddedEventArgs()
  360. {
  361. AppData = data
  362. });
  363. OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs()
  364. {
  365. NumAppsFound = numApplicationsFound,
  366. NumAppsLoaded = numApplicationsLoaded
  367. });
  368. }
  369. OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs()
  370. {
  371. NumAppsFound = numApplicationsFound,
  372. NumAppsLoaded = numApplicationsLoaded
  373. });
  374. }
  375. protected void OnApplicationAdded(ApplicationAddedEventArgs e)
  376. {
  377. ApplicationAdded?.Invoke(null, e);
  378. }
  379. protected void OnApplicationCountUpdated(ApplicationCountUpdatedEventArgs e)
  380. {
  381. ApplicationCountUpdated?.Invoke(null, e);
  382. }
  383. private void GetControlFsAndTitleId(PartitionFileSystem pfs, out IFileSystem controlFs, out string titleId)
  384. {
  385. (_, _, Nca controlNca) = ApplicationLoader.GetGameData(_virtualFileSystem, pfs, 0);
  386. // Return the ControlFS
  387. controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
  388. titleId = controlNca?.Header.TitleId.ToString("x16");
  389. }
  390. internal ApplicationMetadata LoadAndSaveMetaData(string titleId, Action<ApplicationMetadata> modifyFunction = null)
  391. {
  392. string metadataFolder = Path.Combine(AppDataManager.GamesDirPath, titleId, "gui");
  393. string metadataFile = Path.Combine(metadataFolder, "metadata.json");
  394. ApplicationMetadata appMetadata;
  395. if (!File.Exists(metadataFile))
  396. {
  397. Directory.CreateDirectory(metadataFolder);
  398. appMetadata = new ApplicationMetadata();
  399. using (FileStream stream = File.Create(metadataFile, 4096, FileOptions.WriteThrough))
  400. {
  401. JsonHelper.Serialize(stream, appMetadata, true);
  402. }
  403. }
  404. try
  405. {
  406. appMetadata = JsonHelper.DeserializeFromFile<ApplicationMetadata>(metadataFile);
  407. }
  408. catch (JsonException)
  409. {
  410. Logger.Warning?.Print(LogClass.Application, $"Failed to parse metadata json for {titleId}. Loading defaults.");
  411. appMetadata = new ApplicationMetadata();
  412. }
  413. if (modifyFunction != null)
  414. {
  415. modifyFunction(appMetadata);
  416. using (FileStream stream = File.Create(metadataFile, 4096, FileOptions.WriteThrough))
  417. {
  418. JsonHelper.Serialize(stream, appMetadata, true);
  419. }
  420. }
  421. return appMetadata;
  422. }
  423. private string ConvertSecondsToReadableString(double seconds)
  424. {
  425. const int secondsPerMinute = 60;
  426. const int secondsPerHour = secondsPerMinute * 60;
  427. const int secondsPerDay = secondsPerHour * 24;
  428. string readableString;
  429. if (seconds < secondsPerMinute)
  430. {
  431. readableString = $"{seconds}s";
  432. }
  433. else if (seconds < secondsPerHour)
  434. {
  435. readableString = $"{Math.Round(seconds / secondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins";
  436. }
  437. else if (seconds < secondsPerDay)
  438. {
  439. readableString = $"{Math.Round(seconds / secondsPerHour, 2, MidpointRounding.AwayFromZero)} hrs";
  440. }
  441. else
  442. {
  443. readableString = $"{Math.Round(seconds / secondsPerDay, 2, MidpointRounding.AwayFromZero)} days";
  444. }
  445. return readableString;
  446. }
  447. private void GetNameIdDeveloper(ref ApplicationControlProperty controlData, out string titleName, out string titleId, out string publisher)
  448. {
  449. _ = Enum.TryParse(_desiredTitleLanguage.ToString(), out LibHac.Settings.Language desiredTitleLanguage);
  450. if (controlData.Titles.Length > (int)desiredTitleLanguage)
  451. {
  452. titleName = controlData.Titles[(int)desiredTitleLanguage].Name.ToString();
  453. publisher = controlData.Titles[(int)desiredTitleLanguage].Publisher.ToString();
  454. }
  455. else
  456. {
  457. titleName = null;
  458. publisher = null;
  459. }
  460. if (string.IsNullOrWhiteSpace(titleName))
  461. {
  462. foreach (ApplicationControlTitle controlTitle in controlData.Titles)
  463. {
  464. if (!((U8Span)controlTitle.Name).IsEmpty())
  465. {
  466. titleName = controlTitle.Name.ToString();
  467. break;
  468. }
  469. }
  470. }
  471. if (string.IsNullOrWhiteSpace(publisher))
  472. {
  473. foreach (ApplicationControlTitle controlTitle in controlData.Titles)
  474. {
  475. if (!((U8Span)controlTitle.Publisher).IsEmpty())
  476. {
  477. publisher = controlTitle.Publisher.ToString();
  478. break;
  479. }
  480. }
  481. }
  482. if (controlData.PresenceGroupId != 0)
  483. {
  484. titleId = controlData.PresenceGroupId.ToString("x16");
  485. }
  486. else if (controlData.SaveDataOwnerId.Value != 0)
  487. {
  488. titleId = controlData.SaveDataOwnerId.ToString();
  489. }
  490. else if (controlData.AddOnContentBaseId != 0)
  491. {
  492. titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16");
  493. }
  494. else
  495. {
  496. titleId = "0000000000000000";
  497. }
  498. }
  499. private bool IsUpdateApplied(string titleId, out string version)
  500. {
  501. string updatePath = "(unknown)";
  502. try
  503. {
  504. (Nca patchNca, Nca controlNca) = ApplicationLoader.GetGameUpdateData(_virtualFileSystem, titleId, 0, out updatePath);
  505. if (patchNca != null && controlNca != null)
  506. {
  507. ApplicationControlProperty controlData = new ApplicationControlProperty();
  508. using var nacpFile = new UniqueRef<IFile>();
  509. controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(ref nacpFile.Ref(), "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure();
  510. nacpFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure();
  511. version = controlData.DisplayVersion.ToString();
  512. return true;
  513. }
  514. }
  515. catch (InvalidDataException)
  516. {
  517. Logger.Warning?.Print(LogClass.Application,
  518. $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {updatePath}");
  519. }
  520. catch (MissingKeyException exception)
  521. {
  522. Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}. Errored File: {updatePath}");
  523. }
  524. version = "";
  525. return false;
  526. }
  527. }
  528. }