Commit graph

105 commits

Author SHA1 Message Date
Kurt
1348f5deec Allocate smaller buffers for gen3 sav objects
n*0xF80 instead of n*0x1000
2021-04-02 14:57:30 -07:00
Kurt
1e38f55007 Fix changes not being saved completely 2021-04-01 13:43:06 -07:00
Kurt
4700fdd1e3 Set updated version when resetting personal
Closes #3180

Improves handling for corrupt gen3 saves (pokedex cheaters)
2021-04-01 13:37:39 -07:00
Kurt
645f2b4db5 Revert implicit casting
Looks like netstandard2.0 wasn't meant to receive that new c#9 goodie
2021-03-29 00:14:44 -07:00
Kurt
0190098e47 Gen3: Add methods to get/set external event data 2021-03-27 18:58:51 -07:00
Kurt
27cdcb8b0c Simplify SAV3 loading
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
2021-03-16 23:32:16 -07:00
Kurt
33e2c64721 Split SAV3 into version classes
Begone are the version-switch cases for value fetching.
2021-03-15 23:51:58 -07:00
Kurt
49541e6073 Rework mainline sav3 to not operate off chunks
Previous style was to resize the sav buffer and concat all the storage chunks at the end. Allocated a double save file.

Now, just allocate 3 buffers.
2021-03-07 23:22:07 -08:00
Kurt
6566b0ed1f Add Pokedex flag properties
Closes #2954 ; can set directly from propertygrid already, but might as well clean things up a little bit to match the disassembly logic.

Open the simple editor center parent rather than next-form-position
2021-01-09 23:27:22 -08:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
5729718d68 Simplify ternary byte casts
No longer needed to explicitly cast, thanks c#9 !
2020-12-21 16:53:28 -08:00
Kurt
6f7602f2ad Change signatures to use readonly if possible
Extract get/set team methods for battle video
2020-12-05 06:09:33 -08:00
Kurt
e72c80613e Extract metadata/state tracking from SaveFile obj 2020-12-05 05:36:23 -08:00
Kurt
fb4734472b Add notation for language-specific save types 2020-09-26 13:30:17 -07:00
Kurt
32f2703339 Fix entire-box swaps by using correct lengths
Add SIZE_BOXSLOT and update usages
Make SIZE_STORED protected like SIZE_PARTY

probably need to redesign how slot metadata is presented within the savefile...
Closes #2961 ty @Kermalis !
2020-08-07 16:16:10 -07:00
Kurt
15996f2a52 Fix indexof call when short
int within short[] = no
short within short[] = yes
Closes #2955
2020-07-28 19:47:11 -07:00
Kurt
a6a3c6eaaa Refactoring
change some expressions for better perf/readability
2020-07-19 17:48:45 -05:00
Kurt
2cdb5d26db Clean up some method signatures
rename things to be a little more consistent in naming conventions
2020-06-16 21:46:22 -05:00
Kurt
270d984130 Minor clean
Remove unnecessary null checks
Mark some methods with nullable type
2020-04-04 19:30:50 -07:00
Kermalis
face69d469
Fix Emerald decorations (#2788) 2020-03-18 00:25:02 -07:00
Kurt
429a3b1a08 Expose decoration list for editing
Closes #2785 , not making a GUI for this (someone else can do it)

Moves RTC3 to the appropriate folder
2020-03-17 12:14:01 -07:00
Kurt
e378821101 Remove duplicate key item list for pc items
Closes #2733

Co-Authored-By: kermalis <kermalis@users.noreply.github.com>
2020-02-22 19:47:25 -08:00
Kurt
4116fb5b9b Fix sprite format for gen3
Closes #2725

Fix crash if canceling the FRLG version select

Co-Authored-By: Kermalis <kermalis@users.noreply.github.com>
2020-02-20 19:36:06 -08:00
Kurt
e21d108fb2 Split PokeCrypto from PKX
All logic in PokeCrypto is separate from the rest of the PKHeX.Core
library; makes it easy to just rip this portion out and reuse in other
projects without needing the entirety of PKHeX.Core logic

optimize out the CheckEncrypted to the actual path, separate methods.
Only usages of this method were with hardcoded Format values, so no
impact
2020-01-04 14:48:39 -08:00
Kurt
f07aed904d add missing pokedex offset spoof for gen3 saves
https://projectpokemon.org/home/forums/topic/55704-drag-drop-to-boxes-not-working-in-blank-gen-3-save/
ty ICanSnake
2019-12-05 23:08:01 -08:00
Kurt
522d219b3c Re-cap berries at 999
Closes #2414 , thanks @SatoMew !
2019-11-15 18:06:31 -08:00
Kurt
d59764f25f
Fix keyitem reference
Closes #2410 ty @PKMWM1
2019-11-01 23:12:31 -07:00
Kurt
9401b7a790 More readonly struct tweaks
help dat compiler
minor clean elsewhere
2019-10-26 23:18:25 -07:00
Kurt
46640d48a3 Misc clean
un-nest classes,
move some logic to core,
update some get-only properties that return arrays to methods
2019-10-26 12:58:55 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07:00
Kurt
d4ce0644c8 Simplify block property names
[...]Block -> [...]  since it's kinda redundant, we already know by its
type.
Rename offset ints that collide
2019-10-18 20:42:03 -07:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum

* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case

* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable

* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator

* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever

* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
d3b0c392b2 Minor tweaks
no functional change
2019-10-03 22:21:33 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
b81a1e1e29 Refactoring
Increase abstraction for arbitrary slot get/set operations, and fracture
SAV4 behavior for each game type.

Adds: Undo/Redo of party slot changes
Fixes: Fixed Gen5 daycare slot 2 reading, and EXP reading
Fixes: Some slot color glitchiness
Fixed: Box layout editor now hides the flag label if no flags are
present
Fixed: Gen7 box flags are now shown (unknown purpose lol)
Changed: savefile objects are generally smaller (removed a few shared
offset fields)
2019-09-02 19:30:58 -07:00
Kurt
9c58903f55 Fix blank sav3 : sapphire init
lol it's been this way for 7+mo
Closes #2369 ty @CorvusAtrox !
2019-08-04 00:59:59 -07:00
Kurt
a608e0b252 Minor clean
Remove some unnecessary properties from SaveFile
Enumerate checksum flag results for GC memcard checking
Remove unnecessary checks on savefile type
Add some documentation
Decapitalize some method parameters
2019-07-14 15:06:45 -07:00
Kurt
1b028198ad
Split gen5-7 saves with inheritance (#2319)
refer to pull request comments for summary
2019-06-08 19:56:11 -07:00
Kurt
2b8ef9236a use some explicit dex numbers as enum 2019-06-01 10:22:49 -07:00
Kurt
0dc45c00ec Check block index before calculating
Missing/Duplicate blocks (???) result in -1, so skip them.

https://projectpokemon.org/home/forums/topic/52437-cant-export-unmodified-sav-file/

replace linq with manual allocation
2019-04-27 17:19:54 -07:00
Kurt
609db23dc5 Consolidate pouch load/set 2019-03-30 16:10:14 -07:00
Kurt
bb8cf5d3d8 Simplify get/decrypt pkm access 2019-03-29 19:43:33 -07:00
Kurt
4650a6f5b5 Reduce sizes 2019-03-22 21:19:47 -07:00
Kurt
b1ead9e630 Split StringConverter into smaller pieces
reduces loading time (don't have to allocate conversion arrays when
launching a gen7 game), and separates things to easier to manage
locations

reworks gen3 string encode/decode, no longer does 3->4->5 and 5->4->3;
instead goes straight to the end result without an intermediary format.

String sanitization should probably be broken up rather than reused, oh
well.
2019-03-20 21:50:44 -07:00
Kurt
13a6d16cb9 Relocate checksum/dexform logic 2019-03-16 12:01:21 -07:00
Kurt
ee787a0f71 Fix HoF size check
now matches the code in ChecksumsValid (< instead of <=)
2019-03-07 15:45:51 -08:00
Kurt
bb2c7e22cb Add HoF checksum verification and saving
Thanks @av🥑cado#0315 (discord)
2019-03-02 09:16:03 -08:00
Kurt
40963c012a Add sav3 BP Earned editing
misc editor, first tab (main)
2019-02-19 20:59:47 -08:00
Kurt
fa4318ae2f Add gen3 record editing
in misc edits window
2019-02-19 20:46:58 -08:00