Commit graph

105 commits

Author SHA1 Message Date
Kurt
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -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
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
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
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
e72c80613e Extract metadata/state tracking from SaveFile obj 2020-12-05 05:36:23 -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
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
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
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
3b4fd49af9 Catch any exception, show message in result 2020-10-12 10:42:26 -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
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
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
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
fb4734472b Add notation for language-specific save types 2020-09-26 13:30:17 -07:00
Kurt
2b7e06e217 Refactoring
Extract some logic, suppress some compiler messages
2020-09-18 22:11:13 -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
9191f023a3 Minor clean
Nullability annotations and some logic simplification
2020-09-06 11:24:54 -07:00
Kurt
b5677758be Change default TID/SID for gen7+ 2020-08-30 17:54:58 -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
3e21924adc Document some save sizes 2020-06-20 12:08:51 -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
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
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
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
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
643c0c1cc7 null/empty check -> check both 2020-01-18 17:33:19 -08:00
Kurt
843330a375 Remove unnecessary null checks
this is a null free project /s
dont provide null, else u deserve to get an exception
2020-01-18 16:57:25 -08:00
Kurt
bbd1aff5fe Add new lengths
new format still crashes as block absolute index is now different
should do a different way of loading blocks (key instead of index)
2020-01-09 08:17:41 -08:00
Kurt
65b921f806
Only apply 3DS geoloc data for 3DS blank saves
Closes #2560

Different logic in SimpleTrainerInfo applies it to <=Gen5, but that's fine... 414cb2d39e/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs
2019-12-04 14:00:53 -08:00
Kurt
025cf69eeb Switch pkm export formats to party format
Now dumps party format bytes
Cons: more space
Pros: stats are retained, especially when users drag-drop.

Closes #2419
2019-11-16 14:03:25 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

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

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

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

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

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

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

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

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

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
4baf745af8 Use some c#8 sugar
static local functions
switch expressions
using usings :)

nullable next?
2019-10-07 18:40:09 -07:00