Commit graph

762 commits

Author SHA1 Message Date
Kurt
bc45660f99 Update legal raid clamp
https: //github.com/kwsch/PKHeX/issues/2681#issuecomment-582215498
Co-Authored-By: slp32 <slp32@users.noreply.github.com>
2020-02-04 19:06:33 -08:00
Kurt
2e1528b199 Merge branch 'master' of https://github.com/kwsch/PKHeX 2020-02-04 16:55:42 -08:00
Kurt
7e6cae4004 Clamp activating raids to available indexes
Closes #2681
2020-02-04 16:55:40 -08:00
CanoeHope
9b172d2666
Correct Day offset (#2679)
a1ae14325a (commitcomment-37103852)
2020-02-04 07:35:02 -08:00
Kurt
0e1fd49be1 Decrement runtime language if appropriate
Closes #2674
2020-02-03 19:16:30 -08:00
Kurt
a1ae14325a Add more block documentation
Ty @CanoeHope !
Closes #2677

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

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

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

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

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

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

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

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

* fixing label position

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

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

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

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

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

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

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

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

* Changing the offsets handling

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

ty @CanoeHope
2020-01-10 22:16:30 -08:00
Kurt
2915692daa Use more performant block lookup strategy
Rather than storing a dictionary of keys, we can abuse the fact that the SCBlock[] is stored in order of ascending block key.
Binary Search doesn't require extra memory like a Dictionary would; also, we only need to find a few blocks.
2020-01-09 19:00:49 -08:00
Kurt
3fa44361e6 Update block fetch & blank init
blanks: {key,size}
fetch: get block by key (index isnt the same between patches, as blocks with different keys get added). The savefile stores them as a SortedDictionary (by key), hence the shifting.
2020-01-09 08:59:26 -08:00
Kurt
bbd1aff5fe Add new lengths
new format still crashes as block absolute index is now different
should do a different way of loading blocks (key instead of index)
2020-01-09 08:17:41 -08:00
Kurt
3d581283c2 Minor clean
move Text.cs manual Courier new() to the designer, have it dispose when form is disposed. Set it as the numericupdown's font and just reuse that :)
2020-01-05 18:46:30 -08:00
Kurt
e21d108fb2 Split PokeCrypto from PKX
All logic in PokeCrypto is separate from the rest of the PKHeX.Core
library; makes it easy to just rip this portion out and reuse in other
projects without needing the entirety of PKHeX.Core logic

optimize out the CheckEncrypted to the actual path, separate methods.
Only usages of this method were with hardcoded Format values, so no
impact
2020-01-04 14:48:39 -08:00
Kurt
f4bafe0809 Add extension methods for gym team get/set for all
Closes #2607

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

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

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

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

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

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

* Fix G4 box renaming

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

Was just exporting blank data, lol

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

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

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

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

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

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

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

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

ty @Ammako

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

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

have sav6xy use the sav6xy accessor interface instead of the main one
2019-10-19 17:38:01 -07:00
Kurt
3b0fd81aae Rework & fix party slot deletion
Two birds with one stone:
- sav4 doesn't use Data (instead uses General/Storage), so we need to
use the abstracted method calls instead of trying to do things manually.
- setting a blank pkm at a party slot will decrease the party count!
don't decrease things twice.
2019-10-18 21:10:39 -07:00
Kurt
d4ce0644c8 Simplify block property names
[...]Block -> [...]  since it's kinda redundant, we already know by its
type.
Rename offset ints that collide
2019-10-18 20:42:03 -07:00
Kurt
4302347366 Show missing editors
yay useless integer stores instead of checking if an interface is
implemented
2019-10-18 20:26:41 -07:00
Kurt
abe87eb369 Relocate maison stats to block access 2019-10-18 20:13:21 -07:00
Kurt
e05d75eeb7 More training bags
giff swsh
2019-10-17 23:02:01 -07:00
Kurt
c24851129f Add super training block details & to block access
Use some properties in the super training editor, not gonna rewrite that
even though it really needs it :)
2019-10-17 20:13:17 -07:00
Kurt
cf955e9fc7 Fix sav7 init
guess I never launched this format the entire week
2019-10-16 19:08:13 -07:00
Kurt
2367fbd69a Add docs for super training block 2019-10-16 18:49:01 -07:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

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

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

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

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

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

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

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

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

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

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

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

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

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

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

SAV4 also has the hall of fame block, which is a third block; no mo
silly names !
2019-09-14 11:39:48 -07:00
Kurt
dc10c057a0 Use correct boxdata buffer when doing box manip
Closes #2386 ; guess I forgot to finish this.
2019-09-12 19:01:06 -07:00
Kurt
0d9c18e1c6 Minor clean
dual bounds check -> single check via uint cast
pkx: keep array reference for reuse in next check
format return to second line to stick out more; lines of code are cheap
:)
2019-09-11 22:17:16 -07:00
Kurt
40cbbaa695 Relocate to more appropriate util class 2019-09-11 18:39:49 -07:00
Kurt
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
62d08d7c30 Misc clean
split some methods with optional parameters=null
add more xmldoc
replace some magic numbers -> enum/const references
consolidate common array operations (span soon maybe?)
2019-09-10 00:21:51 -07:00
Kurt
edf36e8a34 Fix sav4 checksum calc
DPPt have a footer that's 0x14 bytes; HGSS is only 0x10 (first u32 was
removed from struct).
2019-09-03 18:16:10 -07:00
Kurt
4b8082be23 Add Pokegear number editing (hgss)
Closes #2379
2019-09-02 21:24:49 -07:00
Kurt
b81a1e1e29 Refactoring
Increase abstraction for arbitrary slot get/set operations, and fracture
SAV4 behavior for each game type.

Adds: Undo/Redo of party slot changes
Fixes: Fixed Gen5 daycare slot 2 reading, and EXP reading
Fixes: Some slot color glitchiness
Fixed: Box layout editor now hides the flag label if no flags are
present
Fixed: Gen7 box flags are now shown (unknown purpose lol)
Changed: savefile objects are generally smaller (removed a few shared
offset fields)
2019-09-02 19:30:58 -07:00
Kurt
a133abc615 Add pokegear caller ID enum
#2379
Cheat as requested in issue not implemented yet; pending future changes
to split sav4.
2019-08-27 16:17:29 -07:00
Kurt
f0df115ccd Fix box load on uninitialized box load
Closes #2376
probably will be rewritten at a later time; am reworking the slot info
messaging for drag/drop/display
2019-08-23 18:03:10 -07:00
Kurt
bf6c25eca7 Break up SlotChangeManager logic
A little bit cleaner when the logic is separated
Keep an abstraction of BoxEdit to cache the current box contents.
Already fetched to show sprites; any future fetches (for preview text /
hover sprite) can reuse the already fetched pkm data.

Should probably rewrite this stuff completely, but effort better spent
elsewhere
2019-08-20 19:50:28 -07:00
Kurt
4f3745e3c6 Change enumerate -> array fetch to force eval
https://projectpokemon.org/home/forums/topic/54426-pkhex-error/
trycatch will trip here rather than be uncaught when evaluated later
tbh I don't like pkhex's method chain (enumerable, bool, throws), but
this fixes the error.
2019-08-14 16:45:21 -07:00
Kurt
9c58903f55 Fix blank sav3 : sapphire init
lol it's been this way for 7+mo
Closes #2369 ty @CorvusAtrox !
2019-08-04 00:59:59 -07:00