Commit graph

1203 commits

Author SHA1 Message Date
Kurt
c0d748a975 Add Dream World upload slot indicator
Tested & works on bw & b2w2
Thanks Brokemia for the request!
2021-08-16 11:54:03 -07:00
Kurt
9793e9f1a0 Minor clean
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
2021-08-13 15:36:30 -07:00
Kurt
5ec2b12ae5 Handle some warnings for release build
Unused usings; just make PIDType stuff visible.
2021-08-06 09:41:39 -07:00
Kurt
0f3e5095c5 Replace more linq usage 2021-08-05 22:39:38 -07:00
Kurt
5c472a400d Expand shorthand parameters
int i => int index, or whatever the value is representing.
2021-08-05 20:33:25 -07:00
Kurt
a1f5c76790 Fix pgl jpeg save 2021-08-05 19:38:47 -07:00
Kurt
59d480c834 Minor tweaks
Discard empty pkm files (species 0) when loading boxes or templates
Add more xmldoc
Simplify some method parameter names for readability
2021-08-05 17:05:39 -07:00
Kurt
cc0397f087 Misc tweaks
Improved readability
2021-08-05 15:18:43 -07:00
sora10pls
bfcf081e5b Fix XY multiplayer sprite display
Reorder enums; Serena before Calem
2021-08-05 16:22:06 -04:00
Kurt
1efebe51d3 Simplify Country/Region/ConsoleRegion to byte from int
Only exists in gen6/7 games.
2021-08-02 19:43:57 -07:00
sora10pls
3fdf1396aa Update TrainerFashion6 structure
Rename EyeShadow => Eyeliner, fixes labeling for fields and getters for lip color and freckles data
2021-07-31 16:00:10 -04:00
Kurt
0c6254835d Add battle agency slots to main window misc viewables 2021-07-26 23:57:05 -07:00
Kurt
4ed0e30ace Minor tweaks
Muh infinitesimally small perf gainz found while waiting for next dota match
2021-07-26 23:33:56 -07:00
Kurt
c9640f8561 Comments: forme->form 2021-07-26 14:14:39 -07:00
Kurt
9c8bee19ca Gen5: Add give all musical props, b/w entree level changing
Abstract some things into their parent save block structure.
2021-07-25 23:44:03 -07:00
Kurt
a6176dc3d0 Add fused & gts slot indications for gen5 2021-07-24 17:23:58 -07:00
Kurt
4ee72b0020 Extract pass power enum from gui logic 2021-07-21 00:58:09 -07:00
Kurt
46f50a3a56 Use named consts for magic gender values
More personal magic value comparisons
2021-07-13 18:22:04 -07:00
Kurt
f5090e3ae7 Fix cgear png import
Closes #3231

Symptoms observed:
- Tiles were too dark (not high enough RBG value due to >>3; keep 8bit color here.
- Red/Blue channel inverted, swap R & B. Works? Hope this isn't something related to png storing rgb vs bgr and we'd need to check input pixel format?
- Tiles were misplaced slightly, off by 1. Fix order of operations so that the tile choice value is correct.
2021-07-10 19:32:10 -07:00
Kurt
3fa311f6ed Misc tweaks
more annotations - all bool->out ? are annotated now
fix gender symbol inversion (forgot to set text)
extract some methods to reduce nesting
2021-07-06 08:42:15 -07:00
Kurt
de8e855116 Replace MC->MemoryCard
Simplify some interactions to be more clear
2021-07-05 14:32:09 -07:00
Kurt
103aa9aa4b
Revise EncounterArea and EncounterType for clarity (#3228)
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.

EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.

Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
2021-06-29 20:58:06 -07:00
Kurt
9cd617708d Fix const size reference (same value)
Same value, but different name. Cosmetic, but prevents future confusion.
2021-06-29 16:04:05 -07:00
Kurt
595966b090 Improve range checks 2021-06-24 23:48:35 -07:00
Kurt
49488bb503 Use invariant culture for ToUpper/ToLower
Turkish is quite the language; let's try to prevent any errors down the road for internal/game string case changes.
2021-06-24 09:16:36 -07:00
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
394c5c2c95 Minor clean
Shed some unused code
2021-06-15 20:00:51 -07:00
Kurt
0686922d5c Rewrite gen6ao secret base handling, i/o, GUI
Closes #3177

Format sizes are now accurate to game structure sizes. Added a few more editable fields, rid of label/textbox/etc for general base editing -- use a PropertyGrid instead.

Feels nice having a bank of saves to reference + idb to discover the struct layout.
2021-06-13 00:38:47 -07:00
Kurt
6029c15521 Fix incorrect GameVersion reference 2021-06-09 22:56:19 -07:00
Kurt
f529fd1432 Add xmldoc, split out some operations 2021-06-07 20:03:14 -07:00
Kurt
c98717bdc0 Fix namespaces 2021-06-06 23:34:15 -07:00
Kurt
871de4e213 Add more xmldoc 2021-06-06 11:56:54 -07:00
Kurt
6ee67e624d Update gen2/3 setdex's too 2021-06-04 17:29:55 -07:00
Kurt
d30e00ffbe Clean up SetDex guard clauses
add egg checks for gen4-6/8, group species bound checks
2021-06-04 17:26:06 -07:00
Kurt
7ee60d9e98 Update Zukan4.cs
Set seen after gender-seen, as we check seen in that method (first or second seen gender).
2021-06-04 17:19:12 -07:00
Kurt
3a1fbc9b88 Don't pass key byref
Pass byval and return the result; emits less IL
mark for inlining
2021-06-04 14:19:07 -07:00
Kurt
041074f26c Decrypt sav8 blocks in-place
Removes 1.5MB of allocation; we don't need to preserve the encrypted state.

Revise savefile clone operation to use its own constructor, as we need to call the base constructor first (backup file clone...) prior to decrypting.

Expose CryptStaticXorpadBytes as GetDecryptedRawData no longer exists.
2021-06-04 13:16:00 -07:00
Kurt
066aedfc21 Separate scblock ctor's
No longer need to set byte[] twice
Add value-setter checks for bad mutations (size change, bool1<->bool2 only)
2021-06-03 12:35:39 -07:00
Kurt
8c970ec991 Minor tweaks
no functional change, readability++
add more xmldoc
2021-06-03 12:04:19 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
236fd2943f Add hgss pokewalker stored pk4 fetch
ty atrius
2021-05-25 10:07:14 -07:00
Kurt
b2e4ca393b Minor perf improvements
GetHexStringFromBytes: don't allocate temp slice array on heap
Tile: Span Slice toarray rather than new+copy
2021-05-23 10:56:25 -07:00
Kurt
15afd6f3bc Move mail get to sav obj 2021-05-22 09:28:04 -07:00
Kurt
96115916b2 Prevent overflow of memo write
Setting too many invalid entries will bloat above 500, so clamp the max.

Preallocate entries size rather than 4 always
2021-05-22 09:27:46 -07:00
Kurt
74e0cba3b0 Minor tweaks
use assert instead of manual exceptions
span
remove some dead logic
2021-05-18 16:16:48 -07:00
Kurt
215b1c6e23 Remove whitespace 2021-05-18 13:33:13 -07:00
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -07:00
Kurt
ae0b2f13ea Fix erroneous value setters 2021-05-18 13:12:43 -07:00
Kurt
2d8d3e04fc Move mxyz to subclasses 2021-05-18 13:04:23 -07:00
Kurt
2b25cd1e18 add notes for oras endscroll data
https://projectpokemon.org/home/forums/topic/49356-battle-chateau-help-well-not-really/?do=findComment&comment=266428
2021-05-15 01:46:33 -07:00
Kurt
acdbda4e12 Split DateUtil from Util class 2021-05-14 16:46:48 -07:00
Kurt
3ac1882151 Move BinaryCodedDecimal conversions to separate class
Add unit tests, clarify names
2021-05-14 16:32:26 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -07:00
Kurt
871f9b0627 Convert checksum operations to span-based
Fix SAV.Data references in SAV_Misc4 to use the General block instead
2021-05-14 12:30:40 -07:00
Kurt
b9d9766674 Fix typos, update block list notes 2021-05-14 12:16:08 -07:00
Kurt
07584a8774 Add chateau score, seaside cycle score
Update some other areas too
looks like this fixes the sube pkx fetch method for extraslots, yay.
2021-05-13 23:12:53 -07:00
Kurt
d340642b09 Minor perf improvements 2021-05-10 01:01:45 -07:00
Kurt
8e9953dc0f Keep festaID separate from nex ID bytes 2021-05-09 23:38:14 -07:00
Kurt
ceede68861 Minor tweaks 2021-05-07 22:11:10 -07:00
Kurt
31142ee297 Replace some linq usage with direct logic 2021-05-06 23:26:38 -07:00
CanoeHope
c1cce9a892
Correct Colosseum/XD Item Quantities (#3203)
* Update SAV3Colosseum.cs

* Update SAV3XD.cs
2021-04-28 16:55:37 -07:00
CanoeHope
747d6ed6c7
Fix Colosseum/XD Max Money (#3202)
* Update SAV3Colosseum.cs

* Update SAV3XD.cs
2021-04-28 11:58:26 -07:00
Lusamine
e5867ce512 Add NormalEncountRigel2 block and Pokedex Rec block 2021-04-23 17:41:54 -05:00
Kurt
b89c4fb17f Database load on invalid party counts 2021-04-21 18:33:57 -07:00
Kurt
25565e6f07 More pattern matching expressions
Shapes are fancy; nested pattern checks
2021-04-20 02:17:28 -07:00
Kurt
c67e01849a Extract 3ds chinese glyph remapping, only do on 3DS games
Optimize some functions within gen7zh for perf (no linq, no allocation)
2021-04-18 18:29:02 -07:00
Kurt
8e52d2fddb Xmldoc updates 2021-04-17 13:07:28 -07:00
Kurt
0d45075d4b
Rewrite settings handling; enhance some user experiences (#3193)
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
2021-04-11 18:09:54 -07:00
Kurt
c7b997865c Minor clean 2021-04-09 14:52:49 -07:00
Kurt
b0700ba281 Extract Gen7 HoF class, extend event flag count
4k flags exactly, and probably 4950 for USUM (alignment +1 byte for an even 4960)

The old flag + count (4 bytes total) are just +32 event flags.
2021-04-07 00:20:02 -07:00
Kurt
223b56d779 Fix gen3 save incorrect destination writes 2021-04-05 22:28:04 -07:00
Kurt
8c4ca3134a Fix Gen3 coin get/set 2021-04-04 11:53:55 -07:00
Kurt
1348f5deec Allocate smaller buffers for gen3 sav objects
n*0xF80 instead of n*0x1000
2021-04-02 14:57:30 -07:00
Kurt
cdc9710869 Fix gen3 record get/set
FR and LG are separate version IDs now
2021-04-01 14:15:11 -07:00
Kurt
a92f92e1c5 Fix gen3 TMHM pouch 2021-04-01 14:14:47 -07:00
Kurt
1e38f55007 Fix changes not being saved completely 2021-04-01 13:43:06 -07:00
Kurt
4700fdd1e3 Set updated version when resetting personal
Closes #3180

Improves handling for corrupt gen3 saves (pokedex cheaters)
2021-04-01 13:37:39 -07:00
Kurt
5c9ce494cf Minor perf improvements
Defer some value assignments
Pass already known values directly
Pass static references to reduce allocating small duplicate objects
2021-03-30 18:51:53 -07:00
Kurt
645f2b4db5 Revert implicit casting
Looks like netstandard2.0 wasn't meant to receive that new c#9 goodie
2021-03-29 00:14:44 -07:00
Kurt
f59d012cda Add gen3 battle video class
Just supports importing dumps (via code), and the GUI supports loading the party data to boxes like the other supported battle video formats.
2021-03-27 23:22:56 -07:00
Kurt
0190098e47 Gen3: Add methods to get/set external event data 2021-03-27 18:58:51 -07:00
Kurt
0c1d13bf4d Minor tweaks
Lift some temporary arrays for more reuse
reuse some temp references
less allocation overall
2021-03-23 23:10:30 -07:00
Kurt
3822981590
Rework EncounterCriteria to be ability indexed rather than direct ability (#3179)
* Exploration: rework ability criteria to ability numbers desired

* Sync remaining changes

* Update EncounterCriteria.cs

* Add xmldoc

* Improve speed of IsDualGender check

* More xmldoc updates

Should be doing this on main but meh, this branch is gonna get merged later

* Fix typo

* Update WC7.cs

* Update PersonalInfo.cs
2021-03-23 17:05:15 -07:00
Kurt
8d3f990667 Make some properties into consts 2021-03-20 12:47:21 -07:00
Kurt
27cdcb8b0c Simplify SAV3 loading
Remove hardcoded chunk lengths array
Remove cached chunk index array
Handle new-game files correctly (all blocks present check).
Consistently call things sector instead of chunk or block.

Somehow there was a bug with my FRLG save file's box data, which now loads completely?? Neat
2021-03-16 23:32:16 -07:00
Kurt
3b344bd5c3 Add batrev as a blank sav option via code 2021-03-16 18:49:27 -07:00
Kurt
98a80b4bf1 Fix party offset swap 2021-03-16 18:48:33 -07:00
Kurt
33e2c64721 Split SAV3 into version classes
Begone are the version-switch cases for value fetching.
2021-03-15 23:51:58 -07:00
Kurt
6bce4eea14 Minor clean
Annotations (nullable), some switch cases for readability
2021-03-14 16:16:55 -07:00
Kurt
649958ee68 Move EReader berry names from tables to settings class 2021-03-14 10:16:09 -07:00
Kurt
155e0283ce Inline some string logic, extract magic values, xmldoc 2021-03-09 21:31:53 -08:00
Kurt
e32bfcde2e Minor simplifications
Extract RSBOX checksum logic to checksum class
Allocate half as much for gen3 save detect
Simplify some expressions for GC save loading (x - size + offset, when x==size)
2021-03-08 11:39:15 -08:00
Kurt
49541e6073 Rework mainline sav3 to not operate off chunks
Previous style was to resize the sav buffer and concat all the storage chunks at the end. Allocated a double save file.

Now, just allocate 3 buffers.
2021-03-07 23:22:07 -08:00
Kurt
2826049e32 Add boxes unlocked & secret box toggle
ty @sora10pls
use box layout editor to change values (0-32 and toggle the flag)
2021-03-02 21:28:53 -08:00
sora10pls
94597b84e0 Increment Total Battle/Poké Ball usage records on set
Closes #3158
2021-02-24 11:12:59 -05:00
Kurt
41096fb56e Minor xmldoc / usage updates 2021-02-21 15:01:28 -08:00
Kurt
c11cf3d6d4 Extract gen4 pokedex logic 2021-02-21 09:59:10 -08:00
Kurt
4e92195b80 Add custom save type loading (hacks)
plugin adds a reader -> reader checks if it is a non-PKHeX.Core save type (they'd implement their own savefile/etc type) -> returns a matching save object if so

basically bypasses the base PKHeX logic
2021-02-13 01:53:38 -08:00
Kurt
6e4908b21e Simplify a little
path.getfilename will never return null unless you pass null, which we don't do

setchecksums' base method does the AllBlocks.SetChecksums. move the battle team set to right before the usage of SetChecksums
2021-02-13 01:38:09 -08:00
Kurt
c8d815dc59 Shift gen6 event flags to their actual index (+0xC*8) 2021-02-12 20:08:54 -08:00
Kurt
666a1805ba Relocate formargument logic 2021-02-08 20:42:19 -08:00
Kurt
37cb15749e Update FormArgument handling for gen6/7
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.

Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.

Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.

Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
2021-02-08 20:26:53 -08:00
Kurt
61266e3d49 Use popcount when appropriate 2021-02-07 21:47:43 -08:00
Kurt
8dacc2f63e Clean up memcard handling a little 2021-01-30 16:45:08 -08:00
Kurt
1e86fdcea8
Fracture the encounter matching checks to allow progressive validation (#3137)
## Issue

We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.

## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots. 
* We have a Silcoon that we've leveled up a few times.

Was our Silcoon originally a Wurmple, or was it caught as a Silcoon? 
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.

---

Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).

The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.

---

The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.

---

## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.

## Conclusion

This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
2021-01-29 17:55:27 -08:00
Kurt
edfb8fc2ff Add TID/SID fetch for Battle Revolution
Can unlock boxes by setting a nonzero TID/SID

https://projectpokemon.org/home/forums/topic/36582-pok%C3%A9mon-battle-revolution-save-research-thread/?do=findComment&comment=221812
ty Akunoko
2021-01-22 22:55:55 -08:00
Kurt
5abd61816f Add gamesync interface for gen7
oops; gamesync ID now shows up as intended
2021-01-22 19:04:54 -08:00
Kurt
06e6242944 Update SAV4BR.cs
Uses Big Endian unicode for savefile strings, but pkm strings are big-endian-g4
2021-01-20 22:13:59 -08:00
Kurt
803b8675fe Rework batrev current slot handling
Show all slots even if they're uninitialized. Empty first slots but present second slots caused errors on init.
2021-01-20 20:29:26 -08:00
CanoeHope
121ae9b611
Rename SWSH blocks and update Chinese HGSS Event Constant (#3131)
* Update TrainerCard8.cs

* Update SaveBlockAccessor8SWSH.cs

* Update const_hgss_zh.txt
2021-01-19 12:46:54 -08:00
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