Commit graph

1093 commits

Author SHA1 Message Date
Kurt
b5c30193fa Set initial capacity for stringbuilder to reduce reallocation
Default capacity is 16 so it's rarely an issue, but sometimes we don't need that much.

Update xmldoc for more clarity
2021-01-16 17:31:05 -08:00
Kurt
613e6db744 Use StringConverter api consistently; use stringbuilder when possible
Retain a stringbuilder to mutate the string rather than finalizing temporary strings

yields some speed improvements (less gen0 string objects allocated)
2021-01-14 22:50:13 -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
2deb51b365 Minor optimization for hashing
don't use FIPS compliant hashing methods explicitly, no real reason to. hash.Create() will select managed vs csp depending on the framework/core and reg flags.
add >net46 incremental hash logic for swsh
remove static sha256 instance (single threaded overkill)
2021-01-08 00:32:04 -08:00
Kurt
86d80a7d0b Minor perf improvement for advancing keys
Further improvements can be made if there's a way to have a union struct (4 u16s, lumped u64) that has a simple 4bit diagonal mirror operation on it. Can be at least twice as fast.

Benchmarking with optimizations shows about 80-90% of the prior time taken, so at least a 10% speed optimization

Rarely used, was fun to try and optimize a little more.

Eliminate bounds checks by accessing/setting the highest element, and only index twice instead of 6x.
Eliminate u16 casts by leaving as int type (same result)
Eliminate temp value caching and instead directly write to storage. (no more _0123).

End result looks neat too, since the >> 0's removed looks like a diagonal, like the nibble rotation :D
2021-01-07 20:50:28 -08:00
Kurt
1138cd44bc Minor rearranging 2021-01-07 18:05:21 -08:00
Kurt
19d40f61f5 Move save crypto types to focused folder 2021-01-07 16:01:34 -08:00
Kurt
f615814548 Add xmldoc, increase swish util flexibility 2021-01-07 15:34:26 -08:00
Kurt
5554651951 Mark scxorshift32 and xoro128p as ref structs
Prevents passing them as args, as intended. These are self mutating structs
2021-01-07 15:33:42 -08:00
Kurt
1c19bc86f4 Preallocate some holding objects to prevent doubling allocations
Saves 12 doubling reallocations for new List to hold blocks
Saves 21 for the memorystream on writing
2021-01-07 09:37:27 -08:00
Kurt
6e741a0cf0 Minor tweaks
Add xmldoc
Remove linq from memecrypto code (speed lmao)
Hide some methods that shouldn't be called directly
Name variables better for accessor const's
2021-01-06 23:30:30 -08:00
Kurt
9718d1d2aa Add save handler abstraction for detecting atypical save formats
GCI, DSV, DUC are already supported, so I've written the abstraction for those and seed the Handler list on startup.

Can add a new class with recognition via SaveUtil.Handlers.Add(myHandler);
2021-01-06 15:46:43 -08:00
Kurt
373aecdf7c Merge GO IV checks, behavior is now correct
Rename IV1/2/3 to HP/ATK/DEF in gp1 structure
2021-01-05 09:39:50 -08:00
Kurt
cc43550357 Simplify more expressions 2021-01-04 17:31:43 -08:00
Kurt
ad48f4e909 Set languageID if present for sav
Lowercase the "SAV" variable too
2021-01-04 16:28:46 -08:00
Kurt
cbc57dc794 Force sav1 BU to init as japanese 2021-01-04 15:18:16 -08:00
Kurt
0ab3493335 Skip save sub-type detection if we already it 2021-01-03 18:11:59 -08:00
Kurt
730640decc Minor clean 2021-01-03 16:53:13 -08:00
Kurt
f785231692 Fix backup filenaming 2021-01-02 10:34:33 -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
1d22b74970 Remove unused block class
Copied from Gen7b, swsh is just a key,value list
2021-01-01 16:57:18 -08:00
Kurt
7523e0e200 Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
Kurt
f4bf9dd208 Minor clean
add download count to changelog
move 2019 changelog to uncompiled resource (for record)
2020-12-31 10:36:09 -08:00
Kurt
2af9e800fb Add RotomAffection and rotoloto1/2 flag editing to GUI 2020-12-29 11:39:19 -08:00
Kurt
d9a4eacaf4 Allow deactivating all raids 2020-12-29 10:53:47 -08:00
Kurt
e8c23f6644 Simplify some repeated comparisons with expressions
Less prone for bugs since it uses the same value for all comparisons without re-specifying
2020-12-29 00:37:59 -08:00
Kurt
c119f18af3 spec->species 2020-12-28 22:22:52 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
4a8a495d04 Condense some switch expressions
Should be it for now; exhaustively searched for all that made sense to change
2020-12-25 10:58:33 -08:00
Kurt
43dd390f21 Split IContestStats, mark trades as records 2020-12-24 00:06:40 -08:00
Kurt
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -08:00
Kurt
324ce9d6ac Minor clean 2020-12-23 09:34:29 -08:00
Kurt
e34c8df044 Revise some method signatures 2020-12-22 20:50:33 -08:00
Kurt
997e0751f3 Minor clean
Handle remainder of c#9 sugar
Fix some spelling mistakes
2020-12-21 23:37:07 -08:00
Kurt
514b60b447 Merge type check with usage in if statements
if x is y with z property true, then :D
2020-12-21 22:33:48 -08:00
Kurt
594db92ad0 Minor clean
Handle some stragglers
2020-12-21 17:48:08 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
0303eada32 this is not that
clearer than before, yay
2020-12-21 17:12:39 -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
62018cce1a Unify concepts with different names
AltForm & Form & Forme => Form
GenNumber & Generation => Generation

Extract out SpeciesForm interface, and re-add IGeneration

For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
2020-12-10 20:42:30 -08:00
Kurt
a13c2c852c Add some comments, clean a little 2020-12-07 20:14:12 -08:00
Kurt
98ef0299b6 Add xmldoc for save meta/state tracking
Move some logic around to the more appropriate spot
2020-12-07 19:49:04 -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
e54e94a734 Don't waste alloc on clearing titlescreen slot
Revisiting #3098 #3086
2020-12-01 07:19:21 -08:00
CanoeHope
228042b111
Properly set empty slots to Trainer Card (#3098)
#3086 
Was only partially addressed -- it was only done for Title Screen and not League Card too.
2020-11-30 21:38:15 -08:00
Kurt
fefc38bacb Minor debug optimizations
Trees:
- Only retain the objects needed after calculation
- Reduce size of TreeCoordinates and remove allocation penalty (now a struct)

No more warnings for Release compilation :D
2020-11-28 14:55:09 -08:00
Kurt
9b178fefe2 Xmldoc, minor tweaks
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
2020-11-27 11:51:02 -08:00
Kurt
d6294d42f7 Update SAV1.cs 2020-11-24 10:51:31 -08:00
Kurt
4a8ad8b149 Expose raw evolution chain methods 2020-11-17 14:23:15 -08:00
Kurt
b1ae53ec63 Set empty slots if party not full
Closes #3086
2020-11-15 14:31:33 -08:00
Kurt
df5ebd1f54 Minor clean
Resolve some messages
2020-11-11 21:01:41 -08:00
CanoeHope
a569d91c5e
Add CurrentDex Block (#3081)
Block-Key was present since IoA (1.2.0) update.
2020-11-05 14:08:04 -08:00
Kurt
ae85097c2d Allow go shiny xor!0
Thanks @Lusamine for bruteforce testing to confirm
2020-11-04 20:55:47 -08:00
Kurt
23e765e550 Add opening for rental team dumps
Dunno why anyone would want these, lol
Closes #3074
2020-11-03 20:12:42 -08:00
Kurt
62073f5fd9 Update GP1.cs 2020-11-03 19:28:41 -08:00
Kurt
a2fb9c48eb Add fused calyrex block 2020-11-01 17:55:52 -08:00
Kurt
ef7d1e2af5 Add lair start seed
ty zak
2020-11-01 14:40:16 -08:00
Kurt
28767df0fb Split gamesync details to interface 2020-10-31 11:43:57 -07:00
Kurt
c9587c16c7 Adapt dropped/opened PKM to currently loaded savefile
Closes #3067
2020-10-30 22:44:08 -07:00
Matt
cd42abd915
Add Split-Decision Ruins save block key (#3065) 2020-10-30 13:17:25 -07:00
Matt
1b6a8d3ff6
Document Galarian Star Tournament save blocks (#3060) 2020-10-28 12:46:34 -07:00
CanoeHope
37053fb599
Add CrownDex complete to Trainer Card (#3058)
With this, all Dex markers can be displayed on your League Card as long as your save is from update 1.3.0. Expansion Pass DLC is not required.
2020-10-27 18:06:49 -07:00
Kurt
5b313210ed Handle SWSH gender strings same as LGPE
See 6a0a6aa82a for more context
2020-10-27 09:24:06 -07:00
CanoeHope
e22be71a26
Added one more Max Lair Block (#3055)
So I said that 0xF26B9151 was the first Max Lair Pokemon entry saved in my previous commit which turned out to be wrong and was in fact the Pokemon that is to be hinted by Peonia. Apologies for that mess up.
2020-10-26 21:24:04 -07:00
Lusamine
cce6402608
Fix incorrect offset for first Max Lair saved note (#3053) 2020-10-26 07:42:40 -07:00
CanoeHope
36a9ef05db
Added more Tundra Blocks (#3051)
Max Lair related.
2020-10-25 20:54:15 -07:00
CanoeHope
5722905e5d
Added Crown Tundra Block Data (#3047)
The Tundra League Card block literally only stores the Normal and Rare Peony League Cards, and nothing more.
2020-10-25 18:09:23 -07:00
Kurt
61fc0c7504 Update SaveBlockAccessor8SWSH.cs 2020-10-25 18:08:52 -07:00
Kurt
7e8a1a58d1 Set gender on pokdex registration
Closes #3045 , ty @xXAquaNightXx !
2020-10-24 15:42:17 -07:00
Kurt
919f3f2893 Update RaidSpawnList8.cs
Co-Authored-By: Leanny <1884062+Leanny@users.noreply.github.com>
2020-10-24 12:38:33 -07:00
Kurt
5fa4ddd4a2 Update internal data sources for Crown Tundra
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: ReignOfComputer <2667537+ReignOfComputer@users.noreply.github.com>
2020-10-24 11:11:05 -07:00
Kurt
8a2a25fde1 Update data structures for Crown Tundra
Adds a wild area Raid den detail editor like mainland/armor raids.
2020-10-24 11:09:29 -07:00
Kurt
d35766649b Fix initial blank sav language load
(uint)-1 <= max now returns false, causing it to fall back to english.
2020-10-18 19:59:22 -07:00
Kurt
14a678b57d Revise save detect logic flow
Double-Clicking SAV tab no longer hides any error message; now shows it like the auto-detect would.

Move high-level detection method to Core
2020-10-18 19:49:46 -07:00
Kurt
cce4707604
Enable nullable for winforms csproj (#3037)
Handle all warnings
obviously the usage of null! could potentially be avoided if the object init wasn't such garbage, but here we are with years of old junk and lack of abstraction in the GUI project
2020-10-18 11:02:39 -07:00
Kurt
7a01b1249c Minor clean
Handle more messages, add more xmldoc
2020-10-18 09:43:41 -07:00
Kurt
38b03a42b6 Fix hide flag get/set
Closes #3030
2020-10-16 16:12:42 -07:00
Kurt
7b6f30b779 Handle overflow case
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-12 14:37:08 -07:00
Kurt
a71940bf75 Update CaptureRecords.cs
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-12 14:34:44 -07:00
Kurt
0a6534a208 Extend individual transfer count to 999mil
Closes #3028
Thanks @CarlosofKalos !

Setting 9999 for both on Rattata; capturing the 10,000th didn't increment, but transferring the 10,000th did.

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-12 14:16:55 -07:00
Kurt
3b4fd49af9 Catch any exception, show message in result 2020-10-12 10:42:26 -07:00
Kurt
d66c406751 Update SAV1StadiumJ.cs 2020-10-10 15:28:34 -07:00
Kurt
f821d698fe Update SAV1StadiumJ.cs 2020-10-10 15:11:02 -07:00
Kurt
2e82636f1e Fix slot writes 2020-10-10 14:59:51 -07:00
Kurt
7132750c9b Placeholder crown tundra logic
To be updated:
- Tables8: magic numbers for maximums
- IGigantamax: any new gigantamax forms?
- FormConverter: any new forms? (calyrex)
2020-10-10 13:14:32 -07:00
Kurt
b97bee4412 Use correct filesize reference 2020-10-10 12:50:57 -07:00
Kurt
79f60d2236
Update SAV1Stadium.cs 2020-10-09 22:11:32 -07:00
Kurt
bb65f2d2c2 Show trainer name&id for registered Stadium teams in dropdown 2020-10-09 20:31:13 -07:00
Kurt
9d21e5acdd Add GUI for Capture Records
Accessible from Pokedex window
ur welcome matt
2020-10-08 18:06:29 -07:00
Kurt
804b85ea33 Add CaptureRecord block interaction
No GUI

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-08 15:28:25 -07:00
Kurt
aa43904869 Add stad2 boxnames, registered flag handling 2020-10-05 08:29:17 -07:00
Kurt
d4452ce3af SK2 coerce to load to a hint language
This format won't be supported cleanly, so let's just try to allow language detection to work as best as it can without storing metadata in the SK2 bytes.
2020-10-04 14:42:48 -07:00
Kurt
09c6359e3a Add flexibility for SK2 imports
Check language character table for English vs Japanese when loading for a destination
2020-10-04 10:25:34 -07:00
Kurt
3fd6817a42 Refactoring: Finalize Stadium savefile logic
Extract common abstract class for shared logic
Clean up property/field/method ordering to be consistent and logical (roughly: attributes, constructors, state management, retrievable values, static methods)
Apply default language OT name
2020-10-04 09:23:16 -07:00
Kurt
d13b893351 Use PKHeX as blanksav language
Closes #3009

Make QRPK7 implement IEncounterable and remove hardcoded PKHeX strings
Let force hatching for WC3 eggs try to hatch from the savefile's language, then revert to english if failed to set an OT.
2020-10-04 08:59:33 -07:00
Kurt
8a7ed99689 Fix s1 team export
oops
Add a tostring override to help visually debug
2020-10-04 08:06:44 -07:00
Kurt
fbc4c5038a Set box metadata on write
Fix group export for 1U to exclude the right set of teams
0J now shows the correct amount of boxes & teams (halved)
2020-10-04 07:51:55 -07:00
Kurt
5853888020 Minor Stadium behavior enhancements
Use underscores for enum for ToString replacing with spaces
Don't flag empty-OT as SK2; Stadium0/1 use the "TRAINER" as rental, but leave it blank for SK2.
Don't set any terminators for an OT string if the string is empty; just wipe the buffer.
2020-10-03 21:56:57 -07:00
Kurt
262561d5d1 Fix stad1 missing team types
off by 1 (8=>9, and EN has unused interstitial teams).
Fix last-viewed-slot indication color tracking
2020-10-03 19:48:56 -07:00
Kurt
7efaa5ab71 Minor clean
collapse some expressions
handle some compiler messages
2020-10-03 18:59:36 -07:00
Kurt
816f24e3db Add Misc pkm array viewer for Stadium saves
Readonly slots

Things could be expanded on to use interfaces and wrappers for a "SlotReference" and properties for readonly.

But that's kinda unnecessary
2020-10-03 18:22:29 -07:00
Kurt
bca8a80b39 Minor clean 2020-10-03 17:09:22 -07:00
Kurt
b242aed429 Add ability to load blank japanese/korean save files
Detects the language of the currently loaded save file, and passes that info to the blank sav creator

Use a trainer name of "1337" instead of PKHeX for any Japanese save file, because Gen1/2(/3?) character tables don't have regular ascii chars.
2020-10-03 11:22:06 -07:00
Kurt
97f5f8d362 Add blank sav fetch for stad0/1/2 2020-10-03 10:53:52 -07:00
Kurt
8cb6e15f3e Add team fetch api for stad1/2 2020-10-03 10:53:35 -07:00
Kurt
52a67f2425 Add Stadium2 Support
Introducing a new PKM format: SK2
Split ICaughtData2 off of PK2 so it can be shared with SK2 when type-checks occur
Add conversion for PK2<->SK2
Split the split-buffer handling for GBPKM to GBPKML (what a name), so that I can reuse shared accessor logic for SK2.
2020-10-02 18:08:40 -07:00
Kurt
2c8e0bc8f7 Add automatic byteswap 2020-09-30 22:46:07 -07:00
Kurt
ee207a3fda Revise Stadium savefile logic to read from boxes
Add a helper to spit out teams
Alias hard-coded numbers to something to easy names.
Make them exportable, update checksums for box data
2020-09-30 18:00:25 -07:00
Kurt
af357587f9 Add Pocket Monsters Stadium support
https://projectpokemon.org/home/forums/topic/38108-gen-1-pokemon-stadium-save-file-structure/

untested, need to find a save file somewhere??
2020-09-30 12:45:41 -07:00
Kurt
769d5d8689 Allow SaveFile constructor to specify exportable state
Useful for partially-supported savefiles that can't be exported yet (Stadium)
2020-09-30 12:44:50 -07:00
Kurt
22f37910f0 Remove unnecessary single-member interfaces 2020-09-27 18:19:28 -07:00
Kurt
fb4734472b Add notation for language-specific save types 2020-09-26 13:30:17 -07:00
Kurt
a34434f7cb Make pkm.Data a readonly field rather than property 2020-09-26 12:09:02 -07:00
Kurt
82afefa335 Make GP1 expose IEncounterable for metadata
Make the main loader handle IEncounterable objects
2020-09-26 11:33:21 -07:00
Kurt
6243135f28 Minor clean
Move Home8 location to Locations.cs for documentation
Move FestaFacility to correct folder
Remove unnecessary public modifier on interface method
Pass the program's Version to any loaded plugins, if they wanted to check compatibility...?
2020-09-25 23:55:31 -07:00
Kurt
efc17a1271 Add interface for revised savefile types (patches)
SWSH is the first common savefile type that has different revisions after official patches. We want to indicate in the Program Title which revision we're currently editing, because people still are not editing latest-format saves and complaining y no urshifu.

Use short descriptions to indicate revision (Base, IoA, CT), rather than magic numbers (v0/v1) or 1.X or 1.X.Y+, because GameFreak can't follow semver rules.

go away ranch platinum update, i might handle you another time
2020-09-25 23:41:20 -07:00
Kurt
2b7e06e217 Refactoring
Extract some logic, suppress some compiler messages
2020-09-18 22:11:13 -07:00
Egzon
4b1a9a89da
Add support for reading and editing Underground Items (#2987)
Adds a sub-editor with localized support for editing Underground Items.
2020-09-13 14:55:50 -07:00
Kurt
507c913451
Invert early return bool for sav1stadium recognition
oops
2020-09-10 11:24:16 -07:00
Kurt
741fbd5296 Add stadium sav readonly support of registered teams
no checksum logic performed, just a WIP preview
2020-09-09 22:44:46 -07:00
Kurt
01fb233e48 Minor tweaks
Extract some interfaces
Suppress some warning messages with commented reasons if appropriate
2020-09-09 12:47:24 -07:00
Kurt
5d3bc289b6 seal hunting
Mark things as sealed as they shouldn't be inherited from or overriden in a derived class.
2020-09-07 13:51:13 -07:00
Kurt
9191f023a3 Minor clean
Nullability annotations and some logic simplification
2020-09-06 11:24:54 -07:00
Kurt
1114b97c4b Fix bool value naming for gen8 block editor
Was previously showing RaidArmor for pre-Armor saves, as the reference of a zero-length array was the same as the bools. Just sanity check since all block chunks have length.
2020-09-06 11:21:23 -07:00
Kurt
cf9e5ec37f Minor refactoring
Change Ability array to IReadOnlyList, add method to check ability index in personal data
Suppress some message warnings
Change EvolutionChain short-circuit for VC to jump from gen6 directly down to gen2. There aren't any notradeback 1 situations, so a notradeback1 will always start with g=1, so no need for the other if-continue.

Simplify pk5 conversion
2020-09-06 10:53:13 -07:00
Kurt
c2ec4d55e4 Minor clean
Add some xmldoc, remove some empty lines, move some small logic pieces to a better spot
2020-09-03 14:28:51 -07:00
Kurt
b03a5f2818 Fix pika beach score reading
fix reads as little endian instead of big endian
fix truncation if editor value from byte => ushort
Closes #2976
2020-09-01 16:05:52 -07:00
Kurt
b5677758be Change default TID/SID for gen7+ 2020-08-30 17:54:58 -07:00
Kurt
6e409f288e Use version on clone so that we don't have to detect again
Matches gen1/gen3 clone
2020-08-29 23:39:14 -07:00
Kurt
890f3375c9 Misc clean 2020-08-18 15:39:45 -07:00
Kurt
f35d8b2d4b Remove unnecessary logic
return/frustration not present in these games; no need to check this
2020-08-18 14:45:36 -07:00
Kurt
e012b42c9c Update SAV7b.cs 2020-08-18 10:35:59 -07:00
Kurt
c7eda4f901 Update SAV7b.cs 2020-08-18 09:15:29 -07:00
CanoeHope
1e6858c349
Add misc Restricted Sparring related Block Data (#2971)
The game also stores the Gender ID, Form ID, Encryption Constant, and Alcremie Sweet ID per block for each PKM's slot.

As for Sweet ID it is stored for all Types. However, since you obviously can't use Alcremie in non-Fairy Sparring they go unused. (They are the Int32 blocks you'll notice with a -1 value.)
2020-08-15 12:10:52 -07:00
Kurt
541c9761df Minor clean
Make flag indexes immutable
Rename some properties for clarity
2020-08-14 20:23:54 -07:00
Kurt
1df2bd444a Remove unused using 2020-08-09 20:02:06 -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
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