Many years ago, PKX used to be a >4,000 line bloated file, which spun off multiple classes like CommonEdits and most of the early non-GUI PKM related logic. Now, it's just a stub to source the latest generation & personal table.
Separate files = more concise info, and more room to grow to do more advanced things.
Makes the IsPresent methods public (no longer internal).
Instantiating from template now follows group seed -> spawn 1 correlation, including alpha move.
Differentiates static encounters that don't follow the ow8a correlation, scrambles EC to disassociate.
Adds rand64 to get initial seeds
Set correct level range to match slotSeed; not respecting the slot roll being valid, but whatever.
Now reads/writes correctly in the GUI.
Closes#3470
Not going to handle slot swaps not matching the data, as this becomes problematic when cloning slots. Previous commit added the ability to manually move mail slots.
First 5 blocks are reserved for file accessing info, but we should include them when checking length
Closes#3468
Capture the bool indicating Japanese for the save file, so box names are now read correctly (if changed from game's default).
net6 was 4x faster than 461 with the old implementation; now it is faster for both but not as disparate.
New implementation performance is always at least 30% better than the old implementation; even better for smaller chunks of data (40% less time).
Pretty much mimics bare metal value writes
Seal ComboItem
Reorder methods for easier reading
Fix BulkGenerator living dex setting CurrentLevel -- needs to be after species,form as EXPGrowth can vary for forms.
Was originally expected that gen8 was going to be a pair+revision generation, but with BDSP and PLA being totally different games, there's no need to have inheritance complicating a single SWSH class.
Fixes#3455 by adding bool for insular sea, and adjusting overall progress values as listed.
Closes#3456 (supersedes)
Updates SCBlockAccessor to eliminate bounds check (integer overflow, which isn't possible with our array size), adds some overloads, and xmldoc.
Co-Authored-By: Jonathan Herbert <3344332+foohyfooh@users.noreply.github.com>
Closes#3454
Use ahtb sourced (hash,string) correlation from pkNX to dynamically generate block keys.
Co-Authored-By: Jonathan Herbert <3344332+foohyfooh@users.noreply.github.com>
Xor no longer allocates
Encrypt no longer allocates byte[0x60]
temp now allocated on stack instead of heap
Pre-size memorystream (prevents 0xF0 allocation)
Adds structures to read/write saved spawner data such as seeds, counts.
Adds generator and validator to emulate the FixInitSpec builder used by the game logic
Similar to SW/SH raids, validating these in-process is not feasible due to the number crunching required.
This does not handle the encounter slot call or the follow-up level range call. Just the inner FixInitSpec ctor & fill.
level is calc'd:
randFloat(sum) -> slot float
rand.Next() -> gen_seed (for all the details)
rand.NextInt(delta) +min -> level
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Was writing kor string, then writing en after (all terminators).
Make method signature match other SetString, with write buffer as first arg
Closes#3440
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.
Update 22.02.04
Individual commits from this PR are not cherry-pickable in a vacuum; these were manually re-committed from a staging repo in order to group together changes for general public viewing. There were over 250 commits on the private development repo for this update.
XD shadow monitor stores the Gen3-mainline-SpeciesID instead of nationaldex ID.
Remap the values on the fly.
Pass the data via span to save a 8KB allocation for sav ctor
Closes#3365
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.