From d4835392a0fa1781ed48339aa750a996a47b0078 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 10 Dec 2022 14:01:59 -0800 Subject: [PATCH] Update SAV3GCMemoryCard.cs Move SaveGameCount field reset outside of the loop. Closes #3682 ty @TheZett ! Make if-if-if an if-else since entry to one will never enter the others. --- PKHeX.Core/Saves/SAV3GCMemoryCard.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs index fb586c9c9..00d4296b6 100644 --- a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs +++ b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs @@ -223,6 +223,7 @@ public sealed class SAV3GCMemoryCard : Directory_Block; // Search for pokemon savegames in the directory + SaveGameCount = 0; for (int i = 0; i < NumEntries_Directory; i++) { int offset = (DirectoryBlock_Used * BLOCK_SIZE) + (i * DENTRY_SIZE); @@ -240,7 +241,6 @@ public sealed class SAV3GCMemoryCard if (dataEnd > Data.Length) continue; - SaveGameCount = 0; var header = Data.AsSpan(offset, 4); var ver = SaveHandlerGCI.GetGameCode(header); if (ver == GameVersion.COLO) @@ -250,14 +250,14 @@ public sealed class SAV3GCMemoryCard EntryCOLO = i; SaveGameCount++; } - if (ver == GameVersion.XD) + else if (ver == GameVersion.XD) { if (HasXD) // another entry already exists return GCMemoryCardState.DuplicateXD; EntryXD = i; SaveGameCount++; } - if (ver == GameVersion.RSBOX) + else if (ver == GameVersion.RSBOX) { if (HasRSBOX) // another entry already exists return GCMemoryCardState.DuplicateRSBOX;