Existing `get`/`set` logic is flawed in that it doesn't work on Big Endian operating systems, and it allocates heap objects when it doesn't need to.
`System.Buffers.Binary.BinaryPrimitives` in the `System.Memory` NuGet package provides both Little Endian and Big Endian methods to read and write data; all the `get`/`set` operations have been reworked to use this new API. This removes the need for PKHeX's manual `BigEndian` class, as all functions are already covered by the BinaryPrimitives API.
The `StringConverter` has now been rewritten to accept a Span to read from & write to, no longer requiring a temporary StringBuilder.
Other Fixes included:
- The Super Training UI for Gen6 has been reworked according to the latest block structure additions.
- Cloning a Stadium2 Save File now works correctly (opening from the Folder browser list).
- Checksum & Sanity properties removed from parent PKM class, and is now implemented via interface.
As you progress the story in the Sinnoh games, the water level in Lake Verity will rise allowing you to Surf and reach the Verity Cavern. When this happens differs between DP/BDSP and Pt.
Zone 323 has nothing to do with it being early-game and only when Rowan's briefcase is present, but rather the differing water level. Riley's Riolu Egg can be hatched here without trading, as well.
Co-Authored-By: Billo-PS <63661653+Billo-PS@users.noreply.github.com>
PK4->PK5 fixes gendered Shedinja -> genderless.
Clean up PK4 ball value setters and expose those 2 properties separately.
Add edge case permission for HG/SS Sport Ball Shedinja being legal if evolved on DP (DP doesn't change 0x86, lol)
Copy PokéathlonStat and ball values individually for BK4<->PK4 conversion
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
any contest stat sum above 73 can have any sheen if you really give it trash blocks, lol
not trying to bruteforce the exact combination of consumed blocks/poffins, so these clamps may permit impossible intermediate values, but these are infrequent and meh.
Closes#3325
Can't lower contest stats, but there's no cases of them giving a pkm with contest stats in a game that can't obtain contest stats -- let's just reset instead of zero for futureproofing.
Make them extension methods too; add an overload if you want to purposefully maximize them.
0 is legal in most cases except for Gen2 and BDSP!
...it's technically possible to get 0 in BDSP if you have autosave turned on and have an Egg in your party after hatching one before it, but it will hatch immediately on your next game startup, so disallow it anyway.