Commit graph

1445 commits

Author SHA1 Message Date
sora10pls
fcff2925f1 Add 7 Star Raid record editor 2022-12-02 22:20:43 -05:00
Kurt
2e67526db1 Update 22.12.01 2022-12-01 22:40:11 -08:00
sora10pls
1ffd6872a8 Unban Lansat Berry 2022-11-29 21:47:42 -05:00
sora10pls
d64fdb68ad Label event raid identifier save block
0 for no event active
20221125 for Eevee
2022-11-27 21:31:04 -05:00
Kurt
6002611c80 Fix block value set cast on change language
Closes #3657
2022-11-27 10:52:01 -08:00
Kurt
4df9198ff5 Fix SeenAll/CaughtAll/CaughtNone set/clearing 2022-11-26 15:31:36 -08:00
Kurt
cee97ada26 Minor clean 2022-11-26 14:22:57 -08:00
Kurt
184c206910 Set form seen on SAV pk9 dex set
Set seen gender too
private unused flag names
2022-11-25 19:11:25 -08:00
Kurt
f1b8992989 Handle Item flag set correctly
Remove v1.0.0 bug replication
Ensure the IsUpdated flag is set when writing a non-null pouch
2022-11-25 11:21:18 -08:00
sora10pls
b4253909d7 SV cheat adjustments and additions
Remove story scenario flags from fly loc cheat
Modify shrine work value to lift seals and make sub-legendaries ready to catch
Add cheats to unlock all TM recipes and bike upgrades
Closes #3635
2022-11-25 08:21:10 -05:00
Kurt
721159b0db Add rental teams block label 2022-11-24 22:44:59 -08:00
Kurt
719ec1c6cc Add Collect All Stakes (sublegend x4) cheat button 2022-11-24 21:58:47 -08:00
Kurt
7d7d7e91c0 Add gen9 flyto unlock button 2022-11-24 21:25:52 -08:00
Kurt
25d0ff268f Fix dex species/form iteration cheats
Update Zukan9.cs
2022-11-24 19:58:32 -08:00
Kurt
b6ac0de3f7 Fix changing sav language setter block set 2022-11-24 19:13:19 -08:00
Kurt
0ea152770a Fix IsNew/IsFavorite flag clear 2022-11-24 18:32:32 -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
e1cf36e2c4 Add method to write both save slots 2022-10-19 20:36:56 -07:00
BlackShark
b2f5bd5bd6
Added SIZE_G3EMU (#3603) 2022-10-14 07:29:52 -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
83d6402fd4 Add gen3 unown form-pid check 2022-09-26 07:27:51 -07:00
Kurt
0a9fbfc8c3 Size 7->8, make properties u8 instead of s32 2022-09-22 11:57:58 -07:00
Kurt
d5cdd3e6cc Update SAV1.cs
Closes #3583
2022-09-12 11:54:35 -07:00
Kurt
c5908b2b97 Disassociate metadata's SAV reference from clone
Necessary for gen3 manual overrides; the fetched properties for Metadata should refer to the cloned data that it is using, not the original reference.

Closes #3582
2022-09-11 09:59:00 -07:00
Kurt
bbc45d8b0c CXD played: Use TotalHours to set elapsed hours 2022-09-07 14:39:58 -07:00
Kurt
06196e0440 Minor tweaks
Less alloc
2022-09-04 22:23:35 -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
66e0613d82 Minor clean 2022-08-30 15:00:45 -07:00
Kurt
319a671a6d Simplify munchlax tree list usage 2022-08-29 17:38:27 -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
eb2cef10c9 Minor clean
Stability intensifies
2022-08-22 23:18:53 -07:00
Kurt
3dde8a7cfa Reduce linq usage, minor perf 2022-08-17 23:48:37 -07:00
tastymeatball
5f3516c3ce
Fixed error getting Z coordinate (#3567) 2022-08-12 07:58:23 -07:00
Kurt
59fad0e8cf Minor tweaks
Extract some logic (origin markings)
Revise directives for NET7 targeting, remove old net5 refs
2022-08-05 16:18:42 -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
ec45ca1a83 Set species flag on ck3/xk3->pk3
Make GetG3Species return ushort

Fixes regression caused by 5942a74147
Copying SpeciesID3 instead of Species is fine as it skips the map/unmap step, but it also skips the setting of the HasSpecies flag. So we'll just set it in the individual ConvertToPK3 methods.
2022-08-04 09:53:15 -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
45af203a26 Fix C/XD playtime reading
ty @trigger-segfault
e611c9661e
apparently Japanese XD uses 32bit instead of 64bit, different struct size. Seems the same as the memo size being different for japanese XD too.

Since we're now using Config, apply the correct CurrentRegion/OriginalRegion values when setting a pk* to sav.
2022-07-06 17:33:15 -07:00
Kurt
e4984b203c Update SAV3GCMemoryCard.cs 2022-06-30 07:17:47 -07:00
Kurt
1d94baeb7f Fix footer size chop
oops, another hotfix
2022-06-28 16:54:18 -07:00
Kurt
1f64a41670 Fix gci recognition 2022-06-27 22:28:46 -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
d8c8a13885 Add bizhawk footer handler
Optimize some of the other handlers.
2022-06-25 11:14:00 -07:00
Kurt
210bd90fc1 Add entree MissionsComplete for BW
Closes #3532

BW/B2W2 could be the same, meaning that the pass power offsets in the B2W2 class can be merged back in to the base class.
2022-06-19 08:39:43 -07:00
Kurt
d2115eb8b9 Add remaining gen4 roamer slots
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2022-06-18 19:46:53 -07:00
ShadyRelapse-PP
bd25312181
Added Second Roaming Pokemon for Platinum and Third Roaming Pokemon for HGSS (#3531)
* Update SAV4HGSS.cs

* Update SAV4HGSS.cs

* Update SAV4Pt.cs

* Update SAV4HGSS.cs

* Update SAV4HGSS.cs
2022-06-18 19:14:29 -07:00
Kurt
d1c2f6ef6e Add gen5 roamer get 2022-06-18 19:12:41 -07:00
Kurt
0eca5cbe05 Add gen4 roamer to block editor
Closes #3528
2022-06-18 14:11:22 -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
8319bfe003 Fix Entree Forest saving
Closes #3524
2022-06-14 22:30:57 -07:00
Kurt
0093927e15 Use ReadOnlySpan instead of Span if appropriate 2022-06-13 00:04:20 -07:00
Kurt
436588eb10 Replace é->e for code symbols
Closes #3519
Usages weren't consistent; since `é` isn't accessible on usual english keyboards, just use regular `e` instead of alt-223 entry.

Not sure why VS preferred to save the text files without an encoding prefix; oh well.
2022-06-11 15:32:12 -07:00
Kurt
184440f266 Add more GBMobileCableColor values
see 7225b2b87b
2fe0cbbb19/gfx/mobile/mobile_adapters.pal
2022-06-11 10:40:10 -07:00
Kurt
15a84d9d7e Minor clean 2022-06-11 09:51:43 -07:00
Kurt
8c528855f4 Differentiate dragged PK8/PB8 better w/preferences
Better determine preference with file extension string
2022-06-07 03:33:45 -07:00
Kurt
54cb4dc8c8 Minor comment fixes 2022-06-07 03:21:04 -07:00
Kurt
ab723af640 Expose Context for SaveFile/ITrainerInfo 2022-06-03 19:08:46 -07:00
Kurt
978be73b9a Trycatch path->sav factory method
Closes #3512 -- had a bad gen3 save backup causing trouble.
2022-06-02 19:21:47 -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
Lusamine
0b50d6d4ac Label SWSH Poke Job Storage Block 2022-05-18 00:03:59 -05:00
Kurt
50ce6a92db Revise stadium detection if no teams set
Closes #3494
Thanks @keiyakins !
2022-05-15 14:05:10 -07:00
Kurt
a5b46d80f5 Minor tweaks
ShowdownSet: Lessen allocation
MoveTutor: Remove boxing by calling the generic method instead of object method
Xoro8b: Add more xmldoc, use positive constant instead of inverse negative for parity
StadiumUtil: Use built-in endianness reversal methods
2022-05-14 08:28:13 -07:00
Lusamine
4e703b7c9e Correct ordering of SWSH rental team blocks 2022-05-13 20:02:41 -05:00
Kurt
bc054c09ed PK5: Clear party stats on import
Add property get/set for the undocumented fields
2022-05-08 18:36:18 -07:00
Kurt
69794e7328 PK4: Add Seals & Ball Capsule index
0xD4 + 0x18 = 0xEC = 236 bytes -- end of data!
2022-05-08 13:16:41 -07: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
be9c947dd6 Use tuples and ComboItem, not anonymous class
Little more explicit
2022-05-06 15:43:51 -07:00
Kurt
75874b6b81 Show lock capsule slot in mystery gift editor
Closes #3487

editor getting hacky, but it works
2022-05-05 21:21:03 -07:00
Kurt
d58aed109d Add Current Box Changed flag for sav1/2
Flag not set causes the game to clear all boxes (except current box) to clear garbage sram if saves never cleared. Yay deferred execution?
2022-05-02 23:47:41 -07:00
Kurt
fa76da56c9 Inline some Rand32 calls
No functional change
2022-04-26 20:21:26 -07:00
Kurt
1f49574be1 Fix g6 hof len 2022-04-23 22:05:51 -07:00
Kurt
f5358e0e37 Update HoF6 entity editing
Reusable entity struct, no more overlapping fields
Adds OT Gender, fixes some flags.

Thanks L1nk2futr3 !
https://projectpokemon.org/home/forums/topic/60977-hall-of-fame-tid-resetting-gen-6/?do=findComment&comment=275575
2022-04-23 10:42:56 -07:00
Kurt
ff2e890e69 Revise Overworld8a application of PIDIV
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.
2022-04-22 21:11:11 -07:00
Kurt
e90f19c962 Add setters for spawner objects
UnknownSeed->CountSeed
Seed_01 -> AlphaSeed
yay, no more unknown seed functionality, all documented.
2022-04-18 22:25:34 -07:00
Kurt
515a503ee4 Update spawner models, import from permutemmo 2022-04-17 14:54:54 -07:00
Kurt
a61d8d1efc Extract IMultiplayerSprite from SaveFile
only used by gen6 saves
2022-04-15 14:58:40 -07:00
Kurt
a681783f1a Extract interface for SaveBlock, allow strict
External users shouldn't be using SaveBlock
2022-04-15 11:45:04 -07:00
Kurt
ac7947fd66 Misc tweaks - static namespace using 2022-04-15 09:54:12 -07:00
hp3721
f740e1dd72
Fixed rebattling BDSP trainers (#3481) 2022-04-14 18:36:01 -07:00
Kurt
5f4bbcf8de Permit 0x1FF00 saves as stadium saves
Closes #3479
emulators are stupid
2022-04-13 10:42:35 -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
0389624508 Extract unnecessary stringbuilding from pkmconvert 2022-04-09 11:58:52 -07:00
Kurt
e6cf5d0baf Split PKMConverter into multiple classes
EntityFormat -> detects byte[] -> ctor() PKM
EntityConverter -> converts between pkm formats
RecentTrainerCache -> used by other classes (not within EntityConverter!)
EntityBlank -> creates blank PKM objects indirectly
2022-04-09 01:39:34 -07:00
Kurt
cc1c3e8d42 Refactor stat loading to allow spans
Can load stats without allocating
2022-04-08 21:08:06 -07:00
Kurt
274b613487 Change signature to set stackalloc ivs 2022-04-08 20:43:31 -07:00
Kurt
d40bfa63c7 Refactor gen2 mail data structure
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.
2022-04-02 23:36:56 -07:00
Kurt
55083ee02c Fill(0) -> Clear() 2022-03-26 13:33:58 -07:00
Kurt
977e977dbf Rewrite GeniusCrypto (XD/Batrev)
More clear usage of span
slightly less allocation+copying
more comments for future readers
2022-03-26 13:28:29 -07:00
Kurt
8bf618008a Remove structconverter
Won't work on bigendian architecture for non-byte fields, so just do it manually.
2022-03-25 19:47:23 -07:00
Kurt
6a96ad2278 Disallow loading invalid BDSP savefile versions
rom hacks smh
2022-03-25 19:24:37 -07:00
Kurt
2cbdd5dbe6 Add gen4 pokedex extdata reader 2022-03-22 10:25:53 -07:00
Kurt
68e3a4430d Handle japanese RSBOX memcards
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).
2022-03-21 19:20:06 -07:00
Kurt
46c83faa0e Refactor hall extradata to read as a separate block 2022-03-21 18:53:24 -07:00
Kurt
fadcf92dc8 Faster pokecrypto
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
2022-03-20 02:44:36 -07:00
Kurt
54f1e341f9 Spanify spawner object get 2022-03-20 01:46:24 -07:00
Jonathan Herbert
9222bfa919
Fix BDSP V1.3.0 Suffix (#3465) 2022-03-16 08:01:25 -07:00
Kurt
9aa5bbea2d BDSP v1.3 2022-03-15 19:24:17 -07:00
Kurt
70ea1f7048 Move some files around 2022-03-15 19:23:03 -07:00
Kurt
b45ce123da Show rainbow bean index
14 -> 15
Clean up some API functions
2022-03-08 21:02:06 -08:00
Kurt
bb8dee1e6c Return block value
oops, refactoring forgot to add return
Closes #3458
2022-03-08 08:36:17 -08:00
Kurt
4e1276a954 -8 bytes from each encounter template
saves about ~1MB RAM savings (>=179,142 objects)
2022-03-06 23:25:47 -08:00
Kurt
ba9d3c95af Fix bean get/set 2022-03-06 15:33:33 -08:00
Kurt
9049ef99fd Minor allocation reduction 2022-03-06 13:03:39 -08:00
Kurt
7911cd6d5c Seal some classes 2022-03-06 12:16:36 -08:00
Kurt
47f7efab2c Update SCBlockAccessor.cs 2022-03-06 00:46:10 -08:00
Kurt
e17483fe46 some linq reduction 2022-03-05 20:03:52 -08:00
Kurt
1c0f842173 Remove unnecessary Clone method for Items
Remove linq using by doing things slightly more efficiently
2022-03-05 19:51:16 -08:00
Kurt
9696da2eb3 Minor clean
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.
2022-03-05 18:13:31 -08:00
Kurt
3c567c0c97 Rearrange some scblock logic
No functional change. just increasing robustness
Decouples exportable state from get/set values
2022-03-05 17:46:03 -08:00
Kurt
1370d9ab0f Merge SAV8 into SAV8SWSH
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.
2022-03-05 17:34:09 -08:00
Kurt
90b075947d Move some get/set operations into Accessor class
Adds exception-free get/set for revised saves.
2022-03-05 17:33:08 -08:00
Kurt
8f0035a577 Deduplicate savefile constructors
No longer necessary as we don't keep BAK reference anymore.
2022-03-05 17:15:38 -08:00
Kurt
8fdd96209c Deduplicate some logic
No need to length check in the SwishCrypto hash check, as the methods pre-check length as well.
Extract checksum footer check for Gen5 saves
2022-03-05 17:14:25 -08:00
Kurt
1f07685921 Update MyStatus8b.cs 2022-03-05 15:17:13 -08:00
Kurt
7cfdb8a466 Move hashing to SCBlockAccessor, fix #3455
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>
2022-03-02 18:05:13 -08:00
CanoeHope
e507d4ab91
Update SaveBlockAccessor8LA.cs (#3453) 2022-03-01 21:34:37 -08:00
Kurt
e5296fc51a Add IoA diglett button in Trainer editor
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>
2022-03-01 21:34:16 -08:00
Kurt
415c5f5560 Update SCTypeCode.cs 2022-03-01 19:09:42 -08:00
CanoeHope
e792c038b8
Label a new L:A update block (#3452) 2022-02-28 22:47:30 -08:00
Kurt
d1e62fb6d1 Add dex solitude complete mark checkbox 2022-02-28 00:03:38 -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
b3cd4dea25 Initial support for PLA-v1.1 2022-02-27 07:56:47 -08:00
Kurt
044dfe46ae Reduce allocation on encrypt/decrypt
Xor no longer allocates
Encrypt no longer allocates byte[0x60]
temp now allocated on stack instead of heap
Pre-size memorystream (prevents 0xF0 allocation)
2022-02-27 01:05:11 -08:00
Kurt
fd07456ee1 Fix boolean value copy changes
a5710ee374
2022-02-25 16:10:49 -08:00
Kurt
a5710ee374 Fix PLA box flag setter
nice boo boo matt
2022-02-25 13:29:43 -08:00
Kurt
5a71ecc8bb Minor clean 2022-02-24 23:17:16 -08:00
Kurt
a276975847 Don't throw exception in safe block search
Just duplicate the method to return fake default instead of trycatch overhead.
2022-02-24 21:02:08 -08:00
Kurt
0404b94f86 Add support for BDSP 1.2.0 save files 2022-02-21 18:11:35 -08:00
Kurt
48742da4ae Ignore BDSP backup paths
"Backup.bin"
2022-02-21 17:45:23 -08:00
Kurt
f1264a1a97 Handle struct default ctor 17.1 handling
Closes #3445
2022-02-21 16:11:58 -08:00
CanoeHope
61821c7986
Add L:A blocks and BDSP event constants (#3444)
* Update SaveBlockAccessor8LA.cs

* Update work_bdsp_en.txt
2022-02-20 22:46:20 -08:00
Kurt
d5be6254f3
Add logic for PLA wild RNG correlation (#3443)
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>
2022-02-20 17:59:48 -08:00
Kurt
f2637168ab Fix kor string writes
Was writing kor string, then writing en after (all terminators).
Make method signature match other SetString, with write buffer as first arg

Closes #3440
2022-02-17 23:11:13 -08:00
Kurt
dc3d8e7cec Minor clean 2022-02-14 21:32:52 -08:00
Kurt
2267e1a879 Minor tweaks for api consumers
Indicate Shiny.Random on home shiny-possible gifts
More detailed exception message for GetLearnset/GetPersonal
2022-02-12 23:40:28 -08:00
Kurt
574a7f43a0 BDSP: Handle uninitialized box names
span refactoring didn't catch this
also apply same change for gen4 battle revolution string reads
2022-02-11 10:43:27 -08:00
Kurt
bb2b8e74c3 Update SCBlock xmldoc 2022-02-10 11:08:30 -08:00
Kurt
a5d1bf7900 Fix cxd pouch write, bk4 pid reads
Closes #3429
2022-02-10 10:57:59 -08:00
Kurt
bc2549b24e
Minimize BAK file allocations (#3426)
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.
2022-02-09 16:48:55 -08:00
Kurt
16da1deadc Revise battle subway flag handling
Retain all flag bits; expose the other 5 flag bits as some saves do have them.

Undocumented.

Closes #3422
2022-02-09 15:41:00 -08:00
Kurt
f5344452cf Fix last funfest mission record r/w
Closes #3423
2022-02-09 10:36:46 -08:00
CanoeHope
08f8b6e3d4
Add Legends: Arceus blocks (#3403)
* Update SaveBlockAccessor8LA.cs
2022-02-08 18:50:52 -08:00
Kurt
5cdfe18b8e Add 7b Starter choice
Closes #3420

Co-Authored-By: GiftedK <99304781+GiftedK@users.noreply.github.com>
2022-02-08 18:49:44 -08:00
Kurt
105e6a31f8 Fix Colo checksum refresh
https://projectpokemon.org/home/forums/topic/60614-error-when-opening-a-clean-pok%C3%A9mon-colosseum-save-and-exporting-it-as-is-using-220204/
2022-02-06 19:17:46 -08:00
sora10pls
9023b302c8 Label individual clothing item unlock save blocks 2022-02-05 13:38:39 -05:00
Kurt
cd19d1d700 Fix folder list backup fetch
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.
2022-02-05 09:49:47 -08:00
Kurt
5c33245221 Update MyItem8a.cs 2022-02-04 22:28:07 -08:00
Kurt
e2bafab3c2 Clamp pouch inventory per satchel size
Closes #3384
2022-02-04 22:18:57 -08:00
Kurt
eed5bb04e3
Merge pull request #3382 from kwsch/pla
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.
2022-02-04 18:28:17 -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
Kurt
691f941bb6 Add savedata models
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:31:20 -08:00
Kurt
752ddc1a88 Move SWSH save abstractions to subfolder 2022-02-04 17:22:33 -08:00
Kurt
d44c43f249
Fix swarm/safari seeds for DP saves
https://github.com/kwsch/PKHeX/pull/3379#issuecomment-1026405162
2022-01-31 18:01:44 -08:00
Edoardo Lolletti
5e3efc6c23
Fix swarm seed location for pokemon platinum (#3379)
The seed was being read/written to the wrong location of the save
2022-01-31 18:00:37 -08:00
Kurt
da9d09ea76 Misc tweaks
No functional change
2022-01-11 22:53:20 -08:00
Kurt
1992f36c5b Fix gen3 item quantity reads
Oops :)

Closes #3369
ty @MichiS97 !
2022-01-09 20:34:55 -08:00
Kurt
9cde291595
Enumerate ability permissions in encounter templates, misc updates (#3368) 2022-01-08 22:34:04 -08:00
Kurt
7743b30b2f Fix species being replaced with incorrect mapping
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
2022-01-07 17:48:12 -08: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
ac1136615e Fix rival string read/write to General 2021-12-31 13:52:50 -08:00
Kurt
cc8ac7a4f1 Remove unnecessary warning suppression
fixed dat .editorconfig in vs22
Catching general exceptions is okay because this program handles user modified data that can potentially be corrupt.
2021-12-27 12:09:15 -08:00
Kurt
11039f1119 Extract some event unlocking logic for core 2021-12-26 18:21:34 -08:00
Kurt
13e0f35e00 Add munchlax slot checking for DPPt/BDSP honey trees
Closes #3352
2021-12-25 13:48:28 -08:00
Kurt
4e7e23cb88 Add battle tower record editing 2021-12-20 23:48:05 -08:00
Kurt
36a97a6eda Add misc edit to defeat all trainers & rebattle all 2021-12-20 19:26:07 -08:00
Kurt
98713f4d7b Move inventory item clearing to class
Fixes ClearItem offset being wrong
2021-12-13 18:31:00 -08:00
Kurt
cacd6e9965 More records/sealing 2021-12-05 23:54:59 -08:00
Kurt
7e4877e7de Add 3 more useless blocks
Spinda registers correctly now, lol
2021-12-04 23:52:33 -08:00
Kurt
40ed5898af Merge extended property patterns 2021-12-04 18:37:47 -08:00
Kurt
88ddc5822e c#10: readonly record structs
Reduces some boilerplate constructors/equality compares
2021-12-04 18:32:35 -08:00
Kurt
f55c5bea66 Minor clean
no functional change
2021-12-04 17:56:56 -08:00
Kurt
9a1b2719ec Add simple legal item filtering for giveall
Closes #3318

Gen8: if held item, only give if can be legally held; if dmax crystal, only give if available.
Gen8b: if held item, only give if can be legally held
Others: unimplemented; pull requests accepted.
2021-12-04 12:24:32 -08:00
Kurt
e50bb8f288 Abstract-ify pouch items; acknowledge sort order
Closes #3320
Should better handle bdsp inventory format; shows sort order with the now-zero slots
2021-12-02 23:31:48 -08:00
Kurt
b74283560d Add more useless bdsp saveblock objects 2021-11-30 22:05:20 -08:00
Kurt
8c9fb3a872 Add FieldObjectSave browser 2021-11-30 17:31:46 -08:00
Kurt
1c82b707f3 Add xmldoc, add egglevel get central location 2021-11-30 17:09:46 -08:00
Kurt
1bb3255ab1 Add randomgroup block
Still does the same silly ARNG as gen4:
        seed = 0x6C078965 * seed + 1;
to advance on each day

Do note that it sets event flag 1711 to true, and sets the absolute value of the "Random" to Work[436]. FLAG_DAILY_RANDOM, WK_DAILY_RANDOM, assumedly for easy use with scripts.
2021-11-28 23:31:01 -08:00
Kurt
4276ee1b9d No exp gain for nursery
I'm not up to date on game mechanics, thanks matt.
2021-11-28 16:30:56 -08:00
Kurt
0189e84263 Clear all flags on seen none 2021-11-28 11:55:31 -08:00
Kurt
cc34d40120 Update 21.11.27 2021-11-27 10:50:42 -08:00
Kurt
be3af9fba9 Add bdsp poffin editor
The RAM is pretty dirty for unallocated poffins; slots that have never been filled will have junk with whatever the unallocated pointer was looking at.

An empty poffin slot is just marked as FF, ignores the stats for that slot. Not sure on the naming, but Matt had a single Level 60 poffin -> must be Mild? Thus, all the names are -1 from the textfile array...
2021-11-27 02:06:35 -08:00
Kurt
fd4dd6e2fb Indicate teamlocks in boxes 2021-11-26 19:54:07 -08:00
sora10pls
8bce248d95 Crop BDSP Box Wallpapers, re-tile Grass, and fix off-by-one 2021-11-26 22:11:54 -05:00
Kurt
2560d0eb28 Change safari seed to uint
matches community handling of seeds
2021-11-26 11:31:00 -08:00
Kurt
5d4a8e5328 Add Mystery Gift records for BDSP 2021-11-26 11:08:51 -08:00
Kurt
6fb1634a2f Show internal affixed seal enum name for tostring 2021-11-26 09:35:25 -08:00
Kurt
b50791530c Add ENC_SV_DATA, PLAYER_SAVE_DATA, capsules, UgCountRecord 2021-11-26 01:21:38 -08:00
Kurt
b7c9993bac Add Misc editor form for bdsp
Three clickables so people can stop getting confused about event-bound encounters like Darkrai/Shaymin/Spiritomb
2021-11-25 22:48:09 -08:00
Kurt
02dc4dc8a7 Automatically update v1.1 expanded records on TID/SID change
Closes #3305
I think it was actually crashing due to the bad GameClear date record, not this extra record data, but we'll still update the head record

Fix note of ENC_SV_DATA start offset now that we know the real size of Record8b
Add actual maximums for all record entries
2021-11-25 20:05:39 -08:00
Kurt
1a9f9fcfe5 Add more savedata notes 2021-11-25 18:09:05 -08:00
Kurt
95bdde69a7 Add more savedata abstractions
Array sizes for the top level structures are now noted, should make it easier to determine the shape of them & offsets.
2021-11-25 16:38:58 -08:00
Kurt
0fe80edb37 Add bdsp v1.1 to valid save size hashset
Now shows the save file backups from v1.1 in the Folder Browser
2021-11-25 12:57:43 -08:00
Kurt
d79864b049 Add seal list editor
Inject all the stickers you want.
2021-11-24 17:51:12 -08:00
Kurt
a7ab45746c Set both gender flags for genderless species
Nice deviation from mainline logic :)
2021-11-24 17:02:29 -08:00
Kurt
dc0f56e790 Add underground save structure documentation 2021-11-24 00:45:11 -08:00
Kurt
086c6492f2 Add trainer rebattle status block logic 2021-11-22 20:54:12 -08:00
Kurt
97960d4439 Add placeholder berrytree+poffin blocks 2021-11-22 20:20:57 -08:00
Kurt
1ab895a6c4 Restrict constructor to BDSP save type 2021-11-22 19:31:19 -08:00
Kurt
d81f832a61 Fix Record8b capping first record (uncapped) 2021-11-22 19:30:51 -08:00
Kurt
4b40414b8b Add BattleTower work reader, move BP get/set into it 2021-11-22 19:30:28 -08:00
Synthlight
b32ad02c10
Add/Enable BDSP Battle Tower Points (BP). (#3309) 2021-11-22 18:56:31 -08:00
Kurt
a9bc86bb13 Clear deleted item slots
Closes #3304 ty @MewtwoFanz
2021-11-21 17:49:34 -08:00
Kurt
9b8f1c8305 Allow multiple diggerdrill 2021-11-21 12:52:16 -08:00
Kurt
32edb660ce BDSP: Add underground item-inventory editor 2021-11-21 11:33:04 -08:00
Kurt
ee567a7d15 Add systemtime, (underground item, poketch, both no GUI)
systemtime to be integrated to trainer info editor later
2021-11-20 23:54:27 -08:00
Kurt
9d5cff5221 Add daycare reader, show playtime in backup filename 2021-11-20 19:10:42 -08:00
Kurt
6980026ca2 Add BDSP trainer stat records
Continue crawling down the serialized savedata structure :)
2021-11-20 15:40:18 -08:00
Kurt
921b151aef Add zoneID property 2021-11-20 09:37:40 -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
Kurt
692898fe46 Set metadata for sav on certain paths
Closes #3282
2021-11-07 10:17:03 -08:00
Kurt
533526465e Omit exclusions if empty 2021-10-25 20:03:16 -07:00
Lusamine
bf94c1de1f Document both SWSH bike boost save blocks 2021-10-24 20:39:10 -05:00
CanoeHope
aeb1043d4e
Added 2 SWSH blocks (#3276) 2021-10-23 22:15:48 -07:00
sora10pls
aa214524fd Label SWSH event flag save blocks
Static encounters (stationary and Max Lair), gift encounters, and some general purpose flags. Can filter most of these out in PKHeX settings by ignoring `KCaptured` and `KReceived`.
2021-10-23 16:41:07 -04: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
009e37662f
Startup Enhancements, Gen1/2 Save Indication, Export SAV cleaned up (#3275)
* Providing pkm/sav files via command line (dragging files onto exe / associated file launched) will more intelligently source a partner sav/pkm object if not provided.
* Gen1/2 mainline save files now indicate if they are VC era or GB era (legality implications) in the program title bar.
* Fixes loading VC era save backups not being recognized as VC era (`.bak` extension hides `.dat`)
* Export BAK moved to the SAV tab, which allows Export main to be deleted and Export SAV to be used as the single-click for exporting saves. `CTRL-E` is still the hotkey.
2021-10-21 22:13:21 -07:00
Kurt
4b263bf9bb Fix pattern matching comparison
Wish I had an analyzer to catch this (missing parens) similar to boolean logic

#3271 - resolves the traded egg recognition issue
2021-10-13 20:05:19 -07:00
Kurt
6304ef2006 Fix gets for u16 char widths
oops

Only gen1/2 have trash exposed for OT, so I guess I can just leave these.
2021-10-10 17:23:14 -07:00
Kurt
3bf8d2fe07 Add rival string editing for all remaining games
Block Editor for direct edits, no GUI

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-10-10 16:11:46 -07:00
Kurt
40031fd94d Fix give all goods for ORAS secret base
was overwriting pokepuffs, oops
2021-10-08 12:43:24 -07:00
Kurt
08b7d7ebfe
Update Misc5.cs
#3259
2021-09-18 17:52:58 -07:00
Kurt
0c83da7c1b Add Poké Transfer minigame score editing (Gen 5)
Closes #3259

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-09-18 16:31:22 -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
02af45cb30 Add LGPE to block editor
thanks for nobody noticing this yet :)
2021-09-16 14:06:52 -07:00
Kurt
26422bc17c Add Crystal blue card points get/set
Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>

#3258
2021-09-16 13:16:12 -07:00
Kurt
50084eaaee Fix sav3 [uninit, oneSave] primary secondary detection
Closes #3257
2021-09-14 18:38:46 -07:00
Kurt
d8c5c027ac Emerald: Add walda wallpaper
use block editor
f7a699c686/include/global.h (L1045)
2021-09-06 20:46:41 -07:00
Kurt
819b884b19 Update EventWork7b.cs 2021-09-05 13:07:33 -07:00
Kurt
a7ed5b400f Add Trainer Class / Title property for LGPE 2021-09-04 22:04:49 -07:00
Kurt
f9d9bcfb80 XD: Purification is stored differently for jp games
A more condensed data structure, 72->60 bytes for each entry instead.
Closes #3255

Related? #2956
2021-09-03 18:16:09 -07:00
Kurt
6e9f230dee Add cxd/rsbox event data for mainline sav3
Closes #3248
2021-08-22 18:52:29 -07:00
Kurt
8f0fb902d1 ArgumentException -> ArgumentOutOfRangeException 2021-08-21 16:51:50 -07:00
Kurt
5da9b4a70a Force alignment
FieldOffset isn't implied, fun.
2021-08-20 22:07:09 -07:00
Kurt
05364212ba Update Encount5.cs 2021-08-20 20:53:23 -07:00
Kurt
9ef93552c9 Add ability to set swarms for gen3 2021-08-20 20:50:16 -07:00
Kurt
48024f1245 Add Swarm data get/set for gen3-5
#3245
2021-08-20 19:52:31 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
c6342a163f Minor clean
variable swaps, simplifications
2021-08-20 13:42:25 -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
9793e9f1a0 Minor clean
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
2021-08-13 15:36:30 -07:00
Kurt
5ec2b12ae5 Handle some warnings for release build
Unused usings; just make PIDType stuff visible.
2021-08-06 09:41:39 -07:00
Kurt
0f3e5095c5 Replace more linq usage 2021-08-05 22:39:38 -07:00
Kurt
5c472a400d Expand shorthand parameters
int i => int index, or whatever the value is representing.
2021-08-05 20:33:25 -07:00
Kurt
a1f5c76790 Fix pgl jpeg save 2021-08-05 19:38:47 -07:00
Kurt
59d480c834 Minor tweaks
Discard empty pkm files (species 0) when loading boxes or templates
Add more xmldoc
Simplify some method parameter names for readability
2021-08-05 17:05:39 -07:00
Kurt
cc0397f087 Misc tweaks
Improved readability
2021-08-05 15:18:43 -07:00