aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2024-07-18 00:02:20 +0200
committerGitHub <noreply@github.com>2024-07-17 19:02:20 -0300
commitf77bebac80bd2fcbee72b00845e56faf3de3bad6 (patch)
treed7319b8d56391039c9068c39026bc465a57029c9
parent6fbf279faca30ffd2ef33394463b98809ccaf127 (diff)
Include content data foreach-loop in try-catch (#7036)1.1.1351
-rw-r--r--src/Ryujinx.UI.Common/App/ApplicationLibrary.cs49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
index ef3826cfa..2baf06087 100644
--- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
+++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
@@ -175,22 +175,22 @@ namespace Ryujinx.UI.App.Common
175 var applications = new List<ApplicationData>(); 175 var applications = new List<ApplicationData>();
176 string extension = Path.GetExtension(filePath).ToLower(); 176 string extension = Path.GetExtension(filePath).ToLower();
177 177
178 foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel)) 178 try
179 { 179 {
180 ApplicationData applicationData = new() 180 foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel))
181 { 181 {
182 Id = titleId, 182 ApplicationData applicationData = new()
183 Path = filePath, 183 {
184 }; 184 Id = titleId,
185 Path = filePath,
186 };
185 187
186 try
187 {
188 Nca mainNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Program); 188 Nca mainNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Program);
189 Nca controlNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Control); 189 Nca controlNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Control);
190 190
191 BlitStruct<ApplicationControlProperty> controlHolder = new(1); 191 BlitStruct<ApplicationControlProperty> controlHolder = new(1);
192 192
193 IFileSystem controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); 193 IFileSystem controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, _checkLevel);
194 194
195 // Check if there is an update available. 195 // Check if there is an update available.
196 if (IsUpdateApplied(mainNca, out IFileSystem updatedControlFs)) 196 if (IsUpdateApplied(mainNca, out IFileSystem updatedControlFs))
@@ -199,6 +199,11 @@ namespace Ryujinx.UI.App.Common
199 controlFs = updatedControlFs; 199 controlFs = updatedControlFs;
200 } 200 }
201 201
202 if (controlFs == null)
203 {
204 continue;
205 }
206
202 ReadControlData(controlFs, controlHolder.ByteSpan); 207 ReadControlData(controlFs, controlHolder.ByteSpan);
203 208
204 GetApplicationInformation(ref controlHolder.Value, ref applicationData); 209 GetApplicationInformation(ref controlHolder.Value, ref applicationData);
@@ -246,22 +251,18 @@ namespace Ryujinx.UI.App.Common
246 251
247 applications.Add(applicationData); 252 applications.Add(applicationData);
248 } 253 }
249 catch (MissingKeyException exception) 254 }
250 { 255 catch (MissingKeyException exception)
251 applicationData.Icon = extension == ".xci" ? _xciIcon : _nspIcon; 256 {
252 257 Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}");
253 Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}"); 258 }
254 } 259 catch (InvalidDataException)
255 catch (InvalidDataException) 260 {
256 { 261 Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {filePath}");
257 applicationData.Icon = extension == ".xci" ? _xciIcon : _nspIcon; 262 }
258 263 catch (Exception exception)
259 Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {filePath}"); 264 {
260 } 265 Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. File: '{filePath}' Error: {exception}");
261 catch (Exception exception)
262 {
263 Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. File: '{filePath}' Error: {exception}");
264 }
265 } 266 }
266 267
267 return applications; 268 return applications;