Add missing "yield return" (#424)

This commit is contained in:
Marco Carvalho 2024-12-22 02:28:31 -03:00 committed by GitHub
parent 67ec10feea
commit decd37ce6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 54 additions and 95 deletions

View file

@ -357,7 +357,6 @@ namespace Ryujinx.HLE.HOS
{
string cheatName = DefaultCheatName;
List<string> instructions = new();
List<Cheat> cheats = new();
using StreamReader cheatData = cheatFile.OpenText();
while (cheatData.ReadLine() is { } line)
@ -373,13 +372,13 @@ namespace Ryujinx.HLE.HOS
Logger.Warning?.Print(LogClass.ModLoader, $"Ignoring cheat '{cheatFile.FullName}' because it is malformed");
return Array.Empty<Cheat>();
yield break;
}
// Add the previous section to the list.
if (instructions.Count > 0)
{
cheats.Add(new Cheat($"<{cheatName} Cheat>", cheatFile, instructions));
yield return new Cheat($"<{cheatName} Cheat>", cheatFile, instructions);
}
// Start a new cheat section.
@ -396,10 +395,8 @@ namespace Ryujinx.HLE.HOS
// Add the last section being processed.
if (instructions.Count > 0)
{
cheats.Add(new Cheat($"<{cheatName} Cheat>", cheatFile, instructions));
yield return new Cheat($"<{cheatName} Cheat>", cheatFile, instructions);
}
return cheats;
}
// Assumes searchDirPaths don't overlap