GameTableContextMenu.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. using Gtk;
  2. using LibHac;
  3. using LibHac.Account;
  4. using LibHac.Common;
  5. using LibHac.Fs;
  6. using LibHac.Fs.Fsa;
  7. using LibHac.Fs.Shim;
  8. using LibHac.FsSystem;
  9. using LibHac.FsSystem.NcaUtils;
  10. using LibHac.Ncm;
  11. using LibHac.Ns;
  12. using Ryujinx.Common.Configuration;
  13. using Ryujinx.Common.Logging;
  14. using Ryujinx.HLE.FileSystem;
  15. using Ryujinx.HLE.HOS;
  16. using Ryujinx.HLE.HOS.Services.Account.Acc;
  17. using Ryujinx.Ui.Helper;
  18. using Ryujinx.Ui.Windows;
  19. using System;
  20. using System.Buffers;
  21. using System.Collections.Generic;
  22. using System.Globalization;
  23. using System.IO;
  24. using System.Reflection;
  25. using System.Threading;
  26. using static LibHac.Fs.ApplicationSaveDataManagement;
  27. namespace Ryujinx.Ui.Widgets
  28. {
  29. public partial class GameTableContextMenu : Menu
  30. {
  31. private readonly MainWindow _parent;
  32. private readonly VirtualFileSystem _virtualFileSystem;
  33. private readonly AccountManager _accountManager;
  34. private readonly HorizonClient _horizonClient;
  35. private readonly BlitStruct<ApplicationControlProperty> _controlData;
  36. private readonly string _titleFilePath;
  37. private readonly string _titleName;
  38. private readonly string _titleIdText;
  39. private readonly ulong _titleId;
  40. private MessageDialog _dialog;
  41. private bool _cancel;
  42. public GameTableContextMenu(MainWindow parent, VirtualFileSystem virtualFileSystem, AccountManager accountManager, HorizonClient horizonClient, string titleFilePath, string titleName, string titleId, BlitStruct<ApplicationControlProperty> controlData)
  43. {
  44. _parent = parent;
  45. InitializeComponent();
  46. _virtualFileSystem = virtualFileSystem;
  47. _accountManager = accountManager;
  48. _horizonClient = horizonClient;
  49. _titleFilePath = titleFilePath;
  50. _titleName = titleName;
  51. _titleIdText = titleId;
  52. _controlData = controlData;
  53. if (!ulong.TryParse(_titleIdText, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out _titleId))
  54. {
  55. GtkDialog.CreateErrorDialog("The selected game did not have a valid Title Id");
  56. return;
  57. }
  58. _openSaveUserDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0;
  59. _openSaveDeviceDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0;
  60. _openSaveBcatDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0;
  61. string fileExt = System.IO.Path.GetExtension(_titleFilePath).ToLower();
  62. bool hasNca = fileExt == ".nca" || fileExt == ".nsp" || fileExt == ".pfs0" || fileExt == ".xci";
  63. _extractRomFsMenuItem.Sensitive = hasNca;
  64. _extractExeFsMenuItem.Sensitive = hasNca;
  65. _extractLogoMenuItem.Sensitive = hasNca;
  66. PopupAtPointer(null);
  67. }
  68. private bool TryFindSaveData(string titleName, ulong titleId, BlitStruct<ApplicationControlProperty> controlHolder, SaveDataFilter filter, out ulong saveDataId)
  69. {
  70. saveDataId = default;
  71. Result result = _horizonClient.Fs.FindSaveDataWithFilter(out SaveDataInfo saveDataInfo, SaveDataSpaceId.User, in filter);
  72. if (ResultFs.TargetNotFound.Includes(result))
  73. {
  74. // Savedata was not found. Ask the user if they want to create it
  75. using MessageDialog messageDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, null)
  76. {
  77. Title = "Ryujinx",
  78. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  79. Text = $"There is no savedata for {titleName} [{titleId:x16}]",
  80. SecondaryText = "Would you like to create savedata for this game?",
  81. WindowPosition = WindowPosition.Center
  82. };
  83. if (messageDialog.Run() != (int)ResponseType.Yes)
  84. {
  85. return false;
  86. }
  87. ref ApplicationControlProperty control = ref controlHolder.Value;
  88. if (Utilities.IsZeros(controlHolder.ByteSpan))
  89. {
  90. // If the current application doesn't have a loaded control property, create a dummy one
  91. // and set the savedata sizes so a user savedata will be created.
  92. control = ref new BlitStruct<ApplicationControlProperty>(1).Value;
  93. // The set sizes don't actually matter as long as they're non-zero because we use directory savedata.
  94. control.UserAccountSaveDataSize = 0x4000;
  95. control.UserAccountSaveDataJournalSize = 0x4000;
  96. Logger.Warning?.Print(LogClass.Application, "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
  97. }
  98. Uid user = new Uid((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low);
  99. result = EnsureApplicationSaveData(_horizonClient.Fs, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);
  100. if (result.IsFailure())
  101. {
  102. GtkDialog.CreateErrorDialog($"There was an error creating the specified savedata: {result.ToStringWithName()}");
  103. return false;
  104. }
  105. // Try to find the savedata again after creating it
  106. result = _horizonClient.Fs.FindSaveDataWithFilter(out saveDataInfo, SaveDataSpaceId.User, in filter);
  107. }
  108. if (result.IsSuccess())
  109. {
  110. saveDataId = saveDataInfo.SaveDataId;
  111. return true;
  112. }
  113. GtkDialog.CreateErrorDialog($"There was an error finding the specified savedata: {result.ToStringWithName()}");
  114. return false;
  115. }
  116. private void OpenSaveDir(SaveDataFilter saveDataFilter)
  117. {
  118. saveDataFilter.SetProgramId(new ProgramId(_titleId));
  119. if (!TryFindSaveData(_titleName, _titleId, _controlData, saveDataFilter, out ulong saveDataId))
  120. {
  121. return;
  122. }
  123. string saveRootPath = System.IO.Path.Combine(_virtualFileSystem.GetNandPath(), $"user/save/{saveDataId:x16}");
  124. if (!Directory.Exists(saveRootPath))
  125. {
  126. // Inconsistent state. Create the directory
  127. Directory.CreateDirectory(saveRootPath);
  128. }
  129. string committedPath = System.IO.Path.Combine(saveRootPath, "0");
  130. string workingPath = System.IO.Path.Combine(saveRootPath, "1");
  131. // If the committed directory exists, that path will be loaded the next time the savedata is mounted
  132. if (Directory.Exists(committedPath))
  133. {
  134. OpenHelper.OpenFolder(committedPath);
  135. }
  136. else
  137. {
  138. // If the working directory exists and the committed directory doesn't,
  139. // the working directory will be loaded the next time the savedata is mounted
  140. if (!Directory.Exists(workingPath))
  141. {
  142. Directory.CreateDirectory(workingPath);
  143. }
  144. OpenHelper.OpenFolder(workingPath);
  145. }
  146. }
  147. private void ExtractSection(NcaSectionType ncaSectionType, int programIndex = 0)
  148. {
  149. FileChooserDialog fileChooser = new FileChooserDialog("Choose the folder to extract into", null, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Extract", ResponseType.Accept);
  150. fileChooser.SetPosition(WindowPosition.Center);
  151. ResponseType response = (ResponseType)fileChooser.Run();
  152. string destination = fileChooser.Filename;
  153. fileChooser.Dispose();
  154. if (response == ResponseType.Accept)
  155. {
  156. Thread extractorThread = new Thread(() =>
  157. {
  158. Gtk.Application.Invoke(delegate
  159. {
  160. _dialog = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Cancel, null)
  161. {
  162. Title = "Ryujinx - NCA Section Extractor",
  163. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  164. SecondaryText = $"Extracting {ncaSectionType} section from {System.IO.Path.GetFileName(_titleFilePath)}...",
  165. WindowPosition = WindowPosition.Center
  166. };
  167. int dialogResponse = _dialog.Run();
  168. if (dialogResponse == (int)ResponseType.Cancel || dialogResponse == (int)ResponseType.DeleteEvent)
  169. {
  170. _cancel = true;
  171. _dialog.Dispose();
  172. }
  173. });
  174. using (FileStream file = new FileStream(_titleFilePath, FileMode.Open, FileAccess.Read))
  175. {
  176. Nca mainNca = null;
  177. Nca patchNca = null;
  178. if ((System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".nsp") ||
  179. (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".pfs0") ||
  180. (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".xci"))
  181. {
  182. PartitionFileSystem pfs;
  183. if (System.IO.Path.GetExtension(_titleFilePath) == ".xci")
  184. {
  185. Xci xci = new Xci(_virtualFileSystem.KeySet, file.AsStorage());
  186. pfs = xci.OpenPartition(XciPartitionType.Secure);
  187. }
  188. else
  189. {
  190. pfs = new PartitionFileSystem(file.AsStorage());
  191. }
  192. foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
  193. {
  194. pfs.OpenFile(out IFile ncaFile, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
  195. Nca nca = new Nca(_virtualFileSystem.KeySet, ncaFile.AsStorage());
  196. if (nca.Header.ContentType == NcaContentType.Program)
  197. {
  198. int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
  199. if (nca.Header.GetFsHeader(dataIndex).IsPatchSection())
  200. {
  201. patchNca = nca;
  202. }
  203. else
  204. {
  205. mainNca = nca;
  206. }
  207. }
  208. }
  209. }
  210. else if (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".nca")
  211. {
  212. mainNca = new Nca(_virtualFileSystem.KeySet, file.AsStorage());
  213. }
  214. if (mainNca == null)
  215. {
  216. Logger.Error?.Print(LogClass.Application, "Extraction failure. The main NCA is not present in the selected file.");
  217. Gtk.Application.Invoke(delegate
  218. {
  219. GtkDialog.CreateErrorDialog("Extraction failure. The main NCA is not present in the selected file.");
  220. });
  221. return;
  222. }
  223. (Nca updatePatchNca, _) = ApplicationLoader.GetGameUpdateData(_virtualFileSystem, mainNca.Header.TitleId.ToString("x16"), programIndex, out _);
  224. if (updatePatchNca != null)
  225. {
  226. patchNca = updatePatchNca;
  227. }
  228. int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
  229. IFileSystem ncaFileSystem = patchNca != null ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
  230. : mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
  231. FileSystemClient fsClient = _horizonClient.Fs;
  232. string source = DateTime.Now.ToFileTime().ToString()[10..];
  233. string output = DateTime.Now.ToFileTime().ToString()[10..];
  234. fsClient.Register(source.ToU8Span(), ncaFileSystem);
  235. fsClient.Register(output.ToU8Span(), new LocalFileSystem(destination));
  236. (Result? resultCode, bool canceled) = CopyDirectory(fsClient, $"{source}:/", $"{output}:/");
  237. if (!canceled)
  238. {
  239. if (resultCode.Value.IsFailure())
  240. {
  241. Logger.Error?.Print(LogClass.Application, $"LibHac returned error code: {resultCode.Value.ErrorCode}");
  242. Gtk.Application.Invoke(delegate
  243. {
  244. _dialog?.Dispose();
  245. GtkDialog.CreateErrorDialog("Extraction failed. Read the log file for further information.");
  246. });
  247. }
  248. else if (resultCode.Value.IsSuccess())
  249. {
  250. Gtk.Application.Invoke(delegate
  251. {
  252. _dialog?.Dispose();
  253. MessageDialog dialog = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, null)
  254. {
  255. Title = "Ryujinx - NCA Section Extractor",
  256. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  257. SecondaryText = "Extraction completed successfully.",
  258. WindowPosition = WindowPosition.Center
  259. };
  260. dialog.Run();
  261. dialog.Dispose();
  262. });
  263. }
  264. }
  265. fsClient.Unmount(source.ToU8Span());
  266. fsClient.Unmount(output.ToU8Span());
  267. }
  268. });
  269. extractorThread.Name = "GUI.NcaSectionExtractorThread";
  270. extractorThread.IsBackground = true;
  271. extractorThread.Start();
  272. }
  273. }
  274. private (Result? result, bool canceled) CopyDirectory(FileSystemClient fs, string sourcePath, string destPath)
  275. {
  276. Result rc = fs.OpenDirectory(out DirectoryHandle sourceHandle, sourcePath.ToU8Span(), OpenDirectoryMode.All);
  277. if (rc.IsFailure()) return (rc, false);
  278. using (sourceHandle)
  279. {
  280. foreach (DirectoryEntryEx entry in fs.EnumerateEntries(sourcePath, "*", SearchOptions.Default))
  281. {
  282. if (_cancel)
  283. {
  284. return (null, true);
  285. }
  286. string subSrcPath = PathTools.Normalize(PathTools.Combine(sourcePath, entry.Name));
  287. string subDstPath = PathTools.Normalize(PathTools.Combine(destPath, entry.Name));
  288. if (entry.Type == DirectoryEntryType.Directory)
  289. {
  290. fs.EnsureDirectoryExists(subDstPath);
  291. (Result? result, bool canceled) = CopyDirectory(fs, subSrcPath, subDstPath);
  292. if (canceled || result.Value.IsFailure())
  293. {
  294. return (result, canceled);
  295. }
  296. }
  297. if (entry.Type == DirectoryEntryType.File)
  298. {
  299. fs.CreateOrOverwriteFile(subDstPath, entry.Size);
  300. rc = CopyFile(fs, subSrcPath, subDstPath);
  301. if (rc.IsFailure()) return (rc, false);
  302. }
  303. }
  304. }
  305. return (Result.Success, false);
  306. }
  307. public Result CopyFile(FileSystemClient fs, string sourcePath, string destPath)
  308. {
  309. Result rc = fs.OpenFile(out FileHandle sourceHandle, sourcePath.ToU8Span(), OpenMode.Read);
  310. if (rc.IsFailure()) return rc;
  311. using (sourceHandle)
  312. {
  313. rc = fs.OpenFile(out FileHandle destHandle, destPath.ToU8Span(), OpenMode.Write | OpenMode.AllowAppend);
  314. if (rc.IsFailure()) return rc;
  315. using (destHandle)
  316. {
  317. const int maxBufferSize = 1024 * 1024;
  318. rc = fs.GetFileSize(out long fileSize, sourceHandle);
  319. if (rc.IsFailure()) return rc;
  320. int bufferSize = (int)Math.Min(maxBufferSize, fileSize);
  321. byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
  322. try
  323. {
  324. for (long offset = 0; offset < fileSize; offset += bufferSize)
  325. {
  326. int toRead = (int)Math.Min(fileSize - offset, bufferSize);
  327. Span<byte> buf = buffer.AsSpan(0, toRead);
  328. rc = fs.ReadFile(out long _, sourceHandle, offset, buf);
  329. if (rc.IsFailure()) return rc;
  330. rc = fs.WriteFile(destHandle, offset, buf, WriteOption.None);
  331. if (rc.IsFailure()) return rc;
  332. }
  333. }
  334. finally
  335. {
  336. ArrayPool<byte>.Shared.Return(buffer);
  337. }
  338. rc = fs.FlushFile(destHandle);
  339. if (rc.IsFailure()) return rc;
  340. }
  341. }
  342. return Result.Success;
  343. }
  344. //
  345. // Events
  346. //
  347. private void OpenSaveUserDir_Clicked(object sender, EventArgs args)
  348. {
  349. SaveDataFilter saveDataFilter = new SaveDataFilter();
  350. saveDataFilter.SetUserId(new LibHac.Fs.UserId((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low));
  351. OpenSaveDir(saveDataFilter);
  352. }
  353. private void OpenSaveDeviceDir_Clicked(object sender, EventArgs args)
  354. {
  355. SaveDataFilter saveDataFilter = new SaveDataFilter();
  356. saveDataFilter.SetSaveDataType(SaveDataType.Device);
  357. OpenSaveDir(saveDataFilter);
  358. }
  359. private void OpenSaveBcatDir_Clicked(object sender, EventArgs args)
  360. {
  361. SaveDataFilter saveDataFilter = new SaveDataFilter();
  362. saveDataFilter.SetSaveDataType(SaveDataType.Bcat);
  363. OpenSaveDir(saveDataFilter);
  364. }
  365. private void ManageTitleUpdates_Clicked(object sender, EventArgs args)
  366. {
  367. new TitleUpdateWindow(_parent, _virtualFileSystem, _titleIdText, _titleName).Show();
  368. }
  369. private void ManageDlc_Clicked(object sender, EventArgs args)
  370. {
  371. new DlcWindow(_virtualFileSystem, _titleIdText, _titleName).Show();
  372. }
  373. private void OpenTitleModDir_Clicked(object sender, EventArgs args)
  374. {
  375. string modsBasePath = _virtualFileSystem.ModLoader.GetModsBasePath();
  376. string titleModsPath = _virtualFileSystem.ModLoader.GetTitleDir(modsBasePath, _titleIdText);
  377. OpenHelper.OpenFolder(titleModsPath);
  378. }
  379. private void ExtractRomFs_Clicked(object sender, EventArgs args)
  380. {
  381. ExtractSection(NcaSectionType.Data);
  382. }
  383. private void ExtractExeFs_Clicked(object sender, EventArgs args)
  384. {
  385. ExtractSection(NcaSectionType.Code);
  386. }
  387. private void ExtractLogo_Clicked(object sender, EventArgs args)
  388. {
  389. ExtractSection(NcaSectionType.Logo);
  390. }
  391. private void OpenPtcDir_Clicked(object sender, EventArgs args)
  392. {
  393. string ptcDir = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu");
  394. string mainPath = System.IO.Path.Combine(ptcDir, "0");
  395. string backupPath = System.IO.Path.Combine(ptcDir, "1");
  396. if (!Directory.Exists(ptcDir))
  397. {
  398. Directory.CreateDirectory(ptcDir);
  399. Directory.CreateDirectory(mainPath);
  400. Directory.CreateDirectory(backupPath);
  401. }
  402. OpenHelper.OpenFolder(ptcDir);
  403. }
  404. private void OpenShaderCacheDir_Clicked(object sender, EventArgs args)
  405. {
  406. string shaderCacheDir = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "shader");
  407. if (!Directory.Exists(shaderCacheDir))
  408. {
  409. Directory.CreateDirectory(shaderCacheDir);
  410. }
  411. OpenHelper.OpenFolder(shaderCacheDir);
  412. }
  413. private void PurgePtcCache_Clicked(object sender, EventArgs args)
  414. {
  415. DirectoryInfo mainDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu", "0"));
  416. DirectoryInfo backupDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu", "1"));
  417. MessageDialog warningDialog = GtkDialog.CreateConfirmationDialog("Warning", $"You are about to delete the PPTC cache for :\n\n<b>{_titleName}</b>\n\nAre you sure you want to proceed?");
  418. List<FileInfo> cacheFiles = new List<FileInfo>();
  419. if (mainDir.Exists)
  420. {
  421. cacheFiles.AddRange(mainDir.EnumerateFiles("*.cache"));
  422. }
  423. if (backupDir.Exists)
  424. {
  425. cacheFiles.AddRange(backupDir.EnumerateFiles("*.cache"));
  426. }
  427. if (cacheFiles.Count > 0 && warningDialog.Run() == (int)ResponseType.Yes)
  428. {
  429. foreach (FileInfo file in cacheFiles)
  430. {
  431. try
  432. {
  433. file.Delete();
  434. }
  435. catch(Exception e)
  436. {
  437. GtkDialog.CreateErrorDialog($"Error purging PPTC cache {file.Name}: {e}");
  438. }
  439. }
  440. }
  441. warningDialog.Dispose();
  442. }
  443. private void PurgeShaderCache_Clicked(object sender, EventArgs args)
  444. {
  445. DirectoryInfo shaderCacheDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "shader"));
  446. MessageDialog warningDialog = GtkDialog.CreateConfirmationDialog("Warning", $"You are about to delete the shader cache for :\n\n<b>{_titleName}</b>\n\nAre you sure you want to proceed?");
  447. List<DirectoryInfo> cacheDirectory = new List<DirectoryInfo>();
  448. if (shaderCacheDir.Exists)
  449. {
  450. cacheDirectory.AddRange(shaderCacheDir.EnumerateDirectories("*"));
  451. }
  452. if (cacheDirectory.Count > 0 && warningDialog.Run() == (int)ResponseType.Yes)
  453. {
  454. foreach (DirectoryInfo directory in cacheDirectory)
  455. {
  456. try
  457. {
  458. directory.Delete(true);
  459. }
  460. catch (Exception e)
  461. {
  462. GtkDialog.CreateErrorDialog($"Error purging shader cache at {directory.Name}: {e}");
  463. }
  464. }
  465. }
  466. warningDialog.Dispose();
  467. }
  468. }
  469. }