Commit graph

126 commits

Author SHA1 Message Date
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
0c0651f719 Show ride legend stored data
Hidden in box 33. All alone.
2022-12-05 21:05:16 -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
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
58f729122e Tweak party undo/redo logic 2022-10-09 16:15:50 -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
2cb2531288 Add more xmldoc 2022-08-21 01:39:16 -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
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
Kurt
12954a6369 Minor perf improvement (spans)
Remove PKM.EVs, do operations without heap allocation
Reduce usage of PKM.IVs/PKM.Moves, reuse spans if possible.
2022-06-25 23:08:28 -07:00
Kurt
fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00
Kurt
c66588666c Split box manip default lists from base file
Only change is to allow SM/USUM to allow Heal action

SM/USUM where Transporter messes up PP for VC transfers; otherwise no need for Gen1-5 games.
2022-06-11 15:47:23 -07:00
Kurt
893b5d5293 Revise more PB7/PK8->Interface type checks 2022-06-04 21:03:25 -07:00
Kurt
ab723af640 Expose Context for SaveFile/ITrainerInfo 2022-06-03 19:08:46 -07:00
Kurt
5bcccc6d92
HOME 2.0.0: Handle conversion behavior & restrictions (#3506)
* Revises legality checks to account for traveling between the three game islands (PLA/BDSP/SWSH)
* Adds conversion mechanisms between the three formats, as well as flexible conversion options to backfill missing data (thanks GameFreak/ILCA for opting for lossy conversion instead of updating the games).
* Adds API abstractions for HOME data storage format (EKH/PKH format 1, aka EH1/PH1).
* Revises some APIs for better usage:
  - `PKM` now exposes a `Context` to indicate the isolation context for legality purposes.
  - Some method signatures have changed to accept `Context` or `GameVersion` instead of a vague `int` for Generation.
  - Evolution History is now tracked in the Legality parse for specific contexts, rather than only per generation.
2022-05-30 21:43:52 -07:00
sora10pls
75f9f39cbf Add BDSP Hall of Origin unlock cheat 2022-05-13 17:25:18 -04:00
Kurt
3e8527f11a Minor tweaks
Reduce allocation in a few places, delete unused stuff, more concise expressions.
2022-05-07 21:25:26 -07:00
Kurt
a57f40ae7d Break up PKX into separate classes
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).
2022-05-06 20:38:55 -07:00
Kurt
f753afaae8 Minor clean 2022-04-11 11:56:56 -07:00
Kurt
a5ee845c3b Decouple event flag/work from SaveFile 2022-04-09 18:12:57 -07:00
Kurt
5260c5214e Move files 2022-04-09 12:01:43 -07:00
Kurt
77473476da Split savedata editing template 2022-04-02 17:58:05 -07:00
Kurt
69fafcab83 Performance: Slightly reduce allocations in moveset validation (#3460)
* Reuses move parse result objects for each encounter parsed in a LegalityCheck attempt, instead of creating a new object.
* Ensures the objects are never-null, and makes cleanup easier.

Slightly adjusts some other parts of the moveset validation to reduce allocations.
2022-03-12 17:39:00 -08:00
Kurt
e5e2a3427f Rename Silver SV->SI
SV will likely be the lump for SCarlet and VIolet
2022-02-27 11:16:12 -08:00
Kurt
dd4c2a349c Fix moving 5th party slot between boxes
Thanks Burning Justice !

https://projectpokemon.org/home/forums/topic/60789-error-when-attempting-to-edit-pokemon-battle-revolution-save/
2022-02-25 16:32:15 -08:00
Kurt
b20fb39d77 Don't set dex on slot swap within save
Closes #3411
2022-02-07 15:03:26 -08:00
Kurt
10fff124e5 Minor clean 2022-02-04 22:19:04 -08:00
Kurt
0b32cbf132 Update PKHeX.Core abstractions with latest logic
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-02-04 17:35:15 -08:00
sora10pls
3f1335e19f Add Zone unlock cheat to BDSP Misc Editor
As with most event work tampering, make sure you keep save backups. Accessing areas before you're intended to will almost certainly break story progression.
2022-01-03 11:06:06 -05:00
Kurt
47071b41f3
Refactoring: Span-based value writes and method signatures (#3361)
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.
2022-01-02 21:35:59 -08:00
Kurt
dc4a9136ea Remove trailing whitespace 2021-12-27 14:03:41 -08:00
Kurt
749293fc75 Move BoxManip to subfolder 2021-12-26 19:43:42 -08:00
Kurt
11039f1119 Extract some event unlocking logic for core 2021-12-26 18:21:34 -08:00
Kurt
f1fe2f6a8c Minor clean 2021-12-09 19:30:12 -08:00
Kurt
d7e1f65faa Add some xmldoc, file scoped namespaces
Not much of a git diff history for these files so I don't mind them being reformatted.
2021-12-09 18:58:30 -08:00
Kurt
870a38c607 Use primary constructors for some records 2021-12-09 01:08:46 -08:00
Kurt
cacd6e9965 More records/sealing 2021-12-05 23:54:59 -08:00
Kurt
88ddc5822e c#10: readonly record structs
Reduces some boilerplate constructors/equality compares
2021-12-04 18:32:35 -08:00
Kurt
dc0f56e790 Add underground save structure documentation 2021-11-24 00:45:11 -08:00
Kurt
9d5cff5221 Add daycare reader, show playtime in backup filename 2021-11-20 19:10:42 -08:00
Kurt
723514e89c
Update 21.11.19 - Brilliant Diamond & Shining Pearl (#3289)
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.
2021-11-19 18:23:49 -08:00
FeralFalcon
3afd51e587
Adding a plethora of event flag data (#3273)
* Add metadata flagging for values

Allows users to set a minimum importance for the list displayed.

Could probably make this checkboxes within the flags UI.

* Add setting to filter out gen8 block names

Allows users to filter out unwanted low-value property names.

Co-authored-by: Kurt <kaphotics@gmail.com>
2021-10-23 11:25:14 -07:00
Kurt
4fb0f96dc4 Add daycare slot view for lgpe
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-09-16 14:21:44 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
c0d748a975 Add Dream World upload slot indicator
Tested & works on bw & b2w2
Thanks Brokemia for the request!
2021-08-16 11:54:03 -07:00
Kurt
a939a2dbd6 Add pkmdb sorting rules for loaded database set 2021-08-06 10:09:16 -07:00
Kurt
ebb47867dd Use FileUtil tryget for pkm from path
GetPKMFormatFromExtension is now only used once internally.
2021-08-05 16:29:32 -07:00
Kurt
0c6254835d Add battle agency slots to main window misc viewables 2021-07-26 23:57:05 -07:00
Kurt
51616cc7f9 Handle off by 1 for box/slot differently
Does the opposite as was implemented in 16c8a18928 by updating all downstream users -- batch filters only.
2021-07-20 23:53:33 -07:00
Kurt
16c8a18928 Show box/slot offset by 1 when loading as SlotCache
Closes #3229
also revises parsing to not ToString(), and doesn't add a skip if the slot is empty
2021-07-03 09:28:35 -07:00