Commit graph

1069 commits

Author SHA1 Message Date
Kurt
07a08fa328 Add some xmldoc 2024-06-29 10:55:01 -05:00
Kurt
496c66bd46 Rename box storage slot flag fetch
`IsSlotX` is a little ambiguous; `IsBoxSlotX` much better.
2024-06-29 10:39:59 -05:00
Kurt
f6bcc8a216 Minor clean
StringBuilder.Append has some fancy interpolation handling in the latest NET8 so it's more clean than multiple append calls.
2024-06-15 00:57:44 -05:00
Kurt
0499caa52e Update BK4.cs
Closes #4300
2024-06-14 09:10:08 -05:00
Kurt
b68fb27ccf Update StringConverter5.cs
Closes #4299
2024-06-14 00:06:40 -05:00
Kurt
be79360778 Flag slotnumber instead of Tile
Oops
pk8: check for SV for met location loss
2024-06-11 08:25:20 -05:00
Kurt
4f23efd939 Minor tweaks
Rival_Trash -> RivalTrash
BinaryCodedDecimal better method names
Gift dupe checker differentiate by species
2024-06-10 21:43:27 -05:00
Kurt
67fc0d0885 Misc tweaks
Add Cap Pikachu const value updating for USUM, also set Magearna const for USUM (not only SM)
Remove `NotDistributed` property from WC3 as only CXD events used it, no longer WC3 type.
Delete ArrayUtil; move remaining methods into the StorageUtil class that used them for compressing/inserting bulk into boxes.
Add shiny wormhole flag
Extract byte array strings into spans, faster tests and less overhead.
2024-06-09 08:52:32 -05:00
Kurt
de6c1baaf2 Minor tweaks
PK9: Fix writing box bin of self-owned SV eggs clearing nickname trash, also clear any hint of trading completely
SAV1: ensure current box is index:0 if uninitialized
2024-06-05 23:46:03 -05:00
Kurt
7d05e12c7f Misc tweaks
Fix pk6/7 pkmeditor export, now retaining status condition instead of wiping it
Abstract b2w2 key system to a save block; better documentation on its odd mechanics
Allow gen1-3 filename language/ver detect to work if the filename is ` `->`_` (discord attachments changing spaces to underscores); also revise canadian French emerald filename pattern
others: negligible perf/using standard library functions
2024-06-01 17:44:32 -05:00
Kurt
650f23ab82 Misc tweaks
Rewrites super training editor to not need reflection and special handling for translation
Fixes trash check for traded egg
Fixes Scientist trash applying to Ultra Beasts -- much better comparison
2024-05-30 10:40:08 -05:00
Kurt
c10c2a0dc2
Add Trash Byte verification for Switch formats (#4283)
* Extract logic, finish impl for switch era
* Extract trash checks to static class
* Reduce some allocations in OT name compares
2024-05-27 18:21:11 -05:00
Kurt
ca2bd3baf4 Minor clean
No functional change
2024-05-27 10:33:25 -05:00
Kurt
cd6eadcd8d Fix daycare slot read
Closes #4279
adds writeback for daycare in gen2 as well
2024-05-23 13:31:23 -05:00
abcboy101
4cb1048139
Implement GBA/GC string conversion (#4278)
* Swap GC nickname fields

The first nickname field is used for the displayed nickname, such as for EFIGS PKM whose names get truncated in Japanese games.
The second nickname field stores the actual nickname, which is restored when a PKM is traded back to the GBA games.

* Add StringFont3GC

* Add GC/GBA string conversion tables/logic

* Refactor GC region conversion

* Minor tweaks

Skip copying nickname/OT on generic conversion method; derived impl will remap the trash for us.
Extract the DisplayNickname truncation function and deduplicate. Use buffers directly when updating
Make CurrentRegion/OriginalRegion properties GCRegion instead of int/byte

Extract local func for font check skip for clarity
2024-05-22 12:22:41 -05:00
abcboy101
94e408d445
Use straight apostrophe for Gen3/4 (#4275)
Colosseum/XD/PBR/Ranch/Gen5 all treat the apostrophe/right single quote as a straight apostrophe (U+0027).

This primarily affects unnicknamed Colo/XD Farfetch'd, which need to use `'` instead of `’` to be traded to GBA correctly.
2024-05-18 10:04:25 -05:00
Kurt
0674d72fae Add ITrashIntrospection, impl on PKM classes
new api allows for checking for trash byte metadata, makes it much easier to write a verifier now
2024-05-17 15:58:49 -05:00
Kurt
f5c6510b82 7->8 Handle garbage string trash
no terminator? no problem
2024-05-17 13:18:48 -05:00
Kurt
da51291364 PK1/2 edit: Use save language when detecting lang
GBPKM allow spa/ita lang as fallback (so that nicknamed species just use fallback)
SK2 GetNonNickname reuse the passed language ID instead of recomputing
2024-05-17 13:18:25 -05:00
abcboy101
417231a67c
Update how symbols are handled for Bank -> HOME transfers (#4276)
This maps the remaining (legal) symbols in the private use area that are modified on transfer from Bank -> HOME. If any of these replacements are made, any leading or trailing halfwidth spaces are trimmed. This can result in nicknames/OT names that are the empty string or consist entirely of fullwidth spaces, even though these can't normally entered.
2024-05-17 11:56:55 -05:00
Kurt
a4a0337162 SAV1/2: Force zeroed slots to be FF
Deleting a slot shouldn't leave a level 0 nameless speciesless mon
2024-05-13 19:47:23 -05:00
Kurt
ca85fba061 Force writeback on addition to uninitialized data
Adding an entity to an uninitialized save's box data will force all data to be flushed unless the final destination was (initially zeroed and has no slots to set).
2024-05-13 19:40:55 -05:00
Kurt
bbfec1fb29 GB: Don't read ghost slots
Read count from list, instead of using the full capacity.
Malformed lists (truncated via count) with ghost slots should have those ghost slots ignored.
2024-05-13 18:14:40 -05:00
Kurt
215f892f11 SAV1: Don't reference prior-save boxdata
If the boxes are not initialized, skip reading of box data
If the boxes are empty when saving, don't write if {dest 0} or {boxes uninitialized} to retain old data.
If the boxes have any slots when saving, set the flag that boxdata is good.

Remove flag from SAV2, game is different from SAV1. Only use the boxdata, just mirror to CurrentBox data as Stadium only looks at boxdata.
2024-05-13 17:41:23 -05:00
Kurt
0f7d6e1b6a Handler check for WC7 ash pika reimplemented
The handler state checks to check against current trainer are new, forgot about this edge case.
Reduce allocation of temp strings on wc7->pk7, replicate the HT miss for ash pika wc7->pk7
2024-05-13 12:35:47 -05:00
Kurt
5af96eab95 Extract switch-entity HT update logic, fix
Closes #4227
SlotWrite no longer revises the data incorrectly

if ot&gender mismatch, clear memories and set new values
can retain wrong values by having ot&gender shared between games
2024-05-12 23:40:50 -05:00
Kurt
7b6abc0520 Reduce alloc for ot/nick by raw trash reads
Legality check now catches buffer overflow mons.
Now that I have each type exposing a trash length & charcount, should be easy to have some reusable trash byte measuring methods (see the old branch)
2024-05-12 14:46:58 -05:00
Kurt
08ed482555 Revise gender symbol remapping
Handles Nidoran's shenanigans as well as more clear method names
- Add normalization for PK7->PK8 (no more 0xE... usage for the gender symbols... maybe more chars?)
- Not sure if Gen3 gamecube encoding needs sanitizing. Who is transferring Nidoran to CXD? :)

Requires some silly usage of Language passing as arguments. Future improvements can be made to revise the half/full encoding determination when setting a string. Probably has issues since we're just doing a naive check without considering nicknames w/ special chars.

Closes #4174
2024-05-12 10:47:55 -05:00
Kurt
a33884895f Remove IsNative property
Not something worth retaining if we can check directly.
2024-05-11 16:20:12 -05:00
Kurt
326e790e4b Handle and ' behaviors for 4->5->6
Gen5 does not use the slanted apostrophe for anything. 4->5 converts to ' for both strings.
Gen6 fixes all to be slanted. Even nicknames.
Importing to HOME (PK7, GO) resets nicknames, and the default name is not slanted. Nicknames/OTs are unaltered; again, only the "default" species name is wrong.

Closes #4066
2024-05-11 11:35:55 -05:00
Kurt
0f4024952e Minor clean
indexof -> contains
trailing space
some variable reuse
pcdata/boxdata less janky handling
2024-05-01 00:49:43 -05:00
Kurt
e7f79be41d Minor clean 2024-04-28 00:35:26 -05:00
Kurt
bb6e45db60 Refactor out legality settings, add more settings
Extract PP verifier
Add disabling of wordfilter for formats < 6
Add context-specific bypasses for nickname/handler checks
2024-04-26 14:33:03 -05:00
Kurt
4e56a2b756 Fix zhs/zht table swap
simplified is the first set, not the second
Closes #4254
2024-04-26 01:27:53 -05:00
Kurt
c0e44d6375 PA8: add missing marking interface 2024-04-25 10:24:38 -05:00
Kurt
9ff94455b9 Add setting to retain met date on 4->5 transfer 2024-04-24 02:11:14 -05:00
Kurt
093264bc24 Add IStringConverter, impl on PKM & SaveFile
use in trash editor to translate strings, from PKM instead of SAV.
Closes #4222
2024-04-23 00:57:17 -05:00
Kurt
1b294f7c97
Refactor: Split Gen1/2 string & pokelist conversion methods (#4251)
* Split Gen1/2 string & pokelist conversion methods

* Refactor pokelist to direct read/write, skip on save if blanked

* Add settings editor for SaveLanguage overrides
2024-04-22 14:42:22 -06:00
Kurt
35bf97eaf1 Add status indication & switcher popup
Shows on all tabs to make it clear.
Obviously, status condition is only saved in formats that save status condition in their slot's resting format. Gen3 box mons won't store Burn, etc.
2024-04-17 00:35:42 -05:00
Kurt
b60648627a Add setting to show Gender in Gen1
Default false, current behavior.
Previous commits (years ago) would show Gender, but only current-format properties are shown now.

Fix some form scaling settings that haven't been reported, match other controls.
PKM property copy now checks if src==dest property type; for Gen6<-Gen7 markings, converting ushort -> byte can cause the conversion to fail if more than 8 bits are used. Just ignore copying the marking value, by only copying properties that have the same name AND type.
2024-04-16 21:01:14 -05:00
Kurt
2b4ecee899 Rename EggEncounter to IsEgg 2024-03-25 00:39:30 -05:00
Kurt
024bd85cc3 Minor tweaks
make PL6 use memory instead of byte[]
make GP1 use memory instead of byte[]
move IEncounterable properties higher to IEncounterTemplate
2024-03-24 20:12:33 -05:00
Kurt
f27326cb2e Update PK5.cs
don't count sinnoh champ in battle ribbon sum
2024-03-20 23:31:17 -05:00
abcboy101
8a3a338c0b
Fix encodings for Gen 3/4/5 transfers (#4220)
Adjust Gen 3/4 encodings to be consistent with Gen 5 Unicode encodings
Gen 3 quotation marks are displayed differently based on the game language
Implement how Pal Park handles invalid characters and corrupts certain accented characters
Implement how Poké Transfer handles invalid characters
Use U+25BA BLACK RIGHT-POINTING POINTER, since this character is used as the pointer in menus/etc., rather than as a bullet or generic shape
2024-03-17 22:34:13 -06:00
Jonathan Herbert
4435f032a5
Rename Obedience_Level To Match C# Naming Standard (#4215)
Change from Obedience_Level  to ObedienceLevel since it was missed when other properties we changed to match C# naming standard.
2024-03-11 20:39:31 -06:00
Kurt
7122c5c3f5 Fix database search returning empty w/ unfiltered
Closes #4211
Also fix box dump not creating folder and Surprise Trade block optionally existing in SV saves.
2024-03-11 13:00:08 -05:00
Kurt
994c063537 Misc tweaks 2024-03-08 21:30:21 -06:00
Kurt
6dc785da0c Add gen5 battle video reads 2024-03-08 00:53:35 -06:00
Kurt
f32a1ddc7a Misc fixes
event flag editor gen5-7
rs/frlg/dp/hgss enc->pkm version choice
pb7 party stats loading
daycare slot now shows when present
remove unnecessary `GameVersion.Unknown`, use Invalid instead. Might be worth removing Invalid in favor of changing `Any=0` to `None=0`.
2024-03-05 09:42:20 -06:00
Kurt
59ad4d749f Add handling for lgpe lumped in Contains/Gen check
ty Oval Lenin (discord)

Co-Authored-By: Ivan <15915901+ivanlonel@users.noreply.github.com>
2024-03-03 23:40:55 -06:00