Commit graph

28 commits

Author SHA1 Message Date
Kurt
6754645a5f Minor optimization
Similar to the index hack done for array shuffling modulo 24 & 1f.
2021-04-12 17:08:57 -07:00
Kurt
758b6e6770 Remove '<->’ aliasing
Farfetch’d uses the non-vertical apostrophe, still.

Showdown is consistent with their usage (in/outputting ’), but we'll keep the '->’ for that sanitization just in case other services/users enter the wrong char.

Closes #3185
2021-04-12 17:04:02 -07:00
Kurt
155e0283ce Inline some string logic, extract magic values, xmldoc 2021-03-09 21:31:53 -08:00
Kurt
4c45aa99af Add missing uint cast 2021-03-08 15:33:52 -08:00
Kurt
7d6249853d Add gen8 case
This method is only used by BulkStorage, which is unused. Just keeping this up to date.
2021-01-31 13:10:03 -08:00
Kurt
b5c30193fa Set initial capacity for stringbuilder to reduce reallocation
Default capacity is 16 so it's rarely an issue, but sometimes we don't need that much.

Update xmldoc for more clarity
2021-01-16 17:31:05 -08:00
Kurt
613e6db744 Use StringConverter api consistently; use stringbuilder when possible
Retain a stringbuilder to mutate the string rather than finalizing temporary strings

yields some speed improvements (less gen0 string objects allocated)
2021-01-14 22:50:13 -08:00
Kurt
cc43550357 Simplify more expressions 2021-01-04 17:31:43 -08:00
Kurt
e8c23f6644 Simplify some repeated comparisons with expressions
Less prone for bugs since it uses the same value for all comparisons without re-specifying
2020-12-29 00:37:59 -08:00
Kurt
95e3337f2c More switch expressions 2020-12-24 17:12:08 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
67b7d44ced Fix accented-a/i for spanish in-game trade
I think this was a PKHeX issue that went unnoticed; originally, we didn't include the Á and Í chars in the dictionary.

I checked the transporter code:
The app maintains the international & japanese character tables, and depending on the ROM language, it may change a char to the language-specific entry. Refer to Bulbapedia's notes on the char tables for different languages:

https://bulbapedia.bulbagarden.net/wiki/Character_encoding_in_Generation_II

However, none of these char-changes are able to be reached with a legal char.

Á and Í (only accessible from the Spanish in-game trades) and the german 0xC0 && z <= 0xC6 chars are already in the international table. Every single difference in the VC1/VC2 table is an un-enterable char.

tl;dr -- all possible char codes are transferred fine with the VC2 table without extra language logic. We just keep out any inaccessible char (replaced with space).
2020-11-27 16:49:06 -08:00
Kurt
e9075436b7 Split off g7 transporter string handling
Add katakana / hiragana sensitive transferring

var check = CheckKata("ぐリお") == "ぐりお";
check should be true, dugtrio case !
2020-11-27 15:37:55 -08:00
Kurt
3ab824d306 Refactoring
Condense some logic
2020-10-06 17:54:17 -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
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
4cb283981b Remove linq from list init, manually allocate
Add some docs cuz gen1 structures are always spooky

gen1 not being exactly same as gen2, and jp != int => 4 different sizes of spookiness
2020-07-21 20:56:41 -05:00
Kurt
eb7ed44b29 Finish splitting gen1/2 encounter types from parent class
Results in a little more code, but each path is less tangled
simplify some expressions
remove RBDragonair content in favor of a strict filter for catch rate

Move gen1 trade trainer names to stringconverter, since pk1/pk2 shouldn't refer to legality classes
2020-07-19 13:32:40 -05:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -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
d981dc57e1 Handle ’ ' edge case
#2412
2019-11-16 16:21:17 -08:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -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
7e0fc61428 Add unused character encodings to dictionary
Two of the inaccessible keyboard chars are used by Spanish trades, so
they aren't completely unused.

#2338
2019-06-26 21:16:18 -07:00
Kurt
583fcfa449 Use builtin struct instead of anonymous object
faster overall
2019-03-22 18:46:31 -07:00
Kurt
bc5ed2d218 Misc reductions
Removes empty trashbyte array allocation (less objects)
Change int[] to byte[] (less filesize/mem) (-256*6)
Change int[] to ushort[], precompute reverse table in saved space
removes dictionary lookup for array index fetch (faster, less memory, no
temp obj allocations!)

could make the ushort[] arrays into byte[] by changing them to be value
shifts? Not worth saving filesize for cpu.
2019-03-22 18:42:03 -07:00
Kurt
cce362b98a Relocate FFFF trim (and 0000) to same location 2019-03-20 22:13:09 -07:00
Kurt
b1ead9e630 Split StringConverter into smaller pieces
reduces loading time (don't have to allocate conversion arrays when
launching a gen7 game), and separates things to easier to manage
locations

reworks gen3 string encode/decode, no longer does 3->4->5 and 5->4->3;
instead goes straight to the end result without an intermediary format.

String sanitization should probably be broken up rather than reused, oh
well.
2019-03-20 21:50:44 -07:00