diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8GO.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8GO.cs index 30f358173..81fb679bf 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8GO.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8GO.cs @@ -38,8 +38,6 @@ private static IEnumerable GetPossibleSlots(EvoCriteria[] chain, public IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, LegalInfo info) { - if (pk.TSV == 0) // HOME doesn't assign TSV=0 to accounts. - yield break; if (!CanBeWildEncounter(pk)) yield break; diff --git a/PKHeX.Core/MysteryGifts/WB8.cs b/PKHeX.Core/MysteryGifts/WB8.cs index 02f0110d1..b6cdd8e08 100644 --- a/PKHeX.Core/MysteryGifts/WB8.cs +++ b/PKHeX.Core/MysteryGifts/WB8.cs @@ -578,7 +578,7 @@ private uint GetFixedPID(ITrainerID32 tr) return pid; } - private static uint GetAntishinyFixedHOME(ITrainerID32 tr) => tr.ID32 ^ 0x10u; + private static uint GetAntishinyFixedHOME(ITrainerID32 tr) => tr.ID32 + 0x10u; private static uint GetAntishiny(ITrainerID32 tr) { diff --git a/PKHeX.Core/MysteryGifts/WC8.cs b/PKHeX.Core/MysteryGifts/WC8.cs index 27d4c72d1..03ec1513c 100644 --- a/PKHeX.Core/MysteryGifts/WC8.cs +++ b/PKHeX.Core/MysteryGifts/WC8.cs @@ -477,12 +477,12 @@ public override PK8 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria) pk.TID16 = tr.TID16; pk.SID16 = tr.SID16; + // Initial updates of HOME did not assign a TSV of 0. + // After enough server updates, HOME can now assign a TSV of 0. + // They will XOR the PID to ensure the shiny state of gifts is matched. + // Don't set a Secret ID. if (IsHOMEGift) - { pk.ID32 %= 1_000_000; - while (pk.TSV == 0) - pk.ID32 = (uint)Util.Rand.Next(16, 999_999 + 1); - } } // Official code explicitly corrects for Meowstic @@ -650,8 +650,11 @@ public override bool IsMatchExact(PKM pk, EvoCriteria evo) if (EncryptionConstant != pk.EncryptionConstant) return false; - if (pk.TSV == 0) // HOME doesn't assign TSV=0 to accounts. - return false; + // Initial updates of HOME did not assign a TSV of 0. + // After enough server updates, HOME can now assign a TSV of 0. + // They will XOR the PID to ensure the shiny state of gifts is matched. + // if (pk.TSV == 0) // HOME doesn't assign TSV=0 to accounts. + // return false; if (IsShiny) { diff --git a/PKHeX.Core/Util/FileUtil.cs b/PKHeX.Core/Util/FileUtil.cs index a2eb53089..6be6eab0b 100644 --- a/PKHeX.Core/Util/FileUtil.cs +++ b/PKHeX.Core/Util/FileUtil.cs @@ -195,9 +195,11 @@ public static bool TryGetMemoryCard(byte[] data, [NotNullWhen(true)] out SAV3GCM /// public static bool TryGetMemoryCard(string file, [NotNullWhen(true)] out SAV3GCMemoryCard? memcard) { - memcard = null; if (!File.Exists(file)) + { + memcard = null; return false; + } var data = File.ReadAllBytes(file); return TryGetMemoryCard(data, out memcard); }