Commit graph

1056 commits

Author SHA1 Message Date
Kurt
48024f1245 Add Swarm data get/set for gen3-5
#3245
2021-08-20 19:52:31 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
c6342a163f Minor clean
variable swaps, simplifications
2021-08-20 13:42:25 -07:00
Kurt
c0d748a975 Add Dream World upload slot indicator
Tested & works on bw & b2w2
Thanks Brokemia for the request!
2021-08-16 11:54:03 -07:00
Kurt
9793e9f1a0 Minor clean
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
2021-08-13 15:36:30 -07:00
Kurt
5ec2b12ae5 Handle some warnings for release build
Unused usings; just make PIDType stuff visible.
2021-08-06 09:41:39 -07:00
Kurt
0f3e5095c5 Replace more linq usage 2021-08-05 22:39:38 -07:00
Kurt
5c472a400d Expand shorthand parameters
int i => int index, or whatever the value is representing.
2021-08-05 20:33:25 -07:00
Kurt
a1f5c76790 Fix pgl jpeg save 2021-08-05 19:38:47 -07:00
Kurt
59d480c834 Minor tweaks
Discard empty pkm files (species 0) when loading boxes or templates
Add more xmldoc
Simplify some method parameter names for readability
2021-08-05 17:05:39 -07:00
Kurt
cc0397f087 Misc tweaks
Improved readability
2021-08-05 15:18:43 -07:00
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