diff --git a/PKHeX.Core/Resources/byte/pcd.pkl b/PKHeX.Core/Resources/byte/pcd.pkl index 64822d2ea..17a6b0cab 100644 Binary files a/PKHeX.Core/Resources/byte/pcd.pkl and b/PKHeX.Core/Resources/byte/pcd.pkl differ diff --git a/PKHeX.Core/Resources/byte/wc6.pkl b/PKHeX.Core/Resources/byte/wc6.pkl index 247d68ed4..4f2f77f7b 100644 Binary files a/PKHeX.Core/Resources/byte/wc6.pkl and b/PKHeX.Core/Resources/byte/wc6.pkl differ diff --git a/PKHeX.Core/Resources/byte/wc7full.pkl b/PKHeX.Core/Resources/byte/wc7full.pkl index ffb9fd50f..35e8d703e 100644 Binary files a/PKHeX.Core/Resources/byte/wc7full.pkl and b/PKHeX.Core/Resources/byte/wc7full.pkl differ diff --git a/PKHeX.Core/Saves/Substructures/BVRequestUtil.cs b/PKHeX.Core/Saves/Substructures/BVRequestUtil.cs new file mode 100644 index 000000000..db375c61c --- /dev/null +++ b/PKHeX.Core/Saves/Substructures/BVRequestUtil.cs @@ -0,0 +1,72 @@ +using System; +using System.Diagnostics; +using System.Linq; + +namespace PKHeX.Core +{ + public static class BVRequestUtil + { + public static string GetSMBattleVideoURL(string code) + { + code = code.Replace("-", string.Empty); + Debug.Assert(code.Length == 16); + var video_id = StringToUInt64(code); + if (video_id == uint.MaxValue) + return null; + return $"https://ctr-bnda-live.s3.amazonaws.com/10.CTR_BNDA_datastore/ds/1/data/{video_id:D11}-00001"; // Sun datastore + } + + private const ushort INVALID = ushort.MaxValue; + private const string _01IO = "01IO"; + private const string _WXYZ = "WXYZ"; + private static ushort CharToU16(char c) + { + if (_01IO.Contains(c)) + return INVALID; + int index = _WXYZ.IndexOf(c); + if (index >= 0) + c = _01IO[index]; + if (c >= '0' && c <= '9') + c -= '0'; + else + c -= '7'; + return c; + } + + private static ulong StringToUInt64(string s) + { + // First 4 characters act as the checksum + ulong v1 = 0; + ulong v2 = 0; + for (int i = 0; i < 4; i++) + { + var c = CharToU16(s[i]); + if (c == INVALID) + return INVALID; + v2 = (uint)(((v1 | c) >> 27) | (v2 << 5)); + v1 = (uint)((v1 | c) << 5); + } + var crc = ((v1 >> 5) | (uint)(v2 << 27)) >> 4; + crc |= (v2 >> 5) << 28 | (v2 >> 9) << 32; + + // Last 12 characters act as the file ID (returned value) + ulong val = 0; + for (int i = 4; i < 16; i++) + { + var c = CharToU16(s[i]); + if (c == INVALID) + return INVALID; + var v14 = val | c; + val = (val & 0xFFFFFFFF00000000) | (uint)(val | c); + if (i == 0xF) + continue; + val = (uint)((val >> 32) << 5) << 32 | (uint)val | (v14 >> 27); + val = (val & 0xFFFFFFFF00000000) | (uint)(v14 << 5); + } + + if (SaveUtil.CRC16_CCITT(BitConverter.GetBytes(val)) != crc) + return uint.MaxValue; + return val; + } + } +} diff --git a/PKHeX.WinForms/Resources/text/changelog.txt b/PKHeX.WinForms/Resources/text/changelog.txt index 1bf0d611c..a0a4952bd 100644 --- a/PKHeX.WinForms/Resources/text/changelog.txt +++ b/PKHeX.WinForms/Resources/text/changelog.txt @@ -1,7 +1,37 @@ PKHeX - By Kaphotics http://projectpokemon.org/pkhex -17/09/22 - New Update: +17/10/17 - New Update: + - Legality: + - - Fixed: Gen4 Cute Charm PIDIV detection for species that change gender ratios upon evolution (Combee etc). + - - Fixed: Gen6/7 Traded eggs change the origin version to the hatcher's version when hatched. Updated affected logic. + - - Changed: Gen2->Gen7 and Gen2->Gen1->Gen7 transfer detection & checking improved. + - - Changed: Another round of legality check updates. Thanks (so many different users)! + - Added: Gen1 Stationary Encounter rebattle editor. + - Added: Gen2 RTC Reset Key can now be calculated by clicking the RTC Save Editor button. + - Added: Gen3 Roamer editor. Thanks BlackShark! + - Added: Gen1-3 Japanese item translation. Thanks smileynation! + - Added: Gen1-3 German main series Item translation. Thanks Korados! + - Added: Batch Editor can now use $suggest for HyperTrainFlags. + - Added: Checkpoint (homebrew/cfw save reading) app auto-detection (like JKSV). Thanks sora10pls! + - Added: Can now toggle all mystery gifts in save file Used/Unused in the Mystery Gift save editor. + - Fixed: Gen1/2 Japanese Nicknames/OTs are no longer incorrectly recognized as Korean. + - Fixed: Gen1/2 50/50 gender detection for IV_ATK = 7. Thanks StarFisherX! + - Fixed: Gen1/2 character encoding issues. Thanks wwwwwwzx & theSlayer & Afepoke & smileynation! + - Fixed: Gen2 TM/HM pouch now loads/saves correctly. Thanks fattard! + - Fixed: Gen2 G/S Korean Save Files can now be saved. + - Fixed: Gen2 Unown alt-form now transfers correctly ->7. + - Fixed: Gen3 GC languages are now interpreted correctly. + - Fixed: Gen4 transferred eggs from HGSS special locations no longer reset to Faraway Place. + - Fixed: Current Poketch app now reads from the correct offset. Thanks sora10pls! + - Changed: Increased form loading speed (translation now translates controls faster). + - Changed: Folder browser now prioritizes available folders (sorting them to the top). + - Changed: Internal refactoring for pkm loading to tabs to standardize loading routines. + - Changed: PCD now caches the gift PKM for increased speed (Mystery Gift database or legality checks). + - Changed: Gen1/2 save file version detection improved (can now differentiate RB from Y, and VC from emu). + - Changed: Optimized crc method for faster save detection & saving. + +17/09/22 - New Update: (36505) [734332] - Added: Gen2 G/S Korean Save File/PKM editing support. - Added: Gen2 transporter code for pk2->pk7 (hypothetical). - Changed: Gen1 Shininess correlation changed to match the updated (correct) IV relationship. diff --git a/PKHeX.WinForms/Resources/text/version.txt b/PKHeX.WinForms/Resources/text/version.txt index 8105acdd2..114c6e5fd 100644 --- a/PKHeX.WinForms/Resources/text/version.txt +++ b/PKHeX.WinForms/Resources/text/version.txt @@ -1 +1 @@ -20170922 \ No newline at end of file +20171017 \ No newline at end of file