Was writing kor string, then writing en after (all terminators).
Make method signature match other SetString, with write buffer as first arg
Closes#3440
Existing `get`/`set` logic is flawed in that it doesn't work on Big Endian operating systems, and it allocates heap objects when it doesn't need to.
`System.Buffers.Binary.BinaryPrimitives` in the `System.Memory` NuGet package provides both Little Endian and Big Endian methods to read and write data; all the `get`/`set` operations have been reworked to use this new API. This removes the need for PKHeX's manual `BigEndian` class, as all functions are already covered by the BinaryPrimitives API.
The `StringConverter` has now been rewritten to accept a Span to read from & write to, no longer requiring a temporary StringBuilder.
Other Fixes included:
- The Super Training UI for Gen6 has been reworked according to the latest block structure additions.
- Cloning a Stadium2 Save File now works correctly (opening from the Folder browser list).
- Checksum & Sanity properties removed from parent PKM class, and is now implemented via interface.
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.
EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.
Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
Manually transferred from English Pt to English B
All revised indexes were the result in Black.
Differences that were not incorporated:
0EE=09794 ♂, not 09325 ⑭
0EF=09792 ♀, not 09326 ⑮
0F2=00215 ×, not 09319 ⑧
0F3=00247 ÷, not 09320 ⑨
Full-width and half-width symbols I think are related to full-width games, which English isn't. Probably has different handling for other language, plus it'd result in other duplicates of the half-width symbols.
Revise not-found char glyph to return ? instead of {terminator}, to match the game's behavior. Again, this might be language specific, but whatever.
Make the Convert char methods public, add a few unit tests.
Closes#3172
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
More in line with modernizing the codebase with latest c# syntax
improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
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
Retain a stringbuilder to mutate the string rather than finalizing temporary strings
yields some speed improvements (less gen0 string objects allocated)
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).
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.
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
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.
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.