Stop allocating an entire shadow copy of the save file whenever we create a new savefile object from file.
Prior commits added the clear SaveFileMetadata class to cleanly track the file path. Backups are copied from the original path.
Introduces an option to disable reading .bak / "backup" files; trickle the changes up to all surface users so that SAV_FolderList can correctly load all .bak saves into its Backup tab.
The "ignore backups" was added in the latest feature push to ignore "backup" from being detected as the latest save.
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.
Big thanks to @SciresM @sora10pls @Lusamine @architdate @ReignOfComputer for testing and contributing code / test cases. Can't add co-authors from the PR menu :(
Builds will fail because azure pipelines not yet updated with net6.
Remove hardcoded chunk lengths array
Remove cached chunk index array
Handle new-game files correctly (all blocks present check).
Consistently call things sector instead of chunk or block.
Somehow there was a bug with my FRLG save file's box data, which now loads completely?? Neat
Extract RSBOX checksum logic to checksum class
Allocate half as much for gen3 save detect
Simplify some expressions for GC save loading (x - size + offset, when x==size)
plugin adds a reader -> reader checks if it is a non-PKHeX.Core save type (they'd implement their own savefile/etc type) -> returns a matching save object if so
basically bypasses the base PKHeX logic
Add xmldoc
Remove linq from memecrypto code (speed lmao)
Hide some methods that shouldn't be called directly
Name variables better for accessor const's
GCI, DSV, DUC are already supported, so I've written the abstraction for those and seed the Handler list on startup.
Can add a new class with recognition via SaveUtil.Handlers.Add(myHandler);
Extract common abstract class for shared logic
Clean up property/field/method ordering to be consistent and logical (roughly: attributes, constructors, state management, retrievable values, static methods)
Apply default language OT name
Closes#3009
Make QRPK7 implement IEncounterable and remove hardcoded PKHeX strings
Let force hatching for WC3 eggs try to hatch from the savefile's language, then revert to english if failed to set an OT.
Detects the language of the currently loaded save file, and passes that info to the blank sav creator
Use a trainer name of "1337" instead of PKHeX for any Japanese save file, because Gen1/2(/3?) character tables don't have regular ascii chars.
Introducing a new PKM format: SK2
Split ICaughtData2 off of PK2 so it can be shared with SK2 when type-checks occur
Add conversion for PK2<->SK2
Split the split-buffer handling for GBPKM to GBPKML (what a name), so that I can reuse shared accessor logic for SK2.