Commit graph

430 commits

Author SHA1 Message Date
Kurt
75202c7a89 Misc updates
reducing allocations, increasing clarity by removing some magic numbers
probably can rewrite some of the evo loading/checking for even less, but
good for now.
2019-01-06 16:22:45 -08:00
Kurt
154f122369 Allow changing of default savefile type
kinda have to restrict these to 'valid' choices; should be enough of a
selection->result to be adequate for changing version

restart the program after changing the setting; won't take effect until
rebooted.
2019-01-05 15:42:20 -08:00
Kurt
9a4f12c279 Misc updates
rearrange pkm version groups for clear break between
twins/siblings/family
clear pokelist for sav7b on non-exportable saves (prevents b1s1 from
showing markings)
rename horohoro (pgo) to non romaji lol, hide daycare/party tabs on
nonexportable save
remove some unnecessary operations
rewrite getallcontrolsoftype to remove ToList() and make generic
2019-01-05 15:40:25 -08:00
Kurt
435c429dfc Allow colo to be a blank savefile 2019-01-05 15:37:06 -08:00
Kurt
e028214eab Update dex form handling for dex4
still not sure if it's entirely right, but at least there's no more
exceptions
https://projectpokemon.org/home/forums/topic/48288-pokedex-error-gen-4/
2019-01-05 12:37:41 -08:00
Kurt
7ab42e7cc2 Misc improvements
remove alloc on gc key advancement; advance keys in place
make g6 sizes an explicit comparison instead of new[].Contains
replace Any/Count with Array.Find calls (removes linq dependency from
savetype detection!)
2019-01-04 00:07:37 -08:00
Kurt
bdcabfa573 Update gen4 save detection
footer is different for Korean saves; checked JP/EN and they use the
2006 date. Probably the same for everyone-but-KO.

Simplify check further, only check the 0x4.... sav as it's the first
region saved to. No point wasting time checking the other!

a previous commit alluded to general/storage being initialized in
different slots
e8644280a1
, gonna ignore what was stated as I can't find any proof with the few
tests I did today (all init on second, and found no backups from that
time)
2019-01-03 23:37:49 -08:00
Kurt
e99c9a0999 Add pokestock gst/stk (3 & 4) bulk r/w
ezpz @kamronbatman
2019-01-02 21:56:33 -08:00
Kurt
8c05b9f391 add g3 hall of fame r/w
no GUI

var sav3 = new SAV3(File.ReadAllBytes(path));
var hof = HallFame3Entry.GetEntries(sav3);
hof.Dump();
2019-01-02 18:15:29 -08:00
Kurt
6929b637cc Misc clean
refactor some common operations
2019-01-01 20:05:36 -08:00
Kurt
80ef196468 fix info output off by one 2019-01-01 20:05:00 -08:00
Kurt
2b5272a395 Simplify gen4 save type detection
footer identifiers work just fine for any legitimately created save
file; I might have had the checksum check code for pokesav blank
savefiles

dropping support for bad-blanks in favor of a non-negligible speedup is
favorable :)
2019-01-01 11:16:31 -08:00
Kurt
7ba2860db8 more block details 2019-01-01 00:57:51 -08:00
Kurt
8129e91694 Add more detailed block offset docs 2018-12-31 22:19:40 -08:00
Kurt
4fcee0ae7a Move wr7 to mysterygift folder 2018-12-29 23:34:34 -08:00
Kurt
e7531dca30 Add wr7->pkm
Not sure if one of the 'level' fields is a move ID instead. Pound=1,
Level=1
Maybe a Chansey record would shed more light.
2018-12-29 23:33:36 -08:00
Kurt
03ad20dd16 Improve card title/filename logic
mystery gift editor still fails to generate a description (heldItem < 0
-> exception), the fallback behavior is fine I guess.
2018-12-29 22:15:40 -08:00
Kurt
8a33a95974 Add mystery gift record getset
Mystery Gift button now appears for GG, doesn't work yet
2018-12-29 22:09:59 -08:00
Kurt
f5e3358aaf Split up WR7 to separate files
settled on the class name; looks like it'll be roughly readable as a
mystery gift so inherit some properties. maybe can get r/w in the
mystery gift editor :)
2018-12-29 22:09:27 -08:00
Kurt
71dc944cbd Add wb7 gift record rw
another block documented ;)

https://projectpokemon.org/docs/gen-7/lets-go-pikachu-eevee-wonder-card-album-r109/

names subject to change
2018-12-29 21:24:38 -08:00
Kurt
6f22599baf Prevent slot overwriting on bulk import
https://projectpokemon.org/home/forums/topic/48912-how-to-batch-import-pokemon-boxes-without-erasing-existing-pokemon/
2018-12-28 17:58:13 -08:00
Kurt
d90f099a68 Next unoccupied after starting position 2018-12-27 13:10:55 -08:00
Kurt
f9eb1746ea Add NextOpenBoxSlot fetch for empty slot overwrites
< 0 is storage full
2018-12-27 01:08:42 -08:00
Kurt
9db771c0d5 Split out common 6+ pkm format to abstract class
Didn't really feel like pulling out the shared structure get/set
operations, only the derived properties & overall fixer methods. Should
be easier to maintain if any handling updates.

Clean up pb7 unused stuff; removes ribbon logic since none are used.

c# 8.0 interface defaults can maybe pull out more logic (ex making
FixRelearn and relearn moves into an interface); multiple inheritance
can be useful as features are added/dropped between generations.
2018-12-25 22:56:32 -08:00
Kurt
ec140431c0 Fix box sort for empty locked slot(s) 2018-12-22 13:13:06 -08:00
Kurt
d7a501c168 Relocate some logic to interfaces 2018-12-18 17:15:35 -08:00
Kurt
ff649009ca Misc tweaks
misc perf adjustments
add utility for slot locked check (without box argument, absolute slot
index)
localize dragdrop strings
increase dragdrop file delete delay (dropping files into discord waits
until you confirm; 10s gives enough time to hit confirm)
2018-12-17 11:17:19 -08:00
Kurt
efb9b7eba2 Misc cleanup
removes clickonce logic/reference
2018-12-10 20:32:08 -08:00
Kurt
8a0b9cd88c Add indication for party/starter slots 2018-12-09 23:18:37 -08:00
Kurt
8a98a89f6e Add height/weight and float->scalar
pgo transfer logic disassembly
FF 83 02 D1 FC 6F 04 A9  FA 67 05 A9 F8 5F 06 A9
2018-12-06 21:03:33 -08:00
Kurt
71fab815bf Provide more slot information
remove lockedslots, store & save all teamslots for sav7
differentiate locked slots from overwrite protected slots by emitting an
enum containing info about the slot

locked = can't be replaced, period.
starter/battleteam = can't be pasted over by bulk-pastes

can eventually show more specific sprite layers to denote party
indexes/team#/starter
2018-12-04 22:59:28 -08:00
Kurt
4c1232855f Add getstring method with non-sav data 2018-12-04 22:00:57 -08:00
Kurt
cc59c3cbe8 Remove variable naming hiding
new property named Stats
update sav7b/pb7 to delete unused handling trainer parameters too
2018-12-03 20:59:48 -08:00
Kurt
5750eabcc8 Add user protection for moved starters
Closes #2191
2018-12-02 11:48:44 -08:00
Kurt
0f01068d0d Update mystery match for dppt
off by one
2018-12-01 10:44:38 -08:00
Kurt
f6508bec5b Add dex size record editing via pokedex editor
Closes #2186
2018-11-29 21:40:20 -08:00
Kurt
35a85670b3 Set height/weight dex values
Closes #2167
Based off sub_71001D16A0 with shortcut modifications:
* code marks new entries for evolution processing later using the low
bit (hence the << 1); in save files I can't see any bits set, but I
can't see anywhere in the code that DOESNT set this bit. Thus the
assumption of post-processing.

As noted in gameplay, a new capture doesn't set Min and Max; it only
sets it if it is above the usual sizing values.

Megas apparently don't set until seen in battle, so don't worry about
setting the other forme based indexes.
2018-11-27 22:05:36 -08:00
Kurt
15b6ef0597 Increment wild encounter count on add capture 2018-11-27 08:53:56 -08:00
Kurt
adeaaea0b4 Allow folder import to import mystery gifts & gp1
Closes #2176
2018-11-23 12:22:51 -08:00
Kurt
ab4c3fc7ac Add go park slot delete (&all)
Closes #2179
2018-11-23 12:15:25 -08:00
Kurt
17b3732a7d Rework filename / nickname checks
Closes #2178
2018-11-23 10:31:55 -08:00
Kurt
f27816e622 Add party pointer sort
Pulls party members (and follower index if not already in party?) to the
first slot(s) in the (current/all) box.
2018-11-22 23:02:57 -08:00
Kurt
1d27f64235 Allow currentbox to be changed if not overriden
Now allows modifying/deleting 'current' box.
2018-11-22 10:55:20 -08:00
Kurt
6c0ad30b9a Add gp1-pb7 conversion
Add drop to pkmeditor & drop to saveditor
2018-11-21 20:48:55 -08:00
Kurt
9cf46d5bcb Add CP and Date to GP1 properties
thanks theslayer
2018-11-21 15:25:50 -08:00
Kurt
95776d8520 Set default savefile to gg 2018-11-21 13:51:26 -08:00
Kurt
34f8a71ad0 Always writeback pointer data
User sort isn't tracked, and reorganizes pointers. Set it back always,
no harm as values should always be sensical.

Closes #2171
2018-11-18 20:32:55 -08:00
Kurt
b818aff48a Remove evo tree sanitization
Evo data doesn't provide evolution values for these, fortunately.
2018-11-18 15:25:03 -08:00
Kurt
a1cc1a95c2 Fix species fetch, add altform
Thanks theSLAYER!
2018-11-18 13:54:47 -08:00
Kurt
c268d5ad05 Set party format values always 2018-11-17 19:42:48 -08:00
Kurt
cff1ec68fd Update filter
savedata.bin, not extensionless
cosmetic fix for the dialog window
Closes #2166
2018-11-16 22:17:18 -08:00
Kurt
5652e76728 Split go entities and go storage, rename classes 2018-11-15 17:36:29 -08:00
Kurt
6a0a6aa82a Add methods for 7b quirks
nidoran m/f when sanitized with the old way show the gender symbols as
'?'
2018-11-14 22:51:53 -08:00
Kurt
bf9344087e Update slot storage compression algo
now iterates for all boxes, and restores to the correct offset at the
end
update direct offset pointers to box specific (so that it can work on
gen3 rsefrlg saves if ever used on them).
2018-11-14 22:33:30 -08:00
Kurt
644fa4e929 Call slot compression
Doesn't work correctly (data shifted down still persists)
2018-11-14 22:20:59 -08:00
Kurt
1feecef874 Add go park summarizer 2018-11-14 22:02:01 -08:00
Kurt
fc44022836 Add gopkm block/abstraction 2018-11-14 19:34:21 -08:00
Kurt
7abe0c8a9e Add candy pouch type
reusing free space icon hides the give all button; just add another
sprite.
2018-11-13 20:46:48 -08:00
Kurt
1f985d8112 Remove unnecessary/incorrect flags
copypaste from sm lol uops
2018-11-13 20:46:03 -08:00
Kurt
13e1debe3e Add sav7b object & detection util 2018-11-13 19:18:29 -08:00
Kurt
5f456d705c Add misc setup objects 2018-11-13 19:16:14 -08:00
Kurt
025a290bc9 Update saveblock template for stored offset fetch 2018-11-13 19:15:27 -08:00
Kurt
486445897e Add 7b inventory r/w object 2018-11-13 19:15:11 -08:00
Kurt
707f7b5893 Fix displayed dex index for g7
off by 1 starting with formes
2018-11-13 19:14:42 -08:00
Kurt
49c4043e19 Update dex abstractions, add gg dex 2018-11-13 19:14:23 -08:00
Kurt
98ebf4c5cb Add sort pointer repointing
LGPE uses a list of pkm for boxes, and has pointers indicating where
each party member is at
need some logic for handling the sorting. Had suspected this a while
back so this pre-work came in handy (untested tho)

make eventflags offset ptr virtual, I might end up doing things
differently for event flags
2018-11-10 21:04:24 -08:00
Kurt
fe989d48fe Misc prep updates
Update comments / xmldoc
Add a savefile storage compressor (ie array[] with empty interstitials
-> list); return true if the compression moved anything (repopulate
views), and the count of occupied slots in the list.
Add saveblock base class; I haven't really liked how SAV6/7 do all the
logic; I'll still expose properties that will then point to a saveblock.
Cuts down clutter.
Add template Dex manipulator, with gen6/7 implementations
Speculate sequential gp/ge gameversion IDs
2018-11-01 15:38:09 -07:00
Kurt
8f9cc6cd7e Fix xmldoc ampersands 2018-10-31 13:52:09 -07:00
Kurt
39f98a4a94 Misc qol updates
Check max case for level first, then iterate upwards (eliminates inner
if)
change wc* nature to sbyte (update comparisons, 0xFF too magic-y)
use Rand.Next(x) instead of (0, x)
2018-10-27 21:59:31 -07:00
Kurt
ed3699fbb4 Update Ho-Oh mattle check
More languages than Italian have a rule-breaking name. Rework checks a
bit
Flag eggs more accurately
Update force hatch to move Link Trade met location to Egg Location

fix Ho-oh -> Ho-Oh text strings (correctness is key!)
2018-10-27 16:06:06 -07:00
Kurt
93af3e61b7 Add handling for Mt Battle Ho-Oh (italian) edgecase
https://projectpokemon.org/home/forums/topic/47917-colosseum-italian-ho-oh/

there's no shadow ID, so it can have both the short (transferred back)
or full name (never transferred) as CK3 without side effects.

allow 10chars in pkmeditor
2018-10-13 08:07:15 -07:00
Kurt
f7f5d78beb Misc perf tweaks
hopefully resolves the image corruption issue (dont use unsafe?)
remove some linq
2018-10-13 08:02:55 -07:00
Kurt
4deb5080d1 Misc tweaks
rearrange getmove with respect to tutors; verifycurrentmoves was getting
tutor moves in levelup
extract not-found hint fetch
Expose gen5 block objects (so I can play with saves in linqpad)
2018-10-06 18:45:15 -07:00
Kurt
2a2361220d Add more accurate daycare egg detection
uses eventflag, different index for each game

frlg:
https://www.pokecommunity.com/showthread.php?t=302347
"Flag 0x266 is set by the game engine if an Egg is in the Daycare."

emerald:
https://www.pokecommunity.com/showthread.php?t=330008
"0x86 : Daycare Centre has egg"

rs:
https://gist.github.com/rboninsegna/a4a63c2b66c42e371a94f860eae55361
" 0x86  Egg ready at Daycare"
2018-09-30 21:27:36 -07:00
Kurt
a3421a881d bounds check record set
closes #2129
2018-09-27 21:30:20 -07:00
Kurt
ca0a533779 Add frlg flag toggles from thread 2018-09-27 20:01:34 -07:00
Kurt
10d73d1bf3 Redirect eventflag r/w for frlg
can't just re-call base.SetEventFlag with an adjusted flag ID since the
exception checks max.
just override the geteventflag method with a silly adjustment -- we
can't be sure if Block2 is immediately after Block2, so just adjust the
flag r/w to a different offset&flag when appropriate.

fixes r/s badgeflag get/set, oops, meant to modify FRLG's value in the
last commit.
2018-09-26 21:05:06 -07:00
Kurt
a38a0fed60 Update event flag index for frlg
was block2+0x64
8*((0xF80-0xEE0)+0x64) = 0x820

this highlights a critical flaw in event flag reading; it expects the
region to be contiguous in the savedata. it's not. that's super bad, and
event flag r/w for flags >1280 won't work until I work something out
2018-09-26 20:32:38 -07:00
Kurt
62d8abb69c Update frlg flag/var offset
https://www.pokecommunity.com/showthread.php?t=349936

https://projectpokemon.org/home/forums/topic/47715-help-frlg-flags-research/
2018-09-26 20:08:25 -07:00
Kurt
4a81f326eb Update trade/egg/capture record set
#2128
it's still an imprecise thing, as ingame gifts aren't counted by either
release count isn't tracked, so the number should be roughly >= total
box+party count.
2018-09-26 19:06:05 -07:00
Kurt
55de21afc4 Add records when setting to slot
Closes #2128
2018-09-26 19:00:52 -07:00
Kurt
40a0206a5d Misc style updates
whitespace / brackets
2018-09-26 18:56:29 -07:00
Kurt
5760860c8e Add check for uninitialized save data
a 512KB NDS save can be 'picked up' as a memory card if it's not
initialized; this also rejects the binary in that scenario
2018-09-26 12:42:39 -07:00
Kurt
13bcc4bdc7 Add more enum values
pr video stuff is meh, anyone can contribute that
2018-09-25 16:33:11 -07:00
Kurt
a7f02bf27b Enumerate some trainer appearance values
thanks @sora10pls for gathering resources
2018-09-24 21:20:55 -07:00
Kurt
4ac1cccaa1 Move fashion to another folder
incoming enums
2018-09-24 19:44:12 -07:00
Kurt
e0e628844f Update copyto protection
skip over write protected slots (locked/team), may eventually weaken the
GUI to allow modding boxdata with locked slots (which will be skipped).
2018-09-24 19:43:59 -07:00
Kurt
164a26e757 Misc reorg + skeleton for slot editor
SlotChangeManager is pretty glue-y, might eventually shift to this
implementation
2018-09-21 21:20:28 -07:00
Kurt
39c3a0eea7 Rework sav3 version detect
Might still be flaky for FRLG, but can now (99.99999999%) determine RS
vs E...
2018-09-16 13:57:09 -07:00
Kurt
668b8611d5 Fix sav3 active partition detect logic
change < to >
the lower updated count is the backup partition, not the one to load
from

Closes #2122 , thanks @FaronBracy !
2018-09-16 12:49:00 -07:00
Kurt
3cd45cf5c4 Continue extracting logic 2018-09-16 12:44:00 -07:00
Kurt
b280ffcfef style updates
should be pretty much it
2018-09-14 22:37:47 -07:00
Kurt
87b270dd17 add more gen7 record labels 2018-09-13 22:06:44 -07:00
Kurt
316341e140 Misc updates
Remove unused sav properties
Add translatable strings for autodetect SAV error suggestion

add speculated gg dex formtable
- no eevee forms
- increments 1 for pikachu since it already exists in table
- stops at mewtwo (no other formed-species available)

im currently setting up skeleton stuff for lgpe since we're <70 days
from release; by doing some pre-work like prior games I can get a good
idea of what needs to be adjusted prior to crunchtime!
2018-09-06 20:35:55 -07:00
Kurt
189fa5f7b3 Add button to give all seals + illegal ones
#2112
2018-09-04 15:26:16 -07:00
Kurt
cf3aba4f84 Add gen4 seal data get/set
closes #2112
adds methods to give/remove all, and get/set to retrieve array or
individual.
2018-09-04 15:12:35 -07:00
Kurt
42deb0ad12 Add extra backup locations for savedetect
Closes #2109
Program boots -> load extra locations rather than constantly fetching.
These files won't change location or presence (not an external drive).

just store the locations instead of constantly fetching, we already call
detect once when loading the form anyway.
2018-09-03 10:40:40 -07:00
Kurt
493bef75eb Misc updates
condense repeated logic
extract properties
extract reusable methods
2018-09-02 18:02:25 -07:00
Kurt
91c37ab573 Update legality check message string style
V### names weren't enjoyable to work with; use similar verbose style as
the program message strings.

updating the translation files with the remapped variable names shortly

remap list: https://pastebin.com/jybkVDAK
2018-09-01 14:11:12 -07:00
Kurt
9dae7dad67 Misc updates
move encountertype datasource providing to core
fix rerolling EC not updating characteristic
remove some repeat logic calls
relocate geolocation name fetch to separate class, add tests to ensure
functionality, add languageID->country/region fetch method
2018-08-25 17:04:01 -07:00