Commit graph

481 commits

Author SHA1 Message Date
Kurt
0d3bbe15b7 Add lechonk wc9 to pickle 2023-04-01 15:20:14 -07:00
Kurt
4384cadefc Add more xmldoc 2023-03-31 13:00:34 -07:00
Kurt
79ca670044 Replace party/boxdata get with more performant use
Read directly from the save file.
Batch Editor no longer updates dex, HT details, or updates acquired counts when placing back in the SAV.
2023-03-28 12:49:21 -07:00
Kurt
5c13183d02 Less allocation, minor tweaks
NET 8 will have a Shuffle method, which can get rid of the overload in Util.
Batch Editor no longer crashes the program when selecting OT_Trash/HT_Trash/Nickname_Trash via dropdown.
2023-03-27 00:11:42 -07:00
Kurt
82309cf99d Use Memory<byte> for Gen4 saves
Instead of allocating a buffer for Storage/General, just point within the raw Data, as a Memory<byte> reference. Most of the uses were already using it as span.
2023-03-26 15:16:12 -07:00
Kurt
aa13c93e65 Add misc generic constraints
Resolves some allocation analyzer issues
2023-03-25 23:28:28 -07:00
Kurt
0087ccb44f Use span for savefile slot API
No more offset fetch
2023-03-25 23:14:50 -07:00
Kurt
5ce3e734b8
Skip initial cctor alloc on non-byte primitives (#3850)
Runtime/jit repoints these to the dll rather than heap if we're Little Endian (always, otherwise will allocate like before).

Eliminates quite a few static constructors, so even faster startup. Items later.
2023-03-25 17:55:55 -07:00
Kurt
4615e3577a Span-ify MoveSetApplicator 2023-03-21 21:02:13 -07:00
Kurt
839a76d6a3 Slightly better perf for HiddenPower/Nickname
No more stackalloc for temp string trimming/rebuilding. Really jank strings with multiple parens shouldn't need to be recognized.
Handle bad TeraType pkm values
Handle unrecognized Hidden Power types (Fairy), don't show "Normal"
Hide Tera Type import if requested for non-Tera formats, and gen8 props too.
2023-02-26 13:51:58 -08:00
Lusamine
376e8f2d4f Always use white outlines on box shiny icons 2023-02-06 19:36:01 -06:00
Kurt
31733671ec Fix string screening (str->int) 2023-02-03 20:44:11 -08:00
Kurt
39fe454840 Revise natureamp clicks
now behaves correctly without off-by-1 behavior
2023-01-31 18:31:40 -08:00
Kurt
10613fd070 Improve hidden power mutation logic
No more heap algo span copy mutation. Finish distilling the problem down to bits.
2023-01-30 19:49:31 -08:00
Kurt
3572097c96 Update 23.01.26
Hello .NET 7
2023-01-26 21:58:04 -08:00
Kurt
9ddfe3f629 Misc fixes
Allow dragon ascent bitfetch for gen6/7
Fix hidden power type parse/trim
Remove */ from hidden power type calc
allow longer set lines (full EVs specified for Gen2 is 74 chars
allow set lines of length 1-2 to fully support trash sets for all languages
Tweak pb8->pk8 to be more straightforward
2023-01-26 19:03:06 -08:00
Kurt
88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00
Kurt
f5ea250975
Show star square for everything in Gen9 (#3689) 2022-12-18 00:16:29 -08:00
Kurt
1de869f541 Flag pp ups on non-PP up move IDs
Previous logic wouldn't flag "None" move w/ ppup>0
Also now flags sketch & revival blessing.
2022-12-17 13:29:06 -08:00
Kurt
80c856b618 Move complicated EC get to Common Edits
Rerolling EC will match Maushold and Dudunsparce current form.
2022-12-17 13:17:24 -08:00
Kurt
0c0651f719 Show ride legend stored data
Hidden in box 33. All alone.
2022-12-05 21:05:16 -08:00
MewTracker
703ddb866a
Added spawn points to raid editor (#3668) 2022-12-04 07:52:31 -08:00
Kurt
f7bcb211b2 Improve ForceHatchPKM when Version=0 (SV)
BoxManipModifyComplex finally used after 3-4 years of wait
2022-12-04 00:43:44 -08:00
Kurt
2ae32c6beb Use first tera type on set import if unspecified 2022-11-29 20:06:35 -08:00
Kurt
731a3fdc3b Add $rand0/$rand3 batch cmd for dudu/maus rare
.EncryptionConstant=$rand0
.EncryptionConstant=$rand3
^ both will randomize so EC%100 = 0

Additionally, added $rand0/$randB/$randS for Wurmple/Beautifly/Silcoon to force EC%10 [0,4], otherwise EC%10 will be [5,9] for the Cascoon/Dustox evolution.

For neither of the two above cases, can do EC%6=last char if someone cares about the EC tiebreaker for characteristic determination. No, I don't want to consider how allow the above cases to do that too :) -- just write your own syntax via a plugin and add your ComplexSet to the list!
2022-11-26 12:12:14 -08:00
Kurt
03182ebd3d Update 22.11.24
Adds support for Scarlet & Violet.

Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-11-24 17:42:17 -08:00
Kurt
4a75c4e338 Batch: update ability number if arg length is 2
https://github.com/kwsch/PKHeX/discussions/3586#discussioncomment-3961585
2022-10-25 13:05:12 -07:00
Kurt
37285aa8dc Limit allocation in BallApplicator methods
No longer uses linq, and uses stackalloc for temp array creation.
Silly enums not implementing IEquatable<T>, so I have to implement the Contains myself.
2022-10-15 01:15:45 -07:00
Kurt
66f43291d3 Fix ball enumerating when setter guards value
Ty Atrius!
2022-10-14 17:14:58 -07:00
Kurt
58f729122e Tweak party undo/redo logic 2022-10-09 16:15:50 -07:00
Zazsona
b804557627
Expand My Pokémon Ranch Support (#3595)
* Add RanchMii for SAV4Ranch

* Add RanchToy

* Add RanchTrainerMii

* Add RanchLevel

* Add RanchToy class; make existing RanchToy RanchToyType

* Add RanchToy and RanchLevel to SAV4Ranch

* Remove incorrect MaxPkmCount entry from RanchLevel

* Move code to remove PtHGSS data to a function in G$PKM

* Add RK4 for My Pokemon Ranch Pokemon

* Add RanchPkOwnershipType

* SAV4Ranch updates

* Fix PK4/RK4 conversion logic to stop breaking nicknames/OTs

* Fix EntityDetection.IsPresent() check tripping on the data end marker for SAV4Ranch

* Add .rk4 to README translations

* Minor tweaks

Fix RK4 TID/SID endianness/order, split Ownership enum into two enums
Condense mii classes to get/set properties
Make RanchLevel a static class for logic
Remove ClearFF for TrainerMii -- the FFFF is the string terminator char for gen4
Make Toy byte enum, with unused alignment bytes

Co-authored-by: Kurt <kaphotics@gmail.com>
2022-10-02 13:14:42 -07:00
Kurt
a0c998fdd5 Simplify contest ribbon deadlock set
Was missing the check & revert step; just fix the logic completely.
We should have the contest star ribbon if we've set all the ribbons, otherwise it was already removed.
2022-09-06 21:05:39 -07:00
Kurt
20dcb8d407 Remove old showdown set aliases
Don't need to support sets that don't follow the current standard.
2022-09-06 21:04:40 -07:00
Kurt
1960b335fd Remove PersonalInfo.Abilities, use interfaces
If you must get a list of abilities, then use the span extension methods.
Also reworks some initial moveset fetching to allocate less
2022-09-02 10:20:19 -07:00
Kurt
4a008e510d Sanity check friendship and level values parsed
Don't accept Level: 101, for example.
2022-08-31 22:22:23 -07:00
Kurt
66e0613d82 Minor clean 2022-08-30 15:00:45 -07:00
Kurt
d8fe34011d Remove some bounds checks, int->byte form oops
https://github.com/kwsch/PKHeX/pull/3575#issuecomment-1229244453
ty @Kermalis !
2022-08-27 12:53:30 -07:00
Kurt
3c232505e5
Refactoring: Narrow some value types (Species, Move, Form) (#3575)
In this pull request I've changed a ton of method signatures to reflect the more-narrow types of Species, Move# and Form; additionally, I've narrowed other large collections that stored lists of species / permitted values, and reworked them to be more performant with the latest API spaghetti that PKHeX provides. Roamer met locations, usually in a range of [max-min]<64, can be quickly checked using a bitflag operation on a UInt64. Other collections (like "Is this from Colosseum or XD") were eliminated -- shadow state is not transferred COLO<->XD, so having a Shadow ID or matching the met location from a gift/wild encounter is a sufficient check for "originated in XD".
2022-08-26 23:43:36 -07:00
Kurt
43871e856c Specify some lambdas as static
Rewrite some usages to be more clear
bikeshedding at its finest, ignoring more important things to update/fix :)
2022-08-23 23:11:26 -07:00
Kurt
eb2cef10c9 Minor clean
Stability intensifies
2022-08-22 23:18:53 -07:00
Kurt
6441bdadd8
Add specialized struct for Moveset and IV specs (#3572)
`Moveset` struct stores 4 moves, and exposes methods to interact with a moveset.
`IndividualValueSet` stores a 6 IV template (signed).

Performance impact:
* Less allocating on the heap: Moves - (8 bytes member ptr, 20 bytes heap->8 bytes member)
* Less allocating on the heap: IVs - (8 bytes member ptr, 28 bytes heap->8 bytes member)
* No heap pointers, no need to jump to grab data.
* Easy to inline logic for checking if moves are present (no linq usage with temporary collections).

End result is faster ctor times, less memory used, faster program.
2022-08-21 17:34:32 -07:00
Kurt
2cb2531288 Add more xmldoc 2022-08-21 01:39:16 -07:00
Kurt
5cfaf7eecd Add overloads to get localized showdown sets 2022-08-17 23:50:14 -07:00
Kurt
768047cd80
Legality: Rewrite Ribbon Verifier (#3570)
* Rewrite ribbon verification
* Explicitly verifies all ribbons instead of chained iterators.
* Verifies using only the stack, using `struct` and `Span<T>`. No allocation on heap, or `IEnumerable` iterators.
* Verifies all egg ribbons using a separate method, explicitly implemented. No reflection overhead.
* Separates each ribbon interface to separate `static` classes. Easier to identify code needing change on new game update.
* Extracted logic for specific ribbons. Can easily revise complicated ribbon's acquisition rules.
* Simplifies GiveAll/RemoveAll legal ribbon mutations. No reflection overhead, and no allocation.
* Can be expanded in the future if we need to track conditions for ribbon acquisition (was Sinnoh Champ received in BDSP or Gen4?)

End result is a more performant implementation and easier to maintain & reuse logic.
2022-08-15 21:04:30 -07:00
Kurt
a4274d370f Hide DynamaxLevel outside of Gen8 format 2022-08-14 18:54:08 -07:00
Kurt
7c4e5e7b04 Add more xmldoc 2022-08-11 00:46:41 -07:00
Kurt
94668b4672 Fix clearing of clones (off by 1 last box)
Clamp end box in the clear/modify actions too, just in case.
2022-08-05 11:24:54 -07:00
Kurt
ac17c7d4a3 Prevent setting of invalid dmax levels to set
Just an extra protection.
2022-08-03 17:50:11 -07:00
Kurt
50a64d8beb Add DynamaxLevel parsing for ShowdownSet 2022-08-03 17:10:00 -07:00
Kurt
9166d0eb64
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves

In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.

The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.

The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.

* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 16:15:27 -07:00