Commit graph

1056 commits

Author SHA1 Message Date
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
ad6728fb5c Minor tweaks
Check egg encounter for state rather than re-deriving some properties on the fly
Only check memories if memories are exposed
Remove debug assert (not always true?)
2020-08-04 22:56:55 -07:00
Kurt
02b4343827 Update SAV3XD.cs 2020-08-02 08:25:04 -07:00
Kurt
ff95c734a2 Don't set strategymemo back
Closes #2956
if someone wants to tidy up XD support later, feel free to uncomment and get it working reliably :P
2020-08-01 09:28:35 -07:00
Regnum
9e40fa132f
Improved Pokewalker Editing (#2958)
* Added PokeWalker Courses, Watts, and Steps editing

* Use util method for getting bitflags

* Keep old cheat method

Change signature so that the default value passed is to unlock all; can pass 0 instead to lock all

* Pass reference to derived sav4-type object

Wev'e already type-tested once, capture the reference and pass it into the appropriate load/save methods.

* Add control anchoring for window resizing

Also widen the labels for localization (longer strings possibly)
2020-08-01 09:20:13 -07:00
Kurt
b7211000b0 Split Country/Region/ConsoleRegion from ITrainerInfo
Only present in mainline gen6/7 game pairs, so it's not wise to have it for all games
2020-07-31 13:53:42 -07:00
Kurt
8a51bd7f28 Don't modify strategy memo
Can't correlate the structure to the data it's reading, so don't modify the values until someone figures out how the data is stored & how it should be manipulated.
Closes #2941
2020-07-29 13:37:17 -07:00
Kurt
4909256414 Split shadow info entry to separate files
#2941
add IV fields
2020-07-29 13:36:33 -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
e4092e64df Relocate gen3 ereader berry logic 2020-07-18 22:51:55 -05:00
Kurt
a21bb09c37 Perserve & Display Favorite flag for items
Also clamp give all for TMs to 1 instead of whatever the giveall value is, like for prior games' HMs

reuse the "free space" bool; no real benefit in increasing the amount of abstraction (even though that's my current urge for legality)
2020-07-18 20:15:41 -05:00
CanoeHope
455a787ee4
Add MomSkin to League Card (#2936) 2020-07-11 09:22:19 -05:00
CanoeHope
8027fe30b9
Add ArmorDex complete League Card marker (#2935)
Should work even if you don't have the Expansion Pass. Of course you need the latest update.
2020-07-10 07:42:44 -05:00
CanoeHope
0dc4166e67
Add new SWSH blocks (#2918)
For anybody interested in this League Card block structure: https://pastebin.com/1gkyHe9Q

Also correct the game version record block location.
2020-07-02 21:28:04 -05:00
Kurt
afdd40bcee Check counter rollover the opposite way
FFFF and 0000 -> prefer 0000
FFFF and 0001 -> prefer 0001
...
FFFF and FFFE -> prefer FFFF

they shouldn't be desync'd (incremental); only the uninitialized case is important to handle.
2020-07-02 17:44:03 -05:00
Kurt
9da5263a52 Handle DLC1 records
Accessible in block editor, not as the usual trainer records.

Closes #2913 , ty @CanoeHope!

Co-Authored-By: canoehope <canoehope@users.noreply.github.com>
2020-06-30 23:00:48 -05:00
Kurt
0198179133 Add fixed raid news content
no change in species/form from the crownite ore one afaik; common for both games???

fix type of rigel encount so it shows up in block editor, with correct name (ty matt)
2020-06-29 21:10:12 -05:00
Kurt
fec91e4878 Revert "Show new trainer records"
This reverts commit 19ff1f584a.
2020-06-28 13:44:26 -05:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -05:00
Kurt
a7ba178005 Remove unreachable/const logic
Earlier compares result in some logic being unnecessary

The Gen7 level up move compare was actually an oversight, so it's a worthwhile fix :)
2020-06-27 22:44:14 -05:00
Kurt
19ff1f584a Show new trainer records
#2913
2020-06-27 13:48:45 -05:00
Kurt
105d8f415d Remove unnecessary abstraction/leftovers
SCBlock doesn't have an absolute index; it was only used for tagging in dumps. Offset and Length weren't used.

Removing these 2 ints from the SCBlock object reduces alloc req by 8 bytes each; if we have 2,500 blocks in a save file, this reduces the memory footprint of a sav by 20KB. Nice side effect :D

Remove block dump comment from accessor; new logic in Meta8 for dumping DLC sizes does the same logic with less hassle.
2020-06-27 13:38:21 -05:00
Kurt
93f4bf1977 Add normal_encount_rigel block label
Closes #2899
2020-06-27 13:27:35 -05:00
CanoeHope
5b8d1cb681
Added IoA Restricted Sparring Blocks (#2900)
If you edit in a number of 5 or greater as one of your streaks you'll get a crown mark next to that type in-game, and doing it for all should allow for you to get Mustard's uniform when you talk to the receptionist.
2020-06-23 12:02:33 -05:00
Kurt
a2d9f06350 Differentiate AbilityType from AbilityNumber
invert ability index favoring so that the first ability index is most favored

ability num:
-1=>0/1/2
0=>0/1,
1=>0
2 =>1
4=>2

Ability Type:
0,1,2=>0,1,2
3=>0/1
4=>0/1/2

Should probably get rid of AbilityNumber definition usage but it's so entwined in the trade/static definitions...
2020-06-22 22:01:42 -05:00
Kurt
4a5abab51f Fix raid dump syntax
Closes #2896
2020-06-22 21:28:02 -05:00
Matt
ed7d32f9bb
Fix Gigantamax1 get/set in Zukan8 (#2897)
Bit 0, not bit 1.
2020-06-22 13:06:25 -05:00
CanoeHope
3dcf24dade
New SWSH Block Data (#2890)
* New SWSH Block Data

Found these pretty useful blocks for IoA. I'll maybe look into Restricted Sparring data in the next week or so if no one else does by then.
2020-06-20 21:50:50 -05:00
Kurt
b53a29a0af Add flag for urshifu-1 gmax pokedex
ty @sora10pls
2020-06-20 20:00:35 -05:00
Kurt
1ab7c916ce Clear mega slowbro seen 2020-06-20 14:31:47 -05:00
Kurt
3e21924adc Document some save sizes 2020-06-20 12:08:51 -05:00
NPC-C83H
64be77f46c
Update legal raid counts (#2878) 2020-06-20 08:16:36 -05:00
Kurt
808ca8f307 Add a temp size that isn't 100% dlc sized
dunno what RoC did but it exists?
2020-06-19 19:58:56 -05:00
Kurt
36dd5ece21 Initial Isle of Armor support
Co-Authored-By: sciresm <sciresm@users.noreply.github.com>
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
Co-Authored-By: Archit Date <architdate@gmail.com>
2020-06-19 18:51:15 -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
97d8bcebfe Only check Korean if game isn't recognized as Crystal
https://projectpokemon.org/home/forums/topic/57203-pkhex-error-crystal-save-dont-load/
2020-05-31 09:18:45 -07:00
Kurt
51a4001ce6
Update RaidSpawnList8.cs 2020-05-29 11:20:28 -07:00
Kurt
7f1039d155
Update RaidSpawnList8.cs 2020-05-29 11:19:49 -07:00
Matt
4d47e4ab83
Pretty up GP1 summary/filename (#2846) 2020-05-29 11:13:49 -07:00
Kurt
afa368823e Minor clean
handle some compiler messages
2020-05-26 16:59:47 -07:00
Kurt
043ba3b6f0 Add ability to sideload key names 2020-05-26 15:58:48 -07:00
Kurt
46b443903d Fix SM dex form fetch for spewpa
Closes #2826

It doesn't find it in the SM table, but didn't return -1
rework logic flow to return when found, rather than after loop finishes.

Also fix display off-by-1 since we're not using zero indexing for our entry numbers.

Thanks @Ammako !
2020-05-24 20:42:45 -07:00
Kurt
9619306a8f Update BattleTree7.cs 2020-05-24 18:42:08 -07:00
Kurt
09cbe47240 Add battle tree scout edits
Closes #2833
2020-05-24 18:31:52 -07:00
Kurt
053eef2767 Add encount block
Closes #2840 -- access via Block Editor "Encount"
Tons of undecipherable junk in the roamer struct; looks like a mishmash of past gen code repurposed for their pseudo-stationary|roamer encounter.

ORAS has the same structure (same size/block), but the roamer portion isn't used
2020-05-24 17:31:10 -07:00
Kurt
8ce4f64239 Move files to their correct location 2020-05-24 17:11:39 -07:00
Kurt
bbe1cf3ee1 Fix gen6 gamesync ID read 2020-05-24 17:10:55 -07:00
Kurt
64428539bd Fix sav4 active block detect
Closes #2697 ty @Ammako !

lazy slice check has flaws; just compare the major/minor counters in the save footer and check the uninitialized cases

nobody is gonna save the game 2^32 times, but check for the overflow case too!
first ff'd is preferred when the second is ff'd-1!
2020-05-23 22:17:03 -07:00
Kurt
460062a07c add generic sav block editor 2020-04-26 16:23:06 -07:00
Kurt
6cce57d505 Add configsave to accessor
xy battle background makes up the other 5 bits; good to know!

reorder enum to match comments in properties (switch=0)
2020-04-26 15:17:58 -07:00
Kurt
ca48b4e617 Fix nick set
Closes #2817
2020-04-25 17:18:04 -07:00
Kurt
cc3681c41d Update SAV6AO.cs 2020-04-16 16:38:01 -07:00
Kurt
d6171669e4 Add swsh box wallpapers
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-04-16 14:50:41 -07:00
Kurt
47819a87c4 Update SaveBlockAccessor8SWSH.cs 2020-04-16 14:21:11 -07:00
Kurt
70e7c01896 Add more block-key settings
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-04-16 13:37:48 -07:00
Kurt
3100471299 Strip out some unnecessary logic
notnull => no need to check for null manually
2020-04-16 12:58:48 -07:00
Kurt
66dddc9101 Clean up some method parameters 2020-04-14 10:59:36 -07:00
Kurt
546412e410 Rename class/method name 2020-04-14 10:59:16 -07:00
Kurt
ee1cfa8912 Hanle some compiler messages 2020-04-14 10:52:19 -07:00
Kurt
8936c58417 Skip setdex/modify on box sort 2020-04-14 10:46:21 -07:00
Kurt
33bdacebe8 Minor tweaks
Handle some compiler/extension suggestions
2020-04-12 16:07:59 -07:00
Kurt
0ada4cbd77 Remove some unnecessary null checks 2020-04-12 13:20:40 -07:00
Kurt
270d984130 Minor clean
Remove unnecessary null checks
Mark some methods with nullable type
2020-04-04 19:30:50 -07:00
Kurt
d65338557e Add hp stat 2020-03-24 11:44:54 -07:00
CanoeHope
df09868470
Add another SWSH block (#2793)
Nothing special. Just found it and figured why not add it.
2020-03-19 11:38:17 -07:00
Kurt
287a2ac5c5 Rework handling of bk4 constructor
Can't really detect if it's shuffled or not; just assume it's always unshuffled unless it originates from a save file read. Probably not a perfect solution, but achieves better results.

https://projectpokemon.org/home/forums/topic/56217-error-in-archive-bk4/
2020-03-18 23:34:53 -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
1c6b99185d Ignore bits above the first 3
Some save files use bits 3-7?
2020-03-15 11:11:55 -07:00
pi1024e
8a1e73e5b3
Change OT_Class to have an expression body (#2759) 2020-03-13 10:28:50 -07:00
Kurt
b68e9472cb Break apart value fetch -> compare
easier to debug
2020-03-12 15:05:59 -07:00
Kurt
fbd533092d Fix misspelling of the word "Received"
Closes #2757

Co-Authored-By: pi1024e <pi1024e@users.noreply.github.com>
2020-03-12 15:05:34 -07:00
Kurt
eb01591861 Remove duplicate method
Extract magic number 0x40000
2020-03-11 21:09:36 -07:00
Kurt
0aa6282d73 Sanity check value types via generic method 2020-03-11 16:31:53 -07:00
Kurt
f9bbeba3ad Add get/set for swsh current box
Closes #2742

Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-03-10 23:18:51 -07:00
CanoeHope
e51df9855d
Add blocks for NPC and Friend League Cards (#2741)
* Add blocks for NPC and Friend League Cards

* Update SaveBlockAccessor8SWSH.cs
2020-03-01 00:47:56 -08:00
Kurt
4fb33413e3 Only set display shiny of not owned
Closes #2740 ; we don't want to set display shiny if it's not shiny

we only want to set display-shiny if (!owned && shiny)

Co-Authored-By: canoehope <canoehope@users.noreply.github.com>
2020-02-28 17:35:50 -08:00
Kurt
d80d1598dc Only set displayed form if not previously owned
Closes #2739
2020-02-28 15:31:26 -08: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
0d4cff81c6 Clean 2020-02-15 14:29:23 -08:00
Kurt
3ce590aca8 Don't clear FormArgument on set to box slot
Closes #2706
removal of isParty prevents the erroneous force-0 behavior

Co-Authored-By: Russell Jones <questiondesk@gmail.com>
2020-02-13 16:35:37 -08:00
Kurt
9f6d234c53 Fix hgss box wallpaper read
lol oops
Closes #2698

Co-Authored-By: ammako <ammako@users.noreply.github.com>
2020-02-11 23:24:03 -08:00
CanoeHope
7ab128de89
Add SwSh Birthday blocks (#2696)
Because the Switch doesn't have a feature to internally store your B-day like the DS and 3DS does, you set it in-game by the "Fortune Girl" right in front of Wedgehurst's PokeCenter in month and day.
https://www.serebii.net/swordshield/birthdays.shtml
2020-02-10 18:14:20 -08:00
CanoeHope
acb9cc2a9d
Add Gender to Gen 8 Trainer Card (#2694) 2020-02-10 12:02:52 -08:00
Kurt
1bf22467de Add Rental Team (gen8) reader 2020-02-07 17:23:26 -08:00
Kurt
d52366b0d5 Add download rules/comp block labels
https: //projectpokemon.org/home/forums/topic/56121-swsh-blocks-and-save-research/
Co-Authored-By: pp-theslayer <pp-theslayer@users.noreply.github.com>
2020-02-07 16:32:05 -08:00
Kurt
a73f14836d Add HoF time block accessor object
Not gonna add it to the interface
Closes #2691

Co-Authored-By: canoehope <canoehope@users.noreply.github.com>
2020-02-07 15:59:36 -08:00
Kurt
c08cf9c95f Add rental team hashes
Co-Authored-By: Archit Date <architdate@gmail.com>
2020-02-07 15:33:53 -08:00
Kurt
7866958af8 Add dynamax crystal type, exclude from activation
Closes #2690

Co-Authored-By: slp32 <slp32@users.noreply.github.com>
2020-02-07 10:16:27 -08:00
Kurt
cc05a38548 Clear team slots on blank load
Closes #2688
2020-02-06 20:11:58 -08:00
Frank
e5286f3325
RaidSpawnList8 fix DenType and Flags (#2686)
* RaidSpawnList8 use enum RaidType for DenType

fix IsWishingPiece and add WattsHarvested

* Add check between RaidType.Event and IsEvent flag
2020-02-06 17:12:26 -08:00
Kurt
a004b301d0 Add record count incrementing for sav8
Closes #2685 ty @CanoeHope
2020-02-05 19:42:46 -08:00
Kurt
bc45660f99 Update legal raid clamp
https: //github.com/kwsch/PKHeX/issues/2681#issuecomment-582215498
Co-Authored-By: slp32 <slp32@users.noreply.github.com>
2020-02-04 19:06:33 -08:00
Kurt
2e1528b199 Merge branch 'master' of https://github.com/kwsch/PKHeX 2020-02-04 16:55:42 -08:00
Kurt
7e6cae4004 Clamp activating raids to available indexes
Closes #2681
2020-02-04 16:55:40 -08:00
CanoeHope
9b172d2666
Correct Day offset (#2679)
a1ae14325a (commitcomment-37103852)
2020-02-04 07:35:02 -08:00
Kurt
0e1fd49be1 Decrement runtime language if appropriate
Closes #2674
2020-02-03 19:16:30 -08:00
Kurt
a1ae14325a Add more block documentation
Ty @CanoeHope !
Closes #2677

To edit these values, use the Block Data editor and select the *Object Trainer Card

Co-Authored-By: CanoeHope <canoehope@users.noreply.github.com>
2020-02-03 18:56:35 -08:00
Kurt
b31f0428cf Add raidtype docs & wishing piece indication 2020-02-02 10:21:34 -08:00
Kurt
43036e7e94 Add team index recognition
lock by default until we find the location that locks team slots
2020-02-01 18:56:23 -08:00
Kurt
b35d53368f Sort blocks by initial value
allows some lumping of similar-value blocks for easier analysis
2020-01-28 19:08:26 -08:00
Kurt
ee5c033b51 Add dlc block annotations
ty @pp-theslayer
https://projectpokemon.org/home/forums/topic/56121-swsh-blocks-and-save-research/

add another array detail
2020-01-28 16:21:11 -08:00
Kurt
c301ce88ab Update Random to be a bit more thread safe
Random isn't thread safe; users of PKHeX.Core.dll might run multithreaded operations (see PKSM + ALM), so we need to have a thread-specific RNG available.

Thread Local get; to improve performance, save the random object locally whenever it is used more than once in the method.

https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadlocal-1?redirectedfrom=MSDN&view=netframework-4.8
https://stackoverflow.com/questions/18333885/threadstatic-v-s-threadlocalt-is-generic-better-than-attribute/18337158#18337158
2020-01-25 21:49:52 -08:00
Kurt
527442bb49 Only fetch strings when required for compat check
if item == 0, don't bother checking. Fetch strings only if there's an issue with the item.
2020-01-25 12:16:45 -08:00
Kurt
9b6a10df46 Extract metadata-reflection class to PKHeX.Core
separate GUI logic from non-gui logic :)
2020-01-24 17:57:47 -08:00
Kurt
92d1ccf3d9 Fix Pokewalker course unlock all
write to correct location
https://projectpokemon.org/home/forums/topic/56084-pokewalker-courses/
2020-01-24 17:10:53 -08:00
Kurt
46156b48c6 Add missing generation to accessor type name
Now matches Interface declaration style (iAccessorGenGame), and is consistently named with the other accessors already using the same naming style
plus they are now ordered in the file tree :)

no functional change
2020-01-23 23:22:54 -08:00
Kurt
fb02295c70 Use object block names in diff 2020-01-23 23:19:38 -08:00
Kurt
12244909ba Split off SCBlock-logic from SWSH accessor
In case a future game uses this same setup.
2020-01-23 23:16:09 -08:00
Kurt
2adbca628b Add raw value edits
Not done for Array types or Object types
muh reflection, such spooky

mark Offset as non-browsable so it doesn't show up in propertygrid if the block is being edited by a grid :)

I imagine a struct-type-sensitive array property grid edit could be done via Buffer.BlockCopy to a dest array, but there's so few Array blocks... so meh
2020-01-23 21:30:39 -08:00
Kurt
a88c7c4800 Add more trainer card/status fields & stats
Closes #2658 ty @CanoeHope !
Mostly just serves as documentation; with the amount of fields being editable increasing, hard-coded GUI might not be optimal here. I'm thinking something like a PropertyGrid based on the selected block which will pull up the Block object if the key matches... for fields, something like a dynamically populated list or something.
2020-01-23 18:31:10 -08:00
Egzon
a5985536e2 Miscelanous fix on Underground Scores (#2657)
* UG scores are uint32, with max value up to 999999.

* fixing label position

* another positioning fix!
2020-01-23 16:37:39 -08:00
Kurt
ba5cc26e83 Add indication to which blocks changed
Use reflection to grab all const declarations (private and public), and grab the name of that const. Whenever that block is mentioned in our diff, use the name instead of the key.

Helps identify what changed / remove noise if you don't care about that block.
2020-01-22 17:06:23 -08:00
Kurt
4ea2be250f Add TitleScreen8 and Trainer Card team structs
Closes #2653 , ty @CanoeHope !

Editable from the Trainer Info button, comes with a Copy From Party button for each.
2020-01-21 23:23:27 -08:00
Egzon
9cce65e937 Fix Subway Super checks (#2652)
Oops, it's actually a byte...
2020-01-21 11:00:09 -08:00
Kurt
b84cae9ff5 Fix box name write for sav8swsh
only used via the view-all-boxes popup when switching boxes
ty anubis!
2020-01-20 22:04:52 -08:00
Kurt
6fdc71b2e4 Update tower record set
Record ID const declaration for reuse
Change 255->300 for streak max
Set record as well (ignore currently set value if modified via dropdown)
Closes #2649

Not sure if Money and BP can get a similar record-set treatment.
2020-01-20 18:16:46 -08:00
Kurt
40e5cd66da Add block diff for swsh, add bool type toggle
Apparently my copypaste of the class didn't delete all the old unused controls. Ha!

Move non-gui logic to core as separate classes, in case ppl wanted to reuse them in their own projects.
2020-01-19 22:29:50 -08:00
Kurt
a98ca2351d Don't SetValue to block if not exportable
blank saves do not have the type metadata for the blocks that are spoofed, nor do they have all blocks spoofed.

I suspect things might get more difficult as more value-blocks are identified, which would throw a wrench into things. We'll figure that out at that time :)

Add a test to ensure that the blank save can be created correctly

Closes #2644
2020-01-19 10:25:40 -08:00
Kurt
4567bba03f More elegant block read/write
Removes TONS of unnecessary allocations, and is more simple
2020-01-19 00:55:10 -08:00
Kurt
0244cc7489 Add more info to exception message
Closes #2644
2020-01-18 19:44:34 -08:00
Egzon Qukovci Jusufi
ab5016bf7d Add Subway Scores edition (#2643)
* Add Subway Scores edition

* Changing the offsets handling

Simply use the block offset as the base and add them to it. Also allow edition on B2W2.
2020-01-18 19:31:36 -08:00
Kurt
643c0c1cc7 null/empty check -> check both 2020-01-18 17:33:19 -08:00
Kurt
843330a375 Remove unnecessary null checks
this is a null free project /s
dont provide null, else u deserve to get an exception
2020-01-18 16:57:25 -08:00
Kurt
40c2c483fb Common1-3 => Bool1-3
Blocks that use Bool1/2 toggle to the other state; evident when comparing between two different saves. The key doesn't change, only the Type is toggled.
2020-01-18 14:19:01 -08:00
Kurt
9b0b0cb1a6 Add misc value r/w for trainer8
Closes #2639
casting object to generic T : struct isn't valid, so just cast the get/set appropriately
2020-01-17 23:25:02 -08:00
Kurt
2a7d475b5b Rearrange key list, add syntax sugar methods 2020-01-17 21:53:51 -08:00
Kurt
e4e1681e1c Clamp roto rally score to 99_999
https://github.com/kwsch/PKHeX/issues/2639#issuecomment-575863541
2020-01-17 21:09:54 -08:00
Kurt
e3cafe5cd6 Relocate getsize to extension method
use sizeof for clarity, add test to ensure bool size is 1 byte (which is always true)
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/sizeof
2020-01-17 21:09:26 -08:00
Kurt
a590d3713b Refine enum with TypeCode names
Add GetValue/SetValue/GetType extension methods
2020-01-17 18:59:45 -08:00
Kurt
41f909c08a Add Roto Rally score, copy Jersey # to other block
Closes #2635
2020-01-15 20:48:19 -08:00
Kurt
a6aabcdc96 Split out a method before crypto step
Allows for capturing the obtaining the raw decrypted data via the PKHeX.Core api
2020-01-13 19:03:27 -08:00
Kurt
7e6edbaded Remove unnecessary constructor
Make key readonly
2020-01-11 14:18:11 -08:00
Kurt
62c35194c3 Remove unnecessary form duration code
probably misinterpreted the furfrou/hoopa stuff; probably is "SetMaxFormDuration"
d3f6d5935f (commitcomment-36754955)

ty @CanoeHope
2020-01-10 22:16:30 -08:00
Kurt
2915692daa Use more performant block lookup strategy
Rather than storing a dictionary of keys, we can abuse the fact that the SCBlock[] is stored in order of ascending block key.
Binary Search doesn't require extra memory like a Dictionary would; also, we only need to find a few blocks.
2020-01-09 19:00:49 -08:00
Kurt
3fa44361e6 Update block fetch & blank init
blanks: {key,size}
fetch: get block by key (index isnt the same between patches, as blocks with different keys get added). The savefile stores them as a SortedDictionary (by key), hence the shifting.
2020-01-09 08:59:26 -08:00
Kurt
bbd1aff5fe Add new lengths
new format still crashes as block absolute index is now different
should do a different way of loading blocks (key instead of index)
2020-01-09 08:17:41 -08:00
Kurt
3d581283c2 Minor clean
move Text.cs manual Courier new() to the designer, have it dispose when form is disposed. Set it as the numericupdown's font and just reuse that :)
2020-01-05 18:46:30 -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
f4bafe0809 Add extension methods for gym team get/set for all
Closes #2607

SAV6XY/AO had GymTeams get/set, this now makes similar logic accessible
for even SAV5BW/B2W2.
2019-12-28 22:32:45 -08:00
Kurt
be50abcc44 Add SubEventLog block object, etc
Adds gym team records, remove from savefile properties
update block list documentation
2019-12-28 21:53:58 -08:00
Kurt
0ce6254cee Add GymTeam records for Gen5 saves 2019-12-28 21:51:10 -08:00
Kurt
f65e0a96a7 repoint sav4 event constant reads
should work fine now
2019-12-27 18:30:39 -08:00
Kurt
9ee2b08ce5 Update rare flag logic
Closes #2601

Add ComponentModel attributes for properties, add u64 typeconverter for
propertygrid
2019-12-26 13:39:07 -08:00
Kurt
06348096aa Fix block de-referencing issue
SCBlock is an input to the individual save blocks; changing the SCBlock
byte[] reference won't change the individual save block reference. Just
copy the data and keep the original reference instead.

Repro: trainer data editor, save-close window, then delete a slot.
Export save; reload. Changes to box data were using old byte[]
reference, and didn't get repointed. Works fine with latest commit now.

I think I wanted to avoid copyto since it's slower than just a reference
change; but that didn't work out perfectly :)
2019-12-25 23:24:40 -08:00
Kurt
0a8c791e10 Pad with null terminators rather than 0
Can have a single digit (not forced to 3), so null terminate I assume.
2019-12-25 21:31:49 -08:00
Kurt
97c3c6b610 Add raid/den detail browser
Hold alt when hitting activate all to dump instead
I've seen DenType=5 Event=2 for at least one raid so far... not sure if
the event/rare properties are accurate.
2019-12-23 23:30:21 -08:00
Kurt
ce463d057a Add Pikachu Beach Score editing for YW saves
Closes #2585
2019-12-21 15:17:05 -08:00
Kurt
4bf71de621 Minor clean
automatically update total_watt if insufficient
SAV8 is not SAV8SWSH
#2583
2019-12-12 22:58:18 -08:00
Atzgi
d9c59666e0 Add watt in trainer data editor (#2583) 2019-12-12 16:27:01 -08:00
Kurt
8acb336d51 Use enum for species comparisons
slightly easier to read with named values
2019-12-08 17:39:19 -08:00
Kurt
7b6d2bfa48 Fix trainerID trainer card write 2019-12-06 16:59:54 -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
65b921f806
Only apply 3DS geoloc data for 3DS blank saves
Closes #2560

Different logic in SimpleTrainerInfo applies it to <=Gen5, but that's fine... 414cb2d39e/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs
2019-12-04 14:00:53 -08:00
Kurt
f45d730faf Add TrainerID for trainer card
Closes #2556
2019-12-03 19:54:34 -08:00
Kurt
e9b9141eda
Fix property name typo
efec331741 (r36246093)

ty @AnalogMan151
2019-12-03 10:39:57 -08:00
Frank
efec331741 add some customization options in MyStatus8 (#2552) 2019-12-02 13:40:09 -08:00
Kurt
89b4bc81b9 Update raid structure unknowns 2019-11-29 18:48:12 -08:00
Kurt
3c4e668d9a Add alcremie formArg gui
Closes #2538
Standardize nomenclature as FormArgument, add interface for those
exposing the property.
2019-11-29 10:44:52 -08:00
Kurt
48a87397ec Split daycare8 to its own file
Add method to fetch daycare seeds from metadata
2019-11-28 21:13:53 -08:00
Kurt
f25b36a306 Minor tweaks
Remove unused stuff
add some comments/xmldoc
Move Trainer1 to classes that use it
2019-11-28 14:00:55 -08:00
Kurt
c81edac9e5 Fix CGB import
Trainer1 now unused for this class
Closes #2533
2019-11-27 18:33:30 -08:00
Kurt
d3bd37a950 tweak last saved string format
ty @sora10pls for testing
2019-11-26 23:10:28 -08:00
Kurt
bac6032152 Update last saved parsing
year is years-since-1900
month is months-since-jan (jan=0)
2019-11-26 19:15:05 -08:00
Kurt
6627d7e2f4 Minor clean 2019-11-26 10:45:36 -08:00
Kurt
6987edd7a3 Simplify expression
no allocations
2019-11-25 23:34:49 -08:00
Kurt
c0270b18e4 Add trainer card number editing 2019-11-25 23:26:01 -08:00
Kurt
87a498ac05 Add flag api 2019-11-25 22:50:53 -08:00
Kurt
67565aa71d Update structure note comment 2019-11-23 07:12:20 -08:00
Kurt
5a38e118e8 Add raid spawn initial docs
linq dump code I used for ez vis:
var sav = new SAV8SWSH(File.ReadAllBytes(@"D:\Kurt\Downloads\main
(7)"));
var blocks = sav.Blocks;
var raid = blocks.Raid;
raid.GetAllRaids().Dump();
2019-11-21 22:55:21 -08:00
Kurt
1ffee3de02 Add raid/fashion block accessors
set breakpoint at end of ctor... immediate window dump:
System.IO.File.WriteAllBytes(@"E:\raid.bin", Raid.Data);
2019-11-21 22:26:24 -08:00
Ammako
ee9c91e893 Add G4 Box Flags (#2478) 2019-11-20 11:39:31 -08:00
Kurt
1538f04dce Remove unnecessary logic
rip return frustration, don't need to consider this
2019-11-19 08:15:58 -08:00
Kurt
86796cd67a Add accessor for TrainerCard block 2019-11-18 17:57:33 -08:00
Kurt
adf33404b3 Add Trainer Card block 2019-11-18 17:57:18 -08:00
Kurt
fac5182d4b Add a ChangeAllCount to current value dropdown 2019-11-18 16:25:27 -08:00
Kurt
5cf58dbb5f Fix dex clearing on setting altform/gender 2019-11-18 16:21:11 -08:00
Ammako
acf5df07be Box Layout fixes (#2449)
* Enforce box name length in Box Layout

* Fix G4 box renaming

* Fix G7 box renaming
2019-11-18 16:01:36 -08:00
Kurt
2c11632a3c gen6 Un-truncate box names
Closes #2445 ty @Ammako
2019-11-17 20:41:40 -08:00
Kurt
fa169ff61c Fix box binary / pcbin export
19784aaa41 (diff-37bd5b548e2b340e5c38fd0961a3eb04L880)

Was just exporting blank data, lol

https://projectpokemon.org/home/forums/topic/55436-issue-with-box-data-binary/
2019-11-17 14:04:04 -08:00
Kurt
d077d8549e Add alcremie form display for dex edit
Nothing for the PKM Editor; not sure how I want to handle the reused
FormDuration work value.

For the meantime, just use the Batch Editor for a targeted write.

Closes #2441
2019-11-17 09:34:04 -08:00
Kurt
08c1534cee Lock sha256 for multithreaded use
Opening the database can result in multiple threads trying to hash at
the same time with the same sha256 object, so just gate it behind a lock
2019-11-16 15:46:45 -08:00
Kurt
025cf69eeb Switch pkm export formats to party format
Now dumps party format bytes
Cons: more space
Pros: stats are retained, especially when users drag-drop.

Closes #2419
2019-11-16 14:03:25 -08:00
Kurt
22fb1c8e8f Fix - show daycare tab on sav5/7
Closes #2434 thanks @Ammako !
2019-11-16 13:19:41 -08:00
Ammako
6d61a97247 Fix Gen. 2 key items and balls (#2432) 2019-11-16 13:15:09 -08:00
Kurt
0716e50fd6 Add Gigantamax owned flag logic
Closes #2430 ty @igniscitrinus !
2019-11-16 13:10:46 -08:00
Kurt
83388cc6fe Add missing memecrypto clear
See the SAV7SM.cs constructor... yeah oops!

A hotfix has been posted (committing after I upload!)

Closes #2415 thanks @Ammako !
2019-11-16 11:44:48 -08:00
Kurt
b172008981 Fix Check All behavior
- Gender specific forms now set the correct flags
- Regular click on Check All doesn't set shiny flags
- Shift click on Check All sets shiny flags too.

Closes #2425 thanks @igniscitrinus !
2019-11-16 09:28:32 -08:00
Kurt
19784aaa41 Update box format size get
fixes importing and exporting concatenated binaries
2019-11-15 21:01:22 -08:00
Kurt
522d219b3c Re-cap berries at 999
Closes #2414 , thanks @SatoMew !
2019-11-15 18:06:31 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
d59764f25f
Fix keyitem reference
Closes #2410 ty @PKMWM1
2019-11-01 23:12:31 -07:00
Kurt
a6b6383538 Handle more messages
un-nest some classes, tooltip/menu disposing
2019-10-27 20:39:15 -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
fcc993784b Rename abstract pkm inherited class names
leading underscore for a class name = pls no
2019-10-26 12:42:33 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07:00
Kurt
64a5c30356 Add 4th uint of fashion data
struct is really 16 bytes, and female uses 8 bits of the final uint
Closes #2407
2019-10-25 19:54:50 -07:00
Kurt
4be35890e7 Make some usages generic 2019-10-24 18:10:23 -07:00
Kurt
12a8dc66b6 Fix displayed bit set for gen6
Zukan5/6 was pushing 0 for the formBit, which was an incorrect value. I
probably should have abstracted things since gen5/6 don't behave the
same as gen7

rewrite the SetDisplayedFlag for more clarity, and to early-return
without checking displayed state if the flag is being cleared.
2019-10-19 18:24:37 -07:00
Kurt
923b581fed Fix language flag set
looks like it was unfinished
2019-10-19 18:18:44 -07:00
Kurt
f77f0e8a4b Keep gen6 dex form flags
oops, forgot to include ...(+ i)

ty @Ammako

https://projectpokemon.org/home/forums/topic/55244-pokedex-displays-shiny-version-of-transfered-pokemon/?do=findComment&comment=249665

no need to set editing flag as I'm not changing anything

have sav6xy use the sav6xy accessor interface instead of the main one
2019-10-19 17:38:01 -07:00
Kurt
3b0fd81aae Rework & fix party slot deletion
Two birds with one stone:
- sav4 doesn't use Data (instead uses General/Storage), so we need to
use the abstracted method calls instead of trying to do things manually.
- setting a blank pkm at a party slot will decrease the party count!
don't decrease things twice.
2019-10-18 21:10:39 -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
4302347366 Show missing editors
yay useless integer stores instead of checking if an interface is
implemented
2019-10-18 20:26:41 -07:00
Kurt
abe87eb369 Relocate maison stats to block access 2019-10-18 20:13:21 -07:00
Kurt
e05d75eeb7 More training bags
giff swsh
2019-10-17 23:02:01 -07:00
Kurt
c24851129f Add super training block details & to block access
Use some properties in the super training editor, not gonna rewrite that
even though it really needs it :)
2019-10-17 20:13:17 -07:00
Kurt
cf955e9fc7 Fix sav7 init
guess I never launched this format the entire week
2019-10-16 19:08:13 -07:00
Kurt
2367fbd69a Add docs for super training block 2019-10-16 18:49:01 -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
4baf745af8 Use some c#8 sugar
static local functions
switch expressions
using usings :)

nullable next?
2019-10-07 18:40:09 -07:00
Kurt
a792e58d49 Fix poketch logic
ushort poketch_def
{
enabled:1
unk1:1
unk2:1
color:3
unk40:1
unk80:1
unk:8
}
byte currentapp;
u825] unlockedflags
...app-specific data follows
2019-10-06 20:27:34 -07:00
Kurt
d249975895 Make current box reads s8 instead of s32
https://projectpokemon.org/home/forums/topic/55168-bug-report-pkhex-unable-to-load-pokemon-platinum-save/

saves with un-initialized boxes (FF'd) have 00 FF FF FF in the first 4
bytes
2019-10-05 14:32:40 -07:00
Kurt
40db929166 Re-add resources for inventory editor
Closes #2398
2019-10-04 21:23:54 -07:00
Kurt
87f43a47d8 Bump lang version to 8
some lang upgrades
2019-10-04 20:10:50 -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
ffe3a4ba15 Relocate resource naming for sprite fetch to draw 2019-10-03 18:23:40 -07:00
Kurt
39eedb1db2 Make PCBinary a method instead of get prop 2019-10-03 17:45:19 -07:00
Kurt
c0cdf81ca5 Default LGPE backgrounds to clean
Could iterate up and use the xy special backgrounds; just keep em simple
ty @sora10pls for pointing out this unintended behavior
2019-10-02 20:11:21 -07:00
Kurt
ab0b8979e9
Add swsh content placeholders (#2392)
placeholder content until real data is dumped
2019-09-23 16:56:47 -07:00
Kurt
7819c16792 Use slice operation instead of linq chain
Reuse IsRangeAll for smdemo detect
reset dragdrop on dropping folder (early returned)
2019-09-23 15:13:22 -07:00
Kurt
78b7409e77 Use start index for writing box binary
Closes #2390 ty @PKMWM1 !
2019-09-23 15:12:03 -07:00
Kurt
a60a73e9d5 Fix unintentional overflow
oops
2019-09-22 13:56:13 -07:00
Kurt
ea5b498f8f Fix sav4 stored slot redirect
all Get*Slot fetches are now used like the Set*Slot methods.

https://projectpokemon.org/home/forums/topic/55067-box-2-bug/?do=findComment&comment=249136
2019-09-21 10:42:54 -07:00
Kurt
b41f2a3062 Extract logic from PKX
Extract Species Name logic to SpeciesName
Extract Language logic to Language
Remove FormConverter wrapper for string[] fetch
Rearrange some logic to more appropriate locations, update access
modifiers / types
Move some pkm array methods to arrayutil, make generic

PKX.GetVCLanguage was a dupe of _K12.GuessedLanguage() so just expose
the method

PKX is now back to pkm data manip only
2019-09-18 19:58:23 -07:00
Kurt
b9246ece37 Extract y2k datetime logic, also wardrobe tweak
swsh gonna have wardrobe, so rename class and relocate some logic in for
better docs
2019-09-15 22:12:32 -07:00
Kurt
229bb0d05d Merge dualbuffer into sav4
SAV3 has two general save chunks and storage

SAV4 also has the hall of fame block, which is a third block; no mo
silly names !
2019-09-14 11:39:48 -07:00
Kurt
dc10c057a0 Use correct boxdata buffer when doing box manip
Closes #2386 ; guess I forgot to finish this.
2019-09-12 19:01:06 -07:00
Kurt
0d9c18e1c6 Minor clean
dual bounds check -> single check via uint cast
pkx: keep array reference for reuse in next check
format return to second line to stick out more; lines of code are cheap
:)
2019-09-11 22:17:16 -07:00
Kurt
40cbbaa695 Relocate to more appropriate util class 2019-09-11 18:39:49 -07:00
Kurt
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
62d08d7c30 Misc clean
split some methods with optional parameters=null
add more xmldoc
replace some magic numbers -> enum/const references
consolidate common array operations (span soon maybe?)
2019-09-10 00:21:51 -07:00
Kurt
edf36e8a34 Fix sav4 checksum calc
DPPt have a footer that's 0x14 bytes; HGSS is only 0x10 (first u32 was
removed from struct).
2019-09-03 18:16:10 -07:00
Kurt
4b8082be23 Add Pokegear number editing (hgss)
Closes #2379
2019-09-02 21:24:49 -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
a133abc615 Add pokegear caller ID enum
#2379
Cheat as requested in issue not implemented yet; pending future changes
to split sav4.
2019-08-27 16:17:29 -07:00
Kurt
f0df115ccd Fix box load on uninitialized box load
Closes #2376
probably will be rewritten at a later time; am reworking the slot info
messaging for drag/drop/display
2019-08-23 18:03:10 -07:00
Kurt
bf6c25eca7 Break up SlotChangeManager logic
A little bit cleaner when the logic is separated
Keep an abstraction of BoxEdit to cache the current box contents.
Already fetched to show sprites; any future fetches (for preview text /
hover sprite) can reuse the already fetched pkm data.

Should probably rewrite this stuff completely, but effort better spent
elsewhere
2019-08-20 19:50:28 -07:00
Kurt
4f3745e3c6 Change enumerate -> array fetch to force eval
https://projectpokemon.org/home/forums/topic/54426-pkhex-error/
trycatch will trip here rather than be uncaught when evaluated later
tbh I don't like pkhex's method chain (enumerable, bool, throws), but
this fixes the error.
2019-08-14 16:45:21 -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
f462f49eec Fix sav7 map data rw
https://projectpokemon.org/home/forums/topic/54197-issues-with-newest-version-of-pkhex/
2019-08-02 15:11:22 -07:00
Kurt
9ed47cc8fd Minor tweaks, no functional change 2019-07-21 12:30:21 -07:00
Kurt
894237449b Allow differentiation between SAV2 blanks
Choosing G/S will initialize as GS
Choosing C will initialize as C
calling via their own code (GSC/GS) will choose the most recent (crystal
if possible).
Closes #2359
2019-07-14 15:13:13 -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
839500a7ee Fix medicine offset for AO 2019-07-13 17:43:29 -07:00
Kurt
82f305cd36 Fix dex gender set again
Closes #2356
update test case to actually set a genderless gender
2019-07-12 23:43:12 -07:00
Kurt
face8d64a9 Fix gen5 dexflag set
Add unit tests to check
Closes #2356
2019-07-11 00:13:52 -07:00
Kurt
c64ff5dd76 Fix sav5 behavior
Closes #2356 ty @Ammako
2019-07-10 00:19:59 -07:00
Kurt
cf0908a21e Remove check for impossible conditions
#2354
SUBE is never < 0 with the latest change (blank saves behave same as
retail saves).
2019-07-08 10:03:53 -07:00
NotTsunami
e29da1a8e8 Remove check for impossible condition in XY Save (#2354)
XY can't be ORASDEMO
2019-07-07 22:58:33 -07:00
Kurt
15c44139c3 Fix record read offset
Closes #2353
first 100 are u32, second 100 are u16; shift accordingly
2019-07-07 14:54:38 -07:00
Kurt
8f88e630c2 Fix ORAS inventory class type
now no longer removes items from pouch

https://projectpokemon.org/home/forums/topic/53761-oras-item-problems-with-new-version/
2019-07-07 08:43:58 -07:00
Kurt
772a2715c0 Fix SecondsTo* read offset
copypasted from gen6's, oops
Thanks CreamatedReptile2018!
2019-07-07 08:43:04 -07:00
Kurt
f2ac29ff4e Relocate some logic
slightly reduces savefile.cs footprint
2019-07-05 22:02:29 -07:00
Kurt
9a61f0de0f Minor relocation of logic
and the gradual shift to full-oop continues
2019-07-05 21:39:47 -07:00
Kurt
c0eda5eb61 Add more dex bulk manip options
unused, not sure how an abstraction can work for all games (needs some
virtual methods to actually work, since 1-3 don't have langflags)
2019-07-05 18:49:43 -07:00
Kurt
aa94c70df2 Hide gen6 dex logic behind zukan class
Same as prior commit for gen5 & gen7
2019-07-05 18:04:36 -07:00
Kurt
adbb3e842a Hide gen7 dex logic behind zukan class
Same as prior commit for gen5
2019-07-05 17:05:42 -07:00
Kurt
79a9269fbe Hide gen5 dex logic in Zukan class
Didn't change any of the bulk modifications, but the data get/set is now
done via the Zukan object rather than raw data manipulation
2019-07-05 16:21:53 -07:00
Kurt
7f186048fb Really fix dex lang flag offset style
c345688f6d

base(x) -> base(x - y) resulted in incorrect offsets for LGPE. Great.
Just make PokeDexLanguageFlags a shift offset instead of absolute;
update all usages.

Closes #2348
2019-07-05 12:16:09 -07:00
Kurt
599ec4ed45 Fix checksum offset fetch
#2348
2019-07-05 11:57:40 -07:00
Kurt
810f7271c6 Clear boxes after initialize
Closes #2349
2019-07-05 11:53:13 -07:00
pokecal
6b3d6999d1 update MailBoxEditor (#2344)
fixed FRLG offset, etc.
2019-07-04 21:48:18 -07:00
Kurt
5a8b421672 Add jp crystal eventflag offset
was pointing to an FF'd region, was added back via
e86b8c670f

Closes #2347
2019-07-04 15:07:37 -07:00
Kurt
c345688f6d Fix dex lang bitflag offset write
LangFlags is expected to be less than 0x500 or whatever, zero indexed to
the start of the dex block; NOT an absolute position.
I don't feel like making every usage consistent (gen5, gui editors)
which use the absolute position, so just adjust in the zukan
constructors
2019-06-22 16:53:25 -07:00
Kurt
e81e5f31da Remove shadow info index shift
Thanks @PP-theSLAYER !

https://projectpokemon.org/home/forums/topic/53405-bug-oddity-with-shadow-recognition/?do=findComment&comment=246125
2019-06-20 20:39:34 -07:00
Kurt
dc813da2f7 Add DisplayTID/SID getset 2019-06-19 17:49:56 -07:00
Matt
08835d5d97 Fix ORAS held items/personal reference (#2329) 2019-06-19 12:18:09 -07:00
Kurt
de77f949da Prevent assert on non-exportable saves 2019-06-17 20:55:01 -07:00
Kurt
7225b2b87b Add more sav1/2 option properties
Closes #2321
Closes #2322
no gui as SimpleTrainer is kinda getting overloaded; use linqpad or wait
for someone to make a GUI for the specific games
2019-06-09 14:15:42 -07:00
Kurt
455ab32722 Retain override version on clone
Also hide the pika friend label when YW features hidden #2283
2019-06-09 13:48:51 -07:00
Kurt
a30a00317f Add missing trainer location overrides
Was missing from #2319
2019-06-08 20:19:39 -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
de774ed131 readonly ComboItem
create once, never modified after
2019-06-01 19:12:41 -07:00
Kurt
2b8ef9236a use some explicit dex numbers as enum 2019-06-01 10:22:49 -07:00
Kurt
144a78d688 Relocate method 2019-05-29 16:42:48 -07:00
Kurt
8d781fd167 Simplify sorting to remove linq usage
create custom comparer to do the work
reorder some parameters
simplify gb hm set (All and FindIndex is duplicate work)

only usages of linq remaining are for the bulk action Where filtering
(ok)
2019-05-28 22:55:41 -07:00
Kurt
a45cddd3ed Add missing hax item clamp early return
Closes #2281
remove unnecessary "else", and break for visual separation
2019-05-27 21:38:04 -07:00
Kurt
827eb94f3c Add GameSync r/w for lgpe
https://projectpokemon.org/home/forums/topic/52797-request-lgpe-game-sync-like-value-to-be-added/

ty @PP-theSLAYER !
2019-05-16 22:26:51 -07:00
ReignOfComputer
7625ab66b4 Fix Import Count on Load Boxes (#2308)
Calculation was wrong if non-overwrite is selected. Also fixed OCD-triggering extra space in output message.
2019-05-15 09:11:48 -07:00
Kurt
be8e8851e2 Update 19.05.15 2019-05-14 22:47:48 -07:00
Kurt
091b9e2281 Add g4 poffin editor (misc edits)
Thanks @sora10pls for docs!
https://pastebin.com/jNeVJQi0
2019-05-13 22:56:45 -07:00
Kurt
76e3174d8c Add gen4 poffin logic
800 bytes starting at Offset = SAV.DP ? 0x5050 : 0x52E0;
8 bytes per poffin, 100 poffins.
2019-05-13 18:42:30 -07:00
Kurt
15f93216bd Fix record flag clearing
yay missing ~, Closes #2301 ty @CanoeHope !
rewrite flag loading to not use linq
2019-05-12 15:08:04 -07:00
Kurt
bad16adcee Fix sav7b clone method
underlying data should be a different reference when cloned
2019-05-12 15:06:50 -07:00
Kurt
21e7f4317e Minor updates
increase readability, simplifly some expressions
relocate hot path for legality report string creation
2019-05-11 10:12:14 -07:00
Kurt
300ef4d60a Minor simplifications
Use "SetData" method to automatically apply the Edited flag
Use appropriate method for CopyTo
simplify expressions a tad
2019-04-29 17:21:19 -07:00
Kurt
7c380a29c3 Make sort skip delegate more general 2019-04-29 17:20:16 -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
0bd6caf927 Fix male-only dex bit wiping
only wipe the index specific bits, don't wipe everything but the index
specific bits
2019-04-22 22:25:14 -07:00
Kurt
934595126f Simplify qr gender
use personalinfo object to do majority of work,
end result has the 4 sequential bytes set neatly
2019-04-15 15:43:48 -07:00
Kurt
27dfffd5b2 Add model-gender/starter-gender get/set
https://projectpokemon.org/home/forums/topic/52127-lgpe-save-research/?tab=comments#comment-243751
Thanks theSlayer!

(starter gender not modifiable via gui)
2019-04-10 17:03:05 -07:00
Kurt
82fb95b436 Add ConfigSave language get/set
This value is what determines what language the game runs with
2019-04-09 21:19:08 -07:00
Kurt
2f2512b09c Reduce allocations for checking file write time
FileInfo inherits from FileSystemInfo, which initializes a bunch of
strings that we don't need
this isn't a great optimization, just a fun exercise finding a quicker
approach to get these values
2019-04-05 18:45:59 -07:00
Kurt
bbe56a3318 Simplify trade trainer parameters
Bank was always false, don't try to minimalize gets by fetching before
call (be simple)

remove unreachable branches now that dust has settled
2019-03-30 22:05:28 -07:00
Kurt
e614aa9ac8 Relocate xd/batrev encryption
update some xmldoc too
2019-03-30 21:28:32 -07:00
Kurt
f212ba29c9 Misc reductions
same stuff as previous commit but for Gen2

EventConstMax is always > 0, remove guards
2019-03-30 16:38:52 -07:00
Kurt
4f347fbfa9 Misc reductions
no functional change
2019-03-30 16:21:45 -07:00
Kurt
609db23dc5 Consolidate pouch load/set 2019-03-30 16:10:14 -07:00
Kurt
e1a3c8edb3 Add RTC reset, allows game to define on continue
Closes #2273 , thanks @SatoMew !
2019-03-30 12:34:51 -07:00
Kurt
bb8cf5d3d8 Simplify get/decrypt pkm access 2019-03-29 19:43:33 -07:00
Kurt
5dcf2f4dc8 Use enum instead of nullable bool tristate 2019-03-29 17:52:26 -07:00
Kurt
4f2b9baede
Add missing stamp
Closes #2274
2019-03-29 09:40:31 -07:00
Kurt
4650a6f5b5 Reduce sizes 2019-03-22 21:19:47 -07:00
Kurt
cce362b98a Relocate FFFF trim (and 0000) to same location 2019-03-20 22:13:09 -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
8a08d32dff Simplify pkm constructors
remove Identifier param. 99% of the time, identifier is not provided,
resulting in a useless call

end result:
provide 'create new' and 'create from' constructors
2019-03-16 18:41:56 -07:00
Kurt
5765ce8229 Extract gc version IDs to separate logic 2019-03-16 16:48:38 -07:00
Kurt
ebc7c6ae29 Remove PKX.LCRNG method
Duplicate with RNG.LCRNG
reuse cryptarray for gen5 mysterygift r/w
2019-03-16 16:25:25 -07:00
Kurt
13a6d16cb9 Relocate checksum/dexform logic 2019-03-16 12:01:21 -07:00
Benjamin Sinkula
e4d59b8b98 Add PlayerNames and MatchDate to BV7 2019-03-15 14:35:55 -05:00
Kurt
41bc3f6182
Fix header'ed file export
For xd, getfinaldata returned a standard 344KB save, but then slapped it together with the inner savedata (0x28000 bytes) rather than using the GCI header. Don't use 'Data'
2019-03-15 10:26:16 -07:00
Kurt
e8a5a55323 Add union/berry crush stat ids 2019-03-09 10:26:43 -08:00
Kurt
0d5ee9489b Fix memcard sav cloning
Closes #2267 , Thanks @PMArkive && @Subject21J !
2019-03-07 18:05:55 -08:00
Kurt
bd00680545 Fix incorrect block index ref
https://github.com/kwsch/PKHeX/issues/2267
Still doesn't fix the underlying issue
2019-03-07 17:30:50 -08:00
Kurt
ee787a0f71 Fix HoF size check
now matches the code in ChecksumsValid (< instead of <=)
2019-03-07 15:45:51 -08:00
Kurt
61bf82e2bd Add gs event flags
https://projectpokemon.org/home/forums/topic/49717-pkhex-flag-editing/?tab=comments#comment-240804

via pret repo; looks like 2000 event flags, and 0x100 event
consts/work-vals (byte)
add more rebattle toggles
2019-03-05 23:06:05 -08:00
Kurt
8d49400b07 Change SecondsTo* from int to uint
having a year > 2050 can result in a 32bit seconds value (top bit set);
instead of being negative, keep it as a 32bit number.
2019-03-05 15:55:26 -08:00
Kurt
bb2c7e22cb Add HoF checksum verification and saving
Thanks @av🥑cado#0315 (discord)
2019-03-02 09:16:03 -08:00
Kurt
30e36579be Misc updates
add more xmldoc
revise some comments for clarity
redo a little bit of logic for perf
rename some methods for better description
2019-02-24 13:57:10 -08:00
Kurt
993bb00a61 Remove powersave unused logic
unused & deprecated in favor of using cfw (powersaves price >>>
ntrboot-b9s flashcart)
2019-02-23 18:02:50 -08:00
Kurt
7ba21c5d8c Use subsection fetch 2019-02-23 17:59:46 -08:00
Kurt
d792c0d3a0 use u/L
use 'u' to denote uint values, so that less IL ops are required
~(21->17) in the case of IVs
no functional change, just a fun exercise looking at generated IL and
finding ways to use less ops
2019-02-23 15:36:26 -08:00
Kurt
5b29e71954 Misc tweaks
no functional change, just rewrite some logic for better flow
fix subform popup count restriction (OwnedForms requires forms to be
added/removed manually; it doesn't automatically update)

sanitize box names when dumping boxes with separate folders (and bad box
names)
2019-02-23 14:58:48 -08:00
Kurt
17f954b4e8 Xmldoc
Reorder to match parameter order
add more xmldoc
2019-02-23 14:57:35 -08:00
Kurt
ca51edbdcf Change sav.LoadBoxes to return int
make MysteryGift specific method flexible so that any IEncounterable
enumerable can be passed.
2019-02-23 14:37:06 -08:00
Kurt
a339cc9289 Extract pouch manipulation logic
add overloads for API syntactic sugar
make ItemConverter internal again
2019-02-22 22:48:34 -08:00
Kurt
df94afa711 Misc updates
extract some enums to core, use Enum.GetNames to do string fetch
make stamp listbox taller
clean up Display*ID setters
2019-02-21 21:54:41 -08:00
Kurt
cffa6e681d Add OT name setter 2019-02-20 21:52:22 -08:00
Kurt
ba6a958a1d Add xmldoc, make manip not fetch all BoxData 2019-02-20 19:39:49 -08:00
Kurt
d3dd4fb2a5 Track slot modified count on sort/delete/mod
Sorting will always show multiples of boxcount since it repositions
empty slots
2019-02-20 17:59:54 -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
Kurt
fb8aa3bba0 Lowercase parameter 2019-02-19 20:26:20 -08:00
Kurt
a385a8481d Misc tweak to savefile export
Use flags to request header/footer in the output
gets rid of the DSV/GCI bool arguments
2019-02-18 21:59:57 -08:00
Kurt
7c3e5aa83c Make RandomGender a method instead of property
See pkNX for similar change; the functionality is really *method*
2019-02-17 22:13:40 -08:00
Kurt
258f0f0ad4 Minor refactoring
clean up some gc logic, no functional changes
2019-02-17 10:42:43 -08:00
Kurt
d1f6a5a3ff Misc clean
no functional change
2019-02-15 11:46:46 -08:00
Kurt
858760fa28 Misc updates
relocate program language enum
test that test case is proper
move getcompatible & gettemplate to core
remove catch rate changing for pk1 (catchrate editor now used instead)
2019-02-15 00:50:23 -08:00
Kurt
3d01617c93 Fix safari unlock
dat 0 -> o
Closes #2262
2019-02-14 18:17:16 -08:00
Kurt
54ba9a0312 Update file->open for pb7 filtering
add pb7 to pkm extension list, ignore it in gen7 (sm/usum), update gg
filtering (allow pb7, not bk7)
add comments indicating format source game
2019-02-09 20:33:37 -08:00
Kurt
e96ef76dcd Add xmldoc
no code changes
2019-02-09 20:24:38 -08:00
Kurt
48e2bbcfed Refactor DumpBox to return 1 value
count < 0 implies an error; values >= 0 can be used to indicate actual
dumped count
2019-02-09 20:19:55 -08:00
Kurt
9a93b20515 Minor rework
use hashset instead of new[] every call
precompute empty arr
allow criteria input for better gen requests
2019-02-09 20:07:15 -08:00
Kurt
ec1d3069a5 Remove SaveFile dependency for wallpaper data fetch
reusability++
2019-02-09 20:05:32 -08:00
Kurt
cb98c83bd2 Remove references to Stat_HPMax
use computed value to check if Party Stats are present
maybe I want to use Span and stop resizing all pkm arrays to party
format years from now idk
2019-02-09 13:17:00 -08:00